[PATCH 4/8] dim: support git worktree for aux checkouts

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

 



If available by default. This saves quite a pile of disk-space that
imo making it the default is justified.

Note that this will break the rebuild-nightly script for now,
follow-up patches will fix that.

Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>
---
 dim | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/dim b/dim
index d911ed21777a..7addd0d29696 100755
--- a/dim
+++ b/dim
@@ -1067,15 +1067,24 @@ function setup_aux_checkout # name remote
 	echo "Setting up $dir ..."
 
 	if [ ! -d $dir ]; then
-		git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git $remote_url $dir
-		cd $dir
-		git config remote.origin.url $remote_url
-		echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > .git/objects/info/alternates
-		git repack -a -d -l
-		remote=origin
+		if git help worktree &> /dev/null ; then
+			cd $DIM_PREFIX/$DIM_DRM_INTEL
+			remote=`get_remote_name $remote_url`
+			if ! git branch | grep $name > /dev/null ; then
+				git branch --track $name $remote/$name
+			fi
+			git worktree add ../$dir $name
+		else
+			git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git $remote_url $dir
+			cd $dir
+			git config remote.origin.url $remote_url
+			echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > .git/objects/info/alternates
+			git repack -a -d -l
+			remote=origin
+		fi
 	else
 		cd $dir
-		remote=`get_remote_name $drm_intel_ssh`
+		remote=`get_remote_name $remote_url`
 	fi
 	if ! git branch | grep $name > /dev/null ; then
 		git checkout -t $remote/$name
-- 
2.9.3

_______________________________________________
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