[Intel-gfx] [maintainer-tools PATCH 4/4] dim: unify repo clean checks to a single assert_repo_clean helper

Daniel Vetter daniel at ffwll.ch
Tue Mar 15 13:24:19 UTC 2016


On Tue, Mar 15, 2016 at 11:20:38AM +0200, Jani Nikula wrote:
> Moreover, 'git diff-index --quiet HEAD' kept failing on me even though
> the repo was clean (merely running 'git status' always fixed this). So
> use the other one.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

Oh nice find, never figured out that one really. One nitpick on patch 3,
with that addressed on the entire series:

Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
>  dim | 27 +++++++++++----------------
>  1 file changed, 11 insertions(+), 16 deletions(-)
> 
> diff --git a/dim b/dim
> index 83cc5161c767..9c8ae1098977 100755
> --- a/dim
> +++ b/dim
> @@ -411,11 +411,7 @@ function dim_apply_branch
>  	local file=`mktemp`
>  
>  	assert_branch $branch
> -
> -	if [[ -n `git status --porcelain --untracked-files=no` ]] ; then
> -		echo Repository not clean, aborting
> -		exit 2
> -	fi
> +	assert_repo_clean
>  
>  	cat > $file
>  
> @@ -676,16 +672,6 @@ function dim_conf
>  	dim_checkout drm-intel-next-fixes "$@"
>  }
>  
> -function check_repo_clean
> -{
> -	cd $1
> -	if ! git diff-index --quiet HEAD ; then
> -		echo $2 repo not clean, aborting
> -		exit 1
> -	fi
> -
> -}
> -
>  # $1 is the git sha1 to check
>  function checkpatch_commit
>  {
> @@ -986,7 +972,8 @@ function dim_update_branches
>  	for remote in $DIM_DRM_INTEL_REMOTE $DIM_DRM_UPSTREAM_REMOTE origin; do
>  		git fetch $remote
>  	done
> -	check_repo_clean $DIM_PREFIX/$DIM_DRM_INTEL Kernel
> +
> +	assert_repo_clean
>  
>  	for branch in $dim_branches ; do
>  		dim_checkout $branch
> @@ -1110,6 +1097,14 @@ function assert_branch
>  	fi
>  }
>  
> +function assert_repo_clean
> +{
> +	if [[ -n "$(git status --porcelain --untracked-files=no)" ]]; then
> +		echo "Repository not clean, aborting."
> +		exit 1
> +	fi
> +}
> +
>  # Note: used by bash completion
>  function dim_list_commands
>  {
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list