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

aurpublish fails with: fatal: cache for already exists! #30

Open
aminvakil opened this issue Dec 23, 2023 · 10 comments
Open

aurpublish fails with: fatal: cache for already exists! #30

aminvakil opened this issue Dec 23, 2023 · 10 comments

Comments

@aminvakil
Copy link
Contributor

https://github.com/aminvakil/aur/actions/runs/7310240478/job/19918672631

git push using:  aur:zoiper-bin.git master
fatal: cache for d6a34f40a60a78154048a8c37e1d3463f9138ea7 already exists!

Previous to this I've accidentally had a merge commit adding this subtree to master branch, but I've dropped that commit and I still get this, I don't know what to do.

Nothing is changing, just aurpublish zoiper-bin which is a package I'm maintaining.

@alerque
Copy link
Contributor

alerque commented Dec 24, 2023

Can you try cloning this repo to a fresh location and publish from there? That should tell us whether it's something in the repo history (as exists in the remote) or actually a problem with the subtree cache locally.

@aminvakil
Copy link
Contributor Author

A fresh location (and aurpublish setup afterwards) did not help, it failed with the same error:

git push using:  aur:zoiper-bin.git master
fatal: cache for d6a34f40a60a78154048a8c37e1d3463f9138ea7 already exists!

https://github.com/aminvakil/aur/actions/runs/7313903426/job/19926019741

@orhun
Copy link

orhun commented Dec 24, 2023

I remember having the same error in the past after unintentionally rewriting the Git history of the subtree. I think I solved it by setting up aurpublish and adding each package to the subtree again 💀

@aminvakil
Copy link
Contributor Author

Ah, so I would lost all history in github?

@aminvakil
Copy link
Contributor Author

I can replicate this locally too, git subtree split -P "zoiper-bin" --rejoin always fails with:

fatal: cache for d6a34f40a60a78154048a8c37e1d3463f9138ea7 already exists!

even after rm -rf .git/subtree-cache/.

@alerque
Copy link
Contributor

alerque commented Dec 24, 2023

I think your options are either to delete and re-add the subtree (min two commits) or backtrack to before whatever commit in your current history rewrote something in the subtree. Probably not far back depending on your workflow. You can use that fresh clone and reset --hard HEAD^ a few times until the problem goes away, then cherry-pick the commits from after the problematic one.

@eli-schwartz
Copy link
Owner

eli-schwartz commented Dec 24, 2023

I bisected this in git itself, to commit git/git@d2f0f81

Before this commit, the split verb prints out:

cache for d6a34f40a60a78154048a8c37e1d3463f9138ea7 already exists!
d6a34f40a60a78154048a8c37e1d3463f9138ea7

but succeeds.

It appears that graph traversal which encounters multiple subtree joins is broken, I would report a bug to the git mailing list. Simple reproducer:

git init testme && cd testme
mkdir foo
touch foo/bar
git add foo/bar
git commit -m ...
split_commit=$(git subtree split -P foo --rejoin)
# Added dir 'foo'
echo "${split_commit}"
# 42517e4b9fe310a64be2a777ef08c91bd582b385

git rm -r foo
git commit -m deleted
git subtree add --prefix foo "${split_commit}"
# Added dir 'foo'
git subtree split -P foo --rejoin
# fatal: cache for 42517e4b9fe310a64be2a777ef08c91bd582b385 already exists!

@aminvakil
Copy link
Contributor Author

@alerque @orhun @eli-schwartz Thanks for taking a look at this, I've reset --hard to before any of this happens and thankfully nothing else has changed in repo since then, and it got fixed too.

And I've kept https://github.com/aminvakil/aur/tree/broken_subtree before doing this, in case anyone wanted to reference to it for any reason (I think Eli's reproducer suffices, but anyway).

I would keep this open until the issue is fixed in git (I couldn't find Eli's mail in https://public-inbox.org/git/, not sure if it was the correct place to look for it though), but please close this in case it isn't necessary.

@eli-schwartz
Copy link
Owner

I would keep this open until the issue is fixed in git (I couldn't find Eli's mail in https://public-inbox.org/git/, not sure if it was the correct place to look for it though), but please close this in case it isn't necessary.

It is the correct place to look, but when I said "I would report a bug to the git mailing list" that was advice, not "I have reported".

:P

However, I've decided to report it myself anyway: https://public-inbox.org/git/6de00946-9c5a-4854-9e49-069a22f8a782@gmail.com/T/

@aminvakil
Copy link
Contributor Author

I would keep this open until the issue is fixed in git (I couldn't find Eli's mail in https://public-inbox.org/git/, not sure if it was the correct place to look for it though), but please close this in case it isn't necessary.

It is the correct place to look, but when I said "I would report a bug to the git mailing list" that was advice, not "I have reported".

:P

However, I've decided to report it myself anyway: https://public-inbox.org/git/6de00946-9c5a-4854-9e49-069a22f8a782@gmail.com/T/

Thanks for doing this. I have little knowledge about git subtrees and couldn't report as good enough as you.

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

4 participants