# # patch "git_import.cc" # from [9d648116debe417ff84863d988e0712c2e4c2315] # to [2e606f841fb9f4003552c8bd8e9ed888c4401e67] # ======================================================================== --- git_import.cc 9d648116debe417ff84863d988e0712c2e4c2315 +++ git_import.cc 2e606f841fb9f4003552c8bd8e9ed888c4401e67 @@ -375,6 +375,25 @@ % person.name % person.email % time); } +static void +resolve_commit(git_history &git, app_state &app, git_object_id gitcid, revision_id &rev, manifest_id &mid) +{ + // given the topo order, we ought to have the parent hashed - except + // for incremental imports + map + >::const_iterator cm = git.commitmap.find(gitcid()); + if (cm != git.commitmap.end()) + { + rev = cm->second.first; + mid = cm->second.second; + } + else + { + historical_gitrev_to_monorev(git.branch, &git.commitmap, app, gitcid(), rev); + app.db.get_revision_manifest(rev, mid); + } +} + static revision_id import_git_commit(git_history &git, app_state &app, git_object_id gitrid) { @@ -386,7 +405,7 @@ bool header = true; revision_set rev; edge_map edges; - vector parents; + vector parents; manifest_map manifest; // XXX: it might be user policy decision whether to take author @@ -462,7 +481,7 @@ } else if (keyword == "parent") { - parents.push_back(revision_id(param)); + parents.push_back(param); } else if (keyword == "committer") { @@ -482,20 +501,7 @@ revision_id parent_rev; manifest_id parent_mid; - // given the topo order, we ought to have the parent hashed - except - // for incremental imports - map - >::const_iterator cm = git.commitmap.find(parents[i].inner()); - if (cm != git.commitmap.end()) - { - parent_rev = cm->second.first; - parent_mid = cm->second.second; - } - else - { - historical_gitrev_to_monorev(git.branch, &git.commitmap, app, parents[i].inner(), parent_rev); - app.db.get_revision_manifest(parent_rev, parent_mid); - } + resolve_commit(git, app, parents[i], parent_rev, parent_mid); L(F("parent revision '%s'") % parent_rev.inner()); L(F("parent manifest '%s', loading...") % parent_mid.inner()); @@ -507,9 +513,12 @@ // A merge. See the huge comment in // anc_graph::construct_revision_from_ancestry() if you want to // know why are we bothering with this stuff. + L(F("anti-suture protection...")); + revision_id other_parent_rev; + manifest_id other_parent_mid; + resolve_commit(git, app, parents[unsigned(1 - i)], other_parent_rev, other_parent_mid); + change_set_for_merge(app, parent_rev, other_parent_rev, parent_mid, rev.new_manifest, *changes); - change_set_for_merge(app, parents[i], parents[unsigned(1 - i)], parent_mid, rev.new_manifest, *changes); - } else { manifest_map parent_man; app.db.get_manifest(parent_mid, parent_man);