fix issue dealing with submodules in repositories#5462
Merged
Byron merged 1 commit intogitbutlerapp:masterfrom Nov 6, 2024
Merged
fix issue dealing with submodules in repositories#5462Byron merged 1 commit intogitbutlerapp:masterfrom
Byron merged 1 commit intogitbutlerapp:masterfrom
Conversation
|
@Byron is attempting to deploy a commit to the GitButler Team on Vercel. A member of the Team first needs to authorize it. |
This includes a fix for Tree-writing, where the validation incorrectly tried to assure that commits/submodules existed in the same repository.
krlvi
approved these changes
Nov 6, 2024
Member
krlvi
left a comment
There was a problem hiding this comment.
Thank you so much for the quick turnaround here!
Collaborator
Author
|
Of course, I am glad I caught it early as well. For posterity, here is the fix: commit 4079519e7e292ee193248e3acea6587788c6b884
Author: Sebastian Thiel <sebastian.thiel@icloud.com>
Date: Wed Nov 6 09:07:12 2024 +0100
fix: assure submodules are skipped everywhere
This also adds `Repository::head_tree()` for convenience.
diff --git a/gix/src/object/tree/editor.rs b/gix/src/object/tree/editor.rs
index d7a42fcd9..48fd57167 100644
--- a/gix/src/object/tree/editor.rs
+++ b/gix/src/object/tree/editor.rs
@@ -263,7 +263,7 @@ fn write_cursor<'repo>(cursor: &mut Cursor<'_, 'repo>) -> Result<Id<'repo>, writ
id: entry.oid,
source: err,
})?;
- if !cursor.repo.has_object(entry.oid) {
+ if !entry.mode.is_commit() && !cursor.repo.has_object(entry.oid) {
return Err(write::Error::MissingObject {
filename: entry.filename.clone(),
kind: entry.mode.into(),A small oversight with huge impact. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With the merge of #5416, which made it into the latest release somehow, there was also the introduction of a more convenient API for writing trees. This API, however, also added validation for everything that was about to be written to ensure the tree-entry names are valid and the objects they point to exist.
Unfortunately, a test for submodules was missing, whose objects never exist in the parent repository as they refer to the HEAD commit in the submodule.
This object-exists check would cause errors like
The object d12a68fc4930062c0bed26447a6b5245697e77c1 (160000) at 'suite' could not be found.As this runs as part of most merges now, this also means that no repository with submodules will work.
This PR updates
gitoxideto the latest version which implements a test and fix.It's definitely recommended to release an update soon after.
Fixes #5459 .
Tasks
gitoxideto latest version onmain