Linus,

This is 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
<[EMAIL PROTECTED]> but slightly
differently.

Signed-off-by: Junio C Hamano <[EMAIL PROTECTED]>
---
 
 show-diff.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

show-diff.c:  3f7acd2a692a03026784a18f28521b9af322b71e
--- show-diff.c
+++ show-diff.c 2005-04-15 14:14:53.000000000 -0700
@@ -58,15 +58,20 @@
 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) {
@@ -82,8 +87,10 @@
                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;
                }


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to