[PATCH v2 3/3] revert.c Allow to override cherrypick.recordOrigin

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

 



--no-record-origin can be used by scripts to be sure to not record
origin information when cherry-picking.
---
 Documentation/git-cherry-pick.txt | 4 ++++
 builtin/revert.c                  | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index 63db07d..b063b76 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -58,6 +58,7 @@ OPTIONS
 
 -x::
 --record-origin::
+--no-record-origin::
 	When recording the commit, append a line that says
 	"(cherry picked from commit ...)" to the original commit
 	message in order to indicate which commit this change was
@@ -70,6 +71,9 @@ OPTIONS
 	maintenance branch for an older release from a
 	development branch), adding this information can be
 	useful.
++
+Use `--no-record-origin` if you want to avoid recording the commit id
+even when the `cherrypick.recordOrigin` option is in effect.
 
 -r::
 	It used to be that the command defaulted to do `-x`
diff --git a/builtin/revert.c b/builtin/revert.c
index 899f3e4..14d90ba 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -76,6 +76,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
 	const char * const * usage_str = revert_or_cherry_pick_usage(opts);
 	const char *me = action_name(opts);
 	int cmd = 0;
+	int no_record_origin = 0;
 	struct option options[] = {
 		OPT_CMDMODE(0, "quit", &cmd, N_("end revert or cherry-pick sequence"), 'q'),
 		OPT_CMDMODE(0, "continue", &cmd, N_("resume revert or cherry-pick sequence"), 'c'),
@@ -95,11 +96,13 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
 		OPT_END(),
 		OPT_END(),
 		OPT_END(),
+		OPT_END(),
 	};
 
 	if (opts->action == REPLAY_PICK) {
 		struct option cp_extra[] = {
 			OPT_BOOL('x', "record-origin", &opts->record_origin, N_("append commit name")),
+			OPT_BOOL(0, "no-record-origin", &no_record_origin, N_("don't append commit name")),
 			OPT_BOOL(0, "ff", &opts->allow_ff, N_("allow fast-forward")),
 			OPT_BOOL(0, "allow-empty", &opts->allow_empty, N_("preserve initially empty commits")),
 			OPT_BOOL(0, "allow-empty-message", &opts->allow_empty_message, N_("allow commits with empty messages")),
@@ -118,6 +121,9 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
 	if (opts->keep_redundant_commits)
 		opts->allow_empty = 1;
 
+	if (no_record_origin)
+		opts->record_origin = 0;
+
 	/* Set the subcommand */
 	if (cmd == 'q')
 		opts->subcommand = REPLAY_REMOVE_STATE;
-- 
1.9.0.rc3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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]