summaryrefslogtreecommitdiff
path: root/t/t5538-push-shallow.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-12-05 20:02:47 +0700
committerJunio C Hamano <gitster@pobox.com>2013-12-10 16:14:18 -0800
commit0a1bc12b6e401825f009ac8bb14fc438f77e2d9f (patch)
treef727b9dd79cb0bed05cc0635fd7b266c19f712d6 /t/t5538-push-shallow.sh
parent614db3e2920f4d1c79931833614acf36a00fa88b (diff)
downloadgit-0a1bc12b6e401825f009ac8bb14fc438f77e2d9f.tar.gz
receive-pack: allow pushes that update .git/shallow
The basic 8 steps to update .git/shallow does not fully apply here because the user may choose to accept just a few refs (while fetch always accepts all refs). The steps are modified a bit. 1-6. same as before. After calling assign_shallow_commits_to_refs at step 6, each shallow commit has a bitmap that marks all refs that require it. 7. mark all "ours" shallow commits that are reachable from any refs. We will need to do the original step 7 on them later. 8. go over all shallow commit bitmaps, mark refs that require new shallow commits. 9. setup a strict temporary shallow file to plug all the holes, even if it may cut some of our history short. This file is used by all hooks. The hooks could use --shallow-file=$GIT_DIR/shallow to overcome this and reach everything in current repo. 10. go over the new refs one by one. For each ref, do the reachability test if it needs a shallow commit on the list from step 7. Remove it if it's reachable from our refs. Gather all required shallow commits, run check_everything_connected() with the new ref, then install them to .git/shallow. This mode is disabled by default and can be turned on with receive.shallowupdate Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5538-push-shallow.sh')
-rwxr-xr-xt/t5538-push-shallow.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t5538-push-shallow.sh b/t/t5538-push-shallow.sh
index 650c31a888..ff5eb5bcf5 100755
--- a/t/t5538-push-shallow.sh
+++ b/t/t5538-push-shallow.sh
@@ -67,4 +67,19 @@ test_expect_success 'push from shallow clone, with grafted roots' '
git fsck
'
+test_expect_success 'add new shallow root with receive.updateshallow on' '
+ test_config receive.shallowupdate true &&
+ (
+ cd shallow2 &&
+ git push ../.git +master:refs/remotes/shallow2/master
+ ) &&
+ git log --format=%s shallow2/master >actual &&
+ git fsck &&
+ cat <<EOF >expect &&
+c
+b
+EOF
+ test_cmp expect actual
+'
+
test_done