summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b83c834)
raw | patch | inline | side by side (parent: b83c834)
author | Junio C Hamano <junkio@cox.net> | |
Fri, 15 Apr 2005 22:08:09 +0000 (15:08 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Fri, 15 Apr 2005 22:08:09 +0000 (15:08 -0700) |
This adds the '-q' option for show-diff.c to squelch complaints for
missing files.
It is handy if you want to run it in the merge temporary directory after
running merge-trees with its minimum checkout mode, which is the
default, because you would not find any files other than the ones that
needs human validation after the merge there.
It also fixes the argument parsing bug Paul Mackerras noticed in
<16991.42305.118284.139777@cargo.ozlabs.ibm.com> but slightly
differently.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
missing files.
It is handy if you want to run it in the merge temporary directory after
running merge-trees with its minimum checkout mode, which is the
default, because you would not find any files other than the ones that
needs human validation after the merge there.
It also fixes the argument parsing bug Paul Mackerras noticed in
<16991.42305.118284.139777@cargo.ozlabs.ibm.com> but slightly
differently.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
show-diff.c | patch | blob | history |
diff --git a/show-diff.c b/show-diff.c
index a15e9b4cf0be5f67373d08fb5c833dd5c1d3eeb8..15dcd0525ed944c6f82f93a1744c15e2f3325e61 100644 (file)
--- a/show-diff.c
+++ b/show-diff.c
int main(int argc, char **argv)
{
int silent = 0;
+ int silent_on_nonexisting_files = 0;
int entries = read_cache();
int i;
- while (argc-- > 1) {
- if (!strcmp(argv[1], "-s")) {
- silent = 1;
+ for (i = 1; i < argc; i++) {
+ if (!strcmp(argv[i], "-s")) {
+ silent_on_nonexisting_files = silent = 1;
continue;
}
- usage("show-diff [-s]");
+ if (!strcmp(argv[i], "-q")) {
+ silent_on_nonexisting_files = 1;
+ continue;
+ }
+ usage("show-diff [-s] [-q]");
}
if (entries < 0) {
void *new;
if (stat(ce->name, &st) < 0) {
+ if (errno == ENOENT && silent_on_nonexisting_files)
+ continue;
printf("%s: %s\n", ce->name, strerror(errno));
- if (errno == ENOENT && !silent)
+ if (errno == ENOENT)
show_diff_empty(ce);
continue;
}