Project

General

Profile

Actions

Defect #44354

open

GitAdapterTest#test_diff_path_invalid fails with Git 2.55.0

Added by Go MAEDA about 10 hours ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
SCM
Resolution:
Affected version:

Description

GitAdapterTest#test_diff_path_invalid fails with Git 2.55.0. GitHub Actions also started failing after the runner image was updated to this version.

Failure:
GitAdapterTest#test_diff_path_invalid [test/unit/lib/redmine/scm/adapters/git_adapter_test.rb:677]:
--- expected
+++ actual
@@ -1 +1,6 @@
-[]
+["commit 713f4944648826f558cf548222f813dabe7cbb04
+", "Author: Adam Soltys <asoltys@gmail.com>
+", "Date:   Thu Jun 18 21:37:23 2009 -0700
+", " 
+", "    Updated README to reflect that this is a git repository, not mercurial
+"]

This is a regression in Git 2.55.0. git show <rev> -- <path> prints the commit header even when the path was not modified. Git 2.54.0 and earlier print nothing.

$ git --git-dir tmp/test/git_repository show --no-color --no-renames 713f4944648826f5 -- invalid
commit 713f4944648826f558cf548222f813dabe7cbb04
Author: Adam Soltys <asoltys@gmail.com>
Date:   Thu Jun 18 21:37:23 2009 -0700

    Updated README to reflect that this is a git repository, not mercurial

The regression was introduced by dd4bc01c0a and fixed by 32c4ed70e2. The fix is in Git's master branch but has not been released yet.

The UI impact is small because the diff view ignores these lines. However, Redmine::Scm::Adapters::GitAdapter#diff returns different results depending on the Git version.

The attached patch makes GitAdapter#diff return an empty array when the output contains no diff, ensuring consistent results across Git versions. Unaffected Git versions behave as before.


Files

No data to display

Actions

Also available in: Atom PDF