summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ad2c928)
raw | patch | inline | side by side (parent: ad2c928)
author | Stefan-W. Hahn <stefan.hahn@s-hahn.de> | |
Sat, 27 Feb 2010 14:20:27 +0000 (15:20 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 28 Feb 2010 19:07:49 +0000 (11:07 -0800) |
This patch adds the configuration `am.keepcr` for git-am. It also adds
`--no-keep-cr` parameter for git-am to give the possibility to
override configuration from command line.
Signed-off-by: Stefan-W. Hahn <stefan.hahn@s-hahn.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
`--no-keep-cr` parameter for git-am to give the possibility to
override configuration from command line.
Signed-off-by: Stefan-W. Hahn <stefan.hahn@s-hahn.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config.txt | patch | blob | history | |
Documentation/git-am.txt | patch | blob | history | |
git-am.sh | patch | blob | history |
index 664de6b1ab1fa187ff510eda414c46b5213a8397..dcbbdad661bcb40cf6caf79326ed4699d8beca99 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
executed from the top-level directory of a repository, which may
not necessarily be the current directory.
+am.keepcr::
+ If true, git-am will call git-mailsplit for patches in mbox format
+ with parameter '--keep-cr'. In this case git-mailsplit will
+ not remove `\r` from lines ending with `\r\n`. Can be overrriden
+ by giving '--no-keep-cr' from the command line.
+ See linkgit:git-am[1], linkgit:git-mailsplit[1].
+
apply.ignorewhitespace::
When set to 'change', tells 'git apply' to ignore changes in
whitespace, in the same way as the '--ignore-space-change'
index eefdc4b9dea49d411780eb32ae90f1784619c77a..70bc698a356b13425437418498ec577858304953 100644 (file)
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
SYNOPSIS
--------
[verse]
-'git am' [--signoff] [--keep] [--keep-cr] [--utf8 | --no-utf8]
+'git am' [--signoff] [--keep] [--keep-cr | --no-keep-cr] [--utf8 | --no-utf8]
[--3way] [--interactive] [--committer-date-is-author-date]
[--ignore-date] [--ignore-space-change | --ignore-whitespace]
[--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
Pass `-k` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).
--keep-cr::
+--no-keep-cr::
With `--keep-cr`, call 'git mailsplit' (see linkgit:git-mailsplit[1])
with the same option, to prevent it from stripping CR at the end of
- lines.
+ lines. `am.keepcr` configuration variable can be used to specify the
+ default behaviour. `--no-keep-cr` is useful to override `am.keepcr`.
-c::
--scissors::
diff --git a/git-am.sh b/git-am.sh
index dc8d242beb473410087f237136958116c0d09339..a2004506c551ae484cae2a23044015cbeee64ba7 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
u,utf8 recode into utf8 (default)
k,keep pass -k flag to git-mailinfo
keep-cr pass --keep-cr flag to git-mailsplit for mbox format
+no-keep-cr do not pass --keep-cr flag to git-mailsplit independent of am.keepcr
c,scissors strip everything before a scissors line
whitespace= pass it through git-apply
ignore-space-change pass it through git-apply
split_patches () {
case "$patch_format" in
mbox)
- if test -n "$rebasing$keepcr"
+ if test -n "$rebasing" || test t = "$keepcr"
then
keep_cr=--keep-cr
else
ignore_date=
allow_rerere_autoupdate=
+if test "$(git config --bool --get am.keepcr)" = true
+then
+ keepcr=t
+fi
+
while test $# != 0
do
case "$1" in
GIT_QUIET=t ;;
--keep-cr)
keepcr=t ;;
+ --no-keep-cr)
+ keepcr=f ;;
--)
shift; break ;;
*)
then
keep=-k
fi
-if test "$(cat "$dotest/keepcr")" = t
-then
- keepcr=--keep-cr
-fi
+case "$(cat "$dotest/keepcr")" in
+t)
+ keepcr=--keep-cr ;;
+f)
+ keepcr=--no-keep-cr ;;
+esac
case "$(cat "$dotest/scissors")" in
t)
scissors=--scissors ;;