File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,12 +14,8 @@ emit_output() {
1414 fi
1515}
1616
17- shallow_file () {
18- git rev-parse --git-path shallow
19- }
20-
2117is_shallow_clone () {
22- [[ -f " $( shallow_file ) " ]]
18+ [[ " $( git rev-parse --is-shallow-repository ) " == " true " ]]
2319}
2420
2521has_commit () {
Original file line number Diff line number Diff line change @@ -29,6 +29,11 @@ run_history_check() {
2929 )
3030}
3131
32+ repo_is_shallow () {
33+ local repo=" $1 "
34+ [[ " $( git -C " $repo " rev-parse --is-shallow-repository) " == " true" ]]
35+ }
36+
3237test_raw_sha_fetch_stays_shallow () {
3338 init_remote_repo raw-sha
3439 local remote=" $INIT_REMOTE "
@@ -57,7 +62,7 @@ test_raw_sha_fetch_stays_shallow() {
5762 run_history_check " $clone " " $base_sha " " $output_file "
5863
5964 git -C " $clone " rev-parse --verify " $base_sha ^{commit}" > /dev/null
60- [[ -f " $( git -C " $ clone" rev-parse --git-path shallow ) " ]]
65+ repo_is_shallow " $ clone"
6166 grep -qx ' shallow=true' " $output_file "
6267}
6368
@@ -96,7 +101,7 @@ test_branch_ref_falls_back_to_full_history() {
96101
97102 git -C " $clone " rev-parse --verify " origin/main^{commit}" > /dev/null
98103 git -C " $clone " merge-base HEAD origin/main > /dev/null
99- [[ ! -f " $( git -C " $clone " rev-parse --git-path shallow) " ]]
104+ [[ " $( git -C " $clone " rev-parse --is- shallow-repository ) " == " false " ]]
100105 grep -qx ' shallow=true' " $output_file "
101106}
102107
You can’t perform that action at this time.
0 commit comments