git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
To: git@vger.kernel.org
Cc: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
Subject: [PATCH 2/4] git-mailsplit: add `mailsplit.keepcr` configuration variable.
Date: Thu, 11 Feb 2010 22:26:17 +0100	[thread overview]
Message-ID: <1265923579-24900-3-git-send-email-stefan.hahn@s-hahn.de> (raw)
In-Reply-To: <1265923579-24900-1-git-send-email-stefan.hahn@s-hahn.de>

If using git-mailsplit in environments where files with dos and unix
line ending stay in one repository mbox patches must be split with
additional parameter '--keep-cr', because the behaviour of
git-mailsplit have been changed in commit c2ca1d79.

With this patch the behaviour of git-mailsplit can be set via
configuration file.

Signed-off-by: Stefan-W. Hahn <stefan.hahn@s-hahn.de>
---
 Documentation/config.txt |    4 ++++
 builtin-mailsplit.c      |   10 ++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 4c36aa9..37a4968 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1246,6 +1246,10 @@ mailmap.file::
 	subdirectory, or somewhere outside of the repository itself.
 	See linkgit:git-shortlog[1] and linkgit:git-blame[1].
 
+mailsplit.keepcr::
+	If true git-mailsplit will not remove `\r` from lines ending
+	with `\r\n`. See linkgit:git-mailsplit[1].
+
 man.viewer::
 	Specify the programs that may be used to display help in the
 	'man' format. See linkgit:git-help[1].
diff --git a/builtin-mailsplit.c b/builtin-mailsplit.c
index cdfc1b7..e76974d 100644
--- a/builtin-mailsplit.c
+++ b/builtin-mailsplit.c
@@ -210,6 +210,15 @@ out:
 	return ret;
 }
 
+static int git_mailsplit_config(const char *var, const char *value, void *cb)
+{
+	if (!strcmp(var, "mailsplit.keepcr")) {
+		keep_cr = git_config_bool(var, value);
+		return 0;
+	}
+	return git_default_config(var, value, cb);
+}
+
 int cmd_mailsplit(int argc, const char **argv, const char *prefix)
 {
 	int nr = 0, nr_prec = 4, num = 0;
@@ -218,6 +227,7 @@ int cmd_mailsplit(int argc, const char **argv, const char *prefix)
 	const char **argp;
 	static const char *stdin_only[] = { "-", NULL };
 
+	git_config(git_mailsplit_config, NULL);
 	for (argp = argv+1; *argp; argp++) {
 		const char *arg = *argp;
 
-- 
1.7.0.rc2.17.g39385

  parent reply	other threads:[~2010-02-11 21:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11 21:26 [PATCHv2 0/4] Using git-mailsplit in mixed line ending environment Stefan-W. Hahn
2010-02-11 21:26 ` [PATCH 1/4] git-mailsplit: Show parameter '--keep-cr' in usage and documentation Stefan-W. Hahn
2010-02-11 21:26 ` Stefan-W. Hahn [this message]
2010-02-11 23:21   ` [PATCH 2/4] git-mailsplit: add `mailsplit.keepcr` configuration variable Junio C Hamano
2010-02-12 21:03     ` Stefan-W. Hahn
2010-02-12 21:49       ` Junio C Hamano
2010-02-12 22:00         ` Junio C Hamano
2010-02-12 22:04         ` Stefan-W. Hahn
2010-02-11 21:26 ` [PATCH 3/4] git-am: Add command line parameter `--keep-cr` passing it to git-mailsplit Stefan-W. Hahn
2010-02-11 23:21   ` Junio C Hamano
2010-02-12 21:05     ` Stefan-W. Hahn
2010-02-12 21:54       ` Junio C Hamano
2010-02-11 21:26 ` [PATCH 4/4] Adding test for `--keep-cr` for git-mailsplit and git-am Stefan-W. Hahn

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=1265923579-24900-3-git-send-email-stefan.hahn@s-hahn.de \
    --to=stefan.hahn@s-hahn.de \
    --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).