-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix GetAffectedFiles failed when encountering a null old commit #26881
Conversation
Co-authored-by: CaiCandong <50507092+CaiCandong@users.noreply.github.com>
…etAffectedFiles # Conflicts: # modules/git/diff.go
Wait, is it right to get all changed file between current commit and the empty tree commit? |
I think the solution is ok but maybe the check should not be in that method but some frames up the callstack. Edit: The solution could be a problem because this will now scan the whole repo for (dis)allowed files and that may conflict with already existing files which are not modified in the new branch. So it may be better to use the diverging commit id with the default branch and only fallback to the empty tree commit if there is none. |
Yup, I think so too. And I recalled this PR (not fully related but the "empty sha" behavior should be explicitly clarified) |
Maybe we need to check all possbile places which contains oldcommit and newcommit and handle them like #26290 did. |
Merge this? Edit: Nevermind, i see the |
This should have been replaced by #26290 . @Zettat123 @lng2020 |
Close as outdated. |
When using protected/unprotected file patterns,
git push --set-upstream xxx xxx
will cause an internal server error.This bug is because when
git push --set-upstream
, a null commit is passed to function GetAffectedFiles as oldCommitID, but git diff cannot compare null commits. So whenoldCommit
is null, we should modify theoldCommitID
to empty tree commit("4b825dc642cb6eb9a060e54bf8d69288fbee4904") to usegit diff
.