Skip to content

Commit 19094f4

Browse files
derrickstoleedscho
authored andcommitted
t5538: add test to confirm deltas in shallow pushes
It can be notoriously difficult to detect if delta bases are being computed properly during 'git push'. Construct an example where it will make a kilobyte worth of difference when a delta base is not found. We can then use the progress indicators to distinguish between bytes and KiB depending on whether the delta base is found and used. Signed-off-by: Derrick Stolee <stolee@gmail.com>
1 parent 4a7f1dd commit 19094f4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Diff for: t/t5538-push-shallow.sh

+21
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,25 @@ test_expect_success 'push new commit from shallow clone has correct object count
136136
test_grep "Enumerating objects: 1, done." err
137137
'
138138

139+
test_expect_success 'push new commit from shallow clone has good deltas' '
140+
git init base &&
141+
test_seq 1 999 >base/a &&
142+
test_commit -C base initial &&
143+
git -C base add a &&
144+
git -C base commit -m "big a" &&
145+
146+
git clone --depth=1 "file://$(pwd)/base" deltas &&
147+
git -C deltas checkout -b deltas &&
148+
test_seq 1 1000 >deltas/a &&
149+
git -C deltas commit -a -m "bigger a" &&
150+
GIT_TRACE2_PERF="$(pwd)/trace.txt" \
151+
GIT_PROGRESS_DELAY=0 git -C deltas push --progress origin deltas 2>err &&
152+
153+
test_grep "Enumerating objects: 5, done" err &&
154+
155+
# If the delta base is found, then this message uses "bytes".
156+
# If the delta base is not found, then this message uses "KiB".
157+
test_grep "Writing objects: .* bytes" err
158+
'
159+
139160
test_done

0 commit comments

Comments
 (0)