Skip to content

Commit c06697f

Browse files
edvinassabaliauskasadmorgan
authored andcommitted
Only remove .gitrepo on appropriate patches
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
1 parent 30db3b8 commit c06697f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/git-subrepo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ subrepo:branch() {
869869
local filter=$branch
870870
[[ $first_gitrepo_commit ]] && filter=$first_gitrepo_commit..$branch
871871
FAIL=false RUN git filter-branch -f --prune-empty --tree-filter \
872-
"rm -f .gitrepo" "$filter"
872+
"rm -f .gitrepo" -- "$filter" --first-parent
873873

874874
git:create-worktree "$branch"
875875

0 commit comments

Comments
 (0)