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

Re: git pull --no-ff documentation

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 1, 2012, 04:42 UTC
Message-ID
<7vsj9yerbh.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAHtLG6ROuyCg9WK79igJ=a=6pwT+7TjOJLCNwe454oW3hiJETg@mail.gmail.com>
乙酸鋰 <ch3cooli@gmail.com> writes:
Show 12 quoted lines
> The order of options in git pull is not clear in the documentation
> It only says
> git pull [options] [<repository> [<refspec>...]]
> So we have no idea which options should come first
>
> I tried
> git pull -v --no-tags --progress --no-ff origin
> but failed with unknown option 'no-ff'.
>
> But if I ran
> git pull -v --no-ff  --no-tags --progress origin
> it succeeded.

This actually is not about --no-ff but about --no-tags. Any option that "pull" itself does not care about stops the command line parser and the remainder of the command line is fed to underlying "fetch".

Perhaps something like this? But you should trace the codepath involved to see if this covers all uses of the --tags before using it for real projects, as I didn't.

 git-pull.sh | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)
diff --git i/git-pull.sh w/git-pull.sh
index 2a10047..a53c1e5 100755
--- i/git-pull.sh
+++ w/git-pull.sh
@@ -39,7 +39,7 @@ test -z "$(git ls-files -u)" || die_conflict
 test -f "$GIT_DIR/MERGE_HEAD" && die_merge
 
 strategy_args= diffstat= no_commit= squash= no_ff= ff_only=
-log_arg= verbosity= progress= recurse_submodules=
+log_arg= verbosity= progress= recurse_submodules= fetch_tags=
 merge_args= edit=
 curr_branch=$(git symbolic-ref -q HEAD)
 curr_branch_short="${curr_branch#refs/heads/}"
@@ -62,6 +62,8 @@ do
 		progress=--no-progress ;;
 	-n|--no-stat|--no-summary)
 		diffstat=--no-stat ;;
+	-t|--t|--ta|--tag|--tags|--no-tags)
+		fetch_tags="$1" ;;
 	--stat|--summary)
 		diffstat=--stat ;;
 	--log|--no-log)
@@ -141,15 +143,12 @@ done
 
 error_on_no_merge_candidates () {
 	exec >&2
-	for opt
-	do
-		case "$opt" in
-		-t|--t|--ta|--tag|--tags)
-			echo "Fetching tags only, you probably meant:"
-			echo "  git fetch --tags"
-			exit 1
-		esac
-	done
+	case "$fetch_tags" in
+	-t|--t|--ta|--tag|--tags)
+		echo "Fetching tags only, you probably meant:"
+		echo "  git fetch --tags"
+		exit 1
+	esac
 
 	if test true = "$rebase"
 	then
@@ -213,7 +212,7 @@ test true = "$rebase" && {
 	done
 }
 orig_head=$(git rev-parse -q --verify HEAD)
-git fetch $verbosity $progress $dry_run $recurse_submodules --update-head-ok "$@" || exit 1
+git fetch $verbosity $progress $dry_run $recurse_submodules $fetch_tags --update-head-ok "$@" || exit 1
 test -z "$dry_run" || exit 0
 
 curr_head=$(git rev-parse -q --verify HEAD)
Previous: 乙酸鋰Next: Philip Oakley
Message 2 of 4 in “git pull --no-ff documentation”
  1. 乙酸鋰Oct 1, 2012
  2. Junio C HamanoOct 1, 2012
  3. Philip OakleyOct 1, 2012
  4. Junio C HamanoOct 1, 2012

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.