@@ -147,27 +147,28 @@ static int edit_todo_file(unsigned flags)
147
147
return res ;
148
148
}
149
149
150
- static int get_revision_ranges (const char * upstream , const char * onto ,
150
+ static int get_revision_ranges (struct commit * upstream , struct commit * onto ,
151
151
const char * * head_hash ,
152
152
char * * revisions , char * * shortrevisions )
153
153
{
154
- const char * base_rev = upstream ? upstream : onto , * shorthead ;
154
+ struct commit * base_rev = upstream ? upstream : onto ;
155
+ const char * shorthead ;
155
156
struct object_id orig_head ;
156
157
157
158
if (get_oid ("HEAD" , & orig_head ))
158
159
return error (_ ("no HEAD?" ));
159
160
160
161
* head_hash = find_unique_abbrev (& orig_head , GIT_MAX_HEXSZ );
161
- * revisions = xstrfmt ("%s...%s" , base_rev , * head_hash );
162
+ * revisions = xstrfmt ("%s...%s" , oid_to_hex (& base_rev -> object .oid ),
163
+ * head_hash );
162
164
163
165
shorthead = find_unique_abbrev (& orig_head , DEFAULT_ABBREV );
164
166
165
167
if (upstream ) {
166
168
const char * shortrev ;
167
- struct object_id rev_oid ;
168
169
169
- get_oid ( base_rev , & rev_oid );
170
- shortrev = find_unique_abbrev ( & rev_oid , DEFAULT_ABBREV );
170
+ shortrev = find_unique_abbrev ( & base_rev -> object . oid ,
171
+ DEFAULT_ABBREV );
171
172
172
173
* shortrevisions = xstrfmt ("%s..%s" , shortrev , shorthead );
173
174
} else
@@ -177,7 +178,7 @@ static int get_revision_ranges(const char *upstream, const char *onto,
177
178
}
178
179
179
180
static int init_basic_state (struct replay_opts * opts , const char * head_name ,
180
- const char * onto , const char * orig_head )
181
+ struct commit * onto , const char * orig_head )
181
182
{
182
183
FILE * interactive ;
183
184
@@ -195,10 +196,10 @@ static int init_basic_state(struct replay_opts *opts, const char *head_name,
195
196
}
196
197
197
198
static int do_interactive_rebase (struct replay_opts * opts , unsigned flags ,
198
- const char * switch_to , const char * upstream ,
199
- const char * onto , const char * onto_name ,
199
+ const char * switch_to , struct commit * upstream ,
200
+ struct commit * onto , const char * onto_name ,
200
201
const char * squash_onto , const char * head_name ,
201
- const char * restrict_revision , char * raw_strategies ,
202
+ struct commit * restrict_revision , char * raw_strategies ,
202
203
struct string_list * commands , unsigned autosquash )
203
204
{
204
205
int ret ;
@@ -229,7 +230,8 @@ static int do_interactive_rebase(struct replay_opts *opts, unsigned flags,
229
230
230
231
argv_array_pushl (& make_script_args , "" , revisions , NULL );
231
232
if (restrict_revision )
232
- argv_array_push (& make_script_args , restrict_revision );
233
+ argv_array_push (& make_script_args ,
234
+ oid_to_hex (& restrict_revision -> object .oid ));
233
235
234
236
ret = sequencer_make_script (the_repository , & todo_list .buf ,
235
237
make_script_args .argc , make_script_args .argv ,
@@ -265,9 +267,10 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
265
267
struct replay_opts opts = REPLAY_OPTS_INIT ;
266
268
unsigned flags = 0 , keep_empty = 0 , rebase_merges = 0 , autosquash = 0 ;
267
269
int abbreviate_commands = 0 , rebase_cousins = -1 , ret = 0 ;
268
- const char * onto = NULL , * onto_name = NULL , * restrict_revision = NULL ,
269
- * squash_onto = NULL , * upstream = NULL , * head_name = NULL ,
270
+ const char * onto_name = NULL ,
271
+ * squash_onto = NULL , * head_name = NULL ,
270
272
* switch_to = NULL , * cmd = NULL ;
273
+ struct commit * onto = NULL , * upstream = NULL , * restrict_revision = NULL ;
271
274
struct string_list commands = STRING_LIST_INIT_DUP ;
272
275
char * raw_strategies = NULL ;
273
276
enum {
@@ -303,13 +306,16 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
303
306
N_ ("rearrange fixup/squash lines" ), REARRANGE_SQUASH ),
304
307
OPT_CMDMODE (0 , "add-exec-commands" , & command ,
305
308
N_ ("insert exec commands in todo list" ), ADD_EXEC ),
306
- OPT_STRING (0 , "onto" , & onto , N_ ("onto" ), N_ ("onto" )),
307
- OPT_STRING (0 , "restrict-revision" , & restrict_revision ,
308
- N_ ("restrict-revision" ), N_ ("restrict revision" )),
309
+ { OPTION_CALLBACK , 0 , "onto" , & onto , N_ ("onto" ), N_ ("onto" ),
310
+ PARSE_OPT_NONEG , parse_opt_commit , 0 },
311
+ { OPTION_CALLBACK , 0 , "restrict-revision" , & restrict_revision ,
312
+ N_ ("restrict-revision" ), N_ ("restrict revision" ),
313
+ PARSE_OPT_NONEG , parse_opt_commit , 0 },
309
314
OPT_STRING (0 , "squash-onto" , & squash_onto , N_ ("squash-onto" ),
310
315
N_ ("squash onto" )),
311
- OPT_STRING (0 , "upstream" , & upstream , N_ ("upstream" ),
312
- N_ ("the upstream commit" )),
316
+ { OPTION_CALLBACK , 0 , "upstream" , & upstream , N_ ("upstream" ),
317
+ N_ ("the upstream commit" ), PARSE_OPT_NONEG , parse_opt_commit ,
318
+ 0 },
313
319
OPT_STRING (0 , "head-name" , & head_name , N_ ("head-name" ), N_ ("head name" )),
314
320
{ OPTION_STRING , 'S' , "gpg-sign" , & opts .gpg_sign , N_ ("key-id" ),
315
321
N_ ("GPG-sign commits" ),
0 commit comments