mackyle/topgit

t5050-update-orphans failures with Git 2.30.1

Closed this issue · 8 comments

thmo commented

t5050-update-orphans.sh fails with Git 2.30.1, see the attached t5050-update-orphans.log.

Hello,

I think I hit this bug this week with Git 2.30 as well. tg update fails with the same error:

tg: fatal: git checkout-index failed

I had to quickly fix it and then I was unable to reproduce it after. I was looking after a way to reproduce it and I'm glad you open this new bug report :-)

I don't know if the following would be useful to someone here but here is I wrote when I had the issue:

  • I had a merge conflict with tg update when it was in a top-base ref doing a merge
  • git checkout-index was unable to retrieve the .top* files but it looks like they were not needed (see below)
  • I abort the merge, reset everything and then I re-launched tg update after having changed die with an echo after git checkout-index call in tg-update script. Then it was OK.

BTW: thanks for maintaining and developing this really useful tool :-)

thmo commented

Made a git bisect session, and unless I did something wrong, git/git@7e410615 is the first commit that makes this test fail.

thmo commented

Any idea how to fix this?

Hello,

* I abort the merge, reset everything and then I re-launched `tg update` after having changed `die` with an `echo` after `git checkout-index` call in `tg-update` script. Then it was OK.

Because other people contacted me to know exactly what I did, here is the patch I applied as a workaround for Git >=v2.30

diff --git a/tg-update.sh b/tg-update.sh
index 1776d52..cf22f3f 100644
--- a/tg-update.sh
+++ b/tg-update.sh
@@ -566,7 +566,7 @@ git_topmerge()
                                fi
                        done
                        (cd "$repotoplvl" && git checkout-index -q -f -u -- .topdeps .topmsg) ||
-                       die "git checkout-index failed"
+                       echo "WARN: git checkout-index failed"
                fi
                # dump output without any .topdeps or .topmsg messages
                sed -e '/ \.topdeps/d' -e '/ \.topmsg/d' <"$tmpstdout"

then re-launch make install.

Or if you have installed TopGit from a package, do the same modification in the file in /usr/libexec/topgit/tg-update (or replace /usr by the prefix you used, e.g. /usr/local)

With this, I have the warning but it doesn't seem to be an issue because .topdeps and .topmsg doesn't need to be reset.

I've finally been able to get back to this project.

That patch is fine, but this one is simpler:

https://github.com/mackyle/topgit/blob/d26402c9f96df267/patch.txt

The help for git help checkout-index clearly states:

OPTIONS
       -q, --quiet
           be quiet if files exist or are not in the index

But since Git v2.30.0 it's no longer "quiet" -- I consider throwing an error code not being quiet -- even if the -q switch is given when files are not in the index. As far as I can tell, the operation is unaffected, it's just now throwing an error code. The patch is temporary, a real fix will be in the next TopGit release.

It will also include a proper fix for issue #17 which first appeared in Git v2.29.0 and a fix for the change in how <refname>@{0} gets interpreted starting in Git v2.31.0 (I don't have a patch to fix that one yet and it causes further t6100 breakage).

Thank you for looking at that, providing a better workaround and explaining the issue!

The topgit-0.19.13 release contains a resolution for this (and other reported issues).

thmo commented

Thank you!