path: root/revision.c
diff options
authorLinus Torvalds <>2006-04-26 17:15:54 (GMT)
committerJunio C Hamano <>2006-04-26 19:16:21 (GMT)
commite23d0b4a4a55cc07e133905f0e9526b3550dd61b (patch)
tree515672854c5dd676564edf9d73792129d62f9ecc /revision.c
parentb176e6ba5bc37466ffcb6c8c0f38c47ec6e9e73a (diff)
Fix filename verification when in a subdirectory
When we are in a subdirectory of a git archive, we need to take the prefix of that subdirectory into accoung when we verify filename arguments. Noted by Matthias Lederhofer This also uses the improved error reporting for all the other git commands that use the revision parsing interfaces, not just git-rev-parse. Also, it makes the error reporting for mixed filenames and argument flags clearer (you cannot put flags after the start of the pathname list). [jc: with fix to a trivial typo noticed by Timo Hirvonen] Signed-off-by: Linus Torvalds <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'revision.c')
1 files changed, 3 insertions, 5 deletions
diff --git a/revision.c b/revision.c
index e1f9816..03dd238 100644
--- a/revision.c
+++ b/revision.c
@@ -675,17 +675,15 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
if (get_sha1(arg, sha1) < 0) {
- struct stat st;
int j;
if (seen_dashdash || local_flags)
die("bad revision '%s'", arg);
/* If we didn't have a "--", all filenames must exist */
- for (j = i; j < argc; j++) {
- if (lstat(argv[j], &st) < 0)
- die("'%s': %s", argv[j], strerror(errno));
- }
+ for (j = i; j < argc; j++)
+ verify_filename(revs->prefix, argv[j]);
revs->prune_data = get_pathspec(revs->prefix, argv + i);