diff mbox

dim: add error reporting for rerere cache pulling

Message ID 20170816125120.17971-1-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter Aug. 16, 2017, 12:51 p.m. UTC
This silently failed for me, and I had no idea what's happening.

v2: Use git pull -q (Jani).

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 dim | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

Comments

Jani Nikula Aug. 16, 2017, 1:17 p.m. UTC | #1
On Wed, 16 Aug 2017, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> This silently failed for me, and I had no idea what's happening.
>
> v2: Use git pull -q (Jani).

I presume with git pull -q stderr will contain clues for how to fix
stuff, but there's no harm in printing more.

...but why not echoerr?

With that, ack.

BR,
Jani.



>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  dim | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/dim b/dim
> index 85866488e0e0..124f9b374d4c 100755
> --- a/dim
> +++ b/dim
> @@ -503,7 +503,14 @@ function update_rerere_cache
>  	echo -n "Updating rerere cache... "
>  
>  	cd $DIM_PREFIX/drm-rerere/
> -	git pull &> /dev/null
> +	if ! git pull -q ; then
> +		echo "Failed to update the rerere cache."
> +		echo "Please manually run"
> +		echo "	$ cd $DIM_PREFIX/drm-rerere ; git pull"
> +		echo "and fixup any issues."
> +
> +		return 1
> +	fi
>  	if [ ! -L $(rr_cache_dir) ] ; then
>  		if [ -d $(rr_cache_dir) ] ; then
>  			rm -Rf $(rr_cache_dir)
> @@ -524,7 +531,14 @@ function commit_rerere_cache
>  	if git_is_current_branch rerere-cache ; then
>  		remote=$(branch_to_remote rerere-cache)
>  
> -		git pull >& /dev/null
> +		if ! git pull -q ; then
> +			echo "Failed to update the rerere cache."
> +			echo "Please manually run"
> +			echo "	$ cd $DIM_PREFIX/drm-rerere ; git pull"
> +			echo "and fixup any issues."
> +
> +			return 1
> +		fi
>  		git add ./*.patch >& /dev/null || true
>  		for file  in $(git ls-files); do
>  			if ! git log --since="60 days ago" --name-only -- $file | grep $file &> /dev/null; then
diff mbox

Patch

diff --git a/dim b/dim
index 85866488e0e0..124f9b374d4c 100755
--- a/dim
+++ b/dim
@@ -503,7 +503,14 @@  function update_rerere_cache
 	echo -n "Updating rerere cache... "
 
 	cd $DIM_PREFIX/drm-rerere/
-	git pull &> /dev/null
+	if ! git pull -q ; then
+		echo "Failed to update the rerere cache."
+		echo "Please manually run"
+		echo "	$ cd $DIM_PREFIX/drm-rerere ; git pull"
+		echo "and fixup any issues."
+
+		return 1
+	fi
 	if [ ! -L $(rr_cache_dir) ] ; then
 		if [ -d $(rr_cache_dir) ] ; then
 			rm -Rf $(rr_cache_dir)
@@ -524,7 +531,14 @@  function commit_rerere_cache
 	if git_is_current_branch rerere-cache ; then
 		remote=$(branch_to_remote rerere-cache)
 
-		git pull >& /dev/null
+		if ! git pull -q ; then
+			echo "Failed to update the rerere cache."
+			echo "Please manually run"
+			echo "	$ cd $DIM_PREFIX/drm-rerere ; git pull"
+			echo "and fixup any issues."
+
+			return 1
+		fi
 		git add ./*.patch >& /dev/null || true
 		for file  in $(git ls-files); do
 			if ! git log --since="60 days ago" --name-only -- $file | grep $file &> /dev/null; then