Fix issue with formatting multiple trailer keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux