git/list[1] front-page[2] threads[3] people[4] search[5] about
 

name-ref on annotated-tags is null terminated, but lightweight tags arent

From
MRMax Resnick <max.resnick@forgerock.com>
Date
Jun 5, 2020, 16:51 UTC
Message-ID
<20200605165109.jr6mjl6xz7upofdy@forgemax.local>

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue) I was using name-rev to resolve a commits tag name. Annotated tags seem to have a null termination and lightweight tags dont. ``` /tmp ❯ git clone https://github.com/maxres-fr/null-termination-issue.git Cloning into 'null-termination-issue'... remote: Enumerating objects: 10, done. remote: Counting objects: 100% (10/10), done. remote: Compressing objects: 100% (4/4), done. remote: Total 10 (delta 0), reused 10 (delta 0), pack-reused 0 Unpacking objects: 100% (10/10), 757 bytes | 189.00 KiB/s, done.

/tmp ❯ cd null-termination-issue

/tmp/null-termination-issue on  master ❯ git pull --tags Already up to date.

/tmp/null-termination-issue on  master ❯ git tag --list

/tmp/null-termination-issue on  master ❯ git name-rev --tag --name-only 38bdebc9107cab4ab3718d0581632702e74d9209 annotated-tag^0

/tmp/null-termination-issue on  master ❯ git name-rev --tag --name-only a340894d3ee655ae6c336a85b42d2215d52609e3 lightweight-tag ```

What did you expect to happen? (Expected behavior)

`git name-rev --tag --name-only ANNOTATED-COMMIT-ID` to return the name without null termination

What happened instead? (Actual behavior)

`git name-rev --tag --name-only ANNOTATED-COMMIT-ID` returns the name but it's null terminated

What's different between what you expected and what actually happened?
a null control character exists.
Anything else you want to add:
I tried this with the following git versions:
2.11, 2.23, 2.26, 2.27. I've also been able to reproduce on MacOS.

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info] git version: git version 2.27.0.rc0 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 uname: Linux 5.6.0-1-amd64 #1 SMP Debian 5.6.7-1 (2020-04-29) x86_64 compiler info: gnuc: 9.3 libc info: glibc: 2.30

[Enabled Hooks]
Next: Junio C Hamano
Message 1 of 4 in “name-ref on annotated-tags is null terminated, but lightweight tags arent”
  1. Max ResnickJun 5, 2020
  2. Junio C HamanoJun 5, 2020
  3. Max ResnickJun 5, 2020
  4. Junio C HamanoJun 5, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.