summaryrefslogtreecommitdiff
path: root/git-fetch-script
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-08-20 10:00:03 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-08-24 23:50:51 (GMT)
commit92c533ef0ea2cb43f0d7d493f006f5b4dfa7cda1 (patch)
treedb8870719dbc80c883137397b3af686cc9719c43 /git-fetch-script
parentd9f3be7e2e4c9b402bbe6ee6e2b39b2ee89132cf (diff)
downloadgit-92c533ef0ea2cb43f0d7d493f006f5b4dfa7cda1.zip
git-92c533ef0ea2cb43f0d7d493f006f5b4dfa7cda1.tar.gz
git-92c533ef0ea2cb43f0d7d493f006f5b4dfa7cda1.tar.bz2
[PATCH] Make "git pull" and "git fetch" default to origin
Amos Waterland sent in a patch for the pre-multi-head aware version of "git pull" to do this, but the code changed quite a bit since then. If there is no argument given to pull from, and if "origin" makes sense, default to fetch/pull from "origin" instead of barfing. [jc: besides, the patch by Amos broke the non-default case where explicit refspecs are specified, and did not make sure we know what "origin" means before defaulting to it.] Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-fetch-script')
-rwxr-xr-xgit-fetch-script5
1 files changed, 4 insertions, 1 deletions
diff --git a/git-fetch-script b/git-fetch-script
index 9b05e41..a70909e 100755
--- a/git-fetch-script
+++ b/git-fetch-script
@@ -8,7 +8,10 @@ _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
append=
case "$#" in
0)
- die "Where do you want to fetch from?" ;;
+ test -f "$GIT_DIR/branches/origin" ||
+ test -f "$GIT_DIR/remotes/origin" ||
+ die "Where do you want to fetch from?"
+ set origin ;;
*)
case "$1" in
-a|--a|--ap|--app|--appe|--appen|--append)