File tree Expand file tree Collapse file tree 4 files changed +34
-2
lines changed
Expand file tree Collapse file tree 4 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -769,6 +769,14 @@ am.keepcr::
769769 by giving '--no-keep-cr' from the command line.
770770 See linkgit:git-am[1], linkgit:git-mailsplit[1].
771771
772+ am.threeWay::
773+ By default, `git am` will fail if the patch does not apply cleanly. When
774+ set to true, this setting tells `git am` to fall back on 3-way merge if
775+ the patch records the identity of blobs it is supposed to apply to and
776+ we have those blobs available locally (equivalent to giving the `--3way`
777+ option from the command line). Defaults to `false`.
778+ See linkgit:git-am[1].
779+
772780apply.ignoreWhitespace::
773781 When set to 'change', tells 'git apply' to ignore changes in
774782 whitespace, in the same way as the '--ignore-space-change'
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ SYNOPSIS
1010--------
1111[verse]
1212'git am' [--signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8]
13- [--3way] [--interactive] [--committer-date-is-author-date]
13+ [--[no-] 3way] [--interactive] [--committer-date-is-author-date]
1414 [--ignore-date] [--ignore-space-change | --ignore-whitespace]
1515 [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
1616 [--exclude=<path>] [--include=<path>] [--reject] [-q | --quiet]
@@ -90,10 +90,13 @@ default. You can use `--no-utf8` to override this.
9090
9191-3::
9292--3way::
93+ --no-3way::
9394 When the patch does not apply cleanly, fall back on
9495 3-way merge if the patch records the identity of blobs
9596 it is supposed to apply to and we have those blobs
96- available locally.
97+ available locally. `--no-3way` can be used to override
98+ am.threeWay configuration variable. For more information,
99+ see am.threeWay in linkgit:git-config[1].
97100
98101--ignore-space-change::
99102--ignore-whitespace::
Original file line number Diff line number Diff line change @@ -152,6 +152,8 @@ static void am_state_init(struct am_state *state, const char *dir)
152152
153153 state -> prec = 4 ;
154154
155+ git_config_get_bool ("am.threeway" , & state -> threeway );
156+
155157 state -> utf8 = 1 ;
156158
157159 git_config_get_bool ("am.messageid" , & state -> message_id );
Original file line number Diff line number Diff line change @@ -551,6 +551,25 @@ test_expect_success 'am -3 -p0 can read --no-prefix patch' '
551551 git diff --exit-code lorem
552552'
553553
554+ test_expect_success ' am with config am.threeWay falls back to 3-way merge' '
555+ rm -fr .git/rebase-apply &&
556+ git reset --hard &&
557+ git checkout -b lorem4 base3way &&
558+ test_config am.threeWay 1 &&
559+ git am lorem-move.patch &&
560+ test_path_is_missing .git/rebase-apply &&
561+ git diff --exit-code lorem
562+ '
563+
564+ test_expect_success ' am with config am.threeWay overridden by --no-3way' '
565+ rm -fr .git/rebase-apply &&
566+ git reset --hard &&
567+ git checkout -b lorem5 base3way &&
568+ test_config am.threeWay 1 &&
569+ test_must_fail git am --no-3way lorem-move.patch &&
570+ test_path_is_dir .git/rebase-apply
571+ '
572+
554573test_expect_success ' am can rename a file' '
555574 grep "^rename from" rename.patch &&
556575 rm -fr .git/rebase-apply &&
You can’t perform that action at this time.
0 commit comments