[PATCH 1/2] dim: extract pull_rerere_cache

Rodrigo Vivi rodrigo.vivi at intel.com
Mon Dec 18 20:27:09 UTC 2017


On Fri, Dec 15, 2017 at 03:34:49PM +0000, Daniel Vetter wrote:
> Just prep for the next patch.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> ---
>  dim | 35 +++++++++++++++++------------------
>  1 file changed, 17 insertions(+), 18 deletions(-)
> 
> diff --git a/dim b/dim
> index 094127e3ce90..ab58ceedc7aa 100755
> --- a/dim
> +++ b/dim
> @@ -508,11 +508,14 @@ function rr_cache_dir
>  	fi
>  }
>  
> -function update_rerere_cache
> +function pull_rerere_cache
>  {
> -	echo -n "Updating rerere cache... "
> -
>  	cd $DIM_PREFIX/drm-rerere/
> +	if ! git_is_current_branch rerere-cache; then
> +		echo "Fail: Branch setup for the rerere-cache is borked."
> +		exit 1
> +	fi
> +
>  	if ! git pull -q ; then
>  		echoerr "Failed to update the rerere cache."
>  		echoerr "Please manually run"
> @@ -521,6 +524,15 @@ function update_rerere_cache
>  
>  		return 1
>  	fi
> +	cd - > /dev/null
> +}
> +
> +function update_rerere_cache
> +{
> +	echo -n "Updating rerere cache... "
> +
> +	pull_rerere_cache
> +
>  	if [ ! -L $(rr_cache_dir) ] ; then
>  		if [ -d $(rr_cache_dir) ] ; then
>  			rm -Rf $(rr_cache_dir)
> @@ -528,8 +540,6 @@ function update_rerere_cache
>  		ln -s "$DIM_PREFIX/drm-rerere/rr-cache" $(dirname $(rr_cache_dir))
>  	fi
>  
> -	cd - > /dev/null
> -
>  	echo "Done."
>  }
>  
> @@ -537,24 +547,13 @@ function commit_rerere_cache
>  {
>  	local remote file commit_message
>  
> -	echo -n "Updating rerere cache... "
> +	echo -n "Finalizing rerere cache... "
>  
>  	cd $DIM_PREFIX/drm-rerere/

Are we missing a "cd -" for this case?
I wonder if we should stop using "cd -" in favor of "()" like (cd blah; actions)

Anyways nothing part of this patch.
This one is unifying only and in a right way, so:

Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

> -	if ! git_is_current_branch rerere-cache; then
> -		echo "Fail: Branch setup for the rerere-cache is borked."
> -		exit 1
> -	fi
> -
>  	remote=$(branch_to_remote rerere-cache)
>  
> -	if ! git pull -q; then
> -		echoerr "Failed to update the rerere cache."
> -		echoerr "Please manually run"
> -		echoerr "	$ cd $DIM_PREFIX/drm-rerere; git pull"
> -		echoerr "and fixup any issues."
> +	pull_rerere_cache
>  
> -		return 1
> -	fi
>  	git add ./*.patch >& /dev/null || true
>  	git add fixups/*.patch >& /dev/null || true
>  	for file  in $(git ls-files -- rr-cache); do
> -- 
> 2.15.1
> 
> _______________________________________________
> dim-tools mailing list
> dim-tools at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dim-tools


More information about the dim-tools mailing list