summaryrefslogtreecommitdiff
path: root/builtin/fetch.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-10-05 14:01:54 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-10-05 14:01:54 -0700
commit8e3ec76a20d6abf5dd8ceb3f5f2c157000e4c13e (patch)
tree816c5dc42c7dc8cac732c804b8e99775806bb5dc /builtin/fetch.c
parentMerge branch 'rs/archive-add-file' (diff)
parentrefspec: add support for negative refspecs (diff)
downloadtgif-8e3ec76a20d6abf5dd8ceb3f5f2c157000e4c13e.tar.xz
Merge branch 'jk/refspecs-negative'
"git fetch" and "git push" support negative refspecs. * jk/refspecs-negative: refspec: add support for negative refspecs
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 25fa1cf931..f9c3c49f14 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -539,6 +539,16 @@ static struct ref *get_ref_map(struct remote *remote,
tail = &rm->next;
}
+ /*
+ * apply negative refspecs first, before we remove duplicates. This is
+ * necessary as negative refspecs might remove an otherwise conflicting
+ * duplicate.
+ */
+ if (rs->nr)
+ ref_map = apply_negative_refspecs(ref_map, rs);
+ else
+ ref_map = apply_negative_refspecs(ref_map, &remote->fetch);
+
ref_map = ref_remove_duplicates(ref_map);
for (rm = ref_map; rm; rm = rm->next) {