Skip to content

Last line of annotated tag gets truncated if output of "git cat-file" does not end with an empty newline #11241

@toesus

Description

@toesus

Environment

  • Git Extensions 4.1.0.16698
  • Build 1fe52a1
  • Git 2.42.0.windows.2
  • Microsoft Windows NT 10.0.19044.0
  • .NET 6.0.22

Issue description

The message of an annotated tag shown in the commit-tab does sometimes not include the last line.
I found that this happens if the message as returned by git cat-file -p tagname does not end in an empty newline.

The use of git cat-file was introduced by #9616
The change specifically introduced a removal of the last line of the git output, claiming there to always be an empty line:

// skip the last line as it will always be an empty line (for nice console output)
for (int i = StandardCatFileTagHeaderLength; i < messageLines.Length - 1; ++i)

Maybe this could simply be removed, as it seems the complete message gets .Trim()-ed anyways afterwards.

Steps to reproduce

The only way I was able to reproduce (and how I discovered this) is to create a multiline annotated tag on a GitLab Server using the GitLab REST-API.
(Maybe this is an issue with Gitlab too, not sure if the empty trailing line in a annotated tag would be mandatory?)

After fetching the tag on a local clone, GitExtensions would truncate the last line of the message.

Manually verifying using git cat-file -p tagname confirms that the Gitlab REST-Api created tags indeed miss a trailing newline.

Did this work in previous version of GitExtensions?

No response

Diagnostics

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions