MCPcopy Create free account
hub / github.com/git/git / do_interactive_rebase

Function do_interactive_rebase

builtin/rebase.c:291–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
292{
293 int ret = -1;
294 char *revisions = NULL, *shortrevisions = NULL;
295 struct strvec make_script_args = STRVEC_INIT;
296 struct todo_list todo_list = TODO_LIST_INIT;
297 struct replay_opts replay = get_replay_opts(opts);
298
299 if (get_revision_ranges(opts->upstream, opts->onto, &opts->orig_head->object.oid,
300 &revisions, &shortrevisions))
301 goto cleanup;
302
303 strvec_pushl(&make_script_args, "", revisions, NULL);
304 if (opts->restrict_revision)
305 strvec_pushf(&make_script_args, "^%s",
306 oid_to_hex(&opts->restrict_revision->object.oid));
307
308 ret = sequencer_make_script(the_repository, &todo_list.buf,
309 &make_script_args, flags);
310 if (ret) {
311 error(_("could not generate todo list"));
312 goto cleanup;
313 }
314
315 if (init_basic_state(&replay,
316 opts->head_name ? opts->head_name : "detached HEAD",
317 opts->onto, &opts->orig_head->object.oid))
318 goto cleanup;
319
320 if (!opts->upstream && opts->squash_onto)
321 write_file(path_squash_onto(), "%s\n",
322 oid_to_hex(opts->squash_onto));
323
324 discard_index(the_repository->index);
325 if (todo_list_parse_insn_buffer(the_repository, &replay,
326 todo_list.buf.buf, &todo_list))
327 BUG("unusable todo list");
328
329 ret = complete_action(the_repository, &replay, flags,
330 shortrevisions, opts->onto_name, opts->onto,
331 &opts->orig_head->object.oid, &opts->exec,
332 opts->autosquash, opts->update_refs, &todo_list);
333
334cleanup:
335 replay_opts_release(&replay);
336 free(revisions);
337 free(shortrevisions);
338 todo_list_release(&todo_list);
339 strvec_clear(&make_script_args);
340
341 return ret;
342}
343
344static int run_sequencer_rebase(struct rebase_options *opts)
345{

Callers 1

run_sequencer_rebaseFunction · 0.85

Calls 15

get_replay_optsFunction · 0.85
get_revision_rangesFunction · 0.85
strvec_pushlFunction · 0.85
strvec_pushfFunction · 0.85
oid_to_hexFunction · 0.85
sequencer_make_scriptFunction · 0.85
errorFunction · 0.85
init_basic_stateFunction · 0.85
write_fileFunction · 0.85
discard_indexFunction · 0.85
complete_actionFunction · 0.85

Tested by

no test coverage detected