git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de>
Cc: git@vger.kernel.org
Subject: Re: Antw: Re: blank lines in pre-created merge message
Date: Wed, 31 Jul 2019 15:00:38 +0200 (CEST)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1907311448280.21907@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <5D3FE919020000A100032932@gwsmtp.uni-regensburg.de>

[-- Attachment #1: Type: text/plain, Size: 3065 bytes --]

Hi Ulrich,

On Tue, 30 Jul 2019, Ulrich Windl wrote:

> >>> Johannes Schindelin <Johannes.Schindelin@gmx.de> schrieb am
> >>> 25.07.2019 um 13:58 in Nachricht
> >>> <nycvar.QRO.7.76.6.1907251355500.21907@tvgsbejvaqbjf.bet>:
> >
> > On Thu, 25 Jul 2019, Ulrich Windl wrote:
> >
> >> >>> Johannes Schindelin <Johannes.Schindelin@gmx.de> schrieb am
> >> >>> 25.07.2019 um 12:07 in Nachricht
> >> >>> <nycvar.QRO.7.76.6.1907251204310.21907@tvgsbejvaqbjf.bet>:
> >> >
> >> > On Wed, 24 Jul 2019, Ulrich Windl wrote:
> >> >
> >> >> When using "git merge ‑‑no‑ff ‑‑no‑commit ..", the pre‑created
> >> >> merge message always contains two empty lines in between the
> >> >> comment lines. However if there was a merge conflict (being
> >> >> resolved) an extra blank line is added after the fiVrst line.
> >>
> >> [...]
> >
> >> Could anybody provide a rough overview how and where these editor
> >> comments are created?
> >
> > The best bet would be to call `git grep` with text in that pre‑created
> > merge message, preferably some text that is most likely fixed, i.e. that
> > does not depend on the current worktree/commit.
> >
> > If you give me an example of such a merge message, I can provide you
> > with the appropriate `git grep` call and the code locations to touch.
>
> Hi!
>
> Sorry for the delay:
> OK, here is an example where the auto-generated comment has two blank lines:
> ---snip---
> Merge branch 'shared'
> #
> # It looks like you may be committing a merge.

The command-line I used was:

	git grep "It looks like you may be committing a merge"

It points you to
https://github.com/git/git/blob/v2.22.0/builtin/commit.c#L827

As you can easily see, that message does end in a `\n`, (and also in the
other conditional arm, for cherry-pick), and it is printed via
`status_printf_ln()` (the `_ln` means that it adds another newline), and
in addition another newline is printed directly after that if block:

		fprintf(s->fp, "\n");

Since this extra empty line is bothering you, how about giving it a try
to fix it yourself? I guess the best bet is to delete the `_ln` from the
function call, as it avoids changing a message that was already
translated into about a dozen languages (and would have to be translated
again if you changed it, even if only to remove a trailing newline).

If this works for you, please follow
https://github.com/git/git/blob/v2.22.0/Documentation/SubmittingPatches
to contribute the patch to the Git mailing list.

Ciao,
Johannes

> # If this is not correct, please remove the file
> #       .git/MERGE_HEAD
> # and try again.
>
>
> # Please enter the commit message for your changes. Lines starting
> # with '#' will be ignored, and an empty message aborts the commit.
> # On branch master
> # All conflicts fixed but you are still merging.
> #
> # Changes to be committed:
> #       new file:   .filelist
> #       new file:   .gitignore
> ...more lines omitted
> ---snip---
>
> >
> > Ciao,
> > Johannes
>
>
>
>

  reply	other threads:[~2019-07-31 13:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24  9:54 blank lines in pre-created merge message Ulrich Windl
2019-07-25 10:07 ` Johannes Schindelin
2019-07-25 10:15   ` Antw: " Ulrich Windl
2019-07-25 11:58     ` Johannes Schindelin
2019-07-30  6:52       ` Ulrich Windl
2019-07-31 13:00         ` Johannes Schindelin [this message]
     [not found]           ` <5D437D21020000A100032A6F@gwsmtp.uni-regensburg.de>
     [not found]             ` <nycvar.QRO.7.76.6.1908021449400.46@tvgsbejvaqbjf.bet>
2019-08-02 12:55               ` 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

  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=nycvar.QRO.7.76.6.1907311448280.21907@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=Ulrich.Windl@rz.uni-regensburg.de \
    --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).