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

Alternative to stashing files for testing #2235

Closed
cehteh opened this issue Feb 4, 2022 · 1 comment
Closed

Alternative to stashing files for testing #2235

cehteh opened this issue Feb 4, 2022 · 1 comment
Labels

Comments

@cehteh
Copy link

cehteh commented Feb 4, 2022

Are there any plans to implement alternatives to stashing the worktree?

Ideally this would be hook/scriptable, like some 'prepare-worktree' and 'restore-worktree' options (which default to the current stash behavior) but can also yield some new directory where the tests are run. The rationale here is that my editor reverts files changed on disk and I'd like to add notes to source files while the commit is in progress.

In my own pre-commit hooks I use something like:

 git archive "$(git write-tree)" --prefix="$test_dir/" | tar xf -

To create a pristine source tree (actually, I also prime it with cp -rl with build artifacts from the previous build to speed up incremental builds). 'git-worktree' and other tools could be used as well...

Eventually I have the idea to run some (more expensive) pre-commit checks in the background while one types the commit message. Then in the commit-msg hook wait for the background results and abort the commit there. This should reduce the turn around times significantly.

@cehteh cehteh changed the title Alternative to stashing file for testing Alternative to stashing files for testing Feb 4, 2022
@asottile
Copy link
Member

asottile commented Feb 4, 2022

Are there any plans to implement alternatives to stashing the worktree?

nope! but thanks for the issue nonetheless

@asottile asottile closed this as completed Feb 4, 2022
edelabar added a commit to edelabar/pre-commit that referenced this issue Apr 3, 2023
saravankrish pushed a commit to saravankrish/pre-commit that referenced this issue Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants