diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-02-14 17:53:48 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-02-14 17:53:48 -0800 |
| commit | c3fffcfe8e6c3bfbe358366c973a6109fb95d4e6 (patch) | |
| tree | 3f9e788117d09cd03f5a170d0d9bcfa8e9519471 /t | |
| parent | 09e74b06ea68d4cac8f08b51bf4db2daf1987ae2 (diff) | |
| parent | 93dc16483a312b77c0b6533a6c2705d1df3e3687 (diff) | |
| download | git-c3fffcfe8e6c3bfbe358366c973a6109fb95d4e6.tar.gz | |
Merge branch 'bf/fetch-set-head-fix'
Fetching into a bare repository incorrectly assumed it always used
a mirror layout when deciding to update remote-tracking HEAD, which
has been corrected.
* bf/fetch-set-head-fix:
fetch set_head: fix non-mirror remotes in bare repositories
fetch set_head: refactor to use remote directly
Diffstat (limited to 't')
| -rwxr-xr-x | t/t5505-remote.sh | 10 | ||||
| -rwxr-xr-x | t/t5510-fetch.sh | 17 |
2 files changed, 27 insertions, 0 deletions
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index 93a6662df7..bb7e0c6879 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -589,6 +589,16 @@ test_expect_success 'add --mirror setting HEAD' ' ) ' +test_expect_success 'non-mirror fetch does not interfere with mirror' ' + test_when_finished rm -rf headnotmain && + ( + git init --bare -b notmain headnotmain && + cd headnotmain && + git remote add -f other ../two && + test "$(git symbolic-ref HEAD)" = "refs/heads/notmain" + ) +' + test_expect_success 'add --mirror=fetch' ' mkdir mirror-fetch && git init -b main mirror-fetch/parent && diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 4680e0f644..5f350facf5 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -81,6 +81,23 @@ test_expect_success "fetch test remote HEAD" ' branch=$(git rev-parse refs/remotes/origin/main) && test "z$head" = "z$branch"' +test_expect_success "fetch test remote HEAD in bare repository" ' + test_when_finished rm -rf barerepo && + ( + cd "$D" && + git init --bare barerepo && + cd barerepo && + git remote add upstream ../two && + git fetch upstream && + git rev-parse --verify refs/remotes/upstream/HEAD && + git rev-parse --verify refs/remotes/upstream/main && + head=$(git rev-parse refs/remotes/upstream/HEAD) && + branch=$(git rev-parse refs/remotes/upstream/main) && + test "z$head" = "z$branch" + ) +' + + test_expect_success "fetch test remote HEAD change" ' cd "$D" && cd two && |
