Merge branch 'tg/stash-refresh-index'
Recent update to "git stash pop" made the command empty the index when run with the "--quiet" option, which has been corrected. * tg/stash-refresh-index: stash: make sure we have a valid index before writing itmaint
commit
3c3e5d0ea2
|
@ -483,13 +483,12 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,
|
||||||
if (ret)
|
if (ret)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* read back the result of update_index() back from the disk */
|
||||||
discard_cache();
|
discard_cache();
|
||||||
|
read_cache();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quiet) {
|
if (!quiet) {
|
||||||
if (refresh_and_write_cache(REFRESH_QUIET, 0, 0))
|
|
||||||
warning("could not refresh index");
|
|
||||||
} else {
|
|
||||||
struct child_process cp = CHILD_PROCESS_INIT;
|
struct child_process cp = CHILD_PROCESS_INIT;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -244,8 +244,11 @@ test_expect_success 'save -q is quiet' '
|
||||||
test_must_be_empty output.out
|
test_must_be_empty output.out
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'pop -q is quiet' '
|
test_expect_success 'pop -q works and is quiet' '
|
||||||
git stash pop -q >output.out 2>&1 &&
|
git stash pop -q >output.out 2>&1 &&
|
||||||
|
echo bar >expect &&
|
||||||
|
git show :file >actual &&
|
||||||
|
test_cmp expect actual &&
|
||||||
test_must_be_empty output.out
|
test_must_be_empty output.out
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -254,6 +257,8 @@ test_expect_success 'pop -q --index works and is quiet' '
|
||||||
git add file &&
|
git add file &&
|
||||||
git stash save --quiet &&
|
git stash save --quiet &&
|
||||||
git stash pop -q --index >output.out 2>&1 &&
|
git stash pop -q --index >output.out 2>&1 &&
|
||||||
|
git diff-files file2 >file2.diff &&
|
||||||
|
test_must_be_empty file2.diff &&
|
||||||
test foo = "$(git show :file)" &&
|
test foo = "$(git show :file)" &&
|
||||||
test_must_be_empty output.out
|
test_must_be_empty output.out
|
||||||
'
|
'
|
||||||
|
|
Loading…
Reference in New Issue