All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 5/6] dim: Add helper for checking for a branch
Date: Thu, 26 Jan 2017 12:46:35 +0200	[thread overview]
Message-ID: <874m0m3xpw.fsf@intel.com> (raw)
In-Reply-To: <20170126091049.9122-5-daniel.vetter@ffwll.ch>

On Thu, 26 Jan 2017, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> And roll it out.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Could probably look at the quoting a bit, but this is an
improvement. LGTM.

I've done some shellcheck(1) fixes in a dull moment in the past, I
should revive the series and post.

BR,
Jani.

> ---
>  dim | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/dim b/dim
> index 73fb32c4d5ab..c5c46e9c767a 100755
> --- a/dim
> +++ b/dim
> @@ -307,6 +307,15 @@ function git_is_current_branch # branch
>  	git branch --list $1 | grep -q '\*'
>  }
>  
> +function git_branch_exists # branch
> +{
> +	if [[ `git branch --list $1` == "" ]] ; then
> +		false
> +	else
> +		true
> +	fi
> +}
> +
>  if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then
>          dim_uptodate
>  fi
> @@ -825,7 +834,7 @@ function dim_remove_branch
>  		git worktree prune &> /dev/null || true
>  	fi
>  
> -	if [[ `git branch --list $branch`  != "" ]] &&
> +	if git_branch_exists $branch &&
>  	   ! $DRY git branch -d $branch  ; then
>  			warn_or_fail "Can't remove $branch in working repo"
>  	fi
> @@ -876,7 +885,7 @@ function dim_checkout
>  	branch=$1
>  
>  	dim_cd $branch
> -	if [[ `git branch --list $branch` ==  "" ]] ; then
> +	if ! git_branch_exists $branch ; then
>  		repo=`branch_to_repo $branch`
>  
>  		if [[ $branch == "drm-intel-next" ]] ; then
> @@ -1359,7 +1368,7 @@ function setup_aux_checkout # name url directory
>  		if git help worktree &> /dev/null ; then
>  			cd $DIM_PREFIX/$DIM_DRM_INTEL
>  			remote=`url_to_remote $url`
> -			if [[ `git branch --list $name` == "" ]] ; then
> +			if ! git_branch_exists $name ; then
>  				git_fetch_helper $remote
>  				git branch --track $name $remote/$name
>  			fi
> @@ -1376,7 +1385,7 @@ function setup_aux_checkout # name url directory
>  		cd $dir
>  		remote=`url_to_remote $url`
>  	fi
> -	if [[ `git branch --list $name` == "" ]] ; then
> +	if ! git_branch_exists $name ; then
>  		git checkout -t $remote/$name
>  	fi
>  	cd - > /dev/null

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-01-26 10:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26  9:10 [PATCH 1/6] dim: Update docs Daniel Vetter
2017-01-26  9:10 ` [PATCH 2/6] dim: don't check everything in dim setup Daniel Vetter
2017-01-26  9:10 ` [PATCH 3/6] dim: Also allow git urls Daniel Vetter
2017-01-26 10:39   ` Jani Nikula
2017-01-26  9:10 ` [PATCH 4/6] dim: Add git_is_current_branch helper Daniel Vetter
2017-01-26 10:43   ` Jani Nikula
2017-01-26  9:10 ` [PATCH 5/6] dim: Add helper for checking for a branch Daniel Vetter
2017-01-26 10:46   ` Jani Nikula [this message]
2017-01-26  9:10 ` [PATCH 6/6] dim: Don't try to create branches in update_branches Daniel Vetter
2017-01-26 10:47   ` Jani Nikula
2017-01-26 10:42 ` [PATCH] dim: Explain how to resolve conflicts when git rerere fails Daniel Vetter
2017-01-26 11:12 ` [PATCH 1/6] dim: Update docs Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874m0m3xpw.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.