public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* Fix issue with formatting multiple trailer keys
@ 2024-09-06 19:55 Brooke Kuhlmann
  2024-09-06 22:34 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Brooke Kuhlmann @ 2024-09-06 19:55 UTC (permalink / raw)
  To: git

Hello. 👋

I'm seeing strange issues with log/listing trailer information for commits and tags and I think I'm experiencing a bug where when I attempt to list commits and tags with specific trailer keys, I get new lines showing up in my output.

Here's my steps to recreate using a simple Bash script:

``` 
mkdir demo
cd demo
git init

touch one.txt
git add .
git commit --message "Added one" --trailer Milestone=patch --trailer Issue=111
git tag 0.0.0 --message "Version 0.0.0" --no-sign --trailer Files:1 --trailer Duration:1

touch two.txt
git add .
git commit --message "Added two" --trailer Milestone=patch --trailer Issue=222
git tag 0.0.1 --message "Version 0.0.1" --no-sign --trailer Files:1 --trailer Duration:1
```

Notice that I'm using trailers for my commits *and* tags. Here's what my git log looks like:

``` 
git log --pretty=format:"%h %an% %s %d %cr. %(trailers:key=Milestone) %(trailers:key=Issue)"
```

The above produces this output:

08a07b717bef Brooke KuhlmannAdded two  (HEAD -> main, tag: 0.0.1) 5 minutes ago. Milestone: patch
 Issue: 222

01c4c182c85e Brooke KuhlmannAdded one  (tag: 0.0.0) 5 minutes ago. Milestone: patch
 Issue: 111

...and if I list my tags using this command:

``` 
git tag --list \
        --format="%(refname:short) %(taggerdate:short) %(taggername) %(subject) %(trailers:key=Files) %(trailers:key=Duration)"
```

...I get this output:

0.0.0 2024-09-06 Brooke Kuhlmann Version 0.0.0 Files: 1
Duration: 1
 Files: 1
Duration: 1

0.0.1 2024-09-06 Brooke Kuhlmann Version 0.0.1 Files: 1
Duration: 1
 Files: 1
Duration: 1

Notice, when logging trailer information for commits and tags, I get unexpected new line characters showing up in the output. I expect to see all information printed on the same line without any new lines showing up.

Also, I want to point out that when listing tag trailers, I get the "Duration" key showing up twice. I'm not sure if that's related or not but seems like very weird behavior.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-10  2:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-06 19:55 Fix issue with formatting multiple trailer keys Brooke Kuhlmann
2024-09-06 22:34 ` Jeff King
2024-09-06 23:09   ` Brooke Kuhlmann
2024-09-09 23:03     ` Jeff King
2024-09-10  2:22       ` Brooke Kuhlmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox