Git development
 help / color / mirror / Atom feed
From: "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com>
To: "Alejandro Colomar" <alx@kernel.org>, git@vger.kernel.org
Subject: Re: git-log --format missing trailing newline character
Date: Mon, 23 Dec 2024 21:36:48 +0100	[thread overview]
Message-ID: <d813a3dd-68c2-4cbe-92a0-cfd1ece77e9b@app.fastmail.com> (raw)
In-Reply-To: <cw7vyas4yw2q4lqiskbvil7mpkx5l5qilj25vnqzkrp5nuezrx@d6tsavm3ajzw>

On Mon, Dec 23, 2024, at 21:28, Alejandro Colomar wrote:
> Hi!
>
> I'm having trouble scripting around git-log(1), due to a missing newline
> character at the end of the file.
>
> 	$ git -v
> 	git version 2.45.2
> 	$ git log --format=format:'%H' HEAD^^^..HEAD | wc -l
> 	2
> 	$ git log --format=format:'%H' HEAD^^^..HEAD
> 	2ff431ab1b46a25088fe40baf1faf35ea9fac722
> 	e75e6c4504022ae52d877926e63c908d9572088a
> 	178442837d39560a789a8044a8eb90fde3ad7cd7
>
> Would you mind fixing this bug?  POSIX requires that text files end in a
> newline character, precisely for being able to use UNIX tools to process
> output from arbitrary commands.

Is the format here simplified relative to your use case?  Or do you just
want to process commits as one-hash-per-line?  I would use
git-rev-list(1) instead in that case.

-- 
Kristoffer Haugsbakk


  reply	other threads:[~2024-12-23 20:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-23 20:28 git-log --format missing trailing newline character Alejandro Colomar
2024-12-23 20:36 ` Kristoffer Haugsbakk [this message]
2024-12-23 20:49   ` Alejandro Colomar
2024-12-23 21:09     ` Andreas Schwab
2024-12-23 21:23       ` Alejandro Colomar
2024-12-26 16:00         ` Junio C Hamano
2024-12-26 17:06           ` Alejandro Colomar

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=d813a3dd-68c2-4cbe-92a0-cfd1ece77e9b@app.fastmail.com \
    --to=kristofferhaugsbakk@fastmail.com \
    --cc=alx@kernel.org \
    --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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox