Skip to content

Fixes issue #613 (support for GPG signed commits on upstream repo) #614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2025

Conversation

edvinassabaliauskas
Copy link
Contributor

@edvinassabaliauskas edvinassabaliauskas commented Mar 25, 2024

Fixes #613

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain how this was effecting GPG signed commits? I am not able to see it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, so the filter-branch is effectively rewriting all the commits even if there was no change made (no .gitrepo to remove). If filter encounters a merge commit (with more than one parent), continuing the filter on a second parent rewrites those commits. If commits are GPG signed during rewrite the signatures gets dropped which results in changed commit hash. This results in inability to push the branch to the remote, as local and remote histories do not match.
We actually want to remove .gitrepo files only from the newly created commits and not from the ones that are already on the remote.

I hope I've explained it clear enough 😃 It took me a while to understand what was happening with the commit rewriting.

@soraxas
Copy link
Contributor

soraxas commented Apr 23, 2025

Hi @admorgan , I was encountering this exact issue and was extremely puzzled as to WHY two commits have exactly the same timestamp/message etc but with different SHA. It's only afte r seeing the raw commit info that it became apparent.

Many thanks @edvinassabaliauskas for the fixes (can confirmed it works). Previously, git-subrepo was complaining parent sha not found in subrepo HEAD and was not able to push changes to the subrepo (some changes was made to subrepo outside its parent and got pulled).

Can we get this merged? I can share my info:

  • The Left is inside the tmp worktree (i.e. local to the parent repo),
  • The Right is the remote subrepo (i.e. what you'd see from the actual subrepo) (I've made that changes directly from github web)
  • They are "supposed" to be the same commit, but had diverged.

Notice how the local worktree had the signature removed, resulting in mismatch of the commit SHA

@Lenbok
Copy link

Lenbok commented May 27, 2025

@admorgan I was pulling my hair out trying to work out why I my subrepo pushes were failing and eventually worked out #613 was the issue. Using this PR allowed me to make the push I was after. Thanks @edvinassabaliauskas !!!!

Limit the removal of .gitrepo files to commits on the repo hosting
the subrepo. When using filter-branch and it encountered a merge
commit, continuing the filter on the second branch rewrites all
of those commits, despite that not being necessary for pre-commit.

If the rewritten commits were GPG signed the change in the hash
results in the inability to push to the remote repo.

If during development you were to change to a different branch
on the remote repo that contained a merge, you would not be able
to push upstream because the rewrite would not match the upstream
SHAs.

fixes issue ingydotnet#613
fixes isseu ingydotnet#602
@admorgan admorgan self-assigned this May 28, 2025
@admorgan admorgan merged commit 3ec45fd into ingydotnet:master May 28, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No support for GPG signed commits on upstream repo
4 participants