summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ed1795f)
raw | patch | inline | side by side (parent: ed1795f)
author | Santi Béjar <sbejar@gmail.com> | |
Sat, 23 Sep 2006 10:05:43 +0000 (12:05 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 24 Sep 2006 07:13:49 +0000 (00:13 -0700) |
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>
[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>
Documentation/config.txt | patch | blob | history | |
git-fetch.sh | patch | blob | history | |
git-parse-remote.sh | patch | blob | history |
index bb2fbc324e6fa93a639b31668a7a030ece7787f0..04c5094fdd4c5e66b186107c0f64d3a82e1e8aa5 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
Tells `git-apply` how to handle whitespaces, in the same way
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::
A boolean to enable/disable colored output when the pager is in
use (default is true).
diff --git a/git-fetch.sh b/git-fetch.sh
index 09a5d6ceab7875f2344f84d684ea5cc250786c64..50ad101e89500af01edde00b047b91fc16fdcb81 100755 (executable)
--- a/git-fetch.sh
+++ b/git-fetch.sh
case "$#" in
0)
- test -f "$GIT_DIR/branches/origin" ||
- test -f "$GIT_DIR/remotes/origin" ||
- git-repo-config --get remote.origin.url >/dev/null ||
- die "Where do you want to fetch from today?"
- set origin ;;
+ origin=$(get_default_remote)
+ test -n "$(get_remote_url ${origin})" ||
+ die "Where do you want to fetch from today?"
+ set x $origin ; shift ;;
esac
remote_nick="$1"
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 187f0883c9136772677088ddf61228291d4b41d1..69998169b7f2a2a07363a7d1416be129bca82e84 100755 (executable)
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
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 () {
data_source=$(get_data_source "$1")
case "$data_source" in