git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Santi Béjar" <santi@agolina.net>, git@vger.kernel.org
Subject: Re: [PATCH 5/5] commit: only strip diff from message in verbose mode
Date: Wed, 12 Nov 2008 03:29:47 -0500	[thread overview]
Message-ID: <20081112082947.GA3817@coredump.intra.peff.net> (raw)
In-Reply-To: <20081112082552.GE3751@coredump.intra.peff.net>

On Wed, Nov 12, 2008 at 03:25:52AM -0500, Jeff King wrote:

> +test_expect_success 'diff in message is retained without -v' '
> +	git commit --amend -F diff &&
> +	check_message diff
> +'
> +
> +test_expect_failure 'diff in message is retained with -v' '
> +	git commit --amend -F diff -v &&
> +	check_message diff
> +'

I put in this expect_failure to remind us that we could be doing better.
The solution you proposed would fix this test. Another idea I had was to
use a bogus diff header, and match on that. Something like:

  diff --git --verbose-commit a/file b/file

and searching for "diff --git --verbose-commit", which would not trigger
on any diffs (unless, of course, you were trying to explain how the
verbose mode worked in your commit message :) ).

But that doesn't cover any other special input (i.e., lines beginning
with '#'), and would probably require an ugly hack to the diff machinery
(some diff option for "add these bogus diff command line options").

-Peff

  reply	other threads:[~2008-11-12  8:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-10 15:20 git commit -v does not removes the patch Santi Béjar
2008-11-10 18:10 ` Jeff King
2008-11-10 22:34   ` Santi Béjar
2008-11-10 23:27     ` Junio C Hamano
2008-11-11  0:07       ` Jeff King
2008-11-11  7:56         ` Santi Béjar
2008-11-11 10:29           ` Jeff King
2008-11-11 11:20             ` Santi Béjar
2008-11-11 17:13             ` Junio C Hamano
2008-11-12  8:16               ` Jeff King
2008-11-12  8:17                 ` [PATCH 1/5] define empty tree sha1 as a macro Jeff King
2008-11-12  8:21                 ` [PATCH 2/5] wt-status: refactor initial commit printing Jeff King
2008-11-12  8:23                 ` [PATCH 3/5] status: show "-v" diff even for initial commit Jeff King
2008-11-12  8:24                 ` [PATCH 4/5] commit: loosen pattern for matching "-v" diff Jeff King
2008-11-12  8:25                 ` [PATCH 5/5] commit: only strip diff from message in verbose mode Jeff King
2008-11-12  8:29                   ` Jeff King [this message]
2008-11-13  2:15                 ` git commit -v does not removes the patch Junio C Hamano
2008-11-20 13:09                 ` SZEDER Gábor
2008-11-20 15:20                   ` Jeff King
2008-11-22 15:55                     ` SZEDER Gábor
2008-11-22 20:10                       ` Jeff King
2008-11-22 22:43                       ` Junio C Hamano

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=20081112082947.GA3817@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=santi@agolina.net \
    /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).