git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-pull: warn if only fetching tags with the -t switch

From
Gerrit Pape <pape@smarden.org>
Date
Dec 27, 2007, 14:46 UTC
Message-ID
<20071227144618.32373.qmail@5b51609f839e87.315fe32.mid.smarden.org>
In-Reply-To
<7vwsr0ifqi.fsf@gitster.siamese.dyndns.org>
Subject: [PATCH] git-pull: warn if only fetching tags with the -t switch

git-pull -t|--tags isn't supposed to be run, remove that option from fetch-options.txt, and explicitely add it to git-fetch.txt. Have git pull still fetch tags with the -t switch, but warn afterwards to better use git fetch --tags, and error out. ---

How about this?
 Documentation/fetch-options.txt |    8 --------
 Documentation/git-fetch.txt     |    8 ++++++++
 git-pull.sh                     |    9 +++++++++
 3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
index da03422..debdc87 100644
--- a/Documentation/fetch-options.txt
+++ b/Documentation/fetch-options.txt
@@ -29,14 +29,6 @@
 	and stores them locally.  This option disables this
 	automatic tag following.
 
--t, \--tags::
-	Most of the tags are fetched automatically as branch
-	heads are downloaded, but tags that do not point at
-	objects reachable from the branch heads that are being
-	tracked will not be fetched by this mechanism.  This
-	flag lets all tags and their associated objects be
-	downloaded.
-
 -k, \--keep::
 	Keep downloaded pack.
 
diff --git a/Documentation/git-fetch.txt b/Documentation/git-fetch.txt
index 9003473..3cdac7f 100644
--- a/Documentation/git-fetch.txt
+++ b/Documentation/git-fetch.txt
@@ -33,6 +33,14 @@ OPTIONS
 -------
 include::fetch-options.txt[]
 
+-t, \--tags::
+        Most of the tags are fetched automatically as branch
+        heads are downloaded, but tags that do not point at
+        objects reachable from the branch heads that are being
+        tracked will not be fetched by this mechanism.  This
+        flag lets all tags and their associated objects be
+        downloaded.
+
 include::pull-fetch-param.txt[]
 
 include::urls-remotes.txt[]
diff --git a/git-pull.sh b/git-pull.sh
index 698e82b..ab15eda 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -112,6 +112,15 @@ case "$merge_head" in
 	     exit 1;;
 	  *) exit $?;;
 	esac
+	# warn if only tags have been fetched
+	not_for_merge=$(sed -e '/	not-for-merge	tag/d' \
+			"$GIT_DIR"/FETCH_HEAD)
+	if test "$not_for_merge" = ''; then
+		echo >&2 "Fetching tags only, you probably meant:"
+		echo >&2 "  git fetch --tags"
+		exit 1;
+	fi
+
 	curr_branch=${curr_branch#refs/heads/}
 
 	echo >&2 "You asked me to pull without telling me which branch you"
-- 
1.5.3.7
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 9 in “git-pull: don't complain about branch merge config if only fetching tags”
  1. git-pull: don't complain about branch merge config if only fetching tagsGerrit Pape, Dec 21, 2007
  2. Junio C HamanoDec 21, 2007
  3. Gerrit PapeDec 27, 2007
  4. Junio C HamanoDec 27, 2007
  5. git-pull: warn if only fetching tags with the -t switchGerrit Pape, Dec 27, 2007
  6. Junio C HamanoDec 28, 2007
  7. Junio C HamanoDec 28, 2007
  8. Daniel BarkalowDec 28, 2007
  9. Junio C HamanoDec 28, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.