Re: [PATCH v2 9/9] pull: add the --gpg-sign option.

2014-02-03 Thread Junio C Hamano
"brian m. carlson"  writes:

> ...  It also happens to fix the issue where the help
> text is improperly quoted.  With your suggested fix, it is now quoted
> (ugly, but quoted):

I do not see anything ugly about the output below.  Of course you
could do -S'brian ...', but both look sensible.

>   Stopped at aba3d3ff83b59627adbdafe1b334a46ed5b7ec17... am: add the 
> --gpg-sign option
>   You can amend the commit now, with
>   
>   git commit --amend  '-Sbrian m. carlson '
>
> Since I expect most users are going to use -S, either because they have
> a key specifically specified in .gitconfig, or because the default key
> is the right thing anyway, I don't see this as a huge problem.  I think
> I'll probably end up fixing it anyway and then send out the reroll.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 9/9] pull: add the --gpg-sign option.

2014-01-31 Thread brian m. carlson
On Mon, Jan 27, 2014 at 03:31:36PM -0800, Junio C Hamano wrote:
> 
> ... but here it is used as if it is properly quoted so that later
> "eval $eval" will take it as a single argument.
> 
>   git pull --gpg-sign='foo bar'
> 
> will probably ask the command to use 'foo' as the signer key id,
> with 'bar' as an extra, unknown token on the command line of the
> underlying 'git merge', I suspect.  A "git rev-parse --sq-quote"
> in the earlier hunk may be all it takes to fix it.

Yes, you were correct that that was broken, and yes, it turns out that
your fix is sufficient.  It also happens to fix the issue where the help
text is improperly quoted.  With your suggested fix, it is now quoted
(ugly, but quoted):

  Stopped at aba3d3ff83b59627adbdafe1b334a46ed5b7ec17... am: add the --gpg-sign 
option
  You can amend the commit now, with
  
git commit --amend  '-Sbrian m. carlson '

Since I expect most users are going to use -S, either because they have
a key specifically specified in .gitconfig, or because the default key
is the right thing anyway, I don't see this as a huge problem.  I think
I'll probably end up fixing it anyway and then send out the reroll.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187


signature.asc
Description: Digital signature


Re: [PATCH v2 9/9] pull: add the --gpg-sign option.

2014-01-27 Thread Junio C Hamano
"brian m. carlson"  writes:

> git merge already allows us to sign commits, and git rebase has recently
> learned how to do so as well.  Teach git pull to parse the -S/--gpg-sign
> option and pass this along to merge or rebase, as appropriate.
>
> Signed-off-by: brian m. carlson 
> ---
>  git-pull.sh | 13 -
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/git-pull.sh b/git-pull.sh
> index 0a5aa2c..4164dac 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -138,6 +138,15 @@ do
>   --no-verify-signatures)
>   verify_signatures=--no-verify-signatures
>   ;;
> + --gpg-sign|-S)
> + gpg_sign_args=-S
> + ;;
> + --gpg-sign=*)
> + gpg_sign_args="-S${1#--gpg-sign=}"
> + ;;

Here, $1 is taken from the end-user without any extra quoting...

> + -S*)
> + gpg_sign_args="-S${1#-S}"
> + ;;
>   --d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run)
>   dry_run=--dry-run
>   ;;
> @@ -305,11 +314,13 @@ merge_name=$(git fmt-merge-msg $log_arg 
> <"$GIT_DIR/FETCH_HEAD") || exit
>  case "$rebase" in
>  true)
>   eval="git-rebase $diffstat $strategy_args $merge_args $rebase_args 
> $verbosity"
> + eval="$eval $gpg_sign_args"

... but here it is used as if it is properly quoted so that later
"eval $eval" will take it as a single argument.

git pull --gpg-sign='foo bar'

will probably ask the command to use 'foo' as the signer key id,
with 'bar' as an extra, unknown token on the command line of the
underlying 'git merge', I suspect.  A "git rev-parse --sq-quote"
in the earlier hunk may be all it takes to fix it.

Thanks.

>   eval="$eval --onto $merge_head ${oldremoteref:-$merge_head}"
>   ;;
>  *)
>   eval="git-merge $diffstat $no_commit $verify_signatures $edit $squash 
> $no_ff $ff_only"
> - eval="$eval  $log_arg $strategy_args $merge_args $verbosity $progress"
> + eval="$eval $log_arg $strategy_args $merge_args $verbosity $progress"
> + eval="$eval $gpg_sign_args"
>   eval="$eval \"\$merge_name\" HEAD $merge_head"
>   ;;
>  esac
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html