int quiet;
int signoff;
const char *resolvemsg;
+ int rebasing;
};
/**
read_state_file(&sb, state, "sign", 1);
state->signoff = !strcmp(sb.buf, "t");
+ state->rebasing = !!file_exists(am_path(state, "rebasing"));
+
strbuf_release(&sb);
}
die(_("Failed to split patches."));
}
+ if (state->rebasing)
+ state->threeway = 1;
+
write_file(am_path(state, "threeway"), 1, state->threeway ? "t" : "f");
write_file(am_path(state, "quiet"), 1, state->quiet ? "t" : "f");
write_file(am_path(state, "sign"), 1, state->signoff ? "t" : "f");
+ if (state->rebasing)
+ write_file(am_path(state, "rebasing"), 1, "%s", "");
+ else
+ write_file(am_path(state, "applying"), 1, "%s", "");
+
if (!get_sha1("HEAD", curr_head)) {
write_file(am_path(state, "abort-safety"), 1, "%s", sha1_to_hex(curr_head));
- update_ref("am", "ORIG_HEAD", curr_head, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
+ if (!state->rebasing)
+ update_ref("am", "ORIG_HEAD", curr_head, NULL, 0,
+ UPDATE_REFS_DIE_ON_ERR);
} else {
write_file(am_path(state, "abort-safety"), 1, "%s", "");
- delete_ref("ORIG_HEAD", NULL, 0);
+ if (!state->rebasing)
+ delete_ref("ORIG_HEAD", NULL, 0);
}
/*
am_next(state);
}
- am_destroy(state);
- run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
+ /*
+ * In rebasing mode, it's up to the caller to take care of
+ * housekeeping.
+ */
+ if (!state->rebasing) {
+ am_destroy(state);
+ run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
+ }
}
/**
OPT_CMDMODE(0, "abort", &resume,
N_("restore the original branch and abort the patching operation."),
RESUME_ABORT),
+ OPT_HIDDEN_BOOL(0, "rebasing", &state.rebasing,
+ N_("(internal use for git-rebase)")),
OPT_END()
};