Skip to content

Commit 8cabd16

Browse files
committed
Make git remote failure clearer in make_remote_config_repos
Starting in Git 2.51.0, at least one of the `git remote` commands in the `make_remote_config_repos.sh` fixutre script fails, which causes a subsequently run command depending on it to fail. This is the cause of the CI failures observed in GitoxideLabs#2130. But when any command fails, the intention is that the script fails fast. To help achieve this, `set -e` is used. But the rules for `set -e` have a number of exceptions. At least in some versions of `bash`, the way `&&` was being used kept it from failing fast. This changes that to run the commands separately, surfacing the specific `git remote` command that fails, rather than a subsequent command that fails later as a result of the first failure.
1 parent 2381693 commit 8cabd16

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

gix/tests/fixtures/make_remote_config_repos.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,14 @@ EOF
134134

135135
git clone fetch multiple-remotes
136136
(cd multiple-remotes
137-
git remote add other ../fetch && git fetch other
138-
git remote add with/two/slashes ../fetch && git fetch with/two/slashes
139-
git remote add with/two ../fetch && git fetch with/two
137+
git remote add other ../fetch
138+
git fetch other
139+
140+
git remote add with/two/slashes ../fetch
141+
git fetch with/two/slashes
142+
143+
git remote add with/two ../fetch
144+
git fetch with/two
140145

141146
# add a specialised refspec mapping
142147
git config --add remote.with/two.fetch +refs/heads/special:refs/remotes/with/two/special
@@ -146,4 +151,4 @@ git clone fetch multiple-remotes
146151
git checkout -b track-special with/two/special
147152
git checkout -b main --track origin/main
148153
git checkout -b other-main --track other/main
149-
)
154+
)

0 commit comments

Comments
 (0)