Skip to content

Commit

Permalink
Merge branch 'jk/bisect-peel-tag-fix'
Browse files Browse the repository at this point in the history
"git bisect" reimplemented more in C during 2.30 timeframe did not
take an annotated tag as a good/bad endpoint well.  This regression
has been corrected.

* jk/bisect-peel-tag-fix:
  bisect: peel annotated tags to commits
  • Loading branch information
gitster committed Mar 19, 2021
2 parents 8779c14 + 7730f85 commit 35381b1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
9 changes: 8 additions & 1 deletion builtin/bisect--helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,12 +874,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 ||
Expand Down
12 changes: 12 additions & 0 deletions t/t6030-bisect-porcelain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -939,4 +939,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

0 comments on commit 35381b1

Please sign in to comment.