diff --git a/rev-list.c b/rev-list.c index d0609666a1..e00e6fc76d 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); } diff --git a/rev-parse.c b/rev-parse.c index 0c951af0d4..7abad35de9 100644 --- a/rev-parse.c +++ b/rev-parse.c @@ -154,6 +154,7 @@ int main(int argc, char **argv) const char *prefix = setup_git_directory(); for (i = 1; i < argc; i++) { + struct stat st; char *arg = argv[i]; char *dotdot; @@ -293,6 +294,8 @@ int main(int argc, char **argv) } if (verify) die("Needed a single revision"); + if (lstat(arg, &st) < 0) + die("'%s': %s", arg, strerror(errno)); as_is = 1; show_file(arg); }