summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-21 13:57:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-21 13:57:51 (GMT)
commitd0975a0724cc8f0f88931264b8b97c8a4c428dda (patch)
tree9f78eb6e4070aeddb1488315fbcac313811c98d4 /t
parent7d483e9c00516413a9c2dafc24a6ecb40975b02b (diff)
parent5dcfbf564c0f10869e568af4e05421f63b44fbbf (diff)
downloadgit-d0975a0724cc8f0f88931264b8b97c8a4c428dda.zip
git-d0975a0724cc8f0f88931264b8b97c8a4c428dda.tar.gz
git-d0975a0724cc8f0f88931264b8b97c8a4c428dda.tar.bz2
Merge branch 'js/shallow-and-fetch-prune' into maint
"git repack" in a shallow clone did not correctly update the shallow points in the repository, leading to a repository that does not pass fsck. * js/shallow-and-fetch-prune: repack -ad: prune the list of shallow commits shallow: offer to prune only non-existing entries repack: point out a bug handling stale shallow info
Diffstat (limited to 't')
-rwxr-xr-xt/t5537-fetch-shallow.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/t/t5537-fetch-shallow.sh b/t/t5537-fetch-shallow.sh
index 7045685..6faf17e 100755
--- a/t/t5537-fetch-shallow.sh
+++ b/t/t5537-fetch-shallow.sh
@@ -186,6 +186,33 @@ EOF
test_cmp expect actual
'
+test_expect_success '.git/shallow is edited by repack' '
+ git init shallow-server &&
+ test_commit -C shallow-server A &&
+ test_commit -C shallow-server B &&
+ git -C shallow-server checkout -b branch &&
+ test_commit -C shallow-server C &&
+ test_commit -C shallow-server E &&
+ test_commit -C shallow-server D &&
+ d="$(git -C shallow-server rev-parse --verify D^0)" &&
+ git -C shallow-server checkout master &&
+
+ git clone --depth=1 --no-tags --no-single-branch \
+ "file://$PWD/shallow-server" shallow-client &&
+
+ : now remove the branch and fetch with prune &&
+ git -C shallow-server branch -D branch &&
+ git -C shallow-client fetch --prune --depth=1 \
+ origin "+refs/heads/*:refs/remotes/origin/*" &&
+ git -C shallow-client repack -adfl &&
+ test_must_fail git -C shallow-client rev-parse --verify $d^0 &&
+ ! grep $d shallow-client/.git/shallow &&
+
+ git -C shallow-server branch branch-orig $d &&
+ git -C shallow-client fetch --prune --depth=2 \
+ origin "+refs/heads/*:refs/remotes/origin/*"
+'
+
. "$TEST_DIRECTORY"/lib-httpd.sh
start_httpd