const struct version_info *b,
const char *pathnames[3],
const int extra_marker_size,
+ const int record_object,
struct version_info *result)
{
/*
ret = -1;
}
- if (!ret &&
+ if (!ret && record_object &&
write_object_file(result_buf.ptr, result_buf.size,
OBJ_BLOB, &result->oid)) {
path_msg(opt, ERROR_OBJECT_WRITE_FAILED, 0,
struct version_info merged;
struct conflict_info *base, *side1, *side2;
unsigned was_binary_blob = 0;
+ const int record_object = true;
pathnames[0] = oldpath;
pathnames[1] = newpath;
&side2->stages[2],
pathnames,
1 + 2 * opt->priv->call_depth,
+ record_object,
&merged);
if (clean_merge < 0)
return -1;
struct conflict_info *base, *side1, *side2;
int clean;
+ const int record_object = true;
pathnames[0] = oldpath;
pathnames[other_source_index] = oldpath;
&side2->stages[2],
pathnames,
1 + 2 * opt->priv->call_depth,
+ record_object,
&merged);
if (clean < 0)
return -1;
* Write out the tree to the git object directory, and also
* record the mode and oid in dir_info->result.
*/
+ int record_tree = (!opt->mergeability_only ||
+ opt->priv->call_depth);
dir_info->is_null = 0;
dir_info->result.mode = S_IFDIR;
- if (write_tree(&dir_info->result.oid, &info->versions, offset,
+ if (record_tree &&
+ write_tree(&dir_info->result.oid, &info->versions, offset,
opt->repo->hash_algo->rawsz) < 0)
ret = -1;
}
struct version_info *o = &ci->stages[0];
struct version_info *a = &ci->stages[1];
struct version_info *b = &ci->stages[2];
+ int record_object = (!opt->mergeability_only ||
+ opt->priv->call_depth);
clean_merge = handle_content_merge(opt, path, o, a, b,
ci->pathnames,
opt->priv->call_depth * 2,
+ record_object,
&merged_file);
if (clean_merge < 0)
return -1;
STRING_LIST_INIT_NODUP,
NULL, 0 };
int ret = 0;
+ const int record_tree = (!opt->mergeability_only ||
+ opt->priv->call_depth);
trace2_region_enter("merge", "process_entries setup", opt->repo);
if (strmap_empty(&opt->priv->paths)) {
ret = -1;
goto cleanup;
};
+ if (!ci->merged.clean && opt->mergeability_only &&
+ !opt->priv->call_depth) {
+ ret = 0;
+ goto cleanup;
+ }
+
}
}
trace2_region_leave("merge", "processing", opt->repo);
fflush(stdout);
BUG("dir_metadata accounting completely off; shouldn't happen");
}
- if (write_tree(result_oid, &dir_metadata.versions, 0,
+ if (record_tree &&
+ write_tree(result_oid, &dir_metadata.versions, 0,
opt->repo->hash_algo->rawsz) < 0)
ret = -1;
cleanup:
if (opt->record_conflict_msgs_as_headers)
BUG("Either display conflict messages or record them as headers, not both");
+ if (opt->mergeability_only)
+ BUG("Displaying conflict messages incompatible with mergeability-only checks");
trace2_region_enter("merge", "display messages", opt->repo);
result->path_messages = &opt->priv->conflicts;
if (result->clean >= 0) {
- result->tree = parse_tree_indirect(&working_tree_oid);
- if (!result->tree)
- die(_("unable to read tree (%s)"),
- oid_to_hex(&working_tree_oid));
+ if (!opt->mergeability_only) {
+ result->tree = parse_tree_indirect(&working_tree_oid);
+ if (!result->tree)
+ die(_("unable to read tree (%s)"),
+ oid_to_hex(&working_tree_oid));
+ }
/* existence of conflicted entries implies unclean */
result->clean &= strmap_empty(&opt->priv->conflicted);
}