Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 3/3] fetch --prune: Repair branchname DF conflicts

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:59:29

Tom Miller [off-list ref] writes:
The commit below should be the same patch he tested. The test was added
by him, and I made it part of this commit. Did I do this wrong?
No, no, no.  All my questions were true questions, not complaints
veiled as rhetorical questions.  Thanks for many pointers for
clarification.
quoted
quoted
quoted
---
 builtin/fetch.c  | 10 +++++-----
 t/t5510-fetch.sh | 14 ++++++++++++++
 2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index e50b697..845c687 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -868,11 +868,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
@@ -888,6 +883,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
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 5d4581d..a981125 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -614,4 +614,18 @@ test_expect_success 'all boundary commits are excluded' '
      test_bundle_object_count .git/objects/pack/pack-${pack##pack    }.pack 3
 '

+test_expect_success 'branchname D/F conflict resolved by --prune' '
+     git branch dir/file &&
+     git clone . prune-df-conflict &&
+     git branch -D dir/file &&
+     git branch dir &&
+     (
+             cd prune-df-conflict &&
+             git fetch --prune &&
+             git rev-parse origin/dir >../actual
+     ) &&
+     git rev-parse dir >expect &&
+     test_cmp expect actual
+'
+
 test_done
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help