@matheusbsbs / matheus-bagliano / commits / 9ad0a93330
Fork 0

rev-parse lstat() workaround cleanup.

Earlier we had a workaround to avoid misspelled revision name to be taken as a filename when "--no-revs --no-flags" are in effect. This cleans up the logic. Signed-off-by: Junio C Hamano <junkio@cox.net>

Linus Torvalds committed Feb 5, 2006 at 21:41 UTC 9ad0a9333079359cbce8fd2448eb7478786e1150
1 file changed +9 -7
rev-parse.c
+9 -7
@@ -150,11 +150,14 @@ static void show_datestring(const char *flag, const char *datestr)
150 show(buffer);
151 }
152
153 -static void show_file(const char *arg)
153 +static int show_file(const char *arg)
154 {
155 show_default();
156 - if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV))
156 + if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV)) {
157 show(arg);
158 + return 1;
159 + }
160 + return 0;
161 }
162
163 int main(int argc, char **argv)
@@ -329,14 +332,13 @@ int main(int argc, char **argv)
332 show_rev(REVERSED, sha1, arg+1);
333 continue;
334 }
335 + as_is = 1;
336 + if (!show_file(arg))
337 + continue;
338 if (verify)
339 die("Needed a single revision");
334 - if ((filter & DO_REVS) &&
335 - (filter & DO_NONFLAGS) && /* !def && */
336 - lstat(arg, &st) < 0)
340 + if (lstat(arg, &st) < 0)
341 die("'%s': %s", arg, strerror(errno));
338 - as_is = 1;
339 - show_file(arg);
342 }
343 show_default();
344 if (verify && revs_count != 1)