示例#1
0
文件: wt-status.c 项目: CoerWatt/git
static void wt_status_print_state(struct wt_status *s)
{
	const char *state_color = color(WT_STATUS_HEADER, s);
	struct strbuf branch = STRBUF_INIT;
	struct strbuf onto = STRBUF_INIT;
	struct wt_status_state state;
	struct stat st;

	memset(&state, 0, sizeof(state));

	if (!stat(git_path("MERGE_HEAD"), &st)) {
		state.merge_in_progress = 1;
	} else if (!stat(git_path("rebase-apply"), &st)) {
		if (!stat(git_path("rebase-apply/applying"), &st)) {
			state.am_in_progress = 1;
			if (!stat(git_path("rebase-apply/patch"), &st) && !st.st_size)
				state.am_empty_patch = 1;
		} else {
			state.rebase_in_progress = 1;
			read_and_strip_branch(&branch, &state.branch,
					      "rebase-apply/head-name");
			read_and_strip_branch(&onto, &state.onto,
					      "rebase-apply/onto");
		}
	} else if (!stat(git_path("rebase-merge"), &st)) {
		if (!stat(git_path("rebase-merge/interactive"), &st))
			state.rebase_interactive_in_progress = 1;
		else
			state.rebase_in_progress = 1;
		read_and_strip_branch(&branch, &state.branch,
				      "rebase-merge/head-name");
		read_and_strip_branch(&onto, &state.onto,
				      "rebase-merge/onto");
	} else if (!stat(git_path("CHERRY_PICK_HEAD"), &st)) {
		state.cherry_pick_in_progress = 1;
	}
	if (!stat(git_path("BISECT_LOG"), &st)) {
		state.bisect_in_progress = 1;
		read_and_strip_branch(&branch, &state.branch,
				      "BISECT_START");
	}

	if (state.merge_in_progress)
		show_merge_in_progress(s, &state, state_color);
	else if (state.am_in_progress)
		show_am_in_progress(s, &state, state_color);
	else if (state.rebase_in_progress || state.rebase_interactive_in_progress)
		show_rebase_in_progress(s, &state, state_color);
	else if (state.cherry_pick_in_progress)
		show_cherry_pick_in_progress(s, &state, state_color);
	if (state.bisect_in_progress)
		show_bisect_in_progress(s, &state, state_color);
	strbuf_release(&branch);
	strbuf_release(&onto);
}
示例#2
0
文件: wt-status.c 项目: ANKIT-KS/git
static void wt_status_print_state(struct wt_status *s,
				  struct wt_status_state *state)
{
	const char *state_color = color(WT_STATUS_HEADER, s);
	if (state->merge_in_progress)
		show_merge_in_progress(s, state, state_color);
	else if (state->am_in_progress)
		show_am_in_progress(s, state, state_color);
	else if (state->rebase_in_progress || state->rebase_interactive_in_progress)
		show_rebase_in_progress(s, state, state_color);
	else if (state->cherry_pick_in_progress)
		show_cherry_pick_in_progress(s, state, state_color);
	else if (state->revert_in_progress)
		show_revert_in_progress(s, state, state_color);
	if (state->bisect_in_progress)
		show_bisect_in_progress(s, state, state_color);
}
示例#3
0
static void wt_status_print_state(struct wt_status *s)
{
	const char *state_color = color(WT_STATUS_HEADER, s);
	struct wt_status_state state;
	struct stat st;

	memset(&state, 0, sizeof(state));

	if (!stat(git_path("MERGE_HEAD"), &st)) {
		state.merge_in_progress = 1;
	} else if (!stat(git_path("rebase-apply"), &st)) {
		if (!stat(git_path("rebase-apply/applying"), &st)) {
			state.am_in_progress = 1;
			if (!stat(git_path("rebase-apply/patch"), &st) && !st.st_size)
				state.am_empty_patch = 1;
		} else {
			state.rebase_in_progress = 1;
		}
	} else if (!stat(git_path("rebase-merge"), &st)) {
		if (!stat(git_path("rebase-merge/interactive"), &st))
			state.rebase_interactive_in_progress = 1;
		else
			state.rebase_in_progress = 1;
	} else if (!stat(git_path("CHERRY_PICK_HEAD"), &st)) {
		state.cherry_pick_in_progress = 1;
	}
	if (!stat(git_path("BISECT_LOG"), &st))
		state.bisect_in_progress = 1;

	if (state.merge_in_progress)
		show_merge_in_progress(s, &state, state_color);
	else if (state.am_in_progress)
		show_am_in_progress(s, &state, state_color);
	else if (state.rebase_in_progress || state.rebase_interactive_in_progress)
		show_rebase_in_progress(s, &state, state_color);
	else if (state.cherry_pick_in_progress)
		show_cherry_pick_in_progress(s, &state, state_color);
	if (state.bisect_in_progress)
		show_bisect_in_progress(s, &state, state_color);
}