git-am: Add am.keepcr and --no-keep-cr to override it
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>
This commit is contained in:
parent
ad2c928001
commit
e80d4cbefc
@ -555,6 +555,13 @@ it will be treated as a shell command. For example, defining
|
|||||||
executed from the top-level directory of a repository, which may
|
executed from the top-level directory of a repository, which may
|
||||||
not necessarily be the current directory.
|
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::
|
apply.ignorewhitespace::
|
||||||
When set to 'change', tells 'git apply' to ignore changes in
|
When set to 'change', tells 'git apply' to ignore changes in
|
||||||
whitespace, in the same way as the '--ignore-space-change'
|
whitespace, in the same way as the '--ignore-space-change'
|
||||||
|
@ -9,7 +9,7 @@ git-am - Apply a series of patches from a mailbox
|
|||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
[verse]
|
[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]
|
[--3way] [--interactive] [--committer-date-is-author-date]
|
||||||
[--ignore-date] [--ignore-space-change | --ignore-whitespace]
|
[--ignore-date] [--ignore-space-change | --ignore-whitespace]
|
||||||
[--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
|
[--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
|
||||||
@ -40,9 +40,11 @@ OPTIONS
|
|||||||
Pass `-k` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).
|
Pass `-k` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).
|
||||||
|
|
||||||
--keep-cr::
|
--keep-cr::
|
||||||
|
--no-keep-cr::
|
||||||
With `--keep-cr`, call 'git mailsplit' (see linkgit:git-mailsplit[1])
|
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
|
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::
|
-c::
|
||||||
--scissors::
|
--scissors::
|
||||||
|
20
git-am.sh
20
git-am.sh
@ -16,6 +16,7 @@ s,signoff add a Signed-off-by line to the commit message
|
|||||||
u,utf8 recode into utf8 (default)
|
u,utf8 recode into utf8 (default)
|
||||||
k,keep pass -k flag to git-mailinfo
|
k,keep pass -k flag to git-mailinfo
|
||||||
keep-cr pass --keep-cr flag to git-mailsplit for mbox format
|
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
|
c,scissors strip everything before a scissors line
|
||||||
whitespace= pass it through git-apply
|
whitespace= pass it through git-apply
|
||||||
ignore-space-change pass it through git-apply
|
ignore-space-change pass it through git-apply
|
||||||
@ -218,7 +219,7 @@ check_patch_format () {
|
|||||||
split_patches () {
|
split_patches () {
|
||||||
case "$patch_format" in
|
case "$patch_format" in
|
||||||
mbox)
|
mbox)
|
||||||
if test -n "$rebasing$keepcr"
|
if test -n "$rebasing" || test t = "$keepcr"
|
||||||
then
|
then
|
||||||
keep_cr=--keep-cr
|
keep_cr=--keep-cr
|
||||||
else
|
else
|
||||||
@ -299,6 +300,11 @@ committer_date_is_author_date=
|
|||||||
ignore_date=
|
ignore_date=
|
||||||
allow_rerere_autoupdate=
|
allow_rerere_autoupdate=
|
||||||
|
|
||||||
|
if test "$(git config --bool --get am.keepcr)" = true
|
||||||
|
then
|
||||||
|
keepcr=t
|
||||||
|
fi
|
||||||
|
|
||||||
while test $# != 0
|
while test $# != 0
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -351,6 +357,8 @@ do
|
|||||||
GIT_QUIET=t ;;
|
GIT_QUIET=t ;;
|
||||||
--keep-cr)
|
--keep-cr)
|
||||||
keepcr=t ;;
|
keepcr=t ;;
|
||||||
|
--no-keep-cr)
|
||||||
|
keepcr=f ;;
|
||||||
--)
|
--)
|
||||||
shift; break ;;
|
shift; break ;;
|
||||||
*)
|
*)
|
||||||
@ -500,10 +508,12 @@ if test "$(cat "$dotest/keep")" = t
|
|||||||
then
|
then
|
||||||
keep=-k
|
keep=-k
|
||||||
fi
|
fi
|
||||||
if test "$(cat "$dotest/keepcr")" = t
|
case "$(cat "$dotest/keepcr")" in
|
||||||
then
|
t)
|
||||||
keepcr=--keep-cr
|
keepcr=--keep-cr ;;
|
||||||
fi
|
f)
|
||||||
|
keepcr=--no-keep-cr ;;
|
||||||
|
esac
|
||||||
case "$(cat "$dotest/scissors")" in
|
case "$(cat "$dotest/scissors")" in
|
||||||
t)
|
t)
|
||||||
scissors=--scissors ;;
|
scissors=--scissors ;;
|
||||||
|
Loading…
Reference in New Issue
Block a user