Skip to content

Commit c8abfb4

Browse files
committed
t/t-push-failures-local.sh: align setup steps
Our t/t-push-failures-local.sh test script includes a number of tests which validate the behaviour of the "git push" command when Git LFS objects are missing or corrupt. While these tests are largely similar in their implementation, they vary in a number of formatting and implementation details unrelated to the specifics of the different conditions they simulate. These variations are artifacts of the evolution of our test suite over time; for example, the tests in the t/t-push-failures-local.sh script were refactored and collected from several earlier tests in commit 4d52e08 of PR git-lfs#3109. In a subsequent commit in this PR we expect to update the Git LFS client to remove some non-functional code which attempts to recreate missing Git LFS objects during push operations. In many cases this change will cause the client to report missing objects in an earlier stage of push operations than it does now. We also expect to reword the error message the client will output in such cases. Before we make these changes, we first revise the related tests in our test suite so they are as simple and similar as possible. This will ensure that when we update the Git LFS client we can clearly identify the changes that we need to make in our tests to accommodate the client's new behaviour. A pair of tests in the t/t-push-failures-local.sh script, specifically the "push reject missing objects (lfs.allowincompletepush default)" and "push reject corrupt objects (lfs.allowincompletepush default)" tests, perform their setup of Git LFS objects and Git commits in a different sequence than the other tests in the same script. In order to align the code in all these tests as closely as possible, we simply revise the setup steps of the last two tests in the t/t-push-failures-local.sh script so they follow the same pattern as those of the other tests. This change has no functional effect; the only notable detail is that the tests now create all their Git LFS objects in a single commit instead of using a separate commit to create each object.
1 parent 127dbbf commit c8abfb4

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

t/t-push-failures-local.sh

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,16 @@ begin_test "push reject missing objects (lfs.allowincompletepush default)"
101101
git add .gitattributes
102102
git commit -m "initial commit"
103103

104+
present="present"
105+
present_oid="$(calc_oid "$present")"
106+
printf "%s" "$present" > present.dat
107+
104108
missing="missing"
105109
missing_oid="$(calc_oid "$missing")"
106110
printf "%s" "$missing" > missing.dat
107-
git add missing.dat
108-
git commit -m "add missing.dat"
109111

110-
present="present"
111-
present_oid="$(calc_oid "$present")"
112-
printf "%s" "$present" > present.dat
113-
git add present.dat
114-
git commit -m "add present.dat"
112+
git add missing.dat present.dat
113+
git commit -m "add objects"
115114

116115
delete_local_object "$missing_oid"
117116

@@ -141,17 +140,16 @@ begin_test "push reject corrupt objects (lfs.allowincompletepush default)"
141140
git add .gitattributes
142141
git commit -m "initial commit"
143142

143+
present="present"
144+
present_oid="$(calc_oid "$present")"
145+
printf "%s" "$present" > present.dat
146+
144147
corrupt="corrupt"
145148
corrupt_oid="$(calc_oid "$corrupt")"
146149
printf "%s" "$corrupt" > corrupt.dat
147-
git add corrupt.dat
148-
git commit -m "add corrupt.dat"
149150

150-
present="present"
151-
present_oid="$(calc_oid "$present")"
152-
printf "%s" "$present" > present.dat
153-
git add present.dat
154-
git commit -m "add present.dat"
151+
git add corrupt.dat present.dat
152+
git commit -m "add objects"
155153

156154
corrupt_local_object "$corrupt_oid"
157155

0 commit comments

Comments
 (0)