[Mesa-dev] [PATCH 2/2] bin/get-{extra, fixes}-pick-list.sh: improve output

Eric Engestrom eric.engestrom at imgtec.com
Thu Apr 6 10:05:12 UTC 2017


On Wednesday, 2017-04-05 20:25:24 +0200, Juan A. Suarez Romero wrote:
> Show the commit hash and the title in a way that it is easier to copy
> and paste in the bin/.cherry-ignore-extra file if we want to ignore
> those commits for the future.
> ---
>  bin/get-extra-pick-list.sh | 2 +-
>  bin/get-fixes-pick-list.sh | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/bin/get-extra-pick-list.sh b/bin/get-extra-pick-list.sh
> index 70ed36b..7ae56b2 100755
> --- a/bin/get-extra-pick-list.sh
> +++ b/bin/get-extra-pick-list.sh
> @@ -44,7 +44,7 @@ do
>  		if grep -q ^$candidate already_picked ; then
>  			continue
>  		fi
> -		echo Commit $candidate references $sha
> +		echo Commit \"`git log -n1 --pretty=oneline $candidate`\" references $sha

This will break with any commit that contains glob chars (like `*`, `?`
or `[]`).

While adding quotes around the whole thing should be enough to fix it,
I'd suggest using printf instead, eg.:
	printf "Commit \"%s\" references %s\n" \
		"`git log -n1 --pretty=oneline $candidate`" \
		"$sha"

With either fix, series is:
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

>  	done
>  done
>  
> diff --git a/bin/get-fixes-pick-list.sh b/bin/get-fixes-pick-list.sh
> index 1817300..89865cc 100755
> --- a/bin/get-fixes-pick-list.sh
> +++ b/bin/get-fixes-pick-list.sh
> @@ -41,7 +41,7 @@ do
>  	# For each one try to extract the tag
>  	fixes_count=`git show $sha | grep -i "fixes:" | wc -l`
>  	if [ "x$fixes_count" != x1 ] ; then
> -		echo WARNING: Commit $sha has more than one Fixes tag
> +		echo WARNING: Commit \"`git log -n1 --pretty=oneline $sha`\" has more than one Fixes tag
>  	fi
>  	fixes=`git show $sha | grep -i "fixes:" | head -n 1`
>  	# The following sed/cut combination is borrowed from GregKH
> @@ -66,7 +66,7 @@ do
>  			continue
>  		fi
>  
> -		echo Commit $sha fixes $id
> +		echo Commit \"`git log -n1 --pretty=oneline $sha`\" fixes $id
>  	fi
>  
>  done
> -- 
> 2.9.3
> 


More information about the mesa-dev mailing list