git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nathan W. Panike" <nathan.panike@gmail.com>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Get format-patch to show first commit after root commit
Date: Fri, 9 Jan 2009 19:37:41 -0600	[thread overview]
Message-ID: <d77df1110901091737k6c4fb826tb2287072db2e36a@mail.gmail.com> (raw)
In-Reply-To: <7vmye0yohu.fsf@gitster.siamese.dyndns.org>

Hi:

On Fri, Jan 9, 2009 at 6:49 PM, Junio C Hamano <gitster@pobox.com> wrote:

> I do not see anything special you do for "one commit" case in your patch,
> yet the proposed commit message keeps stressing "-1", which puzzles me.

I was trying to address Alexander's concerns he brought up previously
in the thread.

> Wouldn't it suffice to simply say something like:
>
>    You need to explicitly ask for --root to obtain a patch for the root
>    commit.  This may have been a good way to make sure that the user
>    realizes that a patch from the root commit won't be applicable to a
>    history with existing data, but we should assume the user knows what
>    he is doing when the user explicitly specifies a range of commits that
>    includes the root commit.
>

Indeed it would.  I was giving a specific case that shows what problem
this patch addresses.

> Three issues.
>
>  - The "if(){" violates style by not having one SP before "(" and after ")",
>   and surrounds a single statement with needless { } pair.  You need one SP
>   on each side of the = (assignment) as well.
>
>  - Because rev.show_root_diff is a no-op for non-root commit anyway, I do not
>   think you even want a conditional there.
>
>  - It is a bad style to muck with rev.* while it is actively used for
>   iteration (note that the above part is in a while loop that iterates over
>   &rev).

Thanks for the advice.  I shall adhere to it next time I submit a patch.

> I think the attached would be a better patch.  We already have a
> configuration to control if we show the patch for a root commit by
> default, and we can use reuse it here.  The configuration defaults to true
> these days.

I did not realize this configuration was available.  The patch below
is much more elegant.

> Because the code before the hunk must check if the user said "--root
> commit" or just "commit" from the command line and behave quite
> differently by looking at rev.show_root_diff, we cannot do this assignment
> before the command line parsing like other commands in the log family.
>
>  builtin-log.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git c/builtin-log.c w/builtin-log.c
> index 4a02ee9..2d2c111 100644
> --- c/builtin-log.c
> +++ w/builtin-log.c
> @@ -935,6 +935,14 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
>                 * get_revision() to do the usual traversal.
>                 */
>        }
> +
> +       /*
> +        * We cannot move this anywhere earlier because we do want to
> +        * know if --root was given explicitly from the comand line.
> +        */
> +       if (default_show_root)
> +               rev.show_root_diff = 1;
> +
>        if (cover_letter) {
>                /* remember the range */
>                int i;
>

Thanks,

Nathan Panike

  reply	other threads:[~2009-01-10  1:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-09 21:33 [PATCH] Get format-patch to show first commit after root commit Nathan W. Panike
2009-01-10  0:49 ` Junio C Hamano
2009-01-10  1:37   ` Nathan W. Panike [this message]
2009-01-10 11:36   ` Alexander Potashev
2009-01-10 11:39     ` [PATCH] format-patch: avoid generation of empty patches Alexander Potashev
2009-01-10 16:01       ` Nathan W. Panike
2009-01-10 16:17         ` Alexander Potashev
2009-01-10 18:07           ` Nathan W. Panike
2009-01-10 20:41         ` Junio C Hamano
2009-01-10 16:39       ` [PATCH] Add new testcases for format-patch root commits Alexander Potashev
2009-01-10 18:33         ` Alexander Potashev
  -- strict thread matches above, loose matches on Subject: below --
2009-01-09 19:35 [PATCH] Get format-patch to show first commit after root commit Nathan W. Panike
2009-01-09 20:29 ` Alexander Potashev
2009-01-09 19:02 (unknown) nathan.panike
2009-01-10 10:27 ` [PATCH] Get format-patch to show first commit after root commit Johannes Schindelin
2009-01-10 10:35   ` Johannes Schindelin

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=d77df1110901091737k6c4fb826tb2287072db2e36a@mail.gmail.com \
    --to=nathan.panike@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).