summaryrefslogtreecommitdiff
path: root/builtin/fetch.c
diff options
context:
space:
mode:
authorTom Miller <jackerran@gmail.com>2014-01-03 02:28:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-01-03 18:18:40 (GMT)
commit10a6cc8890ec1e5459c05ddeb28a671acdc37d60 (patch)
treeb94074e834f8b4d77217e9df35c8d4d76a21a0ea /builtin/fetch.c
parent4b3b33a747c325f76b1f6eef89c231609dd4d361 (diff)
downloadgit-10a6cc8890ec1e5459c05ddeb28a671acdc37d60.zip
git-10a6cc8890ec1e5459c05ddeb28a671acdc37d60.tar.gz
git-10a6cc8890ec1e5459c05ddeb28a671acdc37d60.tar.bz2
fetch --prune: Run prune before fetching
When we have a remote-tracking branch named "frotz/nitfol" from a previous fetch, and the upstream now has a branch named "frotz", fetch would fail to remove "frotz/nitfol" with a "git fetch --prune" from the upstream. git would inform the user to use "git remote prune" to fix the problem. Change the way "fetch --prune" works by moving the pruning operation before the fetching operation. This way, instead of warning the user of a conflict, it autmatically fixes it. Signed-off-by: Tom Miller <jackerran@gmail.com> Tested-by: Thomas Rast <tr@thomasrast.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 1b81cf9..09825c8 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -863,11 +863,6 @@ static int do_fetch(struct transport *transport,
if (tags == TAGS_DEFAULT && autotags)
transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, "1");
- if (fetch_refs(transport, ref_map)) {
- free_refs(ref_map);
- retcode = 1;
- goto cleanup;
- }
if (prune) {
/*
* We only prune based on refspecs specified
@@ -883,6 +878,11 @@ static int do_fetch(struct transport *transport,
transport->url);
}
}
+ if (fetch_refs(transport, ref_map)) {
+ free_refs(ref_map);
+ retcode = 1;
+ goto cleanup;
+ }
free_refs(ref_map);
/* if neither --no-tags nor --tags was specified, do automated tag