Skip to content

Commit

Permalink
Make "git fetch" able to fetch a named tag
Browse files Browse the repository at this point in the history
Use "git fetch <repo> tag <tagname>" to get the named tag and everything
it points to.
  • Loading branch information
Linus Torvalds committed Jun 23, 2005
1 parent 170774a commit 5fca669
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions git-fetch-script
Original file line number Diff line number Diff line change
@@ -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"}"}
Expand Down Expand Up @@ -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

0 comments on commit 5fca669

Please sign in to comment.