-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add support subpackage for Git's pathspecs #588
Conversation
46fad4e
to
e1baf68
Compare
The additions related to |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #588 +/- ##
===========================================
- Coverage 92.68% 26.00% -66.69%
===========================================
Files 160 162 +2
Lines 11495 12022 +527
Branches 1769 1832 +63
===========================================
- Hits 10654 3126 -7528
- Misses 652 8776 +8124
+ Partials 189 120 -69 ☔ View full report in Codecov by Sentry. |
The main (if not only) purpose of this functionality is pathspec mangling/translation for handing them over to analog Git command calls on submodules -- for any Git command that supports pathspecs, but not recursion. A simple example for such a command is `git ls-files --other`. It accepts pathspecs, but does not implement `--recurse-submodules` for listing untracked files. The goal of this functionality is to be able to take pathspecs that is valid in the context of a top-level repository, and translate it such that the set of paths specs given to the same command running on/in a submodule/subdirectory gives the same results, as if the initial top-level invocation reported them (if it even could). The included sketch of a testbattery uses ``git ls-files --other` for testing, rather than a formal description -- because the behavior of the implementation is more elaborate than the documentation at https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec suggests. All testing is (for now) performed within a single repository, and with translation for execution in subdirectories. The implementation is a rough sketch for exploring the problem, rather than anything polished. Ping datalad#587 Also see datalad/datalad#6933
There is still some weird behavior coming from Git some times, but this has no impact on this code, it just makes constructing test cases more complex.
Leaving a note here re adoption of pathspecs. I found that one implementation is missing: Recursive discovery of untracked files that honors pathspecs. A use case would be a recursive save of a pathspec-defined subset. However, for consistency and simplicity of behavior, even a status report should be able to select or ignore untracked elements by pathspec. A For |
Closing this PR, because #714 has an advanced implementation. |
The main (if not only) purpose of this functionality is pathspec mangling/translation for handing them over to analog Git command calls on submodules -- for any Git command that supports pathspecs, but not recursion.
A simple example for such a command is
git ls-files --other
. It accepts pathspecs, but does not implement--recurse-submodules
for listing untracked files.The goal of this functionality is to be able to take pathspecs that is valid in the context of a top-level repository, and translate it such that the set of paths specs given to the same command running on/in a submodule/subdirectory gives the same results, as if the initial top-level invocation reported them (if it even could).
The included sketch of a testbattery uses ``git ls-files --other` for testing, rather than a formal description -- because the behavior of the implementation is more elaborate than the documentation at https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec suggests.
All testing is (for now) performed within a single repository, and with translation for execution in subdirectories.
The implementation is a rough sketch for exploring the problem, rather than anything polished.
Ping #587
Also see datalad/datalad#6933
TODO:
:(glob)
pathspecs viaPurePath.match()
:(exclude)
pathspec handling:(attr:...)
pathspec handlingicase
magic does not work as documentediter_submodules()
. Alternatively, add pathspec support toiter_gitworktree()
. However, the former could be less complex. We could take any reported submodule, and try to port any given pathspec to it, and report only submodule that has any match. Initer_gitworktree()
we'd have the problem thatgit ls-files
is totally silent if given a pathspec that points (exclusively) into a submodule.