git-rev-parse: flush "default" head when encountering something unexpected
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 20 Jun 2005 23:14:13 +0000 (16:14 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 20 Jun 2005 23:14:13 +0000 (16:14 -0700)
The unexpected thing is likely a pathname, we need the default for that
too.

rev-parse.c

index 1f4f324..7419d18 100644 (file)
@@ -111,9 +111,12 @@ int main(int argc, char **argv)
                        printf("^%s\n", sha1_to_hex(sha1));
                        continue;
                }
+               if (def) {
+                       printf("%s\n", def);
+                       def = NULL;
+               }
                if (revs_only)
                        continue;
-               def = NULL;
                printf("%s\n", arg);
        }
        if (def)