Skip to content
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

Support exclusions in scmpuff_status #82

Open
imiric opened this issue Mar 4, 2024 · 3 comments
Open

Support exclusions in scmpuff_status #82

imiric opened this issue Mar 4, 2024 · 3 comments

Comments

@imiric
Copy link

imiric commented Mar 4, 2024

Hi, thanks for the wonderful tool! 🤗 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. 🙂

I'm not sure if there are other pathspec features that should be supported besides exclusions 🤔

Cheers!

@mroth
Copy link
Owner

mroth commented Jul 16, 2024

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)

@imiric
Copy link
Author

imiric commented Jul 17, 2024

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!

@mroth
Copy link
Owner

mroth commented Jul 20, 2024

Note to self (or anyone who wants to take a stab at this):

  1. The scmpuff_status1 shell wrapper would need to be verified to pass along arguments correctly (likely works already).
  2. 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.
  3. Alternatively, consider refactor to use go-git instead of system git #33 could finally be implemented, in which case the pathspec exclusion support could be implemented manually (I suspect this is the better solution).
  4. Integration tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants