Skip to content

Commit 17ab5ef

Browse files
committed
tests: Add test_git_stash_workspace_reinstate_index
1 parent 0309191 commit 17ab5ef

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test_stash.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,23 @@ def test_git_stash_workspace(tmp_dir: TmpDir, scm: Git):
1919
assert (tmp_dir / "file").read_text() == "1"
2020

2121

22+
def test_git_stash_workspace_reinstate_index(tmp_dir: TmpDir, scm: Git):
23+
tmp_dir.gen({"modified": "init", "deleted": "deleted"})
24+
scm.add_commit(["modified", "deleted"], "init")
25+
26+
tmp_dir.gen({"newfile": "nefile"})
27+
scm.add("newfile")
28+
tmp_dir.gen({"modified": "modified"})
29+
scm.add("modified")
30+
(tmp_dir / "deleted").unlink()
31+
scm.add("deleted")
32+
33+
prev_status = scm.status()
34+
with scm.stash_workspace(reinstate_index=True):
35+
pass
36+
assert scm.status() == prev_status
37+
38+
2239
@pytest.mark.parametrize(
2340
"ref, include_untracked",
2441
[

0 commit comments

Comments
 (0)