summaryrefslogtreecommitdiff
path: root/rev-parse.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-02-06 05:41:47 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-02-06 05:49:42 (GMT)
commit9ad0a9333079359cbce8fd2448eb7478786e1150 (patch)
tree4335e3d49a40782d7f6f96e356e4b1ca43c23ecd /rev-parse.c
parent2718435b7b746c3c249525b02fbcbad68f5a45f3 (diff)
downloadgit-9ad0a9333079359cbce8fd2448eb7478786e1150.zip
git-9ad0a9333079359cbce8fd2448eb7478786e1150.tar.gz
git-9ad0a9333079359cbce8fd2448eb7478786e1150.tar.bz2
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>
Diffstat (limited to 'rev-parse.c')
-rw-r--r--rev-parse.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/rev-parse.c b/rev-parse.c
index 9cec33b..b82f294 100644
--- a/rev-parse.c
+++ b/rev-parse.c
@@ -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)
@@ -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)