Skip to content

Commit cbcf619

Browse files
committed
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
2 parents 082f7b0 + fba732c commit cbcf619

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

t/t5551-http-fetch-smart.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,4 +733,22 @@ test_expect_success 'no empty path components' '
733733
! grep "//" log
734734
'
735735

736+
test_expect_success 'tag following always works over v0 http' '
737+
upstream=$HTTPD_DOCUMENT_ROOT_PATH/tags &&
738+
git init "$upstream" &&
739+
(
740+
cd "$upstream" &&
741+
git commit --allow-empty -m base &&
742+
git tag not-annotated &&
743+
git tag -m foo annotated
744+
) &&
745+
git init tags &&
746+
git -C tags -c protocol.version=0 \
747+
fetch --depth 1 $HTTPD_URL/smart/tags \
748+
refs/tags/annotated:refs/tags/annotated &&
749+
git -C "$upstream" for-each-ref refs/tags >expect &&
750+
git -C tags for-each-ref >actual &&
751+
test_cmp expect actual
752+
'
753+
736754
test_done

transport-helper.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "refspec.h"
1818
#include "transport-internal.h"
1919
#include "protocol.h"
20+
#include "packfile.h"
2021

2122
static int debug;
2223

@@ -432,6 +433,8 @@ static int fetch_with_fetch(struct transport *transport,
432433
warning(_("%s unexpectedly said: '%s'"), data->name, buf.buf);
433434
}
434435
strbuf_release(&buf);
436+
437+
reprepare_packed_git(the_repository);
435438
return 0;
436439
}
437440

0 commit comments

Comments
 (0)