diff --git a/sha1_name.c b/sha1_name.c index 6d10f052b5..6a2195fcc1 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -858,12 +858,12 @@ static int get_sha1_oneline(const char *prefix, unsigned char *sha1, if (prefix[0] == '!') { if (prefix[1] != '!') - die ("Invalid search pattern: %s", prefix); + return -1; prefix++; } if (regcomp(®ex, prefix, REG_EXTENDED)) - die("Invalid search pattern: %s", prefix); + return -1; for (l = list; l; l = l->next) { l->item->object.flags |= ONELINE_SEEN; diff --git a/t/t6133-pathspec-rev-dwim.sh b/t/t6133-pathspec-rev-dwim.sh index 8e5b338633..a290ffca0d 100755 --- a/t/t6133-pathspec-rev-dwim.sh +++ b/t/t6133-pathspec-rev-dwim.sh @@ -35,4 +35,14 @@ test_expect_success '@{foo} with metacharacters dwims to rev' ' test_cmp expect actual ' +test_expect_success ':/*.t from a subdir dwims to a pathspec' ' + mkdir subdir && + ( + cd subdir && + git log -- ":/*.t" >expect && + git log ":/*.t" >actual && + test_cmp expect actual + ) +' + test_done