Skip to content

Commit

Permalink
t: set both remote and merge settings for push and pull
Browse files Browse the repository at this point in the history
When cloning an empty repository, Git will set branch.master.remote, but
if our default branch name is different, Git won't set that value.
Without the remote setting, Git won't push or pull from the remote as
our tests expect it to, and the operation will fail, even though we've
set branch.*.merge.

Make sure that whenever we expect these values to be set that we either
set them both explicitly or use git push -u to set them both for us.
  • Loading branch information
bk2204 committed Jul 8, 2020
1 parent d8d2f1e commit 4c9ae85
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions t/t-lock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ begin_test "lock with good tracked ref"

git config push.default upstream
git config branch.master.merge refs/heads/tracked
git config branch.master.remote origin
git push origin master

git lfs lock "a.dat" --json 2>&1 | tee lock.json
Expand Down
1 change: 1 addition & 0 deletions t/t-pre-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,7 @@ begin_test "pre-push locks verify 403 with good tracked ref"

git config push.default upstream
git config branch.master.merge refs/heads/tracked
git config branch.master.remote origin
git config "lfs.$GITSERVER/$reponame.git.locksverify" true
git push 2>&1 | tee push.log

Expand Down
4 changes: 4 additions & 0 deletions t/t-pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ begin_test "pull"
cd ../clone

echo "normal pull"
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git pull 2>&1

[ "a" = "$(cat a.dat)" ]
Expand Down Expand Up @@ -296,6 +298,8 @@ begin_test "pull: with missing object"
refute_server_object "$reponame" "$contents_oid"

# should return non-zero, but should also download all the other valid files too
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git lfs pull 2>&1 | tee pull.log
pull_exit="${PIPESTATUS[0]}"
[ "$pull_exit" != "0" ]
Expand Down
4 changes: 2 additions & 2 deletions t/t-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ begin_test "status (unpushed objects)"
git add .gitattributes
git commit -m "initial commit"

git push origin master
git push -u origin master

contents="a"
oid="$(calc_oid "$contents")"
Expand Down Expand Up @@ -477,7 +477,7 @@ begin_test "status (deleted files)"
git add .gitattributes
git commit -m "initial commit"

git push origin master
git push -u origin master

contents="a"
oid="$(calc_oid "$contents")"
Expand Down
1 change: 1 addition & 0 deletions t/t-unlock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ begin_test "unlocking a lock by path with tracked ref"

git config push.default upstream
git config branch.master.merge refs/heads/tracked
git config branch.master.remote origin
git push origin master

git lfs lock --json "c.dat" | tee lock.log
Expand Down

0 comments on commit 4c9ae85

Please sign in to comment.