Message ID | 20161018121356.9594-5-daniel.vetter@ffwll.ch (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, 18 Oct 2016, Daniel Vetter <daniel.vetter@ffwll.ch> wrote: > 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@intel.com> > --- > dim | 23 ++++++++++++++++------- > 1 file changed, 16 insertions(+), 7 deletions(-) > > diff --git a/dim b/dim > index 90eb553c6575..80baf24e4ad7 100755 > --- a/dim > +++ b/dim > @@ -1072,15 +1072,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 The failure modes are annoying if there's a substring match for $name. Unfortunately grep -w is no good if you need to handle "-" too. > + 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
On Tue, Oct 18, 2016 at 3:38 PM, Jani Nikula <jani.nikula@linux.intel.com> wrote: >> + 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 > > The failure modes are annoying if there's a substring match for > $name. Unfortunately grep -w is no good if you need to handle "-" too. Hm, right. I copypasted this all over, but with drm-intel-* we have a few clashes. Played around, and the following does exact matches and gets the job done: if [[ `git branch --list $name` != "" ]] I'll roll this out in a follow up patch everywhere. -Daniel
diff --git a/dim b/dim index 90eb553c6575..80baf24e4ad7 100755 --- a/dim +++ b/dim @@ -1072,15 +1072,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
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@intel.com> --- dim | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)