[PATCH 1/5] dim: Fixup remove-branch for working-trees

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When there's a working-tree checkout we need to remove that first,
before removing the branch. git complains otherwise. Not sure,
but this might be a recently added more strict test for the git
worktree support, at least I believe the "branch still checkout out
in $dir" warning is new-ish.

v2: Move to the front, also include the git worktree prune call to
clean up the potential mess.

Fixes: f507c9230d31 ("dim: abstract dim_{create,remove}_branch")
Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
---
 dim | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/dim b/dim
index 66ea0dd918b3..afa552a77cb1 100755
--- a/dim
+++ b/dim
@@ -673,12 +673,14 @@ function dim_remove_branch
 
 	cd $DIM_PREFIX/$DIM_DRM_INTEL
 
-	if ! $DRY git branch -d $branch ; then
-		warn_or_fail "Can't remove $branch in working repo"
-	fi
-
 	if [[ -d $DIM_PREFIX/$branch ]] ; then
 		rm -R $DIM_PREFIX/$branch
+		git worktree prune &> /dev/null || true
+	fi
+
+	if [[ `git branch --list $branch`  != "" ]] &&
+	   ! $DRY git branch -d $branch  ; then
+			warn_or_fail "Can't remove $branch in working repo"
 	fi
 
 	cd $DIM_PREFIX/drm-intel-nightly
-- 
2.10.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux