[Intel-gfx] [PATCH] dim: Add support for native git worktrees

Daniel Vetter daniel.vetter at ffwll.ch
Thu Dec 17 00:42:40 PST 2015


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 at intel.com>
---
 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



More information about the Intel-gfx mailing list