summaryrefslogtreecommitdiff
path: root/rev-list.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-01-25 22:00:37 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-01-25 22:44:52 (GMT)
commitd8f6b342ae200b2eb72e2f81afea7fe0d41aec0b (patch)
treeda9a928a9bb8bdd0977a36a02d292cacedde2986 /rev-list.c
parent92643a27cc2cc7ce55ba2afd6155f94b40e1aa89 (diff)
downloadgit-d8f6b342ae200b2eb72e2f81afea7fe0d41aec0b.zip
git-d8f6b342ae200b2eb72e2f81afea7fe0d41aec0b.tar.gz
git-d8f6b342ae200b2eb72e2f81afea7fe0d41aec0b.tar.bz2
Make git-rev-list and git-rev-parse argument parsing stricter
If you pass it a filename without the "--" marker to separate it from revision information and flags, we now require that the file in question actually exists. This makes mis-typed revision information not be silently just considered a strange filename. With the "--" marker, you can continue to pass in filenames that do not actually exists - useful for querying what happened to a file that you no longer have in the repository. [ All scripts should use the "--" format regardless, to make things unambiguous. So this change should not affect any existing tools ] Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'rev-list.c')
-rw-r--r--rev-list.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/rev-list.c b/rev-list.c
index d060966..e00e6fc 100644
--- a/rev-list.c
+++ b/rev-list.c
@@ -844,8 +844,12 @@ int main(int argc, const char **argv)
arg++;
limited = 1;
}
- if (get_sha1(arg, sha1) < 0)
+ if (get_sha1(arg, sha1) < 0) {
+ struct stat st;
+ if (lstat(arg, &st) < 0)
+ die("'%s': %s", arg, strerror(errno));
break;
+ }
commit = get_commit_reference(arg, sha1, flags);
handle_one_commit(commit, &list);
}