1 |
Run `git update-index --refresh` to force proper index recheck before |
2 |
running `git reset --merge` on a shallow pull. This fixes syncing on |
3 |
some filesystem configurations including overlayfs on squashfs. |
4 |
--- |
5 |
pym/portage/sync/modules/git/git.py | 21 ++++++++++++++++----- |
6 |
1 file changed, 16 insertions(+), 5 deletions(-) |
7 |
|
8 |
diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py |
9 |
index 3734b80..dc94ec9 100644 |
10 |
--- a/pym/portage/sync/modules/git/git.py |
11 |
+++ b/pym/portage/sync/modules/git/git.py |
12 |
@@ -89,7 +89,7 @@ class GitSync(NewBase): |
13 |
else: |
14 |
# Since the default merge strategy typically fails when |
15 |
# the depth is not unlimited, use `git fetch` followed by |
16 |
- # `git reset --merge`. |
17 |
+ # `git update-index --refresh`, then `git reset --merge`. |
18 |
try: |
19 |
remote_branch = portage._unicode_decode( |
20 |
subprocess.check_output([self.bin_command, 'rev-parse', |
21 |
@@ -116,12 +116,23 @@ class GitSync(NewBase): |
22 |
**self.spawn_kwargs) |
23 |
|
24 |
if exitcode == os.EX_OK and self.repo.sync_depth is not None: |
25 |
- reset_cmd = [self.bin_command, 'reset', '--merge', remote_branch] |
26 |
- if quiet: |
27 |
- reset_cmd.append('--quiet') |
28 |
- exitcode = subprocess.call(reset_cmd, |
29 |
+ # update-index --refresh is needed on some filesystems |
30 |
+ # (e.g. with overlayfs on squashfs) |
31 |
+ update_index_cmd = [self.bin_command, 'update-index'] |
32 |
+ if quiet: # -q needs to go first |
33 |
+ update_index_cmd.append('-q') |
34 |
+ update_index_cmd.append('--refresh') |
35 |
+ |
36 |
+ exitcode = subprocess.call(update_index_cmd, |
37 |
cwd=portage._unicode_encode(self.repo.location)) |
38 |
|
39 |
+ if exitcode == os.EX_OK: |
40 |
+ reset_cmd = [self.bin_command, 'reset', '--merge', remote_branch] |
41 |
+ if quiet: |
42 |
+ reset_cmd.append('--quiet') |
43 |
+ exitcode = subprocess.call(reset_cmd, |
44 |
+ cwd=portage._unicode_encode(self.repo.location)) |
45 |
+ |
46 |
if exitcode != os.EX_OK: |
47 |
msg = "!!! git pull error in %s" % self.repo.location |
48 |
self.logger(self.xterm_titles, msg) |
49 |
-- |
50 |
2.10.2 |