[PATCH] dim: Specify maintainer-tools branch name

Daniel Vetter daniel at ffwll.ch
Sun Nov 11 17:39:09 UTC 2018


On Sat, Nov 10, 2018 at 12:04 AM Daniele Ceraolo Spurio
<daniele.ceraolospurio at intel.com> wrote:
>
>
>
> On 09/11/2018 00:38, Daniel Vetter wrote:
> > On Fri, Nov 9, 2018 at 2:28 AM Daniele Ceraolo Spurio
> > <daniele.ceraolospurio at intel.com> wrote:
> >>
> >> When using worktree, the src repo might already have a master branch,
> >> which would make dim setup fail. Use a different name to avoid
> >> clashes. dim_update_branches is also expecting the branch to be
> >> called maintainer-tools.
> >>
> >> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> >
> > I think the worktree stopped making sense, now that maintainer-tools
> > is a completely free-standing repo without a simple git clone would be
> > better. Plus maybe a git branch -m to rename the master branch to
> > maintainer-tools to keep dim_update_branches happy.
> >
> > The worktree was really just to avoid having to constantly refetch
> > unrelated kernel commits for the maintainer-tools checkout, while that
> > was still living in drm-intel.
> > -Daniel
>
> Would something like this work?
>
> function simple_setup_aux_checkout # name url directory [branch]
> {
>          local name url dir remote branch
>
>          name=$1
>          url=$2
>          dir=$3
>
>          if [[ $# -eq 4 ]]; then
>                  branch=$4
>          else
>                  branch=$name
>          fi
>          echo "Setting up $dir ..."
>
>         if [ ! -d $dir ]; then
>                 git clone $url $dir
>                 remote=origin
>         fi
>
>         cd $dir
>         if [ -z "$remote" ]; then
>                 remote=$(url_to_remote $url)
>         fi
>
>          if ! git_branch_exists $branch ; then
>                  if git_branch_exists $name; then
>                          git branch -m $name $branch
>                  else
>                          git checkout $branch -t $remote/$name
>                  fi
>          fi
>          cd - > /dev/null
> }
>
> Or should I just add something tailored for maintainer-tools?

I think a tailored setup_maintainer_tools_checkout makes the most
sense. No need to overcomplicate a git clone. I also don't think we
need any of the backwards compat stuff, broken setups just need to be
undone ...
-Daniel

>
> Thanks,
> Daniele
>
> >> ---
> >>   dim | 22 ++++++++++++++--------
> >>   1 file changed, 14 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/dim b/dim
> >> index 3d6548568b56..78d69a5bd864 100755
> >> --- a/dim
> >> +++ b/dim
> >> @@ -2082,25 +2082,31 @@ function dim_status
> >>          done
> >>   }
> >>
> >> -function setup_aux_checkout # name url directory
> >> +function setup_aux_checkout # name url directory [branch]
> >>   {
> >> -       local name url dir remote
> >> +       local name url dir remote branch
> >>
> >>          name=$1
> >>          url=$2
> >>          dir=$3
> >>
> >> +       if [[ $# -eq 4 ]]; then
> >> +               branch=$4
> >> +       else
> >> +               branch=$name
> >> +       fi
> >> +
> >>          echo "Setting up $dir ..."
> >>
> >>          if [ ! -d $dir ]; then
> >>                  if git help worktree &> /dev/null ; then
> >>                          cd $DIM_PREFIX/$DIM_REPO
> >>                          remote=$(url_to_remote $url)
> >> -                       if ! git_branch_exists $name ; then
> >> +                       if ! git_branch_exists $branch ; then
> >>                                  git_fetch_helper $remote
> >> -                               git branch --track $name $remote/$name
> >> +                               git branch --track $branch $remote/$name
> >>                          fi
> >> -                       git worktree add $DIM_PREFIX/$dir $name
> >> +                       git worktree add $DIM_PREFIX/$dir $branch
> >>                  else
> >>                          git clone --reference=$DIM_PREFIX/$DIM_REPO/.git $url $dir
> >>                          cd $dir
> >> @@ -2113,8 +2119,8 @@ function setup_aux_checkout # name url directory
> >>                  cd $dir
> >>                  remote=$(url_to_remote $url)
> >>          fi
> >> -       if ! git_branch_exists $name ; then
> >> -               git checkout -t $remote/$name
> >> +       if ! git_branch_exists $branch ; then
> >> +               git checkout $branch -t $remote/$name
> >>          fi
> >>          cd - > /dev/null
> >>   }
> >> @@ -2146,7 +2152,7 @@ function dim_setup
> >>
> >>          cd $DIM_PREFIX
> >>
> >> -       setup_aux_checkout master $maintainer_tools_https maintainer-tools
> >> +       setup_aux_checkout master $maintainer_tools_https maintainer-tools maintainer-tools
> >>
> >>          setup_aux_checkout rerere-cache $drm_tip_ssh drm-rerere
> >>
> >> --
> >> 2.19.1
> >>
> >> _______________________________________________
> >> dim-tools mailing list
> >> dim-tools at lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/dim-tools
> >
> >
> >



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dim-tools mailing list