git-merge: do up-to-date check also for all strategies
This clarifies the logic to omit fast-forward check and omit
trivial merge before running the specified strategy.
The "index_merge" variable started out as a flag to say "do not
do anything clever", but when recursive was changed to skip the
trivial merge, the semantics were changed and the variable alone
does not make sense anymore.
This splits the variable into two, allow_fast_forward (which is
almost always true, and avoids making a merge commit when the
other commit is a descendant of our branch, but is set to false
for ours and subtree) and allow_trivial_merge (which is false
for ours, recursive and subtree).
Unlike the earlier implementation, the "ours" strategy allows an
up-to-date condition. When we are up-to-date, the result will
be our commit, and by definition, we will have our tree as the
result.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-16 06:19:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2009-10-24 08:31:32 +00:00
|
|
|
test_description='merge fast-forward and up to date'
|
git-merge: do up-to-date check also for all strategies
This clarifies the logic to omit fast-forward check and omit
trivial merge before running the specified strategy.
The "index_merge" variable started out as a flag to say "do not
do anything clever", but when recursive was changed to skip the
trivial merge, the semantics were changed and the variable alone
does not make sense anymore.
This splits the variable into two, allow_fast_forward (which is
almost always true, and avoids making a merge commit when the
other commit is a descendant of our branch, but is set to false
for ours and subtree) and allow_trivial_merge (which is false
for ours, recursive and subtree).
Unlike the earlier implementation, the "ours" strategy allows an
up-to-date condition. When we are up-to-date, the result will
be our commit, and by definition, we will have our tree as the
result.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-16 06:19:55 +00:00
|
|
|
|
leak tests: mark passing SANITIZE=leak tests as leak-free
Mark those remaining tests that pass when run under SANITIZE=leak with
TEST_PASSES_SANITIZE_LEAK=true, these were either omitted in
f346fcb62a0 (Merge branch 'ab/mark-leak-free-tests-even-more',
2021-12-15) and 5a4f8381b68 (Merge branch 'ab/mark-leak-free-tests',
2021-10-25), or have had their memory leaks fixed since then.
With this change there's now a a one-to-one mapping between those
tests that we have opted-in via "TEST_PASSES_SANITIZE_LEAK=true", and
those that pass with the new "check" mode:
GIT_TEST_PASSING_SANITIZE_LEAK=check \
GIT_TEST_SANITIZE_LEAK_LOG=true \
make test SANITIZE=leak
Note that the "GIT_TEST_SANITIZE_LEAK_LOG=true" is needed due to the
edge cases noted in a preceding commit, i.e. in some cases we'd pass
the test itself, but still have outstanding leaks due to ignored exit
codes.
The "GIT_TEST_SANITIZE_LEAK_LOG=true" corrects for that, we're only
marking those tests as passing that really don't have any leaks,
whether that was reflected in their exit code or not.
Note that the change here to "t9100-git-svn-basic.sh" is marking that
test as passing under SANITIZE=leak, we're removing a
"TEST_FAILS_SANITIZE_LEAK=true" line, not
"TEST_PASSES_SANITIZE_LEAK=true". See 7a98d9ab00d (revisions API: have
release_revisions() release "cmdline", 2022-04-13) for the
introduction of that t/lib-git-svn.sh-specific variable.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-27 23:13:41 +00:00
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
git-merge: do up-to-date check also for all strategies
This clarifies the logic to omit fast-forward check and omit
trivial merge before running the specified strategy.
The "index_merge" variable started out as a flag to say "do not
do anything clever", but when recursive was changed to skip the
trivial merge, the semantics were changed and the variable alone
does not make sense anymore.
This splits the variable into two, allow_fast_forward (which is
almost always true, and avoids making a merge commit when the
other commit is a descendant of our branch, but is set to false
for ours and subtree) and allow_trivial_merge (which is false
for ours, recursive and subtree).
Unlike the earlier implementation, the "ours" strategy allows an
up-to-date condition. When we are up-to-date, the result will
be our commit, and by definition, we will have our tree as the
result.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-16 06:19:55 +00:00
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success setup '
|
|
|
|
>file &&
|
|
|
|
git add file &&
|
|
|
|
test_tick &&
|
|
|
|
git commit -m initial &&
|
|
|
|
git tag c0 &&
|
|
|
|
|
|
|
|
echo second >file &&
|
|
|
|
git add file &&
|
|
|
|
test_tick &&
|
|
|
|
git commit -m second &&
|
|
|
|
git tag c1 &&
|
2012-02-13 11:48:56 +00:00
|
|
|
git branch test &&
|
|
|
|
echo third >file &&
|
|
|
|
git add file &&
|
|
|
|
test_tick &&
|
|
|
|
git commit -m third &&
|
|
|
|
git tag c2
|
git-merge: do up-to-date check also for all strategies
This clarifies the logic to omit fast-forward check and omit
trivial merge before running the specified strategy.
The "index_merge" variable started out as a flag to say "do not
do anything clever", but when recursive was changed to skip the
trivial merge, the semantics were changed and the variable alone
does not make sense anymore.
This splits the variable into two, allow_fast_forward (which is
almost always true, and avoids making a merge commit when the
other commit is a descendant of our branch, but is set to false
for ours and subtree) and allow_trivial_merge (which is false
for ours, recursive and subtree).
Unlike the earlier implementation, the "ours" strategy allows an
up-to-date condition. When we are up-to-date, the result will
be our commit, and by definition, we will have our tree as the
result.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-16 06:19:55 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'merge -s recursive up-to-date' '
|
|
|
|
|
|
|
|
git reset --hard c1 &&
|
|
|
|
test_tick &&
|
|
|
|
git merge -s recursive c0 &&
|
|
|
|
expect=$(git rev-parse c1) &&
|
|
|
|
current=$(git rev-parse HEAD) &&
|
|
|
|
test "$expect" = "$current"
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'merge -s recursive fast-forward' '
|
|
|
|
|
|
|
|
git reset --hard c0 &&
|
|
|
|
test_tick &&
|
|
|
|
git merge -s recursive c1 &&
|
|
|
|
expect=$(git rev-parse c1) &&
|
|
|
|
current=$(git rev-parse HEAD) &&
|
|
|
|
test "$expect" = "$current"
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'merge -s ours up-to-date' '
|
|
|
|
|
|
|
|
git reset --hard c1 &&
|
|
|
|
test_tick &&
|
|
|
|
git merge -s ours c0 &&
|
|
|
|
expect=$(git rev-parse c1) &&
|
|
|
|
current=$(git rev-parse HEAD) &&
|
|
|
|
test "$expect" = "$current"
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'merge -s ours fast-forward' '
|
|
|
|
|
|
|
|
git reset --hard c0 &&
|
|
|
|
test_tick &&
|
|
|
|
git merge -s ours c1 &&
|
|
|
|
expect=$(git rev-parse c0^{tree}) &&
|
|
|
|
current=$(git rev-parse HEAD^{tree}) &&
|
|
|
|
test "$expect" = "$current"
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'merge -s subtree up-to-date' '
|
|
|
|
|
|
|
|
git reset --hard c1 &&
|
|
|
|
test_tick &&
|
|
|
|
git merge -s subtree c0 &&
|
|
|
|
expect=$(git rev-parse c1) &&
|
|
|
|
current=$(git rev-parse HEAD) &&
|
|
|
|
test "$expect" = "$current"
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2012-04-17 19:22:26 +00:00
|
|
|
test_expect_success 'merge fast-forward octopus' '
|
2012-02-13 11:48:56 +00:00
|
|
|
|
|
|
|
git reset --hard c0 &&
|
|
|
|
test_tick &&
|
2015-03-20 10:06:44 +00:00
|
|
|
git merge c1 c2 &&
|
2012-02-13 11:48:56 +00:00
|
|
|
expect=$(git rev-parse c2) &&
|
|
|
|
current=$(git rev-parse HEAD) &&
|
|
|
|
test "$expect" = "$current"
|
|
|
|
'
|
|
|
|
|
git-merge: do up-to-date check also for all strategies
This clarifies the logic to omit fast-forward check and omit
trivial merge before running the specified strategy.
The "index_merge" variable started out as a flag to say "do not
do anything clever", but when recursive was changed to skip the
trivial merge, the semantics were changed and the variable alone
does not make sense anymore.
This splits the variable into two, allow_fast_forward (which is
almost always true, and avoids making a merge commit when the
other commit is a descendant of our branch, but is set to false
for ours and subtree) and allow_trivial_merge (which is false
for ours, recursive and subtree).
Unlike the earlier implementation, the "ours" strategy allows an
up-to-date condition. When we are up-to-date, the result will
be our commit, and by definition, we will have our tree as the
result.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-16 06:19:55 +00:00
|
|
|
test_done
|