Skip to content
Snippets Groups Projects
Commit cb42d99e authored by Patrick Baudin's avatar Patrick Baudin
Browse files

[Tools] pre-commit hook: prints the unstaged files that are also in the index.

parent 5a5d780e
No related branches found
No related tags found
No related merge requests found
...@@ -32,11 +32,13 @@ ...@@ -32,11 +32,13 @@
echo "Pre-commit Hook..." echo "Pre-commit Hook..."
# Extract the files that have an unstaged version # Extract the files that have both an unstaged version and a staged one.
UNSTAGED="git diff --name-status" UNSTAGED="git diff --name-status"
if [ "$(${UNSTAGED} | wc -l)" != "0" ]; then STAGED="git diff --name-status --cached"
echo "WARNING: These files will only be verified for a 'git commit -a' command." (($UNSTAGED ; $STAGED) | sed "s:^.::" | sort -u) | diff - <(($UNSTAGED ; $STAGED) | sed "s:^.::" | sort)
${UNSTAGED} if [ "$?" != "0" ]; then
echo "WARNING: These previous files are both unstaged and in the index."
echo " They will be verified only for a 'git commit -a' command."
fi fi
# Verifies the current version of files # Verifies the current version of files
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment