{"thread":{"id":"31163","subject":"[PATCH] git-am: make a config setting for --keep-non-patch switch","startedAt":"2012-08-01T17:18:55Z","lastAt":"2012-08-01T19:56:35Z","messageCount":3,"participants":["Paul Gortmaker","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"196292","messageId":"1343841535-25652-1-git-send-email-paul.gortmaker@windriver.com","threadId":"31163","inReplyTo":null,"subject":"[PATCH] git-am: make a config setting for --keep-non-patch switch","fromName":"Paul Gortmaker","fromEmail":"paul.gortmaker@windriver.com","sentAt":"2012-08-01T17:18:55Z","receivedAt":"2012-08-01T17:18:55Z","isPatch":true,"sender":{"key":"paul.gortmaker@windriver.com","avatar":null},"body":"In order to make a commit be invariant (excluding ID) over\na format-patch and subsequent am cycle, one needs to use\nthe '--keep-non-patch' so that commits like:\n\n\t[PATCH] [i386] fix foo bar arch/x86/mm\n\nonly lose the [PATCH] and not the [i386] part.  Since it\nis a common desire (e.g. linux kernel stable trees) to have\nthe subjects remain invariant during a backport, there is\na genuine need for making this the default behaviour from\na config file, versus specifying it in scripts and on the\ncommand line each time.\n\nSigned-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>\n---\n\nSee http://lkml.indiana.edu/hypermail/linux/kernel/1203.1/01817.html\nfor additional background; stable maintainers using it etc.\n\n Documentation/config.txt               | 9 +++++++++\n Documentation/git-am.txt               | 4 ++++\n contrib/completion/git-completion.bash | 1 +\n git-am.sh                              | 8 ++++++++\n 4 files changed, 22 insertions(+)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex a95e5a4..47aded5 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -655,6 +655,15 @@ am.keepcr::\n \tby giving '--no-keep-cr' from the command line.\n \tSee linkgit:git-am[1], linkgit:git-mailsplit[1].\n \n+am.keepnonpatch::\n+\tNormally git-mailinfo strips from the Subject line, all leading\n+\tstrings bracketed with [ and ] pairs.  If this setting is true,\n+\tgit-am will call git-mailinfo with the parameter '-b' so that only\n+\tthe pairs whose bracketed string contains the word \"PATCH\" are\n+\tstripped.  Can be overridden by giving ' '--no-keep-non-patch'\n+\tfrom the command line.\n+\tSee linkgit:git-am[1], linkgit:git-mailinfo[1].\n+\n apply.ignorewhitespace::\n \tWhen set to 'change', tells 'git apply' to ignore changes in\n \twhitespace, in the same way as the '--ignore-space-change'\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex 19d57a8..790efdb 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -41,7 +41,11 @@ OPTIONS\n \tPass `-k` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).\n \n --keep-non-patch::\n+--no-keep-non-patch::\n \tPass `-b` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).\n+\tThe `am.keepnonpatch` configuration variable can be used to specify\n+\tthe default behaviour.  The `--no-keep-non-patch` is useful to\n+\toverride any `am.keepnonpatch` setting.\n \n --keep-cr::\n --no-keep-cr::\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex ffedce7..04339df 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1758,6 +1758,7 @@ _git_config ()\n \t\tadvice.statusHints\n \t\talias.\n \t\tam.keepcr\n+\t\tam.keepnonpatch\n \t\tapply.ignorewhitespace\n \t\tapply.whitespace\n \t\tbranch.autosetupmerge\ndiff --git a/git-am.sh b/git-am.sh\nindex c02e62d..9f6adbf 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -16,6 +16,7 @@ s,signoff       add a Signed-off-by line to the commit message\n u,utf8          recode into utf8 (default)\n k,keep          pass -k flag to git-mailinfo\n keep-non-patch  pass -b flag to git-mailinfo\n+no-keep-non-patch do not pass -b flag to git-mailsplit, independent of am.keepnonpatch\n keep-cr         pass --keep-cr flag to git-mailsplit for mbox format\n no-keep-cr      do not pass --keep-cr flag to git-mailsplit independent of am.keepcr\n c,scissors      strip everything before a scissors line\n@@ -381,6 +382,11 @@ then\n     keepcr=t\n fi\n \n+if test \"$(git config --bool --get am.keepnonpatch)\" = true\n+then\n+    keep=b\n+fi\n+\n while test $# != 0\n do\n \tcase \"$1\" in\n@@ -402,6 +408,8 @@ do\n \t\tkeep=t ;;\n \t--keep-non-patch)\n \t\tkeep=b ;;\n+\t--no-keep-non-patch)\n+\t\tkeep= ;;\n \t-c|--scissors)\n \t\tscissors=t ;;\n \t--no-scissors)\n-- \n1.7.12.rc1.1.gbce1580\n"},{"id":"196298","messageId":"7v1ujqfnyg.fsf@alter.siamese.dyndns.org","threadId":"31163","inReplyTo":"1343841535-25652-1-git-send-email-paul.gortmaker@windriver.com","subject":"Re: [PATCH] git-am: make a config setting for --keep-non-patch switch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-08-01T18:48:23Z","receivedAt":"2012-08-01T18:48:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paul Gortmaker <paul.gortmaker@windriver.com> writes:\n\n> In order to make a commit be invariant (excluding ID) over\n> a format-patch and subsequent am cycle, one needs to use\n> the '--keep-non-patch' so that commits like:\n>\n> \t[PATCH] [i386] fix foo bar arch/x86/mm\n>\n> only lose the [PATCH] and not the [i386] part.  Since it\n> is a common desire (e.g. linux kernel stable trees) to have\n> the subjects remain invariant during a backport, there is\n> a genuine need for making this the default behaviour from\n> a config file, versus specifying it in scripts and on the\n> command line each time.\n>\n> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>\n> ---\n>\n> See http://lkml.indiana.edu/hypermail/linux/kernel/1203.1/01817.html\n> for additional background; stable maintainers using it etc.\n\nThat's a blast from the past; it would have been so much nicer\nif the patch came earlier ;-)\n\nThe patch looks from sane; we may want to have a test in t4150, just like\nwe have tests for am.keepcr in t4253.  We have plenty of time as we\nare in feature freeze right now.\n\nThanks.\n\n>\n>  Documentation/config.txt               | 9 +++++++++\n>  Documentation/git-am.txt               | 4 ++++\n>  contrib/completion/git-completion.bash | 1 +\n>  git-am.sh                              | 8 ++++++++\n>  4 files changed, 22 insertions(+)\n>\n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index a95e5a4..47aded5 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -655,6 +655,15 @@ am.keepcr::\n>  \tby giving '--no-keep-cr' from the command line.\n>  \tSee linkgit:git-am[1], linkgit:git-mailsplit[1].\n>  \n> +am.keepnonpatch::\n> +\tNormally git-mailinfo strips from the Subject line, all leading\n> +\tstrings bracketed with [ and ] pairs.  If this setting is true,\n> +\tgit-am will call git-mailinfo with the parameter '-b' so that only\n> +\tthe pairs whose bracketed string contains the word \"PATCH\" are\n> +\tstripped.  Can be overridden by giving ' '--no-keep-non-patch'\n> +\tfrom the command line.\n> +\tSee linkgit:git-am[1], linkgit:git-mailinfo[1].\n> +\n>  apply.ignorewhitespace::\n>  \tWhen set to 'change', tells 'git apply' to ignore changes in\n>  \twhitespace, in the same way as the '--ignore-space-change'\n> diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\n> index 19d57a8..790efdb 100644\n> --- a/Documentation/git-am.txt\n> +++ b/Documentation/git-am.txt\n> @@ -41,7 +41,11 @@ OPTIONS\n>  \tPass `-k` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).\n>  \n>  --keep-non-patch::\n> +--no-keep-non-patch::\n>  \tPass `-b` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).\n> +\tThe `am.keepnonpatch` configuration variable can be used to specify\n> +\tthe default behaviour.  The `--no-keep-non-patch` is useful to\n> +\toverride any `am.keepnonpatch` setting.\n>  \n>  --keep-cr::\n>  --no-keep-cr::\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index ffedce7..04339df 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -1758,6 +1758,7 @@ _git_config ()\n>  \t\tadvice.statusHints\n>  \t\talias.\n>  \t\tam.keepcr\n> +\t\tam.keepnonpatch\n>  \t\tapply.ignorewhitespace\n>  \t\tapply.whitespace\n>  \t\tbranch.autosetupmerge\n> diff --git a/git-am.sh b/git-am.sh\n> index c02e62d..9f6adbf 100755\n> --- a/git-am.sh\n> +++ b/git-am.sh\n> @@ -16,6 +16,7 @@ s,signoff       add a Signed-off-by line to the commit message\n>  u,utf8          recode into utf8 (default)\n>  k,keep          pass -k flag to git-mailinfo\n>  keep-non-patch  pass -b flag to git-mailinfo\n> +no-keep-non-patch do not pass -b flag to git-mailsplit, independent of am.keepnonpatch\n>  keep-cr         pass --keep-cr flag to git-mailsplit for mbox format\n>  no-keep-cr      do not pass --keep-cr flag to git-mailsplit independent of am.keepcr\n>  c,scissors      strip everything before a scissors line\n> @@ -381,6 +382,11 @@ then\n>      keepcr=t\n>  fi\n>  \n> +if test \"$(git config --bool --get am.keepnonpatch)\" = true\n> +then\n> +    keep=b\n> +fi\n> +\n>  while test $# != 0\n>  do\n>  \tcase \"$1\" in\n> @@ -402,6 +408,8 @@ do\n>  \t\tkeep=t ;;\n>  \t--keep-non-patch)\n>  \t\tkeep=b ;;\n> +\t--no-keep-non-patch)\n> +\t\tkeep= ;;\n>  \t-c|--scissors)\n>  \t\tscissors=t ;;\n>  \t--no-scissors)\n"},{"id":"196301","messageId":"501989F3.7080907@windriver.com","threadId":"31163","inReplyTo":"7v1ujqfnyg.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-am: make a config setting for --keep-non-patch switch","fromName":"Paul Gortmaker","fromEmail":"paul.gortmaker@windriver.com","sentAt":"2012-08-01T19:56:35Z","receivedAt":"2012-08-01T19:56:35Z","isPatch":true,"sender":{"key":"paul.gortmaker@windriver.com","avatar":null},"body":"On 12-08-01 02:48 PM, Junio C Hamano wrote:\n> Paul Gortmaker <paul.gortmaker@windriver.com> writes:\n> \n>> In order to make a commit be invariant (excluding ID) over\n>> a format-patch and subsequent am cycle, one needs to use\n>> the '--keep-non-patch' so that commits like:\n>>\n>> \t[PATCH] [i386] fix foo bar arch/x86/mm\n>>\n>> only lose the [PATCH] and not the [i386] part.  Since it\n>> is a common desire (e.g. linux kernel stable trees) to have\n>> the subjects remain invariant during a backport, there is\n>> a genuine need for making this the default behaviour from\n>> a config file, versus specifying it in scripts and on the\n>> command line each time.\n>>\n>> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>\n>> ---\n>>\n>> See http://lkml.indiana.edu/hypermail/linux/kernel/1203.1/01817.html\n>> for additional background; stable maintainers using it etc.\n> \n> That's a blast from the past; it would have been so much nicer\n> if the patch came earlier ;-)\n\nI just happened to \"rediscover\" the issue yesterday when backporting\na patch that had [S390] in it to linux-2.6.34 -- went looking for\nany possible previous reports and found the above thread.  So the\ntiming was largely out of my control.  :)\n\n> \n> The patch looks from sane; we may want to have a test in t4150, just like\n> we have tests for am.keepcr in t4253.  We have plenty of time as we\n> are in feature freeze right now.\n\nI'll take a look at the test cases, and resend once 1.7.12 is done.\n\nPaul.\n--\n\n> \n> Thanks.\n> \n>>\n>>  Documentation/config.txt               | 9 +++++++++\n>>  Documentation/git-am.txt               | 4 ++++\n>>  contrib/completion/git-completion.bash | 1 +\n>>  git-am.sh                              | 8 ++++++++\n>>  4 files changed, 22 insertions(+)\n>>\n>> diff --git a/Documentation/config.txt b/Documentation/config.txt\n>> index a95e5a4..47aded5 100644\n>> --- a/Documentation/config.txt\n>> +++ b/Documentation/config.txt\n>> @@ -655,6 +655,15 @@ am.keepcr::\n>>  \tby giving '--no-keep-cr' from the command line.\n>>  \tSee linkgit:git-am[1], linkgit:git-mailsplit[1].\n>>  \n>> +am.keepnonpatch::\n>> +\tNormally git-mailinfo strips from the Subject line, all leading\n>> +\tstrings bracketed with [ and ] pairs.  If this setting is true,\n>> +\tgit-am will call git-mailinfo with the parameter '-b' so that only\n>> +\tthe pairs whose bracketed string contains the word \"PATCH\" are\n>> +\tstripped.  Can be overridden by giving ' '--no-keep-non-patch'\n>> +\tfrom the command line.\n>> +\tSee linkgit:git-am[1], linkgit:git-mailinfo[1].\n>> +\n>>  apply.ignorewhitespace::\n>>  \tWhen set to 'change', tells 'git apply' to ignore changes in\n>>  \twhitespace, in the same way as the '--ignore-space-change'\n>> diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\n>> index 19d57a8..790efdb 100644\n>> --- a/Documentation/git-am.txt\n>> +++ b/Documentation/git-am.txt\n>> @@ -41,7 +41,11 @@ OPTIONS\n>>  \tPass `-k` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).\n>>  \n>>  --keep-non-patch::\n>> +--no-keep-non-patch::\n>>  \tPass `-b` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).\n>> +\tThe `am.keepnonpatch` configuration variable can be used to specify\n>> +\tthe default behaviour.  The `--no-keep-non-patch` is useful to\n>> +\toverride any `am.keepnonpatch` setting.\n>>  \n>>  --keep-cr::\n>>  --no-keep-cr::\n>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n>> index ffedce7..04339df 100644\n>> --- a/contrib/completion/git-completion.bash\n>> +++ b/contrib/completion/git-completion.bash\n>> @@ -1758,6 +1758,7 @@ _git_config ()\n>>  \t\tadvice.statusHints\n>>  \t\talias.\n>>  \t\tam.keepcr\n>> +\t\tam.keepnonpatch\n>>  \t\tapply.ignorewhitespace\n>>  \t\tapply.whitespace\n>>  \t\tbranch.autosetupmerge\n>> diff --git a/git-am.sh b/git-am.sh\n>> index c02e62d..9f6adbf 100755\n>> --- a/git-am.sh\n>> +++ b/git-am.sh\n>> @@ -16,6 +16,7 @@ s,signoff       add a Signed-off-by line to the commit message\n>>  u,utf8          recode into utf8 (default)\n>>  k,keep          pass -k flag to git-mailinfo\n>>  keep-non-patch  pass -b flag to git-mailinfo\n>> +no-keep-non-patch do not pass -b flag to git-mailsplit, independent of am.keepnonpatch\n>>  keep-cr         pass --keep-cr flag to git-mailsplit for mbox format\n>>  no-keep-cr      do not pass --keep-cr flag to git-mailsplit independent of am.keepcr\n>>  c,scissors      strip everything before a scissors line\n>> @@ -381,6 +382,11 @@ then\n>>      keepcr=t\n>>  fi\n>>  \n>> +if test \"$(git config --bool --get am.keepnonpatch)\" = true\n>> +then\n>> +    keep=b\n>> +fi\n>> +\n>>  while test $# != 0\n>>  do\n>>  \tcase \"$1\" in\n>> @@ -402,6 +408,8 @@ do\n>>  \t\tkeep=t ;;\n>>  \t--keep-non-patch)\n>>  \t\tkeep=b ;;\n>> +\t--no-keep-non-patch)\n>> +\t\tkeep= ;;\n>>  \t-c|--scissors)\n>>  \t\tscissors=t ;;\n>>  \t--no-scissors)\n"}]}