Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- builtin/merge.c | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-) diff --git a/builtin/merge.c b/builtin/merge.c index d05c528..1c70193 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -58,6 +58,7 @@ static const char *branch; static int verbosity; static int allow_rerere_auto; static unsigned char narrow_base[20]; +static const char *narrow_remote, *narrow_exec; static struct strategy all_strategy[] = { { "recursive", DEFAULT_TWOHEAD | NO_TRIVIAL }, @@ -195,6 +196,10 @@ static struct option builtin_merge_options[] = { OPT_CALLBACK('m', "message", &merge_msg, "message", "message to be used for the merge commit (if any)", option_parse_message), + OPT_STRING(0, "remote", &narrow_remote, "repo", + "remote repo to perform narrow base calculation"), + OPT_STRING(0, "upload-narrow-base", &narrow_exec, "path", + "path to git-upload-narrow-base"), OPT__VERBOSITY(&verbosity), OPT_END() }; @@ -1065,9 +1070,23 @@ int cmd_merge(int argc, const char **argv, const char *prefix) break; item = item->next; } - if (item) - die("Different narrow base, couldn't do merge (yet)"); - hashcpy(narrow_base, lookup_commit(head)->tree->object.sha1); + if (item) { + unsigned char sha1[2][20]; + + if (remoteheads->next) + die("Octopus merge is not supported in narrow repository"); + if (!narrow_remote) + die("This merge cannot be fully performed locally.\n" + "Please specify remote repo with --remote."); + oldest_narrow_base(head, sha1[0]); + oldest_narrow_base(remoteheads->item->object.sha1, sha1[1]); + if (fetch_narrow_base(sha1[0], sha1[1], narrow_base, + get_narrow_prefix(), + narrow_remote, narrow_exec)) + die("Failed to request narrow base from remote repo"); + } + else + hashcpy(narrow_base, lookup_commit(head)->tree->object.sha1); } if (!remoteheads->next) -- 1.7.1.rc1.69.g24c2f7 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html