Skip to content

Commit

Permalink
caught error where no changes added to stash, so cannot checkout stash
Browse files Browse the repository at this point in the history
  • Loading branch information
tanjeffreyz committed May 29, 2022
1 parent 4828811 commit bc563fe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/modules/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,11 @@ def update_submodules(self, force=False):
sub_repo.git.fetch('origin', 'main')
sub_repo.git.reset('--hard', 'FETCH_HEAD')
if not force:
sub_repo.git.checkout('stash', '--', '.') # Restore modified content
print(f" - Updated submodule '{path}'")
try: # Restore modified content
sub_repo.git.checkout('stash', '--', '.')
print(f" - Updated submodule '{path}', restored local changes")
except git.exc.GitCommandError:
print(f" - Updated submodule '{path}'")
else:
print(f" - Rebuilt submodule '{path}'")
sub_repo.git.stash('clear')
Expand Down

0 comments on commit bc563fe

Please sign in to comment.