diff options
-rw-r--r-- | builtin/bisect--helper.c | 9 | ||||
-rwxr-xr-x | t/t6030-bisect-porcelain.sh | 12 |
2 files changed, 20 insertions, 1 deletions
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 709eb713a3..81569530e4 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -875,12 +875,19 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, const char **a */ for (; argc; argc--, argv++) { + struct commit *commit; + if (get_oid(*argv, &oid)){ error(_("Bad rev input: %s"), *argv); oid_array_clear(&revs); return BISECT_FAILED; } - oid_array_append(&revs, &oid); + + commit = lookup_commit_reference(the_repository, &oid); + if (!commit) + die(_("Bad rev input (not a commit): %s"), *argv); + + oid_array_append(&revs, &commit->object.oid); } if (strbuf_read_file(&buf, git_path_bisect_expected_rev(), 0) < the_hash_algo->hexsz || diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 52614eefc7..9abcee0554 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -936,4 +936,16 @@ test_expect_success 'git bisect reset cleans bisection state properly' ' test_path_is_missing ".git/BISECT_START" ' +test_expect_success 'bisect handles annotated tags' ' + test_commit commit-one && + git tag -m foo tag-one && + test_commit commit-two && + git tag -m foo tag-two && + git bisect start && + git bisect good tag-one && + git bisect bad tag-two >output && + bad=$(git rev-parse --verify tag-two^{commit}) && + grep "$bad is the first bad commit" output +' + test_done |