This repository was archived by the owner on Nov 9, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1047,6 +1047,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
1047
1047
{
1048
1048
struct commit_list * todo_list = NULL ;
1049
1049
unsigned char sha1 [20 ];
1050
+ int i ;
1050
1051
1051
1052
if (opts -> subcommand == REPLAY_NONE )
1052
1053
assert (opts -> revs );
@@ -1067,6 +1068,23 @@ int sequencer_pick_revisions(struct replay_opts *opts)
1067
1068
if (opts -> subcommand == REPLAY_CONTINUE )
1068
1069
return sequencer_continue (opts );
1069
1070
1071
+ for (i = 0 ; i < opts -> revs -> pending .nr ; i ++ ) {
1072
+ unsigned char sha1 [20 ];
1073
+ const char * name = opts -> revs -> pending .objects [i ].name ;
1074
+
1075
+ /* This happens when using --stdin. */
1076
+ if (!strlen (name ))
1077
+ continue ;
1078
+
1079
+ if (!get_sha1 (name , sha1 )) {
1080
+ enum object_type type = sha1_object_info (sha1 , NULL );
1081
+
1082
+ if (type > 0 && type != OBJ_COMMIT )
1083
+ die (_ ("%s: can't cherry-pick a %s" ), name , typename (type ));
1084
+ } else
1085
+ die (_ ("%s: bad revision" ), name );
1086
+ }
1087
+
1070
1088
/*
1071
1089
* If we were called as "git cherry-pick <commit>", just
1072
1090
* cherry-pick/revert it, set CHERRY_PICK_HEAD /
Original file line number Diff line number Diff line change 55
55
two"
56
56
'
57
57
58
+ test_expect_success ' cherry-pick three one two: fails' '
59
+ git checkout -f master &&
60
+ git reset --hard first &&
61
+ test_must_fail git cherry-pick three one two:
62
+ '
63
+
58
64
test_expect_success ' output to keep user entertained during multi-pick' '
59
65
cat <<-\EOF >expected &&
60
66
[master OBJID] second
You can’t perform that action at this time.
0 commit comments