You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ProcessException on change file if only mode changes #227
The code throws and ProcessException when trying to execute functions (getContent, isBinary) on a file diff if the diff does not contain an index. This can happen when only the mode changes.
Full error:
Error while running git command:
'git' '--git-dir' '<LOCAL_DIR>' 'cat-file' '-p' ""
fatal: Not a valid object name
Diff file:
diff --git a/a.out b/a.out
old mode 100755
new mode 100644
:100755 100644 d1af4b23d0cc9313e5b2d3ef2fb9696c94afaa81 d1af4b23d0cc9313e5b2d3ef2fb9696c94afaa81 M a.out
diff --git a/a.out b/a.out
old mode 100755
new mode 100644
With all raw output at the top followed by an empty line.
If this seems like a valid solution, let me know and I will implement it.
This could even be made backwards compatible. But maybe get a deprication notice/warning that without raw it cannot always get the index. Giving errors when trying to get content.
Activity
Patrick-Beuks commentedon Jan 5, 2025
While disallowing getting content would be a solution, I would like to be able to get the contents of the file even if not changed
Patrick-Beuks commentedon Jan 5, 2025
Having taken a look at the diff-tree command it is possible to get the index by adding
--rawto https://github.com/gitonomy/gitlib/blob/main/src/Gitonomy/Git/Commit.php#L65This would give the following diff patch
With all raw output at the top followed by an empty line.
If this seems like a valid solution, let me know and I will implement it.
This could even be made backwards compatible. But maybe get a deprication notice/warning that without raw it cannot always get the index. Giving errors when trying to get content.
lyrixx commentedon Jan 27, 2025
Thanks for this bug report
Yes :) thanks
Patrick-Beuks commentedon Jan 29, 2025
PR has been updated