aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-02-02 11:31:51 -0800
committerJunio C Hamano <gitster@pobox.com>2024-02-02 11:31:51 -0800
commitcbcf61990f09ccaf7560832274fa39b24d09d12e (patch)
tree689c57b06a5a01a50e1d477e0c898385802a0dbc
parent082f7b0f791ba1a036337510c55a3438a94376ce (diff)
parentfba732c462107a6e8a92577cae1d64a8cc149879 (diff)
downloadgit-cbcf61990f09ccaf7560832274fa39b24d09d12e.tar.gz
Merge branch 'jk/fetch-auto-tag-following-fix'
Fetching via protocol v0 over Smart HTTP transport sometimes failed to correctly auto-follow tags. * jk/fetch-auto-tag-following-fix: transport-helper: re-examine object dir after fetching
-rwxr-xr-xt/t5551-http-fetch-smart.sh18
-rw-r--r--transport-helper.c3
2 files changed, 21 insertions, 0 deletions
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index e069737b80..a623a1058c 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -733,4 +733,22 @@ test_expect_success 'no empty path components' '
! grep "//" log
'
+test_expect_success 'tag following always works over v0 http' '
+ upstream=$HTTPD_DOCUMENT_ROOT_PATH/tags &&
+ git init "$upstream" &&
+ (
+ cd "$upstream" &&
+ git commit --allow-empty -m base &&
+ git tag not-annotated &&
+ git tag -m foo annotated
+ ) &&
+ git init tags &&
+ git -C tags -c protocol.version=0 \
+ fetch --depth 1 $HTTPD_URL/smart/tags \
+ refs/tags/annotated:refs/tags/annotated &&
+ git -C "$upstream" for-each-ref refs/tags >expect &&
+ git -C tags for-each-ref >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/transport-helper.c b/transport-helper.c
index 6764463873..dd6002b393 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -17,6 +17,7 @@
#include "refspec.h"
#include "transport-internal.h"
#include "protocol.h"
+#include "packfile.h"
static int debug;
@@ -432,6 +433,8 @@ static int fetch_with_fetch(struct transport *transport,
warning(_("%s unexpectedly said: '%s'"), data->name, buf.buf);
}
strbuf_release(&buf);
+
+ reprepare_packed_git(the_repository);
return 0;
}