Support exclusions in scmpuff_status
Hi, thanks for the wonderful tool! :hugs: It's been indispensable in my workflow for years now.
I recently wanted to exclude a directory from showing up in the scmpuff_status (aliased to gs) output, and I noticed that exclusion rules in the pathspec are not taken into account.
For example, the following works as expected with plain git:
git status ':(exclude,top)vendor/*'
Or:
git status -- ':!vendor'
This shows the status of all files, except ones in the vendor directory.
Yet this doesn't work with scmpuff:
gs ':(exclude,top)vendor/*'
Or:
gs -- ':!vendor'
This still shows the status of all files.
An obvious workaround is to do gs | grep -v 'vendor/', but this is inelegant, and shows wrong file numbers.
I'd be happy to contribute this change with a bit of guidance. :slightly_smiling_face:
I'm not sure if there are other pathspec features that should be supported besides exclusions :thinking:
Cheers!
Interesting! I hadn't come across that particular git feature before. Do you have thoughts on how it would ideally interact with the scmpuff ? Most things get passed along to git to handle, so it's a bit unclear to me what scmpuff is stripping/modifying that prevents this from getting passed along, but I could try to take a look.
(It does also occur to me that this would add complexity to be reimplemented if we move scmpuff from using native git library integration in the future instead of a wrapper, but that's a potential tradeoff that could be considered)
Do you have thoughts on how it would ideally interact with the scmpuff ?
I'm not sure how the current integration works, so I can't say for sure. I imagine that the pathspec argument just needs to be passed along to Git, and that scmpuff shouldn't need to interpret it in any way.
Thanks for looking into it!
Note to self (or anyone who wants to take a stab at this):
- The
scmpuff_status1 shell wrapper would need to be verified to pass along arguments correctly (likely works already). - The
scmpuff status2 command would need to be modified to pass along arbitrary arguments to the exec'd git command. On the surface, this is relatively simple, but since this relies on getting back very structured output for the wrapper to parse, we would have to figure out how to ensure only arguments that modify the list of files returned can be passed. - Alternatively, #33 could finally be implemented, in which case the pathspec exclusion support could be implemented manually (I suspect this is the better solution).
- Integration tests.