Skip to content
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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/git-subrepo
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.

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.

Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ subrepo:branch() {
local filter=$branch
[[ $first_gitrepo_commit ]] && filter=$first_gitrepo_commit..$branch
FAIL=false RUN git filter-branch -f --prune-empty --tree-filter \
"rm -f .gitrepo" "$filter"
"rm -f .gitrepo" -- "$filter" --first-parent

git:create-worktree "$branch"

Expand Down