threads / patch / 42810

patchguilt: update reflog with annotations of guilt-command being run

Subject: [PATCH] guilt: update reflog with annotations of guilt-command being run

## tl;dr

2 messages between Jul 9, 2016 and Aug 11, 2016. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Theodore Ts'o· Jul 9, 2016, 22:16 UTC · lore

Many of the updates made by guilt use git update-ref, which means that the output of "git reflog" is extremely unedifying, e.g:

ff0031d HEAD@{177}: reset: moving to ff0031d848a0cd7002606f9feef958de8d5edf19 90f4305 HEAD@{178}: a638d43 HEAD@{179}: ff0031d HEAD@{180}: 079788d HEAD@{181}: 87a6280 HEAD@{182}: 5b9554d HEAD@{183}: de9e918 HEAD@{184}: reset: moving to de9e9181bc066d63d78b768e95b5d949e2a8673a 5b9554d HEAD@{185}:

So teach guilt to use the "set_reflog_action" helper, and since git-update-ref doesn't respect the GIT_REFLOG_ACTION environment variable, use its -m option so that "git reflog" can look like this instead:

1eaa566 HEAD@{11}: guilt-push: track-more-dependencies-on-transaction-commit ab714af HEAD@{12}: guilt-push: move-lockdep-tracking-to-journal_s 7a4b188 HEAD@{13}: guilt-push: move-lockdep-instrumentation-for-jbd2-handles 78d9625 HEAD@{14}: guilt-push: respect-nobarrier-mount-option-in-nojournal-mode d08854f HEAD@{15}: guilt-pop: updating HEAD d08854f HEAD@{16}: guilt-pop: updating HEAD d08854f HEAD@{17}: guilt-push: optimize-ext4_should_retry_alloc-to-improve-ENOSPC-performance

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
---
 guilt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Show changes to guilt +4 −2
diff --git a/guilt b/guilt
index 35177b9..38d426b 100755
--- a/guilt
+++ b/guilt
@@ -114,6 +114,7 @@ if [ $# -ne 0 ]; then
 		disp "" >&2
 		exit 1
 	fi
+	set_reflog_action "guilt-$CMDNAME"
 
 	shift
 else
@@ -640,7 +641,7 @@ commit()
 		commitish=`git commit-tree $treeish -p $2 < "$TMP_MSG"`
 		if $old_style_prefix || git rev-parse --verify --quiet refs/heads/$GUILT_PREFIX$branch >/dev/null
 		then
-			git update-ref HEAD $commitish
+			git update-ref -m "$GIT_REFLOG_ACTION" HEAD $commitish
 		else
 			git branch $GUILT_PREFIX$branch $commitish
 			git symbolic-ref HEAD refs/heads/$GUILT_PREFIX$branch
@@ -687,7 +688,8 @@ push_patch()
 			fi
 		fi
 
-		commit "$pname" HEAD
+		GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: $pname" \
+			commit "$pname" HEAD
 
 		echo "$pname" >> "$applied"
 
-- 
2.5.0
Josef 'Jeff' Sipek· Aug 11, 2016, 14:01 UTC · re: Theodore Ts'o · lore

Re: [PATCH] guilt: update reflog with annotations of guilt-command being run

On Sat, Jul 09, 2016 at 18:16:05 -0400, Theodore Ts'o wrote:
> Many of the updates made by guilt use git update-ref, which means that
> the output of "git reflog" is extremely unedifying, e.g:

This has been an annoyance for me as well. Thanks for fixing it. I'll give it a test run, and likely push it out later today.

Jeff.
Show 63 quoted lines
> ff0031d HEAD@{177}: reset: moving to ff0031d848a0cd7002606f9feef958de8d5edf19
> 90f4305 HEAD@{178}:
> a638d43 HEAD@{179}:
> ff0031d HEAD@{180}:
> 079788d HEAD@{181}:
> 87a6280 HEAD@{182}:
> 5b9554d HEAD@{183}:
> de9e918 HEAD@{184}: reset: moving to de9e9181bc066d63d78b768e95b5d949e2a8673a
> 5b9554d HEAD@{185}:
> 
> So teach guilt to use the "set_reflog_action" helper, and since
> git-update-ref doesn't respect the GIT_REFLOG_ACTION environment
> variable, use its -m option so that "git reflog" can look like this
> instead:
> 
> 1eaa566 HEAD@{11}: guilt-push: track-more-dependencies-on-transaction-commit
> ab714af HEAD@{12}: guilt-push: move-lockdep-tracking-to-journal_s
> 7a4b188 HEAD@{13}: guilt-push: move-lockdep-instrumentation-for-jbd2-handles
> 78d9625 HEAD@{14}: guilt-push: respect-nobarrier-mount-option-in-nojournal-mode
> d08854f HEAD@{15}: guilt-pop: updating HEAD
> d08854f HEAD@{16}: guilt-pop: updating HEAD
> d08854f HEAD@{17}: guilt-push: optimize-ext4_should_retry_alloc-to-improve-ENOSPC-performance
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> Cc: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
> ---
>  guilt | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/guilt b/guilt
> index 35177b9..38d426b 100755
> --- a/guilt
> +++ b/guilt
> @@ -114,6 +114,7 @@ if [ $# -ne 0 ]; then
>  		disp "" >&2
>  		exit 1
>  	fi
> +	set_reflog_action "guilt-$CMDNAME"
>  
>  	shift
>  else
> @@ -640,7 +641,7 @@ commit()
>  		commitish=`git commit-tree $treeish -p $2 < "$TMP_MSG"`
>  		if $old_style_prefix || git rev-parse --verify --quiet refs/heads/$GUILT_PREFIX$branch >/dev/null
>  		then
> -			git update-ref HEAD $commitish
> +			git update-ref -m "$GIT_REFLOG_ACTION" HEAD $commitish
>  		else
>  			git branch $GUILT_PREFIX$branch $commitish
>  			git symbolic-ref HEAD refs/heads/$GUILT_PREFIX$branch
> @@ -687,7 +688,8 @@ push_patch()
>  			fi
>  		fi
>  
> -		commit "$pname" HEAD
> +		GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: $pname" \
> +			commit "$pname" HEAD
>  
>  		echo "$pname" >> "$applied"
>  
> -- 
> 2.5.0
> 
-- 
Real Programmers consider "what you see is what you get" to be just as bad a
concept in Text Editors as it is in women. No, the Real Programmer wants a
"you asked for it, you got it" text editor -- complicated, cryptic,
powerful, unforgiving, dangerous.

← back to recent threads