summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-09-18 21:36:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-09-18 21:36:00 (GMT)
commit3387423870e2efbc0b1bf7478a03320e55d2f0bc (patch)
treec5348a045cce07f674fc28e5facf0f5e0d6746da /t
parentd71abd99f82e7076775f12deb9326f7d26761591 (diff)
parent5ed75e2a3fb30f93fea7772e481ec6091e9a2c5f (diff)
downloadgit-3387423870e2efbc0b1bf7478a03320e55d2f0bc.zip
git-3387423870e2efbc0b1bf7478a03320e55d2f0bc.tar.gz
git-3387423870e2efbc0b1bf7478a03320e55d2f0bc.tar.bz2
Merge branch 'mv/cherry-pick-s'
After "git cherry-pick -s" gave control back to the user asking help to resolve conflicts, concluding "git commit" needs to be run with "-s" if the user wants to sign it off, but the command should be able to remember that. * mv/cherry-pick-s: cherry-pick: don't forget -s on failure
Diffstat (limited to 't')
-rwxr-xr-xt/t3507-cherry-pick-conflict.sh32
-rwxr-xr-xt/t3510-cherry-pick-sequence.sh6
-rw-r--r--t/test-lib-functions.sh21
3 files changed, 51 insertions, 8 deletions
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh
index 0c81b3c..c82f721 100755
--- a/t/t3507-cherry-pick-conflict.sh
+++ b/t/t3507-cherry-pick-conflict.sh
@@ -30,6 +30,7 @@ test_expect_success setup '
test_commit initial foo a &&
test_commit base foo b &&
test_commit picked foo c &&
+ test_commit --signoff picked-signed foo d &&
git config advice.detachedhead false
'
@@ -340,4 +341,35 @@ test_expect_success 'revert conflict, diff3 -m style' '
test_cmp expected actual
'
+test_expect_success 'failed cherry-pick does not forget -s' '
+ pristine_detach initial &&
+ test_must_fail git cherry-pick -s picked &&
+ test_i18ngrep -e "Signed-off-by" .git/MERGE_MSG
+'
+
+test_expect_success 'commit after failed cherry-pick does not add duplicated -s' '
+ pristine_detach initial &&
+ test_must_fail git cherry-pick -s picked-signed &&
+ git commit -a -s &&
+ test $(git show -s |grep -c "Signed-off-by") = 1
+'
+
+test_expect_success 'commit after failed cherry-pick adds -s at the right place' '
+ pristine_detach initial &&
+ test_must_fail git cherry-pick picked &&
+ git commit -a -s &&
+ pwd &&
+ cat <<EOF > expected &&
+picked
+
+Signed-off-by: C O Mitter <committer@example.com>
+
+Conflicts:
+ foo
+EOF
+
+ git show -s --pretty=format:%B > actual &&
+ test_cmp expected actual
+'
+
test_done
diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh
index f4e6450..b5fb527 100755
--- a/t/t3510-cherry-pick-sequence.sh
+++ b/t/t3510-cherry-pick-sequence.sh
@@ -410,7 +410,7 @@ test_expect_success '--continue respects -x in first commit in multi-pick' '
grep "cherry picked from.*$picked" msg
'
-test_expect_success '--signoff is not automatically propagated to resolved conflict' '
+test_expect_failure '--signoff is automatically propagated to resolved conflict' '
pristine_detach initial &&
test_expect_code 1 git cherry-pick --signoff base..anotherpick &&
echo "c" >foo &&
@@ -428,7 +428,7 @@ test_expect_success '--signoff is not automatically propagated to resolved confl
grep "Signed-off-by:" anotherpick_msg
'
-test_expect_success '--signoff dropped for implicit commit of resolution, multi-pick case' '
+test_expect_failure '--signoff dropped for implicit commit of resolution, multi-pick case' '
pristine_detach initial &&
test_must_fail git cherry-pick -s picked anotherpick &&
echo c >foo &&
@@ -441,7 +441,7 @@ test_expect_success '--signoff dropped for implicit commit of resolution, multi-
! grep Signed-off-by: msg
'
-test_expect_success 'sign-off needs to be reaffirmed after conflict resolution, single-pick case' '
+test_expect_failure 'sign-off needs to be reaffirmed after conflict resolution, single-pick case' '
pristine_detach initial &&
test_must_fail git cherry-pick -s picked &&
echo c >foo &&
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 9bc57d2..8889ba5 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -144,11 +144,22 @@ test_pause () {
test_commit () {
notick= &&
- if test "z$1" = "z--notick"
- then
- notick=yes
+ signoff= &&
+ while test $# != 0
+ do
+ case "$1" in
+ --notick)
+ notick=yes
+ ;;
+ --signoff)
+ signoff="$1"
+ ;;
+ *)
+ break
+ ;;
+ esac
shift
- fi &&
+ done &&
file=${2:-"$1.t"} &&
echo "${3-$1}" > "$file" &&
git add "$file" &&
@@ -156,7 +167,7 @@ test_commit () {
then
test_tick
fi &&
- git commit -m "$1" &&
+ git commit $signoff -m "$1" &&
git tag "$1"
}