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 <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
committed by
Junio C Hamano
parent
b176e6ba5b
commit
e23d0b4a4a
@ -675,17 +675,15 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
|
||||
arg++;
|
||||
}
|
||||
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);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user