xandris Tux's lil' helper
Joined: 24 Jan 2005 Posts: 113
|
Posted: Wed Mar 03, 2021 5:16 am Post subject: Shallow git sync: not update. Cannot merge |
|
|
This isn't a huge problem, it's just really confusing! Sometimes when I emerge --sync, I get this:
Code: |
>>> Syncing repository 'gentoo' into '/usr/portage'...
/usr/bin/git fetch origin --depth 1
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
* Using keys from /usr/share/openpgp-keys/gentoo-release.asc
* Refreshing keys via WKD ... [ ok ]
* Trusted signature found on top commit
error: Entry 'app-admin/lsyncd/Manifest' not uptodate. Cannot merge.
fatal: Could not reset index file to revision 'refs/remotes/origin/stable'.
!!! git merge error in /usr/portage
|
With this repo configuration:
Code: |
[gentoo]
location = /usr/portage
sync-type = git
sync-uri = https://github.com/gentoo-mirror/gentoo.git
clone-depth = 1
sync-depth = 1
sync-git-verify-commit-signature = true
sync-user = portage:portage
|
I already figured out one problem: postsync scripts run as root, so the 'git gc' I threw in there was changing ownership. Oops! So now I'm doing this instead:
Code: |
path="$3"
if [ -d "$path/.git" ]; then
sudo -u portage git -C "$path" gc
fi
|
(But maybe I don't need to do that at all. I think the Python code does that very same thing.)
But what is that merge error? Why is emerge --sync merging? I didn't make any changes to the repo, at least not intentionally, and a 'sudo -uportage git status' afterwards doesn't reveal anything except that my branch is behind. What even is the Python code doing?
Code: |
if shallow:
# Since the default merge strategy typically fails when
# the depth is not unlimited, `git reset --merge`.
merge_cmd = [self.bin_command, 'reset', '--merge']
else:
merge_cmd = [self.bin_command, 'merge']
merge_cmd.append('refs/remotes/%s' % remote_branch)
if quiet:
merge_cmd.append('--quiet')
exitcode = portage.process.spawn(merge_cmd,
cwd=portage._unicode_encode(self.repo.location),
**self.spawn_kwargs)
|
(I appreciate all the care that went into this, but I really just want it to 'git reset --hard origin/stable' and call it a day...I guess I could just do it myself)
Okay shallow should be true, so the command should ultimately be
Code: |
git reset --merge refs/remotes/origin/stable
|
So I ran that myself (as portage) and...it worked?
Clearly something is going on beyond my understanding. I would very much appreciate any insight!
As a side note, I've been running this same installation since 2006 and it has been an absolute joy <3 |
|