[PATCH] dim: Add support for native git worktrees

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

 



git 2.5 gained native support for worktrees, so let's use them.

Since this is fairly new I don't think we should switch the general
dim setup over to using it (for e.g. the maintainer-tools and other
auxiliary branches) since 2.5 was only released July 2015.

Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>
---
 dim | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dim b/dim
index e30fc84a8567..854b5a61b399 100755
--- a/dim
+++ b/dim
@@ -556,7 +556,14 @@ function create_workdir
 
 		echo Creating separate workdir for $branch
 
-		$DRY git-new-workdir ${DIM_DRM_INTEL} $branch $branch
+		if git help worktree &> /dev/null; then
+			# native worktree support was added in git 2.5
+			cd $DIM_DRM_INTEL
+			$DRY git worktree add $DIM_PREFIX/$branch $branch
+			cd $DIM_PREFIX
+		else
+			$DRY git-new-workdir $DIM_DRM_INTEL $branch $branch
+		fi
 	done
 }
 
-- 
2.6.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://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