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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux