};
static const char *head;
-static unsigned char head_sha1[20];
+static struct object_id head_oid;
static int branch_use_color = -1;
static char branch_colors[][COLOR_MAXLEN] = {
if (kind == FILTER_REFS_BRANCHES) {
struct branch *branch = branch_get(name);
const char *upstream = branch_get_upstream(branch, NULL);
- unsigned char sha1[20];
+ struct object_id oid;
if (upstream &&
(reference_name = reference_name_to_free =
resolve_refdup(upstream, RESOLVE_REF_READING,
- sha1, NULL)) != NULL)
- reference_rev = lookup_commit_reference(sha1);
+ oid.hash, NULL)) != NULL)
+ reference_rev = lookup_commit_reference(oid.hash);
}
if (!reference_rev)
reference_rev = head_rev;
}
static int check_branch_commit(const char *branchname, const char *refname,
- const unsigned char *sha1, struct commit *head_rev,
+ const struct object_id *oid, struct commit *head_rev,
int kinds, int force)
{
- struct commit *rev = lookup_commit_reference(sha1);
+ struct commit *rev = lookup_commit_reference(oid->hash);
if (!rev) {
error(_("Couldn't look up commit object for '%s'"), refname);
return -1;
int quiet)
{
struct commit *head_rev = NULL;
- unsigned char sha1[20];
+ struct object_id oid;
char *name = NULL;
const char *fmt;
int i;
}
if (!force) {
- head_rev = lookup_commit_reference(head_sha1);
+ head_rev = lookup_commit_reference(head_oid.hash);
if (!head_rev)
die(_("Couldn't look up commit object for HEAD"));
}
RESOLVE_REF_READING
| RESOLVE_REF_NO_RECURSE
| RESOLVE_REF_ALLOW_BAD_NAME,
- sha1, &flags);
+ oid.hash, &flags);
if (!target) {
error(remote_branch
? _("remote-tracking branch '%s' not found.")
}
if (!(flags & (REF_ISSYMREF|REF_ISBROKEN)) &&
- check_branch_commit(bname.buf, name, sha1, head_rev, kinds,
+ check_branch_commit(bname.buf, name, &oid, head_rev, kinds,
force)) {
ret = 1;
goto next;
}
- if (delete_ref(NULL, name, is_null_sha1(sha1) ? NULL : sha1,
+ if (delete_ref(NULL, name, is_null_oid(&oid) ? NULL : oid.hash,
REF_NODEREF)) {
error(remote_branch
? _("Error deleting remote-tracking branch '%s'")
bname.buf,
(flags & REF_ISBROKEN) ? "broken"
: (flags & REF_ISSYMREF) ? target
- : find_unique_abbrev(sha1, DEFAULT_ABBREV));
+ : find_unique_abbrev(oid.hash, DEFAULT_ABBREV));
}
delete_branch_config(bname.buf);
track = git_branch_track;
- head = resolve_refdup("HEAD", 0, head_sha1, NULL);
+ head = resolve_refdup("HEAD", 0, head_oid.hash, NULL);
if (!head)
die(_("Failed to resolve HEAD as a valid ref."));
if (!strcmp(head, "HEAD"))