File tree Expand file tree Collapse file tree 3 files changed +59
-3
lines changed Expand file tree Collapse file tree 3 files changed +59
-3
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ There are also some tests that could not be included here conveniently:
1717- < https://github.com/cirosantilli/test-empty-commit >
1818- < https://github.com/cirosantilli/test-empty-subdir >
1919- < https://github.com/cirosantilli/test-git-partial-clone > : [ partial-clone.sh] ( partial-clone.sh ) | https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository/52269934#52269934
20+ - < https://github.com/cirosantilli/test-git-filter-repo > : [ filter-repo.sh] ( filter-repo.sh )
2021- < https://github.com/cirosantilli/test-invalid-utf8 >
2122- < https://github.com/cirosantilli/test-large-file >
2223- < https://github.com/cirosantilli/test-long-filename-1024 >
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -eu
3+
4+ # Reproducibility.
5+ export GIT_COMMITTER_NAME=' a'
6+ export GIT_COMMITTER_EMAIL=' a'
7+ export GIT_AUTHOR_NAME=' a'
8+ export GIT_AUTHOR_EMAIL=' a'
9+ export GIT_COMMITTER_DATE=' 2000-01-01T00:00:00+0000'
10+ export GIT_AUTHOR_DATE=' 2000-01-01T00:00:00+0000'
11+
12+ # https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository/52269934#52269934
13+ rm -rf filter-repo.tmp
14+ mkdir -p filter-repo.tmp
15+ cd filter-repo.tmp
16+ git init
17+
18+ # Create repo.
19+ git init --quiet
20+
21+ # First commit.
22+ # Directories present in all branches.
23+ mkdir d1 d2
24+ printf ' d1/a' > ./d1/a
25+ printf ' d1/b' > ./d1/b
26+ printf ' d2/a' > ./d2/a
27+ printf ' d2/b' > ./d2/b
28+ # Present only in root.
29+ mkdir ' root'
30+ printf ' root' > ./root/root
31+ git add .
32+ git commit -m ' root' --quiet
33+ root_commmit_sha=" $( git log -1 --format=" %H" ) "
34+
35+ # Second commit only on master.
36+ git rm --quiet -r ./root
37+ mkdir ' master'
38+ printf ' master' > ./master/master
39+ printf ' d1/a' > ./d1/a2
40+ git add .
41+ git commit -m ' master commit' --quiet
42+
43+ # Third commit only on master.
44+ printf ' d1/b' > ./d1/b2
45+ git add .
46+ git commit -m ' master commit' --quiet
47+
48+ # Second commit only on mybranch.
49+ git checkout -b mybranch --quiet " $root_commmit_sha "
50+ git rm --quiet -r ./root
51+ mkdir ' mybranch'
52+ printf ' mybranch' > ./mybranch/mybranch
53+ git add .
54+ git commit -m ' mybranch commit' --quiet
55+
56+ # Restore master.
57+ git checkout --quiet master
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
2+ set -eu
23
34# https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository/52269934#52269934
45rm -rf partial-clone.tmp
56mkdir -p partial-clone.tmp
67cd partial-clone.tmp
78
8- #! /usr/bin/env bash
9- set -eu
10-
119list-objects () (
1210 git rev-list --all --objects
1311 echo " master commit SHA: $( git log -1 --format=" %H" ) "
You can’t perform that action at this time.
0 commit comments