From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C2E7F1395E1 for ; Sun, 30 Oct 2016 21:23:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1AEDA21C123; Sun, 30 Oct 2016 21:23:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 03AA121C123 for ; Sun, 30 Oct 2016 21:23:46 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2916D3412F9 for ; Sun, 30 Oct 2016 21:23:44 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5391A247F for ; Sun, 30 Oct 2016 21:23:42 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1477862610.f77fcd6b0b4ebb49ca62f5767cd5c931127c3dbb.mgorny@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/sync/modules/git/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/sync/modules/git/git.py X-VCS-Directories: pym/portage/sync/modules/git/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: f77fcd6b0b4ebb49ca62f5767cd5c931127c3dbb X-VCS-Branch: master Date: Sun, 30 Oct 2016 21:23:42 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: de1e1e40-ddc6-4278-a9b2-763ce5859672 X-Archives-Hash: 68490e1324499e6796aa0e8414e8c632 commit: f77fcd6b0b4ebb49ca62f5767cd5c931127c3dbb Author: Michał Górny gentoo org> AuthorDate: Sun Oct 30 19:14:11 2016 +0000 Commit: Michał Górny gentoo org> CommitDate: Sun Oct 30 21:23:30 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f77fcd6b [sync] Run `git update-index --refresh` when doing shallow pulls Run `git update-index --refresh` to force proper index recheck before running `git reset --merge` on a shallow pull. This fixes syncing on some filesystem configurations including overlayfs on squashfs. Reviewed-by: Zac Medico gentoo.org> pym/portage/sync/modules/git/git.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 3734b80..dc94ec9 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -89,7 +89,7 @@ class GitSync(NewBase): else: # Since the default merge strategy typically fails when # the depth is not unlimited, use `git fetch` followed by - # `git reset --merge`. + # `git update-index --refresh`, then `git reset --merge`. try: remote_branch = portage._unicode_decode( subprocess.check_output([self.bin_command, 'rev-parse', @@ -116,12 +116,23 @@ class GitSync(NewBase): **self.spawn_kwargs) if exitcode == os.EX_OK and self.repo.sync_depth is not None: - reset_cmd = [self.bin_command, 'reset', '--merge', remote_branch] - if quiet: - reset_cmd.append('--quiet') - exitcode = subprocess.call(reset_cmd, + # update-index --refresh is needed on some filesystems + # (e.g. with overlayfs on squashfs) + update_index_cmd = [self.bin_command, 'update-index'] + if quiet: # -q needs to go first + update_index_cmd.append('-q') + update_index_cmd.append('--refresh') + + exitcode = subprocess.call(update_index_cmd, cwd=portage._unicode_encode(self.repo.location)) + if exitcode == os.EX_OK: + reset_cmd = [self.bin_command, 'reset', '--merge', remote_branch] + if quiet: + reset_cmd.append('--quiet') + exitcode = subprocess.call(reset_cmd, + cwd=portage._unicode_encode(self.repo.location)) + if exitcode != os.EX_OK: msg = "!!! git pull error in %s" % self.repo.location self.logger(self.xterm_titles, msg)