git-mailsplit: add `mailsplit.keep-cr` configuration variable.

Subsystems: documentation, the rest

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

git-mailsplit: add `mailsplit.keep-cr` configuration variable.

From: Stefan-W. Hahn <hidden>
Date: 2016-06-15 22:48:13

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 <redacted>
---
 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..3ee64a6 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.keep-cr::
+	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..a16de52 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.keep-cr")) {
+		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.rc1.50.g84249.dirty

Re: git-mailsplit: add `mailsplit.keep-cr` configuration variable.

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:48:13

Subject should read start with '[PATCH 2/4] '.

"Stefan-W. Hahn" [off-list ref] writes:
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 <redacted>
---
[...]
+mailsplit.keep-cr::
+	If true git-mailsplit will not remove `\r` from lines ending
+	with `\r\n`. See linkgit:git-mailsplit[1].
+
The convention use by config variables is to have camelCase or
allsmallcase name (variable name and section name are case
insensitive), e.g.:

  transfer.unpackLimit::
  status.showUntrackedFiles::
  sendemail.aliasfiletype::
  repack.usedeltabaseoffset::

etc., with the only outlier being add.ignore-errors.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

Re: git-mailsplit: add `mailsplit.keep-cr` configuration variable.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:13

Jakub Narebski [off-list ref] writes:
etc., with the only outlier being add.ignore-errors.
Perhaps a synonym add.ignoreErrors would help, so that later we could
deprecate that outlier?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help