threads / discuss / 44232

Format for %d includes unwanted preceding space

Subject: Format for %d includes unwanted preceding space

## tl;dr

2 messages between Oct 6, 2016 and Oct 6, 2016.

replies: 1people: 2as markdown or json

Ravi (Tom) Hale· Oct 6, 2016, 09:22 UTC · lore
The log --format="%d" includes preceding space:

$ git log -n1 --format="XX%dXX" HEAD XX (HEAD -> master)XX

I know of no other %<token> that is output in this way.

Is there a way of removing this preceding space through the format string, or will it need to be a code change?

-- 
Tom Hale
Junio C Hamano· Oct 6, 2016, 18:49 UTC · re: Ravi (Tom) Hale · lore

Re: Format for %d includes unwanted preceding space

"Ravi (Tom) Hale" <ravi@hale.ee> writes:
Show 6 quoted lines
> The log --format="%d" includes preceding space:
>
> $ git log -n1 --format="XX%dXX" HEAD
> XX (HEAD -> master)XX
>
> I know of no other %<token> that is output in this way.

That is primarily because %d predates %[-+ ]<placeholder> mechanism, I think. It is too late to redefine what "%d" means and force all users to update their script to use "% d" instead, unfortunately.

← back to recent threads