Shiny cherrypicks from teutat3s branch #231

Merged
b12f merged 13 commits from main-cherrypick-from-teutat3s into main 2023-07-13 14:15:06 +00:00
Showing only changes of commit a479b8e544 - Show all commits

View file

@ -8,8 +8,18 @@ else
fi fi
# Stash only unstaged changes, keeping staged changes # Stash only unstaged changes, keeping staged changes
# We have to stash two times, because:
# --keep-index also stashes the staged changes.
# The staged changes end up in both the stage AND the stash.
# https://overflow.hostux.net/questions/7650797/how-to-stash-only-unstaged-changes-in-git#60875082
old_stash=$(git rev-parse --quiet --verify refs/stash) old_stash=$(git rev-parse --quiet --verify refs/stash)
git stash push --quiet --keep-index -m 'Unstaged changes before pre-commit hook' git stash push --quiet --staged --message "Staged changes before pre-commit hook"
git stash push --quiet --message "Unstaged changes before pre-commit hook"
if git stash show "stash@{1}" 2>/dev/null; then
git stash pop --quiet --index "stash@{1}"
else
git stash pop --quiet --index "stash@{0}"
fi
new_stash=$(git rev-parse --quiet --verify refs/stash) new_stash=$(git rev-parse --quiet --verify refs/stash)
diff="git diff-index --name-only --cached $against --diff-filter d" diff="git diff-index --name-only --cached $against --diff-filter d"