diff options
author | Zac Medico <zmedico@gentoo.org> | 2016-07-18 08:48:35 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2016-07-18 08:52:42 -0700 |
commit | 55aef9bf297ef8cbf29921acb454449d01313818 (patch) | |
tree | 4ebe2cc26d687db69301df9baaef67c24279d1eb | |
parent | GitSync.update: respect sync-depth (bug 552814) (diff) | |
download | portage-55aef9bf297ef8cbf29921acb454449d01313818.tar.gz portage-55aef9bf297ef8cbf29921acb454449d01313818.tar.bz2 portage-55aef9bf297ef8cbf29921acb454449d01313818.zip |
GitSync.update: use git reset --merge instead of --hard (bug 552814)
Since `git reset --merge` gives the closest behavior to `git pull`,
use it instead of `-git reset --hard`. This will provide the following
advantages:
* git will not have to stat files that have not changed since the
previous sync, which will allow for optimal performance
* git will abort if there are unstaged local changes to any files that
have changed since the previous sync
Suggested-by: Michał Górny <mgorny@gentoo.org>
Fixes 84413bb1dd9d ("GitSync.update: respect sync-depth (bug 552814)")
-rw-r--r-- | pym/portage/sync/modules/git/git.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 09257f3b3..c1028abc4 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 --hard`. + # `git reset --merge`. remote_branch = portage._unicode_decode( subprocess.check_output([self.bin_command, 'rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{upstream}'], @@ -110,7 +110,7 @@ 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', '--hard', remote_branch] + reset_cmd = [self.bin_command, 'reset', '--merge', remote_branch] if quiet: reset_cmd.append('--quiet') exitcode = subprocess.call(reset_cmd, |