exp: Preserve staged changes after experiments.

- Detach head after stashing workspace.
- Use reinstate_index.
This commit is contained in:
David de la Iglesia Castro
2023-02-14 16:59:10 +01:00
parent 1676d1f344
commit 320771551b
3 changed files with 13 additions and 21 deletions
+5 -5
View File
@@ -323,12 +323,12 @@ class BaseStashQueue(ABC):
.. _Hydra Override:
https://hydra.cc/docs/next/advanced/override_grammar/basic/
"""
with self.scm.detach_head(client="dvc") as orig_head:
stash_head = orig_head
if baseline_rev is None:
baseline_rev = orig_head
with self.scm.stash_workspace(reinstate_index=True) as workspace:
with self.scm.detach_head(client="dvc") as orig_head:
stash_head = orig_head
if baseline_rev is None:
baseline_rev = orig_head
with self.scm.stash_workspace() as workspace:
try:
if workspace:
self.stash.apply(workspace)