Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-03-20 01:25:37 +0300
committerJunio C Hamano <gitster@pobox.com>2021-03-20 01:25:37 +0300
commit35381b13da846cc6ad620f9f9a5abf1d974d6e9b (patch)
tree9fbbe703441c5c11848cb140e88a46211703f483
parent8779c141da62d66be5d420b94d506636006a7901 (diff)
parent7730f85594d4595605934e39d1d816ab663d8fa8 (diff)
Merge branch 'jk/bisect-peel-tag-fix'
"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
-rw-r--r--builtin/bisect--helper.c9
-rwxr-xr-xt/t6030-bisect-porcelain.sh12
2 files changed, 20 insertions, 1 deletions
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
index d69e13335d..1fdb7d9d10 100644
--- a/builtin/bisect--helper.c
+++ b/builtin/bisect--helper.c
@@ -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 ||
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 0ba5a91b4e..32bb66e1ed 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -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