From 5e4f8fa9f3e554276944802f12adfe9aa98ffcdc Mon Sep 17 00:00:00 2001
From: Jani Nikula <jani.nikula@intel.com>
Date: Wed, 11 Oct 2017 18:20:00 +0300
Subject: [PATCH] dim: log git --version in rerere cache commits

Make it easier to debug potential issues in rerere cache
handling. Adding the commit message using a temp file also makes it
easier to add more breadcrumbs in the future.

Very-much-acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/dim b/dim
index 4b65eb2..ac6533d 100755
--- a/dim
+++ b/dim
@@ -589,7 +589,7 @@ function update_rerere_cache
 
 function commit_rerere_cache
 {
-	local remote file
+	local remote file commit_message
 
 	echo -n "Updating rerere cache... "
 
@@ -617,11 +617,21 @@ function commit_rerere_cache
 	done
 	find rr-cache/ -mtime -1 -type f -not -name "thisimage*" -print0 | xargs -0 git add > /dev/null || true
 	git rm rr-cache/rr-cache &> /dev/null || true
-	if git commit -m "$time: $integration_branch rerere cache update" >& /dev/null; then
+
+	commit_message=$(mktemp)
+	cat > $commit_message <<-EOF
+		$time: $integration_branch rerere cache update
+
+		$(git --version)
+		EOF
+
+	if git commit -F $commit_message >& /dev/null; then
 		echo -n "New commit. "
 	else
 		echo -n "Nothing changed. "
 	fi
+	rm $commit_message
+
 	echo -n "Pushing rerere cache... "
 	git push $DRY_RUN $remote HEAD >& /dev/null && echo "Done."
 }
-- 
GitLab