Skip to content

Limit repository creation to one process#594

Merged
asottile merged 1 commit into
masterfrom
parallel_repository_creation
Aug 24, 2017
Merged

Limit repository creation to one process#594
asottile merged 1 commit into
masterfrom
parallel_repository_creation

Conversation

@asottile
Copy link
Copy Markdown
Member

@asottile asottile commented Aug 24, 2017

This attempts to solve #363

I've tested this on windows and linux and it appears to work as intended. This adds some additional printing of [INFO] Locking pre-commit directory when cloning / installing repositories.

I used this script to test this somewhat-thoroughly:

#!/usr/bin/env bash
set -euxo pipefail

tmpdir="$(mktemp -d)"
cleanup() {
    cat "$tmpdir/pre-commit.log" 2> /dev/null || true
    rm -rf "$tmpdir"
}
trap cleanup EXIT

export PRE_COMMIT_HOME="$tmpdir"
seq 10 |
    xargs -P10 --replace \
        pre-commit run trailing-whitespace --files README.md

echo 'done!'

Would definitely love a second set of eyes on this and someone to verify that this approach also works on macos

@asottile asottile requested a review from chriskuehl August 24, 2017 00:38
@asottile asottile force-pushed the parallel_repository_creation branch from 0e1728f to 87910e5 Compare August 24, 2017 00:48
Copy link
Copy Markdown
Member

@chriskuehl chriskuehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@asottile asottile force-pushed the parallel_repository_creation branch from 87910e5 to ea39c43 Compare August 24, 2017 03:10
@asottile asottile force-pushed the parallel_repository_creation branch from ea39c43 to 625aaf5 Compare August 24, 2017 03:59
@asottile
Copy link
Copy Markdown
Member Author

Verified this also works on macos

@asottile asottile merged commit eb2ac28 into master Aug 24, 2017
@asottile asottile deleted the parallel_repository_creation branch August 24, 2017 04:37
@asottile
Copy link
Copy Markdown
Member Author

@artcyb the documentation for pre-commit can be found at pre-commit.com

If you have a particular question not covered by the documentation, feel free to open an issue on the project

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants