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

Tests failing in Fedora with git 2.48 (git update-ref generating an invalid reflog) #138

Open
imciner2 opened this issue Jan 20, 2025 · 2 comments

Comments

@imciner2
Copy link
Contributor

It looks like git was updated recently in Fedora 41 from 2.47 to 2.48, and I believe that is now causing the git-revise tests to fail. This can be seen in a Fedora scratch build (https://koschei.fedoraproject.org/build/19488570), with the build log at https://kojipkgs.fedoraproject.org/work/tasks/6173/128186173/build.log.

The output from the test sections are:

+ /usr/bin/python3 -m pytest
============================= test session starts ==============================
platform linux -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0
rootdir: /builddir/build/BUILD/python-git-revise-0.7.0-build/git-revise-0.7.0
collected 38 items
tests/test_cut.py ..                                                     [  5%]
tests/test_fixup.py ..............                                       [ 42%]
tests/test_gpgsign.py .                                                  [ 44%]
tests/test_interactive.py ..........                                     [ 71%]
tests/test_rerere.py FFF..                                               [ 84%]
tests/test_reword.py ......                                              [100%]
=================================== FAILURES ===================================
________________________ test_reuse_recorded_resolution ________________________
repo = <gitrevise.odb.Repository object at 0x7f99b2ea4cf0>
    def test_reuse_recorded_resolution(repo):
        history_with_two_conflicting_commits(autoUpdate=True)
    
        with editor_main(("-i", "HEAD~~"), input=b"y\ny\ny\ny\n") as ed:
            flip_last_two_commits(repo, ed)
            with ed.next_file() as f:
                f.replace_dedent("resolved two\n")
            with ed.next_file() as f:
                f.replace_dedent("resolved one\n")
    
        tree_after_resolving_conflicts = repo.get_commit("HEAD").tree()
        bash("git reset --hard HEAD@{1}")
    
        # Now we can change the order of the two commits and reuse the recorded conflict resolution.
        with editor_main(("-i", "HEAD~~")) as ed:
            flip_last_two_commits(repo, ed)
    
        assert tree_after_resolving_conflicts == repo.get_commit("HEAD").tree()
>       leftover_index = hunks(repo.git("diff", "-U0", "HEAD"))
/builddir/build/BUILD/python-git-revise-0.7.0-build/git-revise-0.7.0/tests/test_rerere.py:39: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
diff = b''
    def hunks(diff: bytes) -> bytes:
>       return diff[diff.index(b"@@") :]
E       ValueError: subsection not found
/builddir/build/BUILD/python-git-revise-0.7.0-build/git-revise-0.7.0/tests/test_rerere.py:370: ValueError
----------------------------- Captured stdout call -----------------------------
[master (root-commit) d72132e] initial commit
 Author: Bash Author <[email protected]>
 1 file changed, 1 insertion(+)
 create mode 100644 file
[master 698fe81] commit one
 Author: Bash Author <[email protected]>
 1 file changed, 1 insertion(+), 1 deletion(-)
[master b1efb1b] commit two
 Author: Bash Author <[email protected]>
 1 file changed, 1 insertion(+), 1 deletion(-)
Running ['/usr/bin/python3', '-m', 'gitrevise', '-i', 'HEAD~~'] {'input': b'y\ny\ny\ny\n', 'check': True}
Conflict applying 'commit two'
  Path: '/file'
  Edit conflicted file? (Y/n)   Merge successful? (y/N) Recording conflict resolution
pick   e51ab202e87f  commit two
Conflict applying 'commit one'
  Path: '/file'
  Edit conflicted file? (Y/n)   Merge successful? (y/N) Recording conflict resolution
pick   dc50430ecbd2  commit one
Updating refs/heads/master (b1efb1b8ffe680f67bd9e6824fcf0aa55d561139 => dc50430ecbd2d0697ee9266ba6057e0e0b511d7f)
HEAD is now at dc50430 commit one
Running ['/usr/bin/python3', '-m', 'gitrevise', '-i', 'HEAD~~'] {'check': True}
Conflict applying 'commit one'
  Path: '/file'
  Edit conflicted file? (Y/n) 
----------------------------- Captured stderr call -----------------------------
127.0.0.1 - - [20/Jan/2025 01:01:52] "POST / HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2025 01:01:52] "POST / HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2025 01:01:52] "POST / HTTP/1.1" 200 -
warning: log for ref HEAD unexpectedly ended on Thu, 13 Jul 2017 21:40:00 -0500
warning: log for ref HEAD unexpectedly ended on Thu, 13 Jul 2017 21:40:00 -0500
127.0.0.1 - - [20/Jan/2025 01:01:53] "POST / HTTP/1.1" 200 -
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/__main__.py", line 4, in <module>
    main()
    ~~~~^^
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/tui.py", line 263, in main
    inner_main(args, repo)
    ~~~~~~~~~~^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/tui.py", line 254, in inner_main
    interactive(args, repo, staged, head)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/tui.py", line 141, in interactive
    new_head = apply_todos(base, todos, reauthor=args.reauthor)
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/todo.py", line 251, in apply_todos
    rebased = step.commit.rebase(current).update(message=step.message)
              ~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/odb.py", line 621, in rebase
    return rebase(self, parent)
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/merge.py", line 47, in rebase
    tree = merge_trees(
        Path("/"),
    ...<3 lines>...
        get_tree(commit),
    )
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/merge.py", line 90, in merge_trees
    merged = merge_entries(
        path / name.decode(errors="replace"),
    ...<3 lines>...
        other.entries.get(name),
    )
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/merge.py", line 165, in merge_entries
    merge_blobs(path, labels, current.blob(), baseblob, other.blob()).oid,
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/merge.py", line 235, in merge_blobs
    if input("  Edit conflicted file? (Y/n) ").lower() == "n":
       ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
EOFError: EOF when reading a line
__________________________ test_rerere_no_autoupdate ___________________________
repo = <gitrevise.odb.Repository object at 0x7f99b2ea7920>
    def test_rerere_no_autoupdate(repo):
        history_with_two_conflicting_commits(autoUpdate=False)
    
        with editor_main(("-i", "HEAD~~"), input=b"y\ny\ny\ny\n") as ed:
            flip_last_two_commits(repo, ed)
            with ed.next_file() as f:
                f.replace_dedent("resolved two\n")
            with ed.next_file() as f:
                f.replace_dedent("resolved one\n")
    
        tree_after_resolving_conflicts = repo.get_commit("HEAD").tree()
        bash("git reset --hard HEAD@{1}")
    
        # Use the recorded resolution by confirming both times.
        with editor_main(("-i", "HEAD~~"), input=b"y\ny\n") as ed:
            flip_last_two_commits(repo, ed)
        assert tree_after_resolving_conflicts == repo.get_commit("HEAD").tree()
>       leftover_index = hunks(repo.git("diff", "-U0", "HEAD"))
/builddir/build/BUILD/python-git-revise-0.7.0-build/git-revise-0.7.0/tests/test_rerere.py:76: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
diff = b''
    def hunks(diff: bytes) -> bytes:
>       return diff[diff.index(b"@@") :]
E       ValueError: subsection not found
/builddir/build/BUILD/python-git-revise-0.7.0-build/git-revise-0.7.0/tests/test_rerere.py:370: ValueError
----------------------------- Captured stdout call -----------------------------
[master (root-commit) d72132e] initial commit
 Author: Bash Author <[email protected]>
 1 file changed, 1 insertion(+)
 create mode 100644 file
[master 698fe81] commit one
 Author: Bash Author <[email protected]>
 1 file changed, 1 insertion(+), 1 deletion(-)
[master b1efb1b] commit two
 Author: Bash Author <[email protected]>
 1 file changed, 1 insertion(+), 1 deletion(-)
Running ['/usr/bin/python3', '-m', 'gitrevise', '-i', 'HEAD~~'] {'input': b'y\ny\ny\ny\n', 'check': True}
Conflict applying 'commit two'
  Path: '/file'
  Edit conflicted file? (Y/n)   Merge successful? (y/N) Recording conflict resolution
pick   e51ab202e87f  commit two
Conflict applying 'commit one'
  Path: '/file'
  Edit conflicted file? (Y/n)   Merge successful? (y/N) Recording conflict resolution
pick   dc50430ecbd2  commit one
Updating refs/heads/master (b1efb1b8ffe680f67bd9e6824fcf0aa55d561139 => dc50430ecbd2d0697ee9266ba6057e0e0b511d7f)
HEAD is now at dc50430 commit one
Running ['/usr/bin/python3', '-m', 'gitrevise', '-i', 'HEAD~~'] {'input': b'y\ny\n', 'check': True}
Conflict applying 'commit one'
  Path: '/file'
  Edit conflicted file? (Y/n) editor error: Editor exited with status Command '['/bin/sh', '-ec', '/usr/bin/python3 /builddir/build/BUILD/python-git-revise-0.7.0-build/git-revise-0.7.0/tests/dummy_editor.py http://127.0.0.1:46449/ "$@"', '/usr/bin/python3 /builddir/build/BUILD/python-git-revise-0.7.0-build/git-revise-0.7.0/tests/dummy_editor.py http://127.0.0.1:46449/', 'file']' returned non-zero exit status 1.
----------------------------- Captured stderr call -----------------------------
127.0.0.1 - - [20/Jan/2025 01:01:53] "POST / HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2025 01:01:53] "POST / HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2025 01:01:53] "POST / HTTP/1.1" 200 -
warning: log for ref HEAD unexpectedly ended on Thu, 13 Jul 2017 21:40:00 -0500
warning: log for ref HEAD unexpectedly ended on Thu, 13 Jul 2017 21:40:00 -0500
127.0.0.1 - - [20/Jan/2025 01:01:53] "POST / HTTP/1.1" 200 -
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/git-revise-0.7.0/tests/dummy_editor.py", line 17, in <module>
    run_editor(url=sys.argv[1], path=Path(sys.argv[2]).resolve())
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/git-revise-0.7.0/tests/dummy_editor.py", line 8, in run_editor
    with urlopen(url, data=path.read_bytes(), timeout=10) as r:
         ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/urllib/request.py", line 189, in urlopen
    return opener.open(url, data, timeout)
           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/urllib/request.py", line 489, in open
    response = self._open(req, data)
  File "/usr/lib64/python3.13/urllib/request.py", line 506, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
                              '_open', req)
  File "/usr/lib64/python3.13/urllib/request.py", line 466, in _call_chain
    result = func(*args)
  File "/usr/lib64/python3.13/urllib/request.py", line 1348, in http_open
    return self.do_open(http.client.HTTPConnection, req)
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/urllib/request.py", line 1323, in do_open
    r = h.getresponse()
  File "/usr/lib64/python3.13/http/client.py", line 1428, in getresponse
    response.begin()
    ~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.13/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ~~~~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.13/http/client.py", line 292, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/socket.py", line 719, in readinto
    return self._sock.recv_into(b)
           ~~~~~~~~~~~~~~~~~~~~^^^
TimeoutError: timed out
______________________________ test_rerere_merge _______________________________
repo = <gitrevise.odb.Repository object at 0x7f99b2ea76f0>
    def test_rerere_merge(repo):
        (repo.workdir / "file").write_bytes(10 * b"x\n")
        bash(
            """
            git config rerere.enabled true
            git config rerere.autoUpdate true
            git add file; git commit -m 'initial commit'
            """
        )
        changeline("file", 0, b"original1\n")
        bash("git commit -am 'commit 1'")
        changeline("file", 0, b"original2\n")
        bash("git commit -am 'commit 2'")
    
        # Record a resolution for changing the order of two commits.
        with editor_main(("-i", "HEAD~~"), input=b"y\ny\ny\ny\n") as ed:
            flip_last_two_commits(repo, ed)
            with ed.next_file() as f:
                f.replace_dedent(b"resolved1\n" + 9 * b"x\n")
            with ed.next_file() as f:
                f.replace_dedent(b"resolved2\n" + 9 * b"x\n")
        # Go back to the old history so we can try replaying the resolution.
        bash("git reset --hard HEAD@{1}")
    
        # Introduce an unrelated change that will not conflict to check that we can
        # merge the file contents, and not just use the recorded postimage as is.
        changeline("file", 9, b"unrelated change, present in all commits\n")
        bash("git add file")
        main(["HEAD~2"])
    
        with editor_main(("-i", "HEAD~~")) as ed:
            flip_last_two_commits(repo, ed)
    
        assert hunks(repo.git("show", "-U0", "HEAD~")) == dedent(
            """\
                @@ -1 +1 @@
                -x
                +resolved1"""
        )
        assert hunks(repo.git("show", "-U0", "HEAD")) == dedent(
            """\
                @@ -1 +1 @@
                -resolved1
                +resolved2"""
        )
