From: Junio C Hamano Date: Wed, 27 Dec 2017 19:16:29 +0000 (-0800) Subject: Merge branch 'ot/pretty' X-Git-Tag: v2.16.0-rc0~22 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6bd396be0f9c87c2a7012d43eddc3c57f40a169b?ds=inline;hp=-c Merge branch 'ot/pretty' Code clean-up. * ot/pretty: format: create docs for pretty.h format: create pretty.h file --- 6bd396be0f9c87c2a7012d43eddc3c57f40a169b diff --combined builtin/notes.c index 1a2c7d92ad,166bb3f766..7c81761645 --- a/builtin/notes.c +++ b/builtin/notes.c @@@ -12,7 -12,7 +12,7 @@@ #include "builtin.h" #include "notes.h" #include "blob.h" - #include "commit.h" + #include "pretty.h" #include "refs.h" #include "exec_cmd.h" #include "run-command.h" @@@ -33,7 -33,7 +33,7 @@@ static const char * const git_notes_usa N_("git notes merge --commit [-v | -q]"), N_("git notes merge --abort [-v | -q]"), N_("git notes [--ref ] remove [...]"), - N_("git notes [--ref ] prune [-n | -v]"), + N_("git notes [--ref ] prune [-n] [-v]"), N_("git notes [--ref ] get-ref"), NULL }; @@@ -686,7 -686,7 +686,7 @@@ static int merge_abort(struct notes_mer if (delete_ref(NULL, "NOTES_MERGE_PARTIAL", NULL, 0)) ret += error(_("failed to delete ref NOTES_MERGE_PARTIAL")); - if (delete_ref(NULL, "NOTES_MERGE_REF", NULL, REF_NODEREF)) + if (delete_ref(NULL, "NOTES_MERGE_REF", NULL, REF_NO_DEREF)) ret += error(_("failed to delete ref NOTES_MERGE_REF")); if (notes_merge_abort(o)) ret += error(_("failed to remove 'git notes merge' worktree")); @@@ -724,7 -724,7 +724,7 @@@ static int merge_commit(struct notes_me init_notes(t, "NOTES_MERGE_PARTIAL", combine_notes_overwrite, 0); o->local_ref = local_ref_to_free = - resolve_refdup("NOTES_MERGE_REF", 0, oid.hash, NULL); + resolve_refdup("NOTES_MERGE_REF", 0, &oid, NULL); if (!o->local_ref) die(_("failed to resolve NOTES_MERGE_REF")); @@@ -736,8 -736,8 +736,8 @@@ format_commit_message(partial, "%s", &msg, &pretty_ctx); strbuf_trim(&msg); strbuf_insert(&msg, 0, "notes: ", 7); - update_ref(msg.buf, o->local_ref, oid.hash, - is_null_oid(&parent_oid) ? NULL : parent_oid.hash, + update_ref(msg.buf, o->local_ref, &oid, + is_null_oid(&parent_oid) ? NULL : &parent_oid, 0, UPDATE_REFS_DIE_ON_ERR); free_notes(t); @@@ -850,12 -850,12 +850,12 @@@ static int merge(int argc, const char * if (result >= 0) /* Merge resulted (trivially) in result_oid */ /* Update default notes ref with new commit */ - update_ref(msg.buf, default_notes_ref(), result_oid.hash, NULL, - 0, UPDATE_REFS_DIE_ON_ERR); + update_ref(msg.buf, default_notes_ref(), &result_oid, NULL, 0, + UPDATE_REFS_DIE_ON_ERR); else { /* Merge has unresolved conflicts */ const struct worktree *wt; /* Update .git/NOTES_MERGE_PARTIAL with partial merge result */ - update_ref(msg.buf, "NOTES_MERGE_PARTIAL", result_oid.hash, NULL, + update_ref(msg.buf, "NOTES_MERGE_PARTIAL", &result_oid, NULL, 0, UPDATE_REFS_DIE_ON_ERR); /* Store ref-to-be-updated into .git/NOTES_MERGE_REF */ wt = find_shared_symref("NOTES_MERGE_REF", default_notes_ref()); diff --combined builtin/reset.c index 906e541658,43c8514695..e15f595799 --- a/builtin/reset.c +++ b/builtin/reset.c @@@ -12,7 -12,7 +12,7 @@@ #include "lockfile.h" #include "tag.h" #include "object.h" - #include "commit.h" + #include "pretty.h" #include "run-command.h" #include "refs.h" #include "diff.h" @@@ -166,7 -166,7 +166,7 @@@ static int read_from_tree(const struct opt.output_format = DIFF_FORMAT_CALLBACK; opt.format_callback = update_index_from_diff; opt.format_callback_data = &intent_to_add; - opt.flags |= DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG; + opt.flags.override_submodule_config = 1; if (do_diff_cache(tree_oid, &opt)) return 1; @@@ -266,12 -266,12 +266,12 @@@ static int reset_refs(const char *rev, if (!get_oid("HEAD", &oid_orig)) { orig = &oid_orig; set_reflog_message(&msg, "updating ORIG_HEAD", NULL); - update_ref_oid(msg.buf, "ORIG_HEAD", orig, old_orig, 0, + update_ref(msg.buf, "ORIG_HEAD", orig, old_orig, 0, UPDATE_REFS_MSG_ON_ERR); } else if (old_orig) - delete_ref(NULL, "ORIG_HEAD", old_orig->hash, 0); + delete_ref(NULL, "ORIG_HEAD", old_orig, 0); set_reflog_message(&msg, "updating HEAD", rev); - update_ref_status = update_ref_oid(msg.buf, "HEAD", oid, orig, 0, + update_ref_status = update_ref(msg.buf, "HEAD", oid, orig, 0, UPDATE_REFS_MSG_ON_ERR); strbuf_release(&msg); return update_ref_status; diff --combined builtin/show-branch.c index 2e24b5c330,f4069d6ec8..e8a4aa40cb --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@@ -1,6 -1,6 +1,6 @@@ #include "cache.h" #include "config.h" - #include "commit.h" + #include "pretty.h" #include "refs.h" #include "builtin.h" #include "color.h" @@@ -705,8 -705,8 +705,8 @@@ int cmd_show_branch(int ac, const char static const char *fake_av[2]; fake_av[0] = resolve_refdup("HEAD", - RESOLVE_REF_READING, - oid.hash, NULL); + RESOLVE_REF_READING, &oid, + NULL); fake_av[1] = NULL; av = fake_av; ac = 1; @@@ -720,7 -720,7 +720,7 @@@ die(Q_("only %d entry can be shown at one time.", "only %d entries can be shown at one time.", MAX_REVS), MAX_REVS); - if (!dwim_ref(*av, strlen(*av), oid.hash, &ref)) + if (!dwim_ref(*av, strlen(*av), &oid, &ref)) die(_("no such ref %s"), *av); /* Has the base been specified? */ @@@ -731,7 -731,7 +731,7 @@@ /* Ah, that is a date spec... */ timestamp_t at; at = approxidate(reflog_base); - read_ref_at(ref, flags, at, -1, oid.hash, NULL, + read_ref_at(ref, flags, at, -1, &oid, NULL, NULL, NULL, &base); } } @@@ -743,7 -743,7 +743,7 @@@ timestamp_t timestamp; int tz; - if (read_ref_at(ref, flags, 0, base+i, oid.hash, &logmsg, + if (read_ref_at(ref, flags, 0, base + i, &oid, &logmsg, ×tamp, &tz, NULL)) { reflog = i; break; @@@ -775,7 -775,7 +775,7 @@@ } head = resolve_refdup("HEAD", RESOLVE_REF_READING, - head_oid.hash, NULL); + &head_oid, NULL); if (with_current_branch && head) { int has_head = 0;