Re: [PATCH v3 5/5] commit: refuse partial commits during conflict resolution

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]




"Elijah Newren via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:
> -	if (whence != FROM_COMMIT) {
> -		if (whence == FROM_MERGE)
> -			die(_("cannot do a partial commit during a merge."));
> -		else if (is_from_cherry_pick(whence))
> -			die(_("cannot do a partial commit during a cherry-pick."));
> +	switch (sequencer_ongoing_operation(the_repository, whence)) {
> +	case ONGOING_NONE:
> +		break;
> +	case ONGOING_MERGE:
> +		die(_("cannot do a partial commit during a merge."));
> +	case ONGOING_CHERRY_PICK:
> +		die(_("cannot do a partial commit during a cherry-pick."));
> +	case ONGOING_REBASE_EMPTY:
> +		/*
> +		 * A pick that became empty is not a conflict, and creating
> +		 * a new commit (partial or not) poses no problem.
> +		 */
> +		break;
> +	case ONGOING_REVERT:
> +		die(_("cannot do a partial commit during a revert."));
> +	case ONGOING_AM:
> +		die(_("cannot do a partial commit during an am session."));
> +	case ONGOING_REBASE_CONFLICT:
> +		die(_("cannot do a partial commit while resolving conflicts during a rebase."));
> 	}
Looks quite thorough. 
Deliberate ommission of "default:" is a plus ;-)

[Index of Archives] [Linux Kernel Development] [Gcc Help] [IETF Annouce] [DCCP] [Netdev] [Networking] [Security] [V4L] [Bugtraq] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux RAID] [Linux SCSI] [Fedora Users]

(追記) (追記ここまで)
Powered by Linux

AltStyle によって変換されたページ (->オリジナル) /