Skip to content
Permalink
Browse files

Merge pull request #2008 from kraai/2006

Initialize rev before using &rev.pending
  • Loading branch information...
dscho committed Jan 9, 2019
2 parents 7b95654 + 8149e4f commit 6b286585b1c9da0067e39a2333de7c83035fceb7
Showing with 10 additions and 1 deletion.
  1. +2 −1 builtin/stash.c
  2. +8 −0 t/t3903-stash.sh
@@ -1048,14 +1048,15 @@ static int stash_working_tree(struct stash_info *info, struct pathspec ps)
struct strbuf diff_output = STRBUF_INIT;
struct index_state istate = { NULL };

init_revisions(&rev, NULL);

set_alternate_index_output(stash_index_path.buf);
if (reset_tree(&info->i_tree, 0, 0)) {
ret = -1;
goto done;
}
set_alternate_index_output(NULL);

init_revisions(&rev, NULL);
rev.prune_data = ps;
rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = add_diff_to_buf;
@@ -287,6 +287,14 @@ test_expect_success 'stash an added file' '
test new = "$(cat file3)"
'

test_expect_success 'stash --intent-to-add file' '
git reset --hard &&
echo new >file4 &&
git add --intent-to-add file4 &&
test_when_finished "git rm -f file4" &&
test_must_fail git stash
'

test_expect_success 'stash rm then recreate' '
git reset --hard &&
git rm file &&

0 comments on commit 6b28658

Please sign in to comment.
You can’t perform that action at this time.