git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Martin Ågren" <martin.agren@gmail.com>
To: Brandon Richardson <brandon1024.br@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] Allow usage of --gpg-sign flag in commit-tree builtin.
Date: Thu, 17 Jan 2019 21:24:43 +0100	[thread overview]
Message-ID: <CAN0heSo_XVK67urjgCVGh23UvzhrquojBjNnp_P2NgS7eCUd1Q@mail.gmail.com> (raw)
In-Reply-To: <20190117192909.26064-1-brandon1024.br@gmail.com>

Hi Brandon,

Welcome to the list! :-)

On Thu, 17 Jan 2019 at 20:30, Brandon Richardson
<brandon1024.br@gmail.com> wrote:

> Subject: [PATCH] Allow usage of --gpg-sign flag in commit-tree builtin.

Good find!

Maybe "commit-tree: handle --gpg-sign" which looks more like what we
see in `git log --oneline builtin/commit-tree.c`.

> Signed-off-by: Brandon Richardson <brandon1024.br@gmail.com>

It could be worthwhile to note in the proposed commit message that this
option is actually documented, since 55ca3f99ae ("commit-tree: add and
document --no-gpg-sign", 2013-12-13), so it's clearly an omission that
it's not implemented.

> Here are the steps I followed to replicate the issue:
>
> mkdir test && cd test
> git init
> echo 'test' > test.txt
> git hash-object -w test.txt
> git update-index --add --cacheinfo 100644 <blob hash> test.txt
> git write-tree
> git commit-tree --gpg-sign -m 'test commit msg' <tree obj hash>

Have you looked at turning this into a test in the t/ directory?
Grepping a little suggests that t7510-signed-commit.sh might be a good
spot. A test would make the patch more obviously correct, and would make
sure that this doesn't regress in the future.

> -               if (skip_prefix(arg, "-S", &sign_commit))
> +               if (skip_prefix(arg, "-S", &sign_commit) ||
> +                       skip_prefix(arg, "--gpg-sign=", &sign_commit) ||
> +                       skip_prefix(arg, "--gpg-sign", &sign_commit))
>                         continue;

This would match "--gpg-signfoo", which seems like a bug. The first two
`skip_prefix()` calls look ok. Then maybe

  if (!strcmp(arg, "--gpg-sign")) {
          sign_commit = "";
          continue;
  }

That's entirely untested, though.

Thanks for looking into this, rather than just side-stepping it. ;-)

Martin

      reply	other threads:[~2019-01-17 20:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 19:29 [PATCH] Allow usage of --gpg-sign flag in commit-tree builtin Brandon Richardson
2019-01-17 20:24 ` Martin Ågren [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=CAN0heSo_XVK67urjgCVGh23UvzhrquojBjNnp_P2NgS7eCUd1Q@mail.gmail.com \
    --to=martin.agren@gmail.com \
    --cc=brandon1024.br@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
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).