Fetch: default remote repository from branch properties
If in branch "foo" and this in config: [branch "foo"] remote=bar "git fetch" = "git fetch bar" "git pull" = "git pull bar" Signed-off-by: Santi Béjar <sbejar@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
ed1795fcc5
commit
648ad18f50
@ -119,6 +119,9 @@ apply.whitespace::
|
|||||||
Tells `git-apply` how to handle whitespaces, in the same way
|
Tells `git-apply` how to handle whitespaces, in the same way
|
||||||
as the '--whitespace' option. See gitlink:git-apply[1].
|
as the '--whitespace' option. See gitlink:git-apply[1].
|
||||||
|
|
||||||
|
branch.<name>.remote::
|
||||||
|
When in branch <name>, it tells `git fetch` which remote to fetch.
|
||||||
|
|
||||||
pager.color::
|
pager.color::
|
||||||
A boolean to enable/disable colored output when the pager is in
|
A boolean to enable/disable colored output when the pager is in
|
||||||
use (default is true).
|
use (default is true).
|
||||||
|
@ -68,11 +68,10 @@ done
|
|||||||
|
|
||||||
case "$#" in
|
case "$#" in
|
||||||
0)
|
0)
|
||||||
test -f "$GIT_DIR/branches/origin" ||
|
origin=$(get_default_remote)
|
||||||
test -f "$GIT_DIR/remotes/origin" ||
|
test -n "$(get_remote_url ${origin})" ||
|
||||||
git-repo-config --get remote.origin.url >/dev/null ||
|
die "Where do you want to fetch from today?"
|
||||||
die "Where do you want to fetch from today?"
|
set x $origin ; shift ;;
|
||||||
set origin ;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
remote_nick="$1"
|
remote_nick="$1"
|
||||||
|
@ -68,6 +68,12 @@ get_remote_url () {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_default_remote () {
|
||||||
|
curr_branch=$(git-symbolic-ref HEAD | sed -e 's|^refs/heads/||')
|
||||||
|
origin=$(git-repo-config --get "branch.$curr_branch.remote")
|
||||||
|
echo ${origin:-origin}
|
||||||
|
}
|
||||||
|
|
||||||
get_remote_default_refs_for_push () {
|
get_remote_default_refs_for_push () {
|
||||||
data_source=$(get_data_source "$1")
|
data_source=$(get_data_source "$1")
|
||||||
case "$data_source" in
|
case "$data_source" in
|
||||||
|
Loading…
Reference in New Issue
Block a user