Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/sync/modules/git/
Date: Sun, 30 Oct 2016 21:23:46
Message-Id: 1477862610.f77fcd6b0b4ebb49ca62f5767cd5c931127c3dbb.mgorny@gentoo
1 commit: f77fcd6b0b4ebb49ca62f5767cd5c931127c3dbb
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 30 19:14:11 2016 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 30 21:23:30 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f77fcd6b
7
8 [sync] Run `git update-index --refresh` when doing shallow pulls
9
10 Run `git update-index --refresh` to force proper index recheck before
11 running `git reset --merge` on a shallow pull. This fixes syncing on
12 some filesystem configurations including overlayfs on squashfs.
13
14 Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>
15
16 pym/portage/sync/modules/git/git.py | 21 ++++++++++++++++-----
17 1 file changed, 16 insertions(+), 5 deletions(-)
18
19 diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
20 index 3734b80..dc94ec9 100644
21 --- a/pym/portage/sync/modules/git/git.py
22 +++ b/pym/portage/sync/modules/git/git.py
23 @@ -89,7 +89,7 @@ class GitSync(NewBase):
24 else:
25 # Since the default merge strategy typically fails when
26 # the depth is not unlimited, use `git fetch` followed by
27 - # `git reset --merge`.
28 + # `git update-index --refresh`, then `git reset --merge`.
29 try:
30 remote_branch = portage._unicode_decode(
31 subprocess.check_output([self.bin_command, 'rev-parse',
32 @@ -116,12 +116,23 @@ class GitSync(NewBase):
33 **self.spawn_kwargs)
34
35 if exitcode == os.EX_OK and self.repo.sync_depth is not None:
36 - reset_cmd = [self.bin_command, 'reset', '--merge', remote_branch]
37 - if quiet:
38 - reset_cmd.append('--quiet')
39 - exitcode = subprocess.call(reset_cmd,
40 + # update-index --refresh is needed on some filesystems
41 + # (e.g. with overlayfs on squashfs)
42 + update_index_cmd = [self.bin_command, 'update-index']
43 + if quiet: # -q needs to go first
44 + update_index_cmd.append('-q')
45 + update_index_cmd.append('--refresh')
46 +
47 + exitcode = subprocess.call(update_index_cmd,
48 cwd=portage._unicode_encode(self.repo.location))
49
50 + if exitcode == os.EX_OK:
51 + reset_cmd = [self.bin_command, 'reset', '--merge', remote_branch]
52 + if quiet:
53 + reset_cmd.append('--quiet')
54 + exitcode = subprocess.call(reset_cmd,
55 + cwd=portage._unicode_encode(self.repo.location))
56 +
57 if exitcode != os.EX_OK:
58 msg = "!!! git pull error in %s" % self.repo.location
59 self.logger(self.xterm_titles, msg)