aboutsummaryrefslogtreecommitdiff
path: root/modules/extensions.py
diff options
context:
space:
mode:
authorMrau Hu <mrauhu@yandex.ru>2022-11-12 21:44:42 +0300
committerMrau Hu <mrauhu@yandex.ru>2022-11-12 21:44:42 +0300
commitd671d1d45dfab61292ed788fd7778a33a82212ee (patch)
tree8a0648afa1824446843d3c0adc53da678795eb20 /modules/extensions.py
parent98947d173e3f1667eba29c904f681047dea9de90 (diff)
Fix: `error: Your local changes to the following files would be overwritten by merge` when run `pull()` method,
because WSL2 Docker set 755 file permissions instead of 644, this results to the error. Updated `Extension` class: replaced `pull()` with `fetch_and_reset_hard()` method. Updated `apply_and_restart()` function: replaced `ext.pull()` with `ext.fetch_and_reset_hard()` function.
Diffstat (limited to 'modules/extensions.py')
-rw-r--r--modules/extensions.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/extensions.py b/modules/extensions.py
index 94ce479a..db9c4200 100644
--- a/modules/extensions.py
+++ b/modules/extensions.py
@@ -65,9 +65,12 @@ class Extension:
self.can_update = False
self.status = "latest"
- def pull(self):
+ def fetch_and_reset_hard(self):
repo = git.Repo(self.path)
- repo.remotes.origin.pull()
+ # Fix: `error: Your local changes to the following files would be overwritten by merge`,
+ # because WSL2 Docker set 755 file permissions instead of 644, this results to the error.
+ repo.git.fetch('--all')
+ repo.git.reset('--hard', 'origin')
def list_extensions():