From ebf908a228e98a709afd2cb06e66c90cf7a0a99f Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Sun, 19 Nov 2017 06:31:12 +0000 Subject: [PATCH] more tests --- shallow-submodule.sh | 162 +++++++++++++++++++++++++++++++++---------- 1 file changed, 125 insertions(+), 37 deletions(-) diff --git a/shallow-submodule.sh b/shallow-submodule.sh index 8e1c29b..c869c7d 100755 --- a/shallow-submodule.sh +++ b/shallow-submodule.sh @@ -14,15 +14,41 @@ mkdir tmp cd tmp rm -rf * +export GIT_AUTHOR_NAME="Ciro Santilli" +export GIT_AUTHOR_EMAIL="ciro.santilli@gmail.com" +export GIT_AUTHOR_DATE='2000-01-01T00:00:00+0000' +export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" +export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL" +export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" + mkdir mod -cd mod/ +cd mod git init -touch a -git add a -git commit -m 1 -touch b -git add b -git commit -m 2 +touch base +git add base +git commit -m base +touch master-1 +git add master-1 +git commit -m master-1 +touch master-2 +git add master-2 +git commit -m master-2 +git tag tag-master +touch master-3 +git add master-3 +git commit -m master-3 +git checkout -b mybranch HEAD~3 +touch mybranch-1 +git add mybranch-1 +git commit -m mybranch-1 +touch mybranch-2 +git add mybranch-2 +git commit -m mybranch-2 +git tag tag-mybranch +touch mybranch-3 +git add mybranch-3 +git commit -m mybranch-3 +git checkout master cd .. mkdir top @@ -46,8 +72,8 @@ git add .gitmodules git commit -m 'shallow' cd .. -mkdir mod-branch -cd mod-branch/ +mkdir top-branch +cd top-branch git init touch a git add a @@ -55,14 +81,20 @@ git commit -m 1 touch b git add b git commit -m 2 -git checkout -b mybranch HEAD~ -touch c -git add c -git commit -m 3 +git submodule add -b mybranch ../mod/ mod +git add .gitmodules +git commit -m '.gitmodules' cd .. -mkdir top-branch -cd top-branch +cp -rv top-branch top-branch-shallow +cd top-branch-shallow +printf '\tshallow = true\n' >> .gitmodules +git add .gitmodules +git commit -m 'shallow' +cd .. + +mkdir top-tag +cd top-tag git init touch a git add a @@ -70,39 +102,95 @@ git commit -m 1 touch b git add b git commit -m 2 -git submodule add -b mybranch ../mod-branch/ mod -git add .gitmodules +git submodule add ../mod/ mod +cd mod +git checkout tag-mybranch +cd .. +git add . git commit -m '.gitmodules' cd .. -cp -rv top-branch top-branch-shallow -cd top-branch-shallow -printf '\tshallow = true\n' >> .gitmodules -git add .gitmodules -git commit -m 'shallow' +mkdir top-sha +cd top-sha +git init +touch a +git add a +git commit -m 1 +touch b +git add b +git commit -m 2 +git submodule add ../mod/ mod +cd mod +git checkout tag-mybranch~ +cd .. +git add . +git commit -m '.gitmodules' cd .. +rm -f results + +git clone --depth 1 "file://$(pwd)/mod" mod-clone +git --git-dir mod-clone/.git log --oneline | wc -l >>results +# 1 + +git clone --depth 1 "file://$(pwd)/mod" mod-branch-clone +git --git-dir mod-branch-clone/.git log --oneline | wc -l >>results +# 1 + +## gitmodule + +echo 'gitmodule' >>results + git clone --recursive "file://$(pwd)/top" top-clone -git --git-dir top-clone/.git/modules/mod log -# two commits +git --git-dir top-clone/.git/modules/mod log --oneline | wc -l >>results +# many git clone --recursive "file://$(pwd)/top-shallow" top-shallow-clone -git --git-dir top-shallow-clone/.git/modules/mod log -# one commit +git --git-dir top-shallow-clone/.git/modules/mod log --oneline | wc -l >>results +# 1 git clone --recursive "file://$(pwd)/top-branch" top-branch-clone -git --git-dir top-branch-clone/.git/modules/mod log -# two commits +git --git-dir top-branch-clone/.git/modules/mod log --oneline | wc -l >>results +# many git clone --recursive "file://$(pwd)/top-branch-shallow" top-branch-shallow-clone -git --git-dir top-branch-shallow-clone/.git/modules/mod log -# locally: one commit -# github 2017-11, git 2.14.1: two commits +git --git-dir top-branch-shallow-clone/.git/modules/mod log --oneline | wc -l >>results +# many -git clone --depth 1 "file://$(pwd)/mod" mod-clone -git --git-dir mod-clone/.git log -# one commit +git clone --recursive "file://$(pwd)/top-tag" top-tag-clone +git --git-dir top-tag-clone/.git/modules/mod log --oneline | wc -l >>results +# many + +git clone --recursive "file://$(pwd)/top-sha" top-sha-clone +git --git-dir top-sha-clone/.git/modules/mod log --oneline | wc -l >>results +# many + +## SS + +echo 'ss' >>results + +git clone --recursive --shallow-submodules "file://$(pwd)/top" top-clone-ss +git --git-dir top-clone-ss/.git/modules/mod log --oneline | wc -l >>results +# 1 + +git clone --recursive --shallow-submodules "file://$(pwd)/top-shallow" top-shallow-clone-ss +git --git-dir top-shallow-clone-ss/.git/modules/mod log --oneline | wc -l >>results +# 1 + +git clone --recursive --shallow-submodules "file://$(pwd)/top-branch" top-branch-clone-ss +git --git-dir top-branch-clone-ss/.git/modules/mod log --oneline | wc -l >>results +# 1 + +git clone --recursive --shallow-submodules "file://$(pwd)/top-branch-shallow" top-branch-shallow-clone-ss +git --git-dir top-branch-shallow-clone-ss/.git/modules/mod log --oneline | wc -l >>results +# 1 + +git clone --recursive --shallow-submodules "file://$(pwd)/top-tag" top-tag-clone-ss +git --git-dir top-tag-clone-ss/.git/modules/mod log --oneline | wc -l >>results +# 1 + +#git clone --recursive --shallow-submodules "file://$(pwd)/top-sha" top-sha-clone-ss +# error: Server does not allow request for unadvertised object +#git --git-dir top-sha-clone-ss/.git/modules/mod log --oneline | wc -l >>results -git clone --depth 1 "file://$(pwd)/mod-branch" mod-branch-clone -git --git-dir mod-branch-clone/.git log -# one commit +cat results