diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2010-08-11 03:37:51 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-08-15 19:12:08 -0700 |
commit | 314eeb6e483350cc7ef0bee0498ff24a12346495 (patch) | |
tree | 2411b1879f3099e75ac5a20af968770f77e6f144 /t | |
parent | cherry-pick/revert: Use error() for failure message (diff) | |
download | tgif-314eeb6e483350cc7ef0bee0498ff24a12346495.tar.xz |
cherry-pick/revert: Use advise() for hints
When cherry-pick fails after picking a large series of commits, it can
be hard to pick out the error message and advice. Prefix the advice
with “hint: ” to help.
Before:
error: could not apply 7ab78c9... foo
After resolving the conflicts,
mark the corrected paths with 'git add <paths>' or 'git rm <paths>'
and commit the result with:
git commit -c 7ab78c9a7898b87127365478431289cb98f8d98f
After:
error: could not apply 7ab78c9... foo
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit -c 7ab78c9'
Noticed-by: Thomas Rast <trast@student.ethz.ch>
Encouraged-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t3507-cherry-pick-conflict.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh index e25cf8039a..3f29594329 100755 --- a/t/t3507-cherry-pick-conflict.sh +++ b/t/t3507-cherry-pick-conflict.sh @@ -38,6 +38,26 @@ test_expect_success 'failed cherry-pick does not advance HEAD' ' test "$head" = "$newhead" ' +test_expect_success 'advice from failed cherry-pick' ' + git checkout -f initial^0 && + git read-tree -u --reset HEAD && + git clean -d -f -f -q -x && + + git update-index --refresh && + git diff-index --exit-code HEAD && + + picked=$(git rev-parse --short picked) && + cat <<-EOF >expected && + error: could not apply $picked... picked + hint: after resolving the conflicts, mark the corrected paths + hint: with 'git add <paths>' or 'git rm <paths>' + hint: and commit the result with 'git commit -c $picked' + EOF + test_must_fail git cherry-pick picked 2>actual && + + test_cmp expected actual +' + test_expect_success 'failed cherry-pick produces dirty index' ' git checkout -f initial^0 && |