5 # If the vcsh repository does not exist, exit without doing anything.
6 [ -d "$GIT_DIR" ] || exit 0
8 # Only one vcsh instance at a time can have the working tree fully populated.
11 # Kill the parent process because vcsh does not catch the hook exit value.
12 # See: https://github.com/RichiH/vcsh/issues/251
13 mkdir "$LOCKDIR" 2>/dev/null || { echo "An instance of vcsh already entered a repository." 1>&2; kill -- -$PPID;}
15 # Lock on the parent pid because the hooks are launched as children of vcsh.
16 echo $PPID > "$LOCKDIR/pid"
18 # git read-tree manual page says this is the proper way to fully repopulate
20 git config core.sparseCheckout true
21 rm -f "$GIT_DIR/info/sparse-checkout"
22 echo "/*" > "$GIT_DIR/info/sparse-checkout"
23 git read-tree -mu HEAD
24 git config core.sparseCheckout false