>       leftover_index = hunks(repo.git("diff", "-U0", "HEAD"))
/builddir/build/BUILD/python-git-revise-0.7.0-build/git-revise-0.7.0/tests/test_rerere.py:144: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
diff = b''
    def hunks(diff: bytes) -> bytes:
>       return diff[diff.index(b"@@") :]
E       ValueError: subsection not found
/builddir/build/BUILD/python-git-revise-0.7.0-build/git-revise-0.7.0/tests/test_rerere.py:370: ValueError
----------------------------- Captured stdout call -----------------------------
[master (root-commit) 78ab633] initial commit
 Author: Bash Author <[email protected]>
 1 file changed, 10 insertions(+)
 create mode 100644 file
[master bc4398a] commit 1
 Author: Bash Author <[email protected]>
 1 file changed, 1 insertion(+), 1 deletion(-)
[master 8ede3c3] commit 2
 Author: Bash Author <[email protected]>
 1 file changed, 1 insertion(+), 1 deletion(-)
Running ['/usr/bin/python3', '-m', 'gitrevise', '-i', 'HEAD~~'] {'input': b'y\ny\ny\ny\n', 'check': True}
Conflict applying 'commit 2'
  Path: '/file'
  Edit conflicted file? (Y/n)   Merge successful? (y/N) Recording conflict resolution
pick   8d5d4e07cf09  commit 2
Conflict applying 'commit 1'
  Path: '/file'
  Edit conflicted file? (Y/n)   Merge successful? (y/N) Recording conflict resolution
pick   4afa53fa2fa8  commit 1
Updating refs/heads/master (8ede3c350c17709e6a2b5f4775e4a12770b88dc1 => 4afa53fa2fa843a3a089d55050139011198ab3d0)
HEAD is now at 4afa53f commit 1
Running ['/usr/bin/python3', '-m', 'gitrevise', 'HEAD~2'] {'check': True}
Applying staged changes to 'HEAD~2'
035bca1522bd initial commit
712c4d25b5e2 commit 2
33e258e25f6a commit 1
Updating refs/heads/master (4afa53fa2fa843a3a089d55050139011198ab3d0 => 33e258e25f6a8d5629beb2c02cb1b7e388b61791)
Running ['/usr/bin/python3', '-m', 'gitrevise', '-i', 'HEAD~~'] {'check': True}
Conflict applying 'commit 1'
  Path: '/file'
  Edit conflicted file? (Y/n) 
----------------------------- Captured stderr call -----------------------------
127.0.0.1 - - [20/Jan/2025 01:02:04] "POST / HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2025 01:02:04] "POST / HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2025 01:02:04] "POST / HTTP/1.1" 200 -
warning: log for ref HEAD unexpectedly ended on Thu, 13 Jul 2017 21:40:00 -0500
warning: log for ref HEAD unexpectedly ended on Thu, 13 Jul 2017 21:40:00 -0500
127.0.0.1 - - [20/Jan/2025 01:02:04] "POST / HTTP/1.1" 200 -
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/__main__.py", line 4, in <module>
    main()
    ~~~~^^
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/tui.py", line 263, in main
    inner_main(args, repo)
    ~~~~~~~~~~^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/tui.py", line 254, in inner_main
    interactive(args, repo, staged, head)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/tui.py", line 141, in interactive
    new_head = apply_todos(base, todos, reauthor=args.reauthor)
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/todo.py", line 251, in apply_todos
    rebased = step.commit.rebase(current).update(message=step.message)
              ~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/odb.py", line 621, in rebase
    return rebase(self, parent)
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/merge.py", line 47, in rebase
    tree = merge_trees(
        Path("/"),
    ...<3 lines>...
        get_tree(commit),
    )
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/merge.py", line 90, in merge_trees
    merged = merge_entries(
        path / name.decode(errors="replace"),
    ...<3 lines>...
        other.entries.get(name),
    )
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/merge.py", line 165, in merge_entries
    merge_blobs(path, labels, current.blob(), baseblob, other.blob()).oid,
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-git-revise-0.7.0-build/BUILDROOT/usr/lib/python3.13/site-packages/gitrevise/merge.py", line 235, in merge_blobs
    if input("  Edit conflicted file? (Y/n) ").lower() == "n":
       ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
