Skip to content

Commit

Permalink
rev-parse lstat() workaround cleanup.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Feb 6, 2006
1 parent 2718435 commit 9ad0a93
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions rev-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,14 @@ static void show_datestring(const char *flag, const char *datestr)
show(buffer);
}

static void show_file(const char *arg)
static int show_file(const char *arg)
{
show_default();
if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV))
if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV)) {
show(arg);
return 1;
}
return 0;
}

int main(int argc, char **argv)
Expand Down Expand Up @@ -329,14 +332,13 @@ int main(int argc, char **argv)
show_rev(REVERSED, sha1, arg+1);
continue;
}
as_is = 1;
if (!show_file(arg))
continue;
if (verify)
die("Needed a single revision");
if ((filter & DO_REVS) &&
(filter & DO_NONFLAGS) && /* !def && */
lstat(arg, &st) < 0)
if (lstat(arg, &st) < 0)
die("'%s': %s", arg, strerror(errno));
as_is = 1;
show_file(arg);
}
show_default();
if (verify && revs_count != 1)
Expand Down

0 comments on commit 9ad0a93

Please sign in to comment.