From: Antonio Ospite Date: Thu, 24 Jan 2019 14:51:31 +0000 (+0100) Subject: hooks: rename sparse-checkout.sh to enable-sparse-checkout.sh X-Git-Url: https://git.ao2.it/config/vcsh.git/commitdiff_plain/9b5157bf589b2c1921c7cca8e59f965c169a86a6 hooks: rename sparse-checkout.sh to enable-sparse-checkout.sh Rename the sparse-checkout.sh script to enable-sparse-checkout.sh to better illustrate what the script actually does. In particular the new name should communicate that the script does not update the working tree itself but it just enable sparse checkout support, leaving the working tree update to other git commands (read-tree, checkout, etc.). --- diff --git a/.config/vcsh/hooks-available/enable-sparse-checkout.sh b/.config/vcsh/hooks-available/enable-sparse-checkout.sh new file mode 100755 index 0000000..2ebf5a5 --- /dev/null +++ b/.config/vcsh/hooks-available/enable-sparse-checkout.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e + +# If the vcsh repository does not exist, exit without doing anything. +[ -d "$GIT_DIR" ] || exit 0 + +: "${XDG_CONFIG_HOME:="$HOME/.config"}" + +git config core.sparseCheckout true +rm -f "$GIT_DIR/info/sparse-checkout" +ln -s "$XDG_CONFIG_HOME/vcsh/sparse-checkout" "$GIT_DIR/info/sparse-checkout" diff --git a/.config/vcsh/hooks-available/populate-sparsely.sh b/.config/vcsh/hooks-available/populate-sparsely.sh index 0561add..937122a 100755 --- a/.config/vcsh/hooks-available/populate-sparsely.sh +++ b/.config/vcsh/hooks-available/populate-sparsely.sh @@ -17,7 +17,7 @@ LOCKPID=$(cat "$LOCKDIR/pid") : "${XDG_CONFIG_HOME:="$HOME/.config"}" # shellcheck source=/dev/null -. "$XDG_CONFIG_HOME/vcsh/hooks-available/sparse-checkout.sh" +. "$XDG_CONFIG_HOME/vcsh/hooks-available/enable-sparse-checkout.sh" # Verify if the current branch is valid before updating the working tree. # This avoids errors with empty repositories which would only confuse the diff --git a/.config/vcsh/hooks-available/sparse-checkout.sh b/.config/vcsh/hooks-available/sparse-checkout.sh deleted file mode 100755 index 2ebf5a5..0000000 --- a/.config/vcsh/hooks-available/sparse-checkout.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -set -e - -# If the vcsh repository does not exist, exit without doing anything. -[ -d "$GIT_DIR" ] || exit 0 - -: "${XDG_CONFIG_HOME:="$HOME/.config"}" - -git config core.sparseCheckout true -rm -f "$GIT_DIR/info/sparse-checkout" -ln -s "$XDG_CONFIG_HOME/vcsh/sparse-checkout" "$GIT_DIR/info/sparse-checkout" diff --git a/.config/vcsh/hooks-enabled/pre-upgrade.00-sparse-checkout b/.config/vcsh/hooks-enabled/pre-upgrade.00-sparse-checkout index 2a2ca43..689d439 120000 --- a/.config/vcsh/hooks-enabled/pre-upgrade.00-sparse-checkout +++ b/.config/vcsh/hooks-enabled/pre-upgrade.00-sparse-checkout @@ -1 +1 @@ -../hooks-available/sparse-checkout.sh \ No newline at end of file +../hooks-available/enable-sparse-checkout.sh \ No newline at end of file