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

[feature request]: run command on each (applied) patch #469

Open
fbenkstein opened this issue Jul 10, 2024 · 3 comments
Open

[feature request]: run command on each (applied) patch #469

fbenkstein opened this issue Jul 10, 2024 · 3 comments

Comments

@fbenkstein
Copy link

Hi,

I switched from a git rebase --interactive based workflow to stgit and it's working great. One thing I'm missing occasionally is git rebase --exec '...' which allows me to run a command on each patch, e.g. to check if build and tests are still working after reshuffling patches or rebasing.

I came up with an alias which provides a crude immitation of the feature but having something built-in would be quite useful:

[stgit "alias"]
  foreach = "!bash -c 'for ((i=0, n=$(stg series -cA); i < n; i++)); do stg goto $i || break; ( set -xe; \"$@\" ) || { ret=$?; echo "Exit code $ret" >&2; exit $ret; }; done'" --

I'd be willing to try implementing this myself if such a patch has a chance of being accepted.

Thank you,
Frank.

@jpgrayson
Copy link
Collaborator

I'm not categorically opposed to StGit having this kind of feature. But I do want to be careful about only adding features that are generally useful and have a good risk-to-value proposition.

Would you want a stg foreach command that behaves as your alias does?

Or are you imagining some StGit commands gaining a --exec option?

What's the scope?

I'll also note that if we implemented #241, then it would be possible to write a stg-foreach script that lived in $PATH that could be run as stg foreach. It would be an easy call to add such a script to the contrib directory.

@fbenkstein
Copy link
Author

fbenkstein commented Jul 10, 2024

How about stg rebase --exec '...' having the same semantics as git rebase --exec '...', see https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt---execltcmdgt?

@jpgrayson
Copy link
Collaborator

If that covers your use cases, it make sense to me to do it that way.

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

No branches or pull requests

2 participants