-
Notifications
You must be signed in to change notification settings - Fork 203
Two minor patches #1366
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
Merged
Merged
Two minor patches #1366
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -640,6 +640,7 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> { | |
| fn write_parents_of( | ||
| &mut self, | ||
| path: &Utf8Path, | ||
| root: &gio::File, | ||
| cache: &mut HashSet<Utf8PathBuf>, | ||
| ) -> Result<()> { | ||
| let Some(parent) = path.parent() else { | ||
|
|
@@ -654,15 +655,11 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> { | |
| return Ok(()); | ||
| } | ||
|
|
||
| self.write_parents_of(parent, cache)?; | ||
| self.write_parents_of(parent, root, cache)?; | ||
|
Comment on lines
657
to
+658
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| let inserted = cache.insert(parent.to_owned()); | ||
| debug_assert!(inserted); | ||
|
|
||
| let root = self | ||
| .repo | ||
| .read_commit(&self.commit_checksum, gio::Cancellable::NONE)? | ||
| .0; | ||
| let parent_file = root.resolve_relative_path(unmap_path(parent).as_ref()); | ||
| let queryattrs = "unix::*"; | ||
| let queryflags = gio::FileQueryInfoFlags::NOFOLLOW_SYMLINKS; | ||
|
|
@@ -733,13 +730,17 @@ fn write_chunk<W: std::io::Write>( | |
| create_parent_dirs: bool, | ||
| ) -> Result<()> { | ||
| let mut cache = std::collections::HashSet::new(); | ||
| let root = writer | ||
| .repo | ||
| .read_commit(&writer.commit_checksum, gio::Cancellable::NONE)? | ||
| .0; | ||
|
Comment on lines
+733
to
+736
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| for (checksum, (_size, paths)) in chunk.into_iter() { | ||
| let (objpath, h) = writer.append_content(checksum.borrow())?; | ||
| for path in paths.iter() { | ||
| let path = path_for_tar_v1(path); | ||
| let h = h.clone(); | ||
| if create_parent_dirs { | ||
| writer.write_parents_of(&path, &mut cache)?; | ||
| writer.write_parents_of(&path, &root, &mut cache)?; | ||
| } | ||
| writer.append_content_hardlink(&objpath, h, path)?; | ||
| } | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing the
rootobject here allows the function to resolve paths relative to the commit, avoiding redundant loading of the commit object in each recursive call.