aboutsummaryrefslogtreecommitdiff
path: root/git-fetch-script
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-23 08:59:00 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-23 08:59:00 -0700
commit5fca669f1933ca3ef5f93ee2bf8871183bc2a7c2 (patch)
tree92682825066cca3460e33e0fdbed0a1988019ec0 /git-fetch-script
parent170774a39d32755fc013601d9d682ee034974625 (diff)
downloadgit-5fca669f1933ca3ef5f93ee2bf8871183bc2a7c2.tar.gz
git-5fca669f1933ca3ef5f93ee2bf8871183bc2a7c2.tar.xz
Make "git fetch" able to fetch a named tag
Use "git fetch <repo> tag <tagname>" to get the named tag and everything it points to.
Diffstat (limited to 'git-fetch-script')
-rwxr-xr-xgit-fetch-script10
1 files changed, 8 insertions, 2 deletions
diff --git a/git-fetch-script b/git-fetch-script
index 2e62f001b..fb4a53776 100755
--- a/git-fetch-script
+++ b/git-fetch-script
@@ -1,7 +1,13 @@
#!/bin/sh
#
+destination=FETCH_HEAD
+
merge_repo=$1
merge_name=${2:-HEAD}
+if [ "$2" = "tag" ]; then
+ merge_name="refs/tags/$3"
+ destination="$merge_name"
+fi
: ${GIT_DIR=.git}
: ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"}
@@ -35,7 +41,7 @@ download_objects () {
}
echo "Getting remote $merge_name"
-download_one "$merge_repo/$merge_name" "$GIT_DIR"/FETCH_HEAD || exit 1
+download_one "$merge_repo/$merge_name" "$GIT_DIR/$destination" || exit 1
echo "Getting object database"
-download_objects "$merge_repo" "$(cat "$GIT_DIR"/FETCH_HEAD)" || exit 1
+download_objects "$merge_repo" "$(cat "$GIT_DIR/$destination")" || exit 1