summaryrefslogtreecommitdiff
path: root/patch-ids.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-01-25 14:19:19 -0800
committerJunio C Hamano <gitster@pobox.com>2021-01-25 14:19:19 -0800
commitb69bed22c59fa08848bd7ffa5fbfacc0b62fcd48 (patch)
tree047ebb72feb3534f7929ae8a52cb9e43a0f23d81 /patch-ids.c
parent27d7c8599b159862762e2bd121c22d516fb04e90 (diff)
parentc9e3a4e76d57b03170118aa67054af0b81e7f507 (diff)
downloadgit-b69bed22c59fa08848bd7ffa5fbfacc0b62fcd48.tar.gz
Merge branch 'jk/log-cherry-pick-duplicate-patches'
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 cf5e8045b7..3f404e4b0b 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)
{