Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FugitiveHead() produces wrong value with reftable #2371

Open
bk2204 opened this issue Jan 21, 2025 · 0 comments
Open

FugitiveHead() produces wrong value with reftable #2371

bk2204 opened this issue Jan 21, 2025 · 0 comments

Comments

@bk2204
Copy link

bk2204 commented Jan 21, 2025

Git has a new ref backend called reftable. When that's used, the ref data and reflogs are stored inside a set of binary files and the .git/HEAD file always contains ref: refs/heads/.invalid (note that .invalid is not permitted in a real refname).

As a result, calling FugitiveHead returns .invalid, which is not correct. This also causes Airline to reflect the incorrect branch name.

To reproduce this situation, you can set up a repository with Git 2.48 and this shell script:

#!/bin/sh

git init -b dev --ref-format=reftable test-repo
cd test-repo
touch abc.txt
git add abc.txt
git commit -m +

Once inside, you can open Vim with Fugitive enabled and run :call FugitiveHead(). The correct result is dev, and the incorrect result is .invalid.

I suspect you are going to need to actually invoke Git in this case. Perhaps a command like git rev-parse --abbrev-ref HEAD will be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant