Skip to content

Commit

Permalink
Merge branch 'jk/fetch-auto-tag-following-fix'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gitster committed Feb 2, 2024
2 parents 082f7b0 + fba732c commit cbcf619
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions t/t5551-http-fetch-smart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions transport-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "refspec.h"
#include "transport-internal.h"
#include "protocol.h"
#include "packfile.h"

static int debug;

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit cbcf619

Please sign in to comment.