const char *name = objects[i].name;
switch (o->type) {
case OBJ_BLOB:
- ret = show_blob_object(get_object_hash(*o), &rev, name);
+ ret = show_blob_object(o->oid.hash, &rev, name);
break;
case OBJ_TAG: {
struct tag *t = (struct tag *)o;
diff_get_color_opt(&rev.diffopt, DIFF_COMMIT),
t->tag,
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
- ret = show_tag_object(get_object_hash(*o), &rev);
+ ret = show_tag_object(o->oid.hash, &rev);
rev.shown_one = 1;
if (ret)
break;
- o = parse_object(get_object_hash(*t->tagged));
+ o = parse_object(t->tagged->oid.hash);
if (!o)
ret = error(_("Could not read object %s"),
oid_to_hex(&t->tagged->oid));
static const char *signature = git_version_string;
static const char *signature_file;
static int config_cover_letter;
+static const char *config_output_directory;
enum {
COVER_UNSET,
config_cover_letter = git_config_bool(var, value) ? COVER_ON : COVER_OFF;
return 0;
}
+ if (!strcmp(var, "format.outputdirectory"))
+ return git_config_string(&config_output_directory, var, value);
return git_log_config(var, value, cb);
}
o2 = rev->pending.objects[1].item;
flags1 = o1->flags;
flags2 = o2->flags;
- c1 = lookup_commit_reference(get_object_hash(*o1));
- c2 = lookup_commit_reference(get_object_hash(*o2));
+ c1 = lookup_commit_reference(o1->oid.hash);
+ c2 = lookup_commit_reference(o2->oid.hash);
if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING))
die(_("Not a range."));
diff_setup_done(&opts);
- diff_tree_sha1(get_object_hash(origin->tree->object),
- get_object_hash(head->tree->object),
+ diff_tree_sha1(origin->tree->object.oid.hash,
+ head->tree->object.oid.hash,
"", &opts);
diffcore_std(&opts);
diff_flush(&opts);
int cover_letter = -1;
int boundary_count = 0;
int no_binary_diff = 0;
+ int zero_commit = 0;
struct commit *origin = NULL;
const char *in_reply_to = NULL;
struct patch_ids ids;
PARSE_OPT_NOARG | PARSE_OPT_NONEG, keep_callback },
OPT_BOOL(0, "no-binary", &no_binary_diff,
N_("don't output binary diffs")),
+ OPT_BOOL(0, "zero-commit", &zero_commit,
+ N_("output all-zero hash in From header")),
OPT_BOOL(0, "ignore-if-in-upstream", &ignore_if_in_upstream,
N_("don't include a patch matching a commit upstream")),
{ OPTION_SET_INT, 'p', "no-stat", &use_patch_format, NULL,
/* Always generate a patch */
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
+ rev.zero_commit = zero_commit;
+
if (!DIFF_OPT_TST(&rev.diffopt, TEXT) && !no_binary_diff)
DIFF_OPT_SET(&rev.diffopt, BINARY);
if (rev.show_notes)
init_display_notes(&rev.notes_opt);
+ if (!output_directory && !use_stdout)
+ output_directory = config_output_directory;
+
if (!use_stdout)
output_directory = set_outdir(prefix, output_directory);
else
{
if (!verbose) {
printf("%c %s\n", sign,
- find_unique_abbrev(get_object_hash(commit->object), abbrev));
+ find_unique_abbrev(commit->object.oid.hash, abbrev));
} else {
struct strbuf buf = STRBUF_INIT;
pp_commit_easy(CMIT_FMT_ONELINE, commit, &buf);
printf("%c %s %s\n", sign,
- find_unique_abbrev(get_object_hash(commit->object), abbrev),
+ find_unique_abbrev(commit->object.oid.hash, abbrev),
buf.buf);
strbuf_release(&buf);
}