Merge branch 'stable-2.16' into stable-3.0

* stable-2.16:
  Insert Change-Id at start of trailers

Change-Id: Ied5226e885fa6dd83feb0cae130cacd3401702ee
This commit is contained in:
David Pursehouse
2020-04-06 10:59:00 +09:00
2 changed files with 9 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_end {
function test_at_start {
cat << EOF > input
bla bla
@@ -119,16 +119,16 @@ Bug: #123
EOF
${hook} input || fail "failed hook execution"
result=$(tail -1 input | grep ^Change-Id)
result=$(git interpret-trailers --parse input | head -1 | grep ^Change-Id)
if [[ -z "${result}" ]] ; then
echo "after: "
cat input
fail "did not find Change-Id at end"
fail "did not find Change-Id at start"
fi
}
function test_dash_at_end {
function test_dash_at_start {
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=$(tail -1 input | grep ^Change-Id)
result=$(git interpret-trailers --parse input | head -1 | grep ^Change-Id)
if [[ -z "${result}" ]] ; then
echo "after: "
cat input
fail "did not find Change-Id at end"
fail "did not find Change-Id at start"
fi
}

View File

@@ -50,7 +50,7 @@ fi
# 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 \
if ! git -c trailer.ifexists=doNothing interpret-trailers --where start \
--trailer "Change-Id: I${random}" < "$1" > "${dest}" ; then
echo "cannot insert change-id line in $1"
exit 1