Skip to content

Commit

Permalink
Refresh current index before trying to stash changes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
extsoft committed Nov 6, 2019
1 parent 2689246 commit f3d3248
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .workflows/ci-pipeline.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions libexec/plugins/pipe
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ stash-pipe() {
# Makes automatic stash and unstash if possible
# usage: stash-pipe <command> [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 "
Expand All @@ -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
}
Expand Down

0 comments on commit f3d3248

Please sign in to comment.