@@ -6,31 +6,31 @@ test_description='git repack works correctly'
6
6
7
7
commit_and_pack () {
8
8
test_commit " $@ " 1>&2 &&
9
- SHA1 =$( git pack-objects --all --unpacked --incremental .git/objects/pack/pack < /dev/null) &&
10
- echo pack-${SHA1 } .pack
9
+ incrpackid =$( git pack-objects --all --unpacked --incremental .git/objects/pack/pack < /dev/null) &&
10
+ echo pack-${incrpackid } .pack
11
11
}
12
12
13
13
test_no_missing_in_packs () {
14
14
myidx=$( ls -1 .git/objects/pack/* .idx) &&
15
15
test_path_is_file " $myidx " &&
16
16
git verify-pack -v alt_objects/pack/* .idx > orig.raw &&
17
- sed -n -e " s/^\([0-9a-f]\{40\} \).*/\1/p" orig.raw | sort > orig &&
17
+ sed -n -e " s/^\($OID_REGEX \).*/\1/p" orig.raw | sort > orig &&
18
18
git verify-pack -v $myidx > dest.raw &&
19
19
cut -d" " -f1 dest.raw | sort > dest &&
20
20
comm -23 orig dest > missing &&
21
21
test_must_be_empty missing
22
22
}
23
23
24
- # we expect $packsha1 and $objsha1 to be defined
24
+ # we expect $packid and $oid to be defined
25
25
test_has_duplicate_object () {
26
26
want_duplicate_object=" $1 "
27
27
found_duplicate_object=false
28
28
for p in .git/objects/pack/* .idx
29
29
do
30
30
idx=$( basename $p )
31
- test " pack-$packsha1 .idx" = " $idx " && continue
31
+ test " pack-$packid .idx" = " $idx " && continue
32
32
git verify-pack -v $p > packlist || return $?
33
- if grep " ^$objsha1 " packlist
33
+ if grep " ^$oid " packlist
34
34
then
35
35
found_duplicate_object=true
36
36
echo " DUPLICATE OBJECT FOUND"
@@ -51,25 +51,25 @@ test_expect_success 'objects in packs marked .keep are not repacked' '
51
51
git rev-list --objects --all | grep -v file2 |
52
52
git pack-objects pack &&
53
53
# The second pack will contain the excluded object
54
- packsha1 =$(git rev-list --objects --all | grep file2 |
54
+ packid =$(git rev-list --objects --all | grep file2 |
55
55
git pack-objects pack) &&
56
- >pack-$packsha1 .keep &&
57
- objsha1 =$(git verify-pack -v pack-$packsha1 .idx | head -n 1 |
58
- sed -e "s/^\([0-9a-f]\{40\} \).*/\1/") &&
56
+ >pack-$packid .keep &&
57
+ oid =$(git verify-pack -v pack-$packid .idx | head -n 1 |
58
+ sed -e "s/^\($OID_REGEX \).*/\1/") &&
59
59
mv pack-* .git/objects/pack/ &&
60
60
git repack -A -d -l &&
61
61
git prune-packed &&
62
62
test_has_duplicate_object false
63
63
'
64
64
65
65
test_expect_success ' writing bitmaps via command-line can duplicate .keep objects' '
66
- # build on $objsha1 , $packsha1 , and .keep state from previous
66
+ # build on $oid , $packid , and .keep state from previous
67
67
git repack -Adbl &&
68
68
test_has_duplicate_object true
69
69
'
70
70
71
71
test_expect_success ' writing bitmaps via config can duplicate .keep objects' '
72
- # build on $objsha1 , $packsha1 , and .keep state from previous
72
+ # build on $oid , $packid , and .keep state from previous
73
73
git -c repack.writebitmaps=true repack -Adl &&
74
74
test_has_duplicate_object true
75
75
'
@@ -78,7 +78,7 @@ test_expect_success 'loose objects in alternate ODB are not repacked' '
78
78
mkdir alt_objects &&
79
79
echo $(pwd)/alt_objects >.git/objects/info/alternates &&
80
80
echo content3 >file3 &&
81
- objsha1 =$(GIT_OBJECT_DIRECTORY=alt_objects git hash-object -w file3) &&
81
+ oid =$(GIT_OBJECT_DIRECTORY=alt_objects git hash-object -w file3) &&
82
82
git add file3 &&
83
83
test_tick &&
84
84
git commit -m commit_file3 &&
@@ -124,7 +124,7 @@ test_expect_success 'packed obs in alternate ODB kept pack are repacked' '
124
124
test_expect_success ' packed unreachable obs in alternate ODB are not loosened' '
125
125
rm -f alt_objects/pack/*.keep &&
126
126
mv .git/objects/pack/* alt_objects/pack/ &&
127
- csha1 =$(git rev-parse HEAD^{commit}) &&
127
+ coid =$(git rev-parse HEAD^{commit}) &&
128
128
git reset --hard HEAD^ &&
129
129
test_tick &&
130
130
git reflog expire --expire=$test_tick --expire-unreachable=$test_tick --all &&
@@ -135,14 +135,14 @@ test_expect_success 'packed unreachable obs in alternate ODB are not loosened' '
135
135
rm -f .git/objects/pack/* &&
136
136
mv pack-* .git/objects/pack/ &&
137
137
test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
138
- grep "^$csha1 " | sort | uniq | wc -l) &&
138
+ grep "^$coid " | sort | uniq | wc -l) &&
139
139
echo >.git/objects/info/alternates &&
140
- test_must_fail git show $csha1
140
+ test_must_fail git show $coid
141
141
'
142
142
143
143
test_expect_success ' local packed unreachable obs that exist in alternate ODB are not loosened' '
144
144
echo $(pwd)/alt_objects >.git/objects/info/alternates &&
145
- echo "$csha1 " | git pack-objects --non-empty --all --reflog pack &&
145
+ echo "$coid " | git pack-objects --non-empty --all --reflog pack &&
146
146
rm -f .git/objects/pack/* &&
147
147
mv pack-* .git/objects/pack/ &&
148
148
# The pack-objects call on the next line is equivalent to
@@ -152,9 +152,9 @@ test_expect_success 'local packed unreachable obs that exist in alternate ODB ar
152
152
rm -f .git/objects/pack/* &&
153
153
mv pack-* .git/objects/pack/ &&
154
154
test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
155
- grep "^$csha1 " | sort | uniq | wc -l) &&
155
+ grep "^$coid " | sort | uniq | wc -l) &&
156
156
echo >.git/objects/info/alternates &&
157
- test_must_fail git show $csha1
157
+ test_must_fail git show $coid
158
158
'
159
159
160
160
test_expect_success ' objects made unreachable by grafts only are kept' '
0 commit comments