Skip to content

Commit 89f5660

Browse files
DanielBautenadmorgan
authored andcommitted
Remove unneeded worktree on push
If there weren't any changes to push, remove the worktree and branch. If there were changes, then the worktree is needed.
1 parent c14bf41 commit 89f5660

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/git-subrepo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,10 @@ subrepo:push() {
656656
new_upstream_head_commit=$(git rev-parse "$branch_name")
657657
if ! $new_upstream; then
658658
if [[ $upstream_head_commit == "$new_upstream_head_commit" ]]; then
659+
if $branch_created; then
660+
o "Remove branch '$branch_name'."
661+
git:delete-branch "$branch_name"
662+
fi
659663
OK=false
660664
CODE=-2
661665
return

0 commit comments

Comments
 (0)