summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-09-28 14:47:56 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-09-28 14:47:56 +0900
commit73ecdc606eedbfd98ec66d50d44b3374425fd13b (patch)
tree6a2aeb6eb0b30e1645c8af06b10c9f4ec2815dd8 /builtin
parentMerge branch 'rs/mailinfo-qp-decode-fix' (diff)
parentrefs: pass NULL to resolve_ref_unsafe() if hash is not needed (diff)
downloadtgif-73ecdc606eedbfd98ec66d50d44b3374425fd13b.tar.xz
Merge branch 'rs/resolve-ref-optional-result'
Code clean-up. * rs/resolve-ref-optional-result: refs: pass NULL to resolve_ref_unsafe() if hash is not needed refs: pass NULL to refs_resolve_ref_unsafe() if hash is not needed refs: make sha1 output parameter of refs_resolve_ref_unsafe() optional
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit.c3
-rw-r--r--builtin/log.c3
-rw-r--r--builtin/receive-pack.c3
-rw-r--r--builtin/remote.c3
-rw-r--r--builtin/submodule--helper.c6
-rw-r--r--builtin/symbolic-ref.c3
6 files changed, 7 insertions, 14 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 58f9747c2f..39d5b7f6c7 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1431,7 +1431,6 @@ static void print_summary(const char *prefix, const struct object_id *oid,
struct rev_info rev;
struct commit *commit;
struct strbuf format = STRBUF_INIT;
- struct object_id junk_oid;
const char *head;
struct pretty_print_context pctx = {0};
struct strbuf author_ident = STRBUF_INIT;
@@ -1484,7 +1483,7 @@ static void print_summary(const char *prefix, const struct object_id *oid,
rev.diffopt.break_opt = 0;
diff_setup_done(&rev.diffopt);
- head = resolve_ref_unsafe("HEAD", 0, junk_oid.hash, NULL);
+ head = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
if (!strcmp(head, "HEAD"))
head = _("detached HEAD");
else
diff --git a/builtin/log.c b/builtin/log.c
index f8cccbc964..d81a09051e 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1660,10 +1660,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
check_head = 1;
if (check_head) {
- struct object_id oid;
const char *ref, *v;
ref = resolve_ref_unsafe("HEAD", RESOLVE_REF_READING,
- oid.hash, NULL);
+ NULL, NULL);
if (ref && skip_prefix(ref, "refs/heads/", &v))
branch_name = xstrdup(v);
else
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index dd06b3fb4f..29a0f3b75f 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1207,11 +1207,10 @@ static void check_aliased_update(struct command *cmd, struct string_list *list)
const char *dst_name;
struct string_list_item *item;
struct command *dst_cmd;
- unsigned char sha1[GIT_MAX_RAWSZ];
int flag;
strbuf_addf(&buf, "%s%s", get_git_namespace(), cmd->ref_name);
- dst_name = resolve_ref_unsafe(buf.buf, 0, sha1, &flag);
+ dst_name = resolve_ref_unsafe(buf.buf, 0, NULL, &flag);
strbuf_release(&buf);
if (!(flag & REF_ISSYMREF))
diff --git a/builtin/remote.c b/builtin/remote.c
index 33ba739332..4f5cac96b0 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -558,14 +558,13 @@ static int read_remote_branches(const char *refname,
struct strbuf buf = STRBUF_INIT;
struct string_list_item *item;
int flag;
- struct object_id orig_oid;
const char *symref;
strbuf_addf(&buf, "refs/remotes/%s/", rename->old);
if (starts_with(refname, buf.buf)) {
item = string_list_append(rename->remote_branches, xstrdup(refname));
symref = resolve_ref_unsafe(refname, RESOLVE_REF_READING,
- orig_oid.hash, &flag);
+ NULL, &flag);
if (flag & REF_ISSYMREF)
item->util = xstrdup(symref);
else
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index f6a5e1af5d..06ed02f994 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -17,9 +17,8 @@
static char *get_default_remote(void)
{
char *dest = NULL, *ret;
- unsigned char sha1[20];
struct strbuf sb = STRBUF_INIT;
- const char *refname = resolve_ref_unsafe("HEAD", 0, sha1, NULL);
+ const char *refname = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
if (!refname)
die(_("No such ref: %s"), "HEAD");
@@ -1089,8 +1088,7 @@ static const char *remote_submodule_branch(const char *path)
return "master";
if (!strcmp(branch, ".")) {
- unsigned char sha1[20];
- const char *refname = resolve_ref_unsafe("HEAD", 0, sha1, NULL);
+ const char *refname = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
if (!refname)
die(_("No such ref: %s"), "HEAD");
diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c
index df75cb9d4a..17aabaa679 100644
--- a/builtin/symbolic-ref.c
+++ b/builtin/symbolic-ref.c
@@ -12,9 +12,8 @@ static const char * const git_symbolic_ref_usage[] = {
static int check_symref(const char *HEAD, int quiet, int shorten, int print)
{
- unsigned char sha1[20];
int flag;
- const char *refname = resolve_ref_unsafe(HEAD, 0, sha1, &flag);
+ const char *refname = resolve_ref_unsafe(HEAD, 0, NULL, &flag);
if (!refname)
die("No such ref: %s", HEAD);