aboutsummaryrefslogtreecommitdiffstats
path: root/patch-ids.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-02-05 16:31:27 -0800
committerJunio C Hamano <gitster@pobox.com>2021-02-05 16:31:28 -0800
commit2d436678a70c118bc2683b8d81131459e602a1d7 (patch)
tree552fe457ec2d800874d4a1a09d50f2f53be492db /patch-ids.c
parentMerge branch 'jk/forbid-lf-in-git-url' into maint (diff)
parentpatch-ids: handle duplicate hashmap entries (diff)
downloadgit-2d436678a70c118bc2683b8d81131459e602a1d7.tar.gz
git-2d436678a70c118bc2683b8d81131459e602a1d7.zip
Merge branch 'jk/log-cherry-pick-duplicate-patches' into maint
When more than one commit with the same patch ID appears on one side, "git log --cherry-pick A...B" did not exclude them all when a commit with the same patch ID appears on the other side. Now it does. * jk/log-cherry-pick-duplicate-patches: patch-ids: handle duplicate hashmap entries
Diffstat (limited to 'patch-ids.c')
-rw-r--r--patch-ids.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/patch-ids.c b/patch-ids.c
index 21973e4933..f51021a0cb 100644
--- a/patch-ids.c
+++ b/patch-ids.c
@@ -89,7 +89,7 @@ static int init_patch_id_entry(struct patch_id *patch,
return 0;
}
-struct patch_id *has_commit_patch_id(struct commit *commit,
+struct patch_id *patch_id_iter_first(struct commit *commit,
struct patch_ids *ids)
{
struct patch_id patch;
@@ -104,6 +104,18 @@ struct patch_id *has_commit_patch_id(struct commit *commit,
return hashmap_get_entry(&ids->patches, &patch, ent, NULL);
}
+struct patch_id *patch_id_iter_next(struct patch_id *cur,
+ struct patch_ids *ids)
+{
+ return hashmap_get_next_entry(&ids->patches, cur, ent);
+}
+
+int has_commit_patch_id(struct commit *commit,
+ struct patch_ids *ids)
+{
+ return !!patch_id_iter_first(commit, ids);
+}
+
struct patch_id *add_commit_patch_id(struct commit *commit,
struct patch_ids *ids)
{