git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git pull --no-ff documentation
@ 2012-10-01  3:36 乙酸鋰
  2012-10-01  4:42 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: 乙酸鋰 @ 2012-10-01  3:36 UTC (permalink / raw)
  To: git

Hi,

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.

Regards,
ch3cooli

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git pull --no-ff documentation
  2012-10-01  3:36 git pull --no-ff documentation 乙酸鋰
@ 2012-10-01  4:42 ` Junio C Hamano
  2012-10-01 19:54   ` Philip Oakley
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2012-10-01  4:42 UTC (permalink / raw)
  To: 乙酸鋰; +Cc: git

乙酸鋰 <ch3cooli@gmail.com> writes:

> 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)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: git pull --no-ff documentation
  2012-10-01  4:42 ` Junio C Hamano
@ 2012-10-01 19:54   ` Philip Oakley
  2012-10-01 20:24     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Philip Oakley @ 2012-10-01 19:54 UTC (permalink / raw)
  To: Junio C Hamano, 乙酸鋰; +Cc: git

From: "Junio C Hamano" <gitster@pobox.com>
> 乙酸鋰 <ch3cooli@gmail.com> writes:
>
>> 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".
>

Should this be said within the documentation's synopsis ?

e.g.
git pull [pull_options] [merge_options] [fetch_options [<repository> 
[<refspec>…]]

> 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)
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 
> 09/30/12
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git pull --no-ff documentation
  2012-10-01 19:54   ` Philip Oakley
@ 2012-10-01 20:24     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2012-10-01 20:24 UTC (permalink / raw)
  To: Philip Oakley; +Cc: 乙酸鋰, git

"Philip Oakley" <philipoakley@iee.org> writes:

>> 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".
>>
>
> Should this be said within the documentation's synopsis ?
>
> e.g.
> git pull [pull_options] [merge_options] [fetch_options [<repository>
> [<refspec>…]]

We certainly could do that, but I was hoping somebody would
volunteer to make it easier to the end users so that they do not
have to remember which one is which.

The "perhaps something like this?" patch was a hint to show the
first step in that preferrable direction.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-01 20:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-01  3:36 git pull --no-ff documentation 乙酸鋰
2012-10-01  4:42 ` Junio C Hamano
2012-10-01 19:54   ` Philip Oakley
2012-10-01 20:24     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).