From f3d32489b7dfdcb161457576c26138d83bbca7e5 Mon Sep 17 00:00:00 2001 From: Dmytro Serdiuk Date: Wed, 6 Nov 2019 14:31:01 +0200 Subject: [PATCH] Refresh current index before trying to stash changes In some cases, `git update-index -q --refresh` does not update an index. Please read about "why?" on https://stackoverflow.com/a/34808299/10418734. So, the `--refresh` option is replaced with `--really-refresh` which aims to do a real index refresh. --- .workflows/ci-pipeline.bash | 2 +- libexec/plugins/pipe | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.workflows/ci-pipeline.bash b/.workflows/ci-pipeline.bash index ea8737c..1344aaf 100755 --- a/.workflows/ci-pipeline.bash +++ b/.workflows/ci-pipeline.bash @@ -32,7 +32,7 @@ pipeline() { --verbose --file=/dev/null || fail "Unreadable todo is identified." ( .workflows/docs-generation.bash - git update-index --refresh + git update-index --really-refresh git diff-index --quiet HEAD -- ) || fail "The documentation is not up to date. Please run './.workflows/docs-generation.bash' and commit the changes" diff --git a/libexec/plugins/pipe b/libexec/plugins/pipe index d9af31c..338206f 100644 --- a/libexec/plugins/pipe +++ b/libexec/plugins/pipe @@ -6,7 +6,7 @@ stash-pipe() { # Makes automatic stash and unstash if possible # usage: stash-pipe [args]... - git update-index -q --refresh + git update-index -q --really-refresh if ! git diff-index --quiet HEAD --; then local message="Elegant Git auto-stash: " message+="WIP in '$(git rev-parse --abbrev-ref HEAD)' branch " @@ -17,7 +17,7 @@ stash-pipe() { "${@}" if [[ -n "${message}" ]]; then - git update-index -q --refresh + git update-index -q --really-refresh git-verbose stash pop $(git stash list --grep="${message}" --format="%gd") fi }