Skip to content

Alternative to stashing files for testing #2235

@cehteh

Description

@cehteh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions