git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Aguilar <davvid@gmail.com>
To: Mike Lewis <mike@mplew.is>
Cc: git@vger.kernel.org, "David A . Greene" <greened@obbligato.org>,
	Techlive Zheng <techlivezheng@gmail.com>,
	James Denholm <nod.helm@gmail.com>,
	Charles Bailey <cbailey32@bloomberg.net>
Subject: Re: [PATCH] contrib/subtree: add "--no-commit" flag for merge and pull
Date: Wed, 29 Mar 2017 00:37:04 -0700	[thread overview]
Message-ID: <20170329073704.vhya5gkwg7j5kchb@gmail.com> (raw)
In-Reply-To: <20170326070238.64522-1-mike@mplew.is>

On Sun, Mar 26, 2017 at 03:02:38AM -0400, Mike Lewis wrote:
> Allows the user to verify and/or change the contents of the merge
> before committing as necessary
> 
> Signed-off-by: Mike Lewis <mike@mplew.is>
> ---
>  contrib/subtree/git-subtree.sh | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
> index dec085a23..c30087485 100755
> --- a/contrib/subtree/git-subtree.sh
> +++ b/contrib/subtree/git-subtree.sh
> @@ -29,6 +29,8 @@ onto=         try connecting new tree to an existing one
>  rejoin        merge the new branch back into HEAD
>   options for 'add', 'merge', and 'pull'
>  squash        merge subtree changes as a single commit
> + options for 'merge' and 'pull'
> +no-commit     perform the merge, but don't commit
>  "
>  eval "$(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)"
>  
> @@ -48,6 +50,7 @@ annotate=
>  squash=
>  message=
>  prefix=
> +commit_option="--commit"

It might be simpler to default commit_option= empty like the others, and
remove the "" double quotes around "$commit_option" indicated below so
that the shell ignores it when it's empty.

>  
>  debug () {
>  	if test -n "$debug"
> @@ -137,6 +140,12 @@ do
>  	--no-squash)
>  		squash=
>  		;;
> +	--no-commit)
> +		commit_option="--no-commit"
> +		;;
> +	--no-no-commit)
> +		commit_option="--commit"
> +		;;

"--no-no-commit" should just be "--commit" instead.
The real flag is called "--commit" (git help merge), so subtree
should follow suite by supporting "--commit" and "--no-commit" only.


> @@ -815,17 +824,17 @@ cmd_merge () {
>  	then
>  		if test -n "$message"
>  		then
> -			git merge -s subtree --message="$message" "$rev"
> +			git merge -s subtree --message="$message" "$commit_option" "$rev"
                                                                  ^              ^
>  		else
> -			git merge -s subtree "$rev"
> +			git merge -s subtree "$commit_option" "$rev"
                                             ^              ^
>  		fi
>  [...]

-- 
David

  reply	other threads:[~2017-03-29  7:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-26  7:02 [PATCH] contrib/subtree: add "--no-commit" flag for merge and pull Mike Lewis
2017-03-29  7:37 ` David Aguilar [this message]
2017-03-29  7:56   ` Mike Lewis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170329073704.vhya5gkwg7j5kchb@gmail.com \
    --to=davvid@gmail.com \
    --cc=cbailey32@bloomberg.net \
    --cc=git@vger.kernel.org \
    --cc=greened@obbligato.org \
    --cc=mike@mplew.is \
    --cc=nod.helm@gmail.com \
    --cc=techlivezheng@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).