Project

General

Profile

Actions

Defect #44354

closed

GitAdapterTest#test_diff_path_invalid fails with Git 2.55.0

Added by Go MAEDA 24 days ago. Updated 23 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
SCM
Target version:
Resolution:
Fixed
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

Actions #1

Updated by Go MAEDA 23 days ago

  • Target version changed from Candidate for next minor release to 6.0.11

Setting the target version to 6.0.11.

Actions #2

Updated by Go MAEDA 23 days ago

  • Status changed from New to Resolved
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch in r24947.

Actions #3

Updated by Go MAEDA 23 days ago

  • Status changed from Resolved to Closed

Merged the change into the stable branches in r24949, r24950, and r24951.

Actions

Also available in: Atom PDF