Add `stg import --message-id` option
[stgit.git] / t / t3304-edit-trailers.sh
blobaad47d7af72a8bc8e1ef4b18965e9f42d681120e
1 #!/bin/sh
2 test_description='Test adding trailers with "stg edit"'
4 . ./test-lib.sh
6 msg () { git cat-file -p $1 | sed '1,/^$/d' | tr '\n' / | sed 's,/*$,,' ; }
8 test_expect_success 'Initialize repo' '
9 test_commit_bulk --message="p%s" 6 &&
10 stg init &&
11 stg uncommit -n 6
14 test_expect_success 'Sign a patch' '
15 m=$(msg refs/patches/master/p1) &&
16 stg edit --sign p1 &&
17 test "$(msg refs/patches/master/p1)" = "$m//Signed-off-by: C Ó Mitter <committer@example.com>"
20 test_expect_success 'Acknowledge a patch' '
21 m=$(msg HEAD) &&
22 stg edit --ack &&
23 test "$(msg HEAD)" = "$m//Acked-by: C Ó Mitter <committer@example.com>"
26 test_expect_success 'Review a patch' '
27 m=$(msg refs/patches/master/p2) &&
28 stg edit --review p2 &&
29 test "$(msg refs/patches/master/p2)" = "$m//Reviewed-by: C Ó Mitter <committer@example.com>"
32 test_expect_success 'Review, ack, and sign a patch' '
33 m=$(msg refs/patches/master/p3) &&
34 stg edit --review --ack --sign p3 &&
35 test "$(msg refs/patches/master/p3)" = "$m//Reviewed-by: C Ó Mitter <committer@example.com>/Acked-by: C Ó Mitter <committer@example.com>/Signed-off-by: C Ó Mitter <committer@example.com>"
38 test_expect_success 'Sign a patch with custom email address' '
39 m=$(msg refs/patches/master/p4) &&
40 stg edit --sign-by "Someone <someone@example.com>" p4 &&
41 test "$(msg refs/patches/master/p4)" = "$m//Signed-off-by: Someone <someone@example.com>"
44 test_expect_success 'Sign patch and tack on a custom ack and review' '
45 m=$(msg refs/patches/master/p5) &&
46 stg edit --sign-by "Someone <someone@example.com>" p5 &&
47 test "$(msg refs/patches/master/p5)" = "$m//Signed-off-by: Someone <someone@example.com>"
48 stg edit --ack-by "ACKKER" --review-by="best friend" p5 &&
49 test "$(msg refs/patches/master/p5)" = "$m//Signed-off-by: Someone <someone@example.com>/Acked-by: ACKKER/Reviewed-by: best friend"
52 test_done