* [PATCH/RFC v2 1/2] t4150-am: refactor am -3 tests
@ 2015-06-02 13:24 Remi Lespinet
2015-06-02 13:24 ` [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable Remi Lespinet
0 siblings, 1 reply; 8+ messages in thread
From: Remi Lespinet @ 2015-06-02 13:24 UTC (permalink / raw)
To: git
Cc: Remi Galan, Remi Lespinet, Guillaume Pages,
Louis-Alexandre Stuber, Antoine Delaite, Matthieu Moy
Create a setup for git am -3 in a separate test instead of creating
this setup each time.
This prepares for the next commit which will use this setup as well.
Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
---
I removed the function creating temporary branch for now, because this
would have cost too much time reviewing. I've just done a refactoring
to simplify changes introduced in the next commit.
t/t4150-am.sh | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 306e6f3..6ced98c 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -274,15 +274,21 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' '
grep "^\[foo\] third" actual
'
+test_expect_success 'setup am -3' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout -b base3way master2 &&
+ sed -n -e "3,\$p" msg >file &&
+ head -n 9 msg >>file &&
+ git add file &&
+ test_tick &&
+ git commit -m "copied stuff"
+'
+
test_expect_success 'am -3 falls back to 3-way merge' '
rm -fr .git/rebase-apply &&
git reset --hard &&
- git checkout -b lorem2 master2 &&
- sed -n -e "3,\$p" msg >file &&
- head -n 9 msg >>file &&
- git add file &&
- test_tick &&
- git commit -m "copied stuff" &&
+ git checkout -b lorem2 base3way &&
git am -3 lorem-move.patch &&
test_path_is_missing .git/rebase-apply &&
git diff --exit-code lorem
@@ -291,12 +297,7 @@ test_expect_success 'am -3 falls back to 3-way merge' '
test_expect_success 'am -3 -p0 can read --no-prefix patch' '
rm -fr .git/rebase-apply &&
git reset --hard &&
- git checkout -b lorem3 master2 &&
- sed -n -e "3,\$p" msg >file &&
- head -n 9 msg >>file &&
- git add file &&
- test_tick &&
- git commit -m "copied stuff" &&
+ git checkout -b lorem3 base3way &&
git am -3 -p0 lorem-zero.patch &&
test_path_is_missing .git/rebase-apply &&
git diff --exit-code lorem
@@ -338,12 +339,7 @@ test_expect_success 'am -3 can rename a file after falling back to 3-way merge'
test_expect_success 'am -3 -q is quiet' '
rm -fr .git/rebase-apply &&
git checkout -f lorem2 &&
- git reset master2 --hard &&
- sed -n -e "3,\$p" msg >file &&
- head -n 9 msg >>file &&
- git add file &&
- test_tick &&
- git commit -m "copied stuff" &&
+ git reset base3way --hard &&
git am -3 -q lorem-move.patch >output.out 2>&1 &&
! test -s output.out
'
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable
2015-06-02 13:24 [PATCH/RFC v2 1/2] t4150-am: refactor am -3 tests Remi Lespinet
@ 2015-06-02 13:24 ` Remi Lespinet
2015-06-02 13:37 ` Matthieu Moy
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Remi Lespinet @ 2015-06-02 13:24 UTC (permalink / raw)
To: git
Cc: Remi Galan, Remi Lespinet, Guillaume Pages,
Louis-Alexandre Stuber, Antoine Delaite, Matthieu Moy
Add the am.threeWay configuration variable to use the -3 or --3way
option of git am by default. When am.threeway is set and not desired
for a specific git am command, the --no-3way option can be used to
override it.
Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
---
Documentation/config.txt | 7 +++++++
Documentation/git-am.txt | 6 ++++--
git-am.sh | 7 +++++++
t/t4150-am.sh | 19 +++++++++++++++++++
4 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index d44bc85..8e42752 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -769,6 +769,13 @@ am.keepcr::
by giving '--no-keep-cr' from the command line.
See linkgit:git-am[1], linkgit:git-mailsplit[1].
+am.threeWay::
+ If true, git-am will fall back on 3-way merge when the patch
+ cannot be applied cleanly, in the same way as the '-3' or
+ '--3-way' option. Can be overridden by giving '--no-3-way'
+ from the command line.
+ See linkgit:git-am[1].
+
apply.ignoreWhitespace::
When set to 'change', tells 'git apply' to ignore changes in
whitespace, in the same way as the '--ignore-space-change'
diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index 0d8ba48..3190c05 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -89,11 +89,13 @@ default. You can use `--no-utf8` to override this.
linkgit:git-mailinfo[1]).
-3::
---3way::
+--[no-]3way::
When the patch does not apply cleanly, fall back on
3-way merge if the patch records the identity of blobs
it is supposed to apply to and we have those blobs
- available locally.
+ available locally. `am.threeWay` configuration variable
+ can be used to specify the default behaviour. `--no-3way`
+ is useful to override `am.threeWay`.
--ignore-space-change::
--ignore-whitespace::
diff --git a/git-am.sh b/git-am.sh
index 761befb..781507c 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -389,6 +389,11 @@ then
keepcr=t
fi
+if test "$(git config --bool --get am.threeWay)" = true
+then
+ threeway=t
+fi
+
while test $# != 0
do
case "$1" in
@@ -400,6 +405,8 @@ it will be removed. Please do not use it anymore."
;;
-3|--3way)
threeway=t ;;
+ --no-3way)
+ threeway=f ;;
-s|--signoff)
sign=t ;;
-u|--utf8)
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 6ced98c..b822a39 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -303,6 +303,25 @@ test_expect_success 'am -3 -p0 can read --no-prefix patch' '
git diff --exit-code lorem
'
+test_expect_success 'am with config am.threeWay falls back to 3-way merge' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout -b lorem4 base3way &&
+ test_config am.threeWay 1 &&
+ git am lorem-move.patch &&
+ test_path_is_missing .git/rebase-apply &&
+ git diff --exit-code lorem
+'
+
+test_expect_success 'am with config am.threeWay overridden by --no-3way' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout -b lorem5 base3way &&
+ test_config am.threeWay 1 &&
+ test_must_fail git am --no-3way lorem-move.patch &&
+ test_path_is_dir .git/rebase-apply
+'
+
test_expect_success 'am can rename a file' '
grep "^rename from" rename.patch &&
rm -fr .git/rebase-apply &&
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable
2015-06-02 13:24 ` [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable Remi Lespinet
@ 2015-06-02 13:37 ` Matthieu Moy
2015-06-02 13:52 ` Remi LESPINET
2015-06-02 14:37 ` Paul Tan
2015-06-02 13:58 ` Mikael Magnusson
2015-06-02 14:13 ` Matthieu Moy
2 siblings, 2 replies; 8+ messages in thread
From: Matthieu Moy @ 2015-06-02 13:37 UTC (permalink / raw)
To: Remi Lespinet
Cc: git, Remi Galan, Guillaume Pages, Louis-Alexandre Stuber,
Antoine Delaite
Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:
> +if test "$(git config --bool --get am.threeWay)" = true
> +then
> + threeway=t
> +fi
I think you missed Paul's remark on this:
http://article.gmane.org/gmane.comp.version-control.git/270150
Not terribly important since am will be rewritten soon, though.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable
2015-06-02 13:37 ` Matthieu Moy
@ 2015-06-02 13:52 ` Remi LESPINET
2015-06-02 14:01 ` Eric Sunshine
2015-06-02 14:37 ` Paul Tan
1 sibling, 1 reply; 8+ messages in thread
From: Remi LESPINET @ 2015-06-02 13:52 UTC (permalink / raw)
To: Matthieu Moy
Cc: git, Remi Galan, Guillaume Pages, Louis-Alexandre Stuber,
Antoine Delaite
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
> Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:
>
> > +if test "$(git config --bool --get am.threeWay)" = true
> > +then
> > + threeway=t
> > +fi
>
> I think you missed Paul's remark on this:
>
> http://article.gmane.org/gmane.comp.version-control.git/270150
>
> Not terribly important since am will be rewritten soon, though.
Oh right, sorry about that, I modify it and I resend the patch asap
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable
2015-06-02 13:52 ` Remi LESPINET
@ 2015-06-02 14:01 ` Eric Sunshine
0 siblings, 0 replies; 8+ messages in thread
From: Eric Sunshine @ 2015-06-02 14:01 UTC (permalink / raw)
To: Remi LESPINET
Cc: Matthieu Moy, Git List, Remi Galan, Guillaume Pages,
Louis-Alexandre Stuber, Antoine Delaite
On Tue, Jun 2, 2015 at 9:52 AM, Remi LESPINET
<remi.lespinet@ensimag.grenoble-inp.fr> wrote:
> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
>
>> Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:
>>
>> > +if test "$(git config --bool --get am.threeWay)" = true
>> > +then
>> > + threeway=t
>> > +fi
>>
>> I think you missed Paul's remark on this:
>>
>> http://article.gmane.org/gmane.comp.version-control.git/270150
>>
>> Not terribly important since am will be rewritten soon, though.
>
> Oh right, sorry about that, I modify it and I resend the patch asap
In fact, it looks like all of Paul's remarks were missed. (The bit at
the bottom of his review is also important.)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable
2015-06-02 13:37 ` Matthieu Moy
2015-06-02 13:52 ` Remi LESPINET
@ 2015-06-02 14:37 ` Paul Tan
1 sibling, 0 replies; 8+ messages in thread
From: Paul Tan @ 2015-06-02 14:37 UTC (permalink / raw)
To: Matthieu Moy
Cc: Remi Lespinet, Git List, Remi Galan, Guillaume Pages,
Louis-Alexandre Stuber, Antoine Delaite
Hi,
On Tue, Jun 2, 2015 at 9:37 PM, Matthieu Moy
<Matthieu.Moy@grenoble-inp.fr> wrote:
> Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:
>
>> +if test "$(git config --bool --get am.threeWay)" = true
>> +then
>> + threeway=t
>> +fi
>
> I think you missed Paul's remark on this:
>
> http://article.gmane.org/gmane.comp.version-control.git/270150
>
> Not terribly important since am will be rewritten soon, though.
As the person who had to do four preparatory patch series' to fix bugs
for the rewrite of git-pull, I respectfully disagree ;-)
Regards,
Paul
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable
2015-06-02 13:24 ` [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable Remi Lespinet
2015-06-02 13:37 ` Matthieu Moy
@ 2015-06-02 13:58 ` Mikael Magnusson
2015-06-02 14:13 ` Matthieu Moy
2 siblings, 0 replies; 8+ messages in thread
From: Mikael Magnusson @ 2015-06-02 13:58 UTC (permalink / raw)
To: Remi Lespinet
Cc: git, Remi Galan, Guillaume Pages, Louis-Alexandre Stuber,
Antoine Delaite, Matthieu Moy
On Tue, Jun 2, 2015 at 3:24 PM, Remi Lespinet
<remi.lespinet@ensimag.grenoble-inp.fr> wrote:
> Add the am.threeWay configuration variable to use the -3 or --3way
> option of git am by default. When am.threeway is set and not desired
> for a specific git am command, the --no-3way option can be used to
> override it.
>
> Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
> ---
> Documentation/config.txt | 7 +++++++
> Documentation/git-am.txt | 6 ++++--
> git-am.sh | 7 +++++++
> t/t4150-am.sh | 19 +++++++++++++++++++
> 4 files changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index d44bc85..8e42752 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -769,6 +769,13 @@ am.keepcr::
> by giving '--no-keep-cr' from the command line.
> See linkgit:git-am[1], linkgit:git-mailsplit[1].
>
> +am.threeWay::
> + If true, git-am will fall back on 3-way merge when the patch
> + cannot be applied cleanly, in the same way as the '-3' or
> + '--3-way' option. Can be overridden by giving '--no-3-way'
> + from the command line.
> + See linkgit:git-am[1].
> +
This part spells it 3-way while everywhere else appears to be 3way.
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable
2015-06-02 13:24 ` [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable Remi Lespinet
2015-06-02 13:37 ` Matthieu Moy
2015-06-02 13:58 ` Mikael Magnusson
@ 2015-06-02 14:13 ` Matthieu Moy
2 siblings, 0 replies; 8+ messages in thread
From: Matthieu Moy @ 2015-06-02 14:13 UTC (permalink / raw)
To: Remi Lespinet
Cc: git, Remi Galan, Guillaume Pages, Louis-Alexandre Stuber,
Antoine Delaite
Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:
> Add the am.threeWay configuration variable to use the -3 or --3way
> option of git am by default. When am.threeway is set and not desired
> for a specific git am command, the --no-3way option can be used to
> override it.
>
> Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
> ---
> Documentation/config.txt | 7 +++++++
> Documentation/git-am.txt | 6 ++++--
> git-am.sh | 7 +++++++
> t/t4150-am.sh | 19 +++++++++++++++++++
> 4 files changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index d44bc85..8e42752 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -769,6 +769,13 @@ am.keepcr::
> by giving '--no-keep-cr' from the command line.
> See linkgit:git-am[1], linkgit:git-mailsplit[1].
>
> +am.threeWay::
> + If true, git-am will fall back on 3-way merge when the patch
git-am should be spelled `git am` or 'git am' (the second is used a lot
in git-am.txt, but Documentation/CodingGuidelines says:
Literal examples (e.g. use of command-line options, command names, and
configuration variables) are typeset in monospace, and if you can use
`backticks around word phrases`, do so.
`--pretty=oneline`
`git rev-list`
`remote.pushDefault`
) so I guess the first is the right way to typeset it.
FYI, the syntax git-am actually existed in the past (before git 1.6).
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-06-02 14:37 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 13:24 [PATCH/RFC v2 1/2] t4150-am: refactor am -3 tests Remi Lespinet
2015-06-02 13:24 ` [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable Remi Lespinet
2015-06-02 13:37 ` Matthieu Moy
2015-06-02 13:52 ` Remi LESPINET
2015-06-02 14:01 ` Eric Sunshine
2015-06-02 14:37 ` Paul Tan
2015-06-02 13:58 ` Mikael Magnusson
2015-06-02 14:13 ` Matthieu Moy
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).