Skip to content

Commit

Permalink
only do git stash save/pop if we have a non-empty working tree (openS…
Browse files Browse the repository at this point in the history
…USE#228)

Thanks to openSUSE#209 sometimes our working tree will be empty.  In
that case don't try to stash a bunch of changes which effectively
delete the whole working tree and then re-pop them after switching
version.

Fixes openSUSE#228.
  • Loading branch information
aspiers committed Jun 22, 2018
1 parent 2a8911b commit 8cd57de
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion TarSCM/scm/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import re
import sys

from glob import glob

from TarSCM.scm.base import Scm


Expand Down Expand Up @@ -44,7 +46,8 @@ def switch_revision(self):
for rev in revs:
if self._ref_exists(rev):
found_revision = True
if os.getenv('OSC_VERSION'):
if os.getenv('OSC_VERSION') and \
len(glob(self.clone_dir + "/*")) > 0:
stash_text = self.helpers.safe_run(
self._get_scm_cmd() +
['stash'],
Expand Down

0 comments on commit 8cd57de

Please sign in to comment.