Skip to content

Commit 423e4cd

Browse files
committed
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 <[email protected]>
1 parent 2361d58 commit 423e4cd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

t/t5538-push-shallow.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,25 @@ test_expect_success 'push new commit from shallow clone to origin is efficient'
137137
test_grep "Enumerating objects: 1, done." err
138138
'
139139

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

0 commit comments

Comments
 (0)