Repository navigation
Accept an index from anywhere in 'mtree' - #426
Merged
Merged
Conversation
The input was passed to os.Stat before anything looked at whether it was meant to be an index, so 'mtree -i' only ever accepted a local file. 'mtree -i -s store -' and an index named by URL both failed with "no such file or directory", where every other command reading an index takes both. Handle the index case first and hand the location to the index store, and only go to the filesystem for a catar or a directory, which are always local. The friendly message for '-i' on a directory is kept. The mtree header is no longer written before the input is known to be readable, so a failure doesn't leave one on stdout with nothing under it.
folbricht
force-pushed
the
fix-mtree-index-location
branch
from
September 3, 2026 11:17
d6fac2e to
3968813
Compare
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.
The input was handed to
os.Statbefore anything looked at whether it was meant to be an index, somtree -ionly ever accepted a local file.desync mtree -i -s store -and an index named by URL both failed withno such file or directory, while every other command that reads an index takes both —untar -iwith the same URL works.The index case is now handled first and its location handed to the index store; the filesystem is only consulted for a catar or a directory, which are always local. The friendly message for
-ion a directory is kept.The
#mtree v1.0header used to be written before any of this, so a failure left a header on stdout with nothing under it. Nothing is written now until the input is known to be readable.Based on #425, which touches the same function; the diff shown here is just this change.