Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cirosantilli committed Nov 19, 2017
1 parent 072a5fb commit ebf908a
Showing 1 changed file with 125 additions and 37 deletions.
162 changes: 125 additions & 37 deletions shallow-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -46,63 +72,125 @@ 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
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
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

0 comments on commit ebf908a

Please sign in to comment.