Merge branch 'bk/submodule-in-recursive-merge'
* bk/submodule-in-recursive-merge: submodule: Search for merges only at end of recursive merge submodule: Demonstrate known breakage during recursive mergemaint
commit
2201cc8c97
|
@ -946,8 +946,10 @@ static struct merge_file_info merge_file_1(struct merge_options *o,
|
||||||
free(result_buf.ptr);
|
free(result_buf.ptr);
|
||||||
result.clean = (merge_status == 0);
|
result.clean = (merge_status == 0);
|
||||||
} else if (S_ISGITLINK(a->mode)) {
|
} else if (S_ISGITLINK(a->mode)) {
|
||||||
result.clean = merge_submodule(result.sha, one->path, one->sha1,
|
result.clean = merge_submodule(result.sha,
|
||||||
a->sha1, b->sha1);
|
one->path, one->sha1,
|
||||||
|
a->sha1, b->sha1,
|
||||||
|
!o->call_depth);
|
||||||
} else if (S_ISLNK(a->mode)) {
|
} else if (S_ISLNK(a->mode)) {
|
||||||
hashcpy(result.sha, a->sha1);
|
hashcpy(result.sha, a->sha1);
|
||||||
|
|
||||||
|
|
|
@ -794,7 +794,7 @@ static void print_commit(struct commit *commit)
|
||||||
|
|
||||||
int merge_submodule(unsigned char result[20], const char *path,
|
int merge_submodule(unsigned char result[20], const char *path,
|
||||||
const unsigned char base[20], const unsigned char a[20],
|
const unsigned char base[20], const unsigned char a[20],
|
||||||
const unsigned char b[20])
|
const unsigned char b[20], int search)
|
||||||
{
|
{
|
||||||
struct commit *commit_base, *commit_a, *commit_b;
|
struct commit *commit_base, *commit_a, *commit_b;
|
||||||
int parent_count;
|
int parent_count;
|
||||||
|
@ -849,6 +849,10 @@ int merge_submodule(unsigned char result[20], const char *path,
|
||||||
* user needs to confirm the resolution.
|
* user needs to confirm the resolution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Skip the search if makes no sense to the calling context. */
|
||||||
|
if (!search)
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* find commit which merges them */
|
/* find commit which merges them */
|
||||||
parent_count = find_first_merges(&merges, path, commit_a, commit_b);
|
parent_count = find_first_merges(&merges, path, commit_a, commit_b);
|
||||||
switch (parent_count) {
|
switch (parent_count) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ int fetch_populated_submodules(int num_options, const char **options,
|
||||||
int quiet);
|
int quiet);
|
||||||
unsigned is_submodule_modified(const char *path, int ignore_untracked);
|
unsigned is_submodule_modified(const char *path, int ignore_untracked);
|
||||||
int merge_submodule(unsigned char result[20], const char *path, const unsigned char base[20],
|
int merge_submodule(unsigned char result[20], const char *path, const unsigned char base[20],
|
||||||
const unsigned char a[20], const unsigned char b[20]);
|
const unsigned char a[20], const unsigned char b[20], int search);
|
||||||
int check_submodule_needs_pushing(unsigned char new_sha1[20], const char *remotes_name);
|
int check_submodule_needs_pushing(unsigned char new_sha1[20], const char *remotes_name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -228,4 +228,55 @@ test_expect_success 'merging with a modify/modify conflict between merge bases'
|
||||||
git merge d
|
git merge d
|
||||||
'
|
'
|
||||||
|
|
||||||
|
# canonical criss-cross history in top and submodule
|
||||||
|
test_expect_success 'setup for recursive merge with submodule' '
|
||||||
|
mkdir merge-recursive &&
|
||||||
|
(cd merge-recursive &&
|
||||||
|
git init &&
|
||||||
|
mkdir sub &&
|
||||||
|
(cd sub &&
|
||||||
|
git init &&
|
||||||
|
test_commit a &&
|
||||||
|
git checkout -b sub-b master &&
|
||||||
|
test_commit b &&
|
||||||
|
git checkout -b sub-c master &&
|
||||||
|
test_commit c &&
|
||||||
|
git checkout -b sub-bc sub-b &&
|
||||||
|
git merge sub-c &&
|
||||||
|
git checkout -b sub-cb sub-c &&
|
||||||
|
git merge sub-b &&
|
||||||
|
git checkout master) &&
|
||||||
|
git add sub &&
|
||||||
|
git commit -m a &&
|
||||||
|
git checkout -b top-b master &&
|
||||||
|
(cd sub && git checkout sub-b) &&
|
||||||
|
git add sub &&
|
||||||
|
git commit -m b &&
|
||||||
|
git checkout -b top-c master &&
|
||||||
|
(cd sub && git checkout sub-c) &&
|
||||||
|
git add sub &&
|
||||||
|
git commit -m c &&
|
||||||
|
git checkout -b top-bc top-b &&
|
||||||
|
git merge -s ours --no-commit top-c &&
|
||||||
|
(cd sub && git checkout sub-bc) &&
|
||||||
|
git add sub &&
|
||||||
|
git commit -m bc &&
|
||||||
|
git checkout -b top-cb top-c &&
|
||||||
|
git merge -s ours --no-commit top-b &&
|
||||||
|
(cd sub && git checkout sub-cb) &&
|
||||||
|
git add sub &&
|
||||||
|
git commit -m cb)
|
||||||
|
'
|
||||||
|
|
||||||
|
# merge should leave submodule unmerged in index
|
||||||
|
test_expect_success 'recursive merge with submodule' '
|
||||||
|
(cd merge-recursive &&
|
||||||
|
test_must_fail git merge top-bc &&
|
||||||
|
echo "160000 $(git rev-parse top-cb:sub) 2 sub" > expect2 &&
|
||||||
|
echo "160000 $(git rev-parse top-bc:sub) 3 sub" > expect3 &&
|
||||||
|
git ls-files -u > actual &&
|
||||||
|
grep "$(cat expect2)" actual > /dev/null &&
|
||||||
|
grep "$(cat expect3)" actual > /dev/null)
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Loading…
Reference in New Issue