Merge changes I12e70a65,Ibccec851 into stable-2.16

* changes:
  Revert "Insert Change-Id at start of trailers"
  Revert "commit-msg: Remove obsolete comments"
This commit is contained in:
David Pursehouse
2020-04-21 01:51:28 +00:00
committed by Gerrit Code Review
2 changed files with 11 additions and 9 deletions

View File

@@ -63,9 +63,9 @@ index 625fd613d9..03aeba3b21 100755
@@ -38,6 +38,7 @@
context
line
+hello, world
context
line
EOF
@@ -111,7 +111,7 @@ EOF
}
# Change-Id goes after existing trailers.
function test_at_start {
function test_at_end {
cat << EOF > input
bla bla
@@ -119,16 +119,16 @@ Bug: #123
EOF
${hook} input || fail "failed hook execution"
result=$(git interpret-trailers --parse input | head -1 | grep ^Change-Id)
result=$(tail -1 input | grep ^Change-Id)
if [[ -z "${result}" ]] ; then
echo "after: "
cat input
fail "did not find Change-Id at start"
fail "did not find Change-Id at end"
fi
}
function test_dash_at_start {
function test_dash_at_end {
if [[ ! -x /bin/dash ]] ; then
echo "/bin/dash not installed; skipping dash test."
return
@@ -142,12 +142,12 @@ EOF
/bin/dash ${hook} input || fail "failed hook execution"
result=$(git interpret-trailers --parse input | head -1 | grep ^Change-Id)
result=$(tail -1 input | grep ^Change-Id)
if [[ -z "${result}" ]] ; then
echo "after: "
cat input
fail "did not find Change-Id at start"
fail "did not find Change-Id at end"
fi
}

View File

@@ -48,7 +48,9 @@ if test ! -s "${dest}" ; then
exit 1
fi
if ! git -c trailer.ifexists=doNothing interpret-trailers --where start \
# Avoid the --in-place option which only appeared in Git 2.8
# Avoid the --if-exists option which only appeared in Git 2.15
if ! git -c trailer.ifexists=doNothing interpret-trailers \
--trailer "Change-Id: I${random}" < "$1" > "${dest}" ; then
echo "cannot insert change-id line in $1"
exit 1