-
-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix!: rename
Repository::branch_remote_ref()
to `Repository::branch…
…_remote_ref_name()`, add `direction` argument (also to `Repository::branch_remote_name()` and `Repository::branch_remote()`). This better differentiates the return value from the corresponding ref objects, which would require the named ref to exist in the repository. The `direction` argument allows to get the reference to push to as well. Further, it now takes a full ref name to support deriving the name of branches to push to. Regarding `Repository::branch_remote()`, previously, this functionality was only available from a `Reference`, but now it's more generally available with just a branch name. The method was also adjusted to permit looking up non-symbolic remote names, like remotes that are specified by their URL.
- Loading branch information
Showing
10 changed files
with
380 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+11.3 KB
gix/tests/fixtures/generated-archives/make_remote_config_repos.tar.xz
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/bin/bash | ||
set -eu -o pipefail | ||
|
||
(mkdir fetch && cd fetch | ||
git init -q | ||
|
||
git checkout -b main | ||
|
||
git commit --allow-empty -q -m c1 | ||
|
||
git remote add --fetch remote_repo . | ||
git branch --set-upstream-to remote_repo/main | ||
|
||
git config branch.broken.merge not_a_valid_merge_ref | ||
git config push.default simple | ||
) | ||
|
||
(mkdir push-mapped && cd push-mapped | ||
git init -q | ||
|
||
git checkout -b main | ||
git commit --allow-empty -q -m c1 | ||
|
||
cat<<EOF >.git/config | ||
[remote "origin"] | ||
url = . | ||
fetch = +refs/heads/*:refs/remotes/origin/* | ||
push = refs/heads/main ; this should be ignored | ||
push = refs/heads/main:refs/heads/remapped-main | ||
push = refs/heads/main:refs/heads/skipped ; skipped as it's not the first matching one | ||
push = refs/heads/feature:refs/heads/remapped-feature ; this is picked up before going to push.default (which would fail) | ||
[branch "main"] | ||
remote = "origin" | ||
merge = refs/heads/main | ||
[push] | ||
default = simple | ||
[branch "feature"] | ||
remote = "origin" | ||
merge = refs/heads/main ; this one is remapped to merge from main, which doesn't affect the push remote. | ||
EOF | ||
) | ||
|
||
(mkdir push-missing && cd push-missing | ||
git init -q | ||
|
||
git checkout -b main | ||
git commit --allow-empty -q -m c1 | ||
|
||
cat<<EOF >.git/config | ||
[remote "origin"] | ||
url = . | ||
fetch = +refs/heads/*:refs/remotes/origin/* | ||
push = refs/heads/main ; there is a match, but no destination is available | ||
[push] | ||
default = current ; this could work, but the default isn't looked at if there are any push specs | ||
[branch "main"] | ||
remote = "origin" | ||
merge = refs/heads/main | ||
EOF | ||
) | ||
|
||
(mkdir push-default-current && cd push-default-current | ||
git init -q | ||
|
||
git checkout -b main | ||
git commit --allow-empty -q -m c1 | ||
|
||
cat<<EOF >.git/config | ||
[remote "origin"] | ||
url = . | ||
fetch = +refs/heads/*:refs/remotes/origin/* | ||
[push] | ||
default = current ; this would be the one setting that works as it ignores 'branch.main.merge' | ||
[branch "main"] | ||
remote = "origin" | ||
merge = refs/heads/other | ||
EOF | ||
) | ||
|
Oops, something went wrong.