git-fetch: make it work from within a subdirectory.
authorJunio C Hamano <junkio@cox.net>
Thu, 14 Dec 2006 08:36:23 +0000 (00:36 -0800)
committerJunio C Hamano <junkio@cox.net>
Thu, 14 Dec 2006 10:45:51 +0000 (02:45 -0800)
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-fetch.sh

index 4eecf148ea90c02bfe9f2aa018118ccbd26f8e97..fb35815a5fbf1074f6a4a2fb08c6c9656c6a1654 100755 (executable)
@@ -2,7 +2,13 @@
 #
 
 USAGE='<fetch-options> <repository> <refspec>...'
+SUBDIRECTORY_OK=Yes
 . git-sh-setup
+TOP=$(git-rev-parse --show-cdup)
+if test ! -z "$TOP"
+then
+       cd "$TOP"
+fi
 . git-parse-remote
 _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
 _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"