diff --git a/line-log.c b/line-log.c index 8b6e497b3ff187ee328cba395f30d3db7f86c0b4..717638b333b680da7a3a5acefcb73db9d956a00f 100644 --- a/line-log.c +++ b/line-log.c @@ -760,7 +760,8 @@ void line_log_init(struct rev_info *rev, const char *prefix, struct string_list r = r->next; } paths[count] = NULL; - parse_pathspec(&rev->diffopt.pathspec, 0, 0, "", paths); + parse_pathspec(&rev->diffopt.pathspec, 0, + PATHSPEC_PREFER_FULL, "", paths); free(paths); } } diff --git a/revision.c b/revision.c index 7e03e154f446d2c105150cecea8c50fdc8e5238a..3fdea51ffed4839c6c30f34b45d67f5e95ab6cc2 100644 --- a/revision.c +++ b/revision.c @@ -1372,7 +1372,8 @@ static void prepare_show_merge(struct rev_info *revs) i++; } free_pathspec(&revs->prune_data); - parse_pathspec(&revs->prune_data, PATHSPEC_ALL_MAGIC, 0, "", prune); + parse_pathspec(&revs->prune_data, PATHSPEC_ALL_MAGIC, + PATHSPEC_PREFER_FULL, "", prune); revs->limited = 1; } diff --git a/t/t4208-log-magic-pathspec.sh b/t/t4208-log-magic-pathspec.sh index 72300b5f244504540a551854cb82f81cf5391a55..d8f23f488e00dad97eeb5d22f5f0db01bcab8021 100755 --- a/t/t4208-log-magic-pathspec.sh +++ b/t/t4208-log-magic-pathspec.sh @@ -46,4 +46,19 @@ test_expect_success 'git log HEAD -- :/' ' test_cmp expected actual ' +test_expect_success 'command line pathspec parsing for "git log"' ' + git reset --hard && + >a && + git add a && + git commit -m "add an empty a" --allow-empty && + echo 1 >a && + git commit -a -m "update a to 1" && + git checkout HEAD^ && + echo 2 >a && + git commit -a -m "update a to 2" && + test_must_fail git merge master && + git add a && + git log --merge -- a +' + test_done