author | Junio C Hamano <gitster@pobox.com> | |
Fri, 9 Dec 2011 21:37:14 +0000 (13:37 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 9 Dec 2011 21:37:14 +0000 (13:37 -0800) |
* nd/resolve-ref:
Copy resolve_ref() return value for longer use
Convert many resolve_ref() calls to read_ref*() and ref_exists()
Conflicts:
builtin/fmt-merge-msg.c
builtin/merge.c
refs.c
Copy resolve_ref() return value for longer use
Convert many resolve_ref() calls to read_ref*() and ref_exists()
Conflicts:
builtin/fmt-merge-msg.c
builtin/merge.c
refs.c
1 | 2 | |||
---|---|---|---|---|
builtin/branch.c | patch | | diff1 | | diff2 | | blob | history |
builtin/checkout.c | patch | | diff1 | | diff2 | | blob | history |
builtin/commit.c | patch | | diff1 | | diff2 | | blob | history |
builtin/fmt-merge-msg.c | patch | | diff1 | | diff2 | | blob | history |
builtin/merge.c | patch | | diff1 | | diff2 | | blob | history |
builtin/tag.c | patch | | diff1 | | diff2 | | blob | history |
cache.h | patch | | diff1 | | diff2 | | blob | history |
notes-merge.c | patch | | diff1 | | diff2 | | blob | history |
refs.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc builtin/branch.c
Simple merge
diff --cc builtin/checkout.c
Simple merge
diff --cc builtin/commit.c
Simple merge
diff --cc builtin/fmt-merge-msg.c
index ed95349b424f2f3d2aa671a277b346ae6198d34c,a3ba21520916ce2e244839304def0a748e8a53c7..bdfa0ea05d99089937b9e753cf85a8489a5e27cb
+++ b/builtin/fmt-merge-msg.c
strbuf_addch(out, '\n');
for (i = 0; i < origins.nr; i++)
- shortlog(origins.items[i].string, origins.items[i].util,
- head, &rev, shortlog_len, out);
+ shortlog(origins.items[i].string,
+ origins.items[i].util,
+ head, &rev, opts->shortlog_len, out);
}
+
+ strbuf_complete_line(out);
+ free((char *)current_branch);
return 0;
}
diff --cc builtin/merge.c
index 7349396d5b44f6ee894e0f0f50e2b66bb31203be,9cda40003e7af5ff55acd2793248f78916ff433d..a1c85344b2b54f957ea69ace864ea99b7d295405
--- 1/builtin/merge.c
--- 2/builtin/merge.c
+++ b/builtin/merge.c
/* Get the name for the merge commit's message. */
static void merge_name(const char *remote, struct strbuf *msg)
{
- struct object *remote_head;
+ struct commit *remote_head;
- unsigned char branch_head[20], buf_sha[20];
+ unsigned char branch_head[20];
struct strbuf buf = STRBUF_INIT;
struct strbuf bname = STRBUF_INIT;
const char *ptr;
strbuf_addstr(&truname, "refs/heads/");
strbuf_addstr(&truname, remote);
strbuf_setlen(&truname, truname.len - len);
- if (resolve_ref(truname.buf, buf_sha, 1, NULL)) {
+ if (ref_exists(truname.buf)) {
strbuf_addf(msg,
"%s\t\tbranch '%s'%s of .\n",
- sha1_to_hex(remote_head->sha1),
+ sha1_to_hex(remote_head->object.sha1),
truname.buf + 11,
(early ? " (early part)" : ""));
strbuf_release(&truname);
if (!allow_fast_forward)
die(_("Non-fast-forward commit does not make sense into "
"an empty head"));
- remote_head = want_commit(argv[0]);
+ remote_head = get_merge_parent(argv[0]);
if (!remote_head)
die(_("%s - not something we can merge"), argv[0]);
- read_empty(remote_head->sha1, 0);
- update_ref("initial pull", "HEAD", remote_head->sha1, NULL, 0,
- DIE_ON_ERR);
+ read_empty(remote_head->object.sha1, 0);
+ update_ref("initial pull", "HEAD", remote_head->object.sha1,
+ NULL, 0, DIE_ON_ERR);
- return 0;
+ goto done;
} else {
struct strbuf merge_names = STRBUF_INIT;
if (have_message)
strbuf_addstr(&msg,
" (no commit created; -m option ignored)");
- o = want_commit(sha1_to_hex(remoteheads->item->object.sha1));
- if (!o) {
+ commit = remoteheads->item;
- if (!commit)
- return 1;
++ if (!commit) {
+ ret = 1;
+ goto done;
+ }
if (checkout_fast_forward(head_commit->object.sha1,
- commit->object.sha1))
- return 1;
- remoteheads->item->object.sha1)) {
++ commit->object.sha1)) {
+ ret = 1;
+ goto done;
+ }
- finish(head_commit, o->sha1, msg.buf);
+ finish(head_commit, commit->object.sha1, msg.buf);
drop_save();
- return 0;
+ goto done;
} else if (!remoteheads->next && common->next)
;
/*
diff --cc builtin/tag.c
Simple merge
diff --cc cache.h
Simple merge
diff --cc notes-merge.c
Simple merge
diff --cc refs.c
index c74b6e2a70222386383edb89789dbb7880768157,44c1c86e187568f8cf1224f2f540cb6b73db3469..f5cb297292f5ae577e3d2719f5f78512aae8cf28
+++ b/refs.c
hashclr(sha1);
flag |= REF_ISBROKEN;
}
- } else if (!resolve_ref(ref, sha1, 1, &flag)) {
- } else
- if (read_ref_full(ref, sha1, 1, &flag)) {
- hashclr(sha1);
- flag |= REF_ISBROKEN;
- }
- add_ref(ref, sha1, flag, array, NULL);
++ } else if (read_ref_full(ref, sha1, 1, &flag)) {
+ hashclr(sha1);
+ flag |= REF_ISBROKEN;
+ }
+ add_ref(ref, sha1, flag, 1, array, NULL);
}
free(ref);
closedir(dir);