Key-value pairs in Git should be appended to the Git trailers section
(AKA footer). This patch fixes the commit message produced by
gerrit-push-patch which currently creates a commit message where the
Job key appears in the commit message body rather than the trailer.
For example:
An example commit message
Job: builder-job/123
Change-Id:
1234567
Signed-off-by: Jenkins <jenkins@example.org>
This fixes it to:
An example commit with proper trailer
Job: builder-job/123
Change-Id: 123457
Signed-off-by: Jenkins <jenkins@example.org>
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
Change-Id: I66c9b0813b36065c20adcf0e886eaa29354ca603
--- /dev/null
+---
+fixes:
+ - |
+ Fix Job key in commit message body rather than trailers section
+ (AKA footer). The commit message produced by gerrit-push-patch which
+ currently creates a commit message where the Job key appears in the commit
+ message body rather than the trailer.
+
+ For example::
+
+ An example commit message
+
+ Job: builder-job/123
+
+ Change-Id: 1234567
+ Signed-off-by: Jenkins <jenkins@example.org>
+
+ This fixes it to::
+
+ An example commit with proper trailer
+
+ Job: builder-job/123
+ Change-Id: 123457
+ Signed-off-by: Jenkins <jenkins@example.org>
# If available, add change_id to commit message
if change_id=$(echo "$query_result" | grep 'Change-Id:' | awk '{print $2}'); then
echo "NOTE: Found gerrit review: $change_id"
- message="Job: $job"$'\n\n'"Change-Id: $change_id"
+ message="Job: $job"$'\n'"Change-Id: $change_id"
else
echo "NOTE: No gerrit review found"
message="Job: $job"
fi
-git commit -sm "$GERRIT_COMMIT_MESSAGE" -m "$message"
+git commit -sm "$GERRIT_COMMIT_MESSAGE
+
+$message"
git status
git remote add gerrit "ssh://$GERRIT_USER@$GERRIT_HOST:29418/$PROJECT.git"