git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Guido Günther" <agx@sigxcpu.org>
To: git@vger.kernel.org
Subject: [PATCH] revert.c: Allow to specify -x via git-config
Date: Tue, 18 Feb 2014 07:56:20 +0100	[thread overview]
Message-ID: <20140218065620.GA3448@bogon.m.sigxcpu.org> (raw)

Without this when maintaining stable branches it's easy to forget to use
-x to track where a patch was cherry-picked from.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
 Documentation/git-cherry-pick.txt |  8 ++++++++
 builtin/revert.c                  | 10 ++++++++++
 2 files changed, 18 insertions(+)

diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index c205d23..c35064f 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -215,6 +215,14 @@ the working tree.
 spending extra time to avoid mistakes based on incorrectly matching
 context lines.
 
+CONFIGURATION
+-------------
+
+See linkgit:git-config[1] for core variables.
+
+cherrypick.record-origin::
+	Default for the `-x` option. Defaults to `false`.
+
 SEE ALSO
 --------
 linkgit:git-revert[1]
diff --git a/builtin/revert.c b/builtin/revert.c
index 87659c9..df9718f 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -196,6 +196,15 @@ int cmd_revert(int argc, const char **argv, const char *prefix)
 	return res;
 }
 
+static int git_cherry_pick_config(const char *var, const char *value, void *cb)
+{
+	struct replay_opts *opts = cb;
+
+	if (!strcmp(var, "cherrypick.record-origin"))
+		opts->record_origin = git_config_bool (var, value);
+	return 0;
+}
+
 int cmd_cherry_pick(int argc, const char **argv, const char *prefix)
 {
 	struct replay_opts opts;
@@ -204,6 +213,7 @@ int cmd_cherry_pick(int argc, const char **argv, const char *prefix)
 	memset(&opts, 0, sizeof(opts));
 	opts.action = REPLAY_PICK;
 	git_config(git_default_config, NULL);
+	git_config(git_cherry_pick_config, &opts);
 	parse_args(argc, argv, &opts);
 	res = sequencer_pick_revisions(&opts);
 	if (res < 0)
-- 
1.9.0.rc3

             reply	other threads:[~2014-02-18  7:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-18  6:56 Guido Günther [this message]
2014-02-18  9:11 ` [PATCH] revert.c: Allow to specify -x via git-config John Keeping
2014-02-18 17:49 ` Jonathan Nieder
2014-02-18 18:38   ` brian m. carlson
2014-02-18 19:20     ` Jonathan Nieder
2014-02-18 21:27       ` [PATCH v2 0/3] Allow to configure cherry-pick's record origin Guido Günther
2014-02-18 21:27         ` [PATCH v2 1/3] revert.c: Allow to specify -x via git-config Guido Günther
2014-02-19 19:57           ` Junio C Hamano
2014-02-18 21:27         ` [PATCH v2 2/3] revert.c: Add --record-origin Guido Günther
2014-02-18 21:27         ` [PATCH v2 3/3] revert.c Allow to override cherrypick.recordOrigin Guido Günther

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140218065620.GA3448@bogon.m.sigxcpu.org \
    --to=agx@sigxcpu.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).