EOFError: EOF when reading a line
=========================== short test summary info ============================
FAILED tests/test_rerere.py::test_reuse_recorded_resolution - ValueError: sub...
FAILED tests/test_rerere.py::test_rerere_no_autoupdate - ValueError: subsecti...
FAILED tests/test_rerere.py::test_rerere_merge - ValueError: subsection not f...
======================== 3 failed, 35 passed in 22.86s =========================

@mystor
Copy link
Owner

mystor commented Jan 21, 2025

Thanks for the catch!

It appears that git 2.28 introduced a bug (I believe) in the git update-ref command. I've sent an email describing the bug to the git mailing list: https://lore.kernel.org/git/CACwGqKixQEGau8CZuLwJx02F4h8hxrf9e_7N1tHMU=Wvy8ViyQ@mail.gmail.com/.

From that email:

In git 2.48.1, the git update-ref subcommand no longer correctly updates the reflog in some cases. Specifically, it appears that the old_oid field will not be updated when modifying a branch referenced by another symbolic ref (e.g. HEAD). This doesn't break the git reflog subcommand, but does break references like HEAD@{1}, which appear to read the old_oid field.

STR (in a fresh directory):

git init -b main
git commit --allow-empty -m "A"
git commit --allow-empty -m "B"
git update-ref -m "reason" refs/heads/main HEAD~ HEAD

Expected Result:

$ git rev-parse HEAD@{1}
70d9116663eee9f01065c3a6d8984b1dea661f20

$ cat .git/logs/HEAD
0000000000000000000000000000000000000000
17dd31aaf89190a36b8d04136a1a0f83fb37da4c AUTHOR <EMAIL> TIME  commit
(initial): A
17dd31aaf89190a36b8d04136a1a0f83fb37da4c
70d9116663eee9f01065c3a6d8984b1dea661f20 AUTHOR <EMAIL> TIME  commit:
B
70d9116663eee9f01065c3a6d8984b1dea661f20
17dd31aaf89190a36b8d04136a1a0f83fb37da4c AUTHOR <EMAIL> TIME  reason

The old_oid field for the reflog entry added by git update-ref is present, and correctly initialized. This was the case prior to git 2.48.

Actual Result:

$ git rev-parse HEAD@{1}
warning: log for ref HEAD unexpectedly ended on TIME
17dd31aaf89190a36b8d04136a1a0f83fb37da4c

$ cat .git/logs/HEAD
0000000000000000000000000000000000000000
17dd31aaf89190a36b8d04136a1a0f83fb37da4c AUTHOR <EMAIL> TIME  commit
(initial): A
17dd31aaf89190a36b8d04136a1a0f83fb37da4c
70d9116663eee9f01065c3a6d8984b1dea661f20 AUTHOR <EMAIL> TIME  commit:
B
0000000000000000000000000000000000000000
17dd31aaf89190a36b8d04136a1a0f83fb37da4c AUTHOR <EMAIL> TIME  reason

The old_oid field is empty (all zeroes). This is only the case in derived reflogs (in this case .git/logs/HEAD). The reflog for refs/heads/main appears to be updated correctly.

This ends up breaking the rerere tests, as they run git reset --hard HEAD@{1} to undo a git revise operation and re-apply it, which ends up not changing HEAD due to the reflog being invalid, and leading to the test failing in a confusing way.

The test could be changed such that it no longer depends on the reflog and passes on git 2.48, however the underlying issue with git update-ref generating busted reflog entries might be more difficult to work around.

@mystor mystor changed the title Tests failing in Fedora with git 2.47 Tests failing in Fedora with git 2.48 (git update-ref generating an invalid reflog) Jan 21, 2025
@imciner2
Copy link
Contributor Author

Wow, thanks for tracking that down! I guess for now, there might not be a need to actually patch anything here, and hopefully they address the regression in the next release. If you think these failures don't represent any potential problems with the git-revise functionality, I can just disable those tests locally in the Fedora build until the git version is one that contains a fix.

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

2 participants