From 91d21fde9f8b7f50b7e65d9ef05389ede822adce Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 16 Jul 2016 21:55:18 -0700 Subject: [PATCH] GitSync.update: refresh index before git reset (bug 552814) Refresh the index in order to ensure that `git reset --hard` will not re-write files unnecessarily. X-Gentoo-Bug: 552814 X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=552814 --- pym/portage/sync/modules/git/git.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 09257f3..6ed7d12 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -110,6 +110,11 @@ class GitSync(NewBase): **self.spawn_kwargs) if exitcode == os.EX_OK and self.repo.sync_depth is not None: + # Refresh the index in order to ensure that `git reset --hard` + # will not re-write files unnecessarily. + subprocess.call([self.bin_command, 'update-index', '--refresh'], + cwd=portage._unicode_encode(self.repo.location)) + reset_cmd = [self.bin_command, 'reset', '--hard', remote_branch] if quiet: reset_cmd.append('--quiet') -- 2.7.4