summaryrefslogtreecommitdiff
path: root/builtin/merge-base.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-02-21 23:47:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-02-22 18:12:16 (GMT)
commitd0ae910af44cc3e8998e4c521784ae84198d945a (patch)
tree79a2ece66fd704b0463f881a1438b17e4550816c /builtin/merge-base.c
parent76c1d9a09624ae39fa9e3140f6581e672b9c040a (diff)
downloadgit-d0ae910af44cc3e8998e4c521784ae84198d945a.zip
git-d0ae910af44cc3e8998e4c521784ae84198d945a.tar.gz
git-d0ae910af44cc3e8998e4c521784ae84198d945a.tar.bz2
builtin/merge-base: convert to struct object_id
Convert the remaining uses of unsigned char [20] to struct object_id. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge-base.c')
-rw-r--r--builtin/merge-base.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/builtin/merge-base.c b/builtin/merge-base.c
index db95bc2..cfe2a79 100644
--- a/builtin/merge-base.c
+++ b/builtin/merge-base.c
@@ -36,12 +36,12 @@ static const char * const merge_base_usage[] = {
static struct commit *get_commit_reference(const char *arg)
{
- unsigned char revkey[20];
+ struct object_id revkey;
struct commit *r;
- if (get_sha1(arg, revkey))
+ if (get_oid(arg, &revkey))
die("Not a valid object name %s", arg);
- r = lookup_commit_reference(revkey);
+ r = lookup_commit_reference(revkey.hash);
if (!r)
die("Not a valid commit name %s", arg);
@@ -113,14 +113,14 @@ struct rev_collect {
unsigned int initial : 1;
};
-static void add_one_commit(unsigned char *sha1, struct rev_collect *revs)
+static void add_one_commit(struct object_id *oid, struct rev_collect *revs)
{
struct commit *commit;
- if (is_null_sha1(sha1))
+ if (is_null_oid(oid))
return;
- commit = lookup_commit(sha1);
+ commit = lookup_commit(oid->hash);
if (!commit ||
(commit->object.flags & TMP_MARK) ||
parse_commit(commit))
@@ -139,15 +139,15 @@ static int collect_one_reflog_ent(struct object_id *ooid, struct object_id *noid
if (revs->initial) {
revs->initial = 0;
- add_one_commit(ooid->hash, revs);
+ add_one_commit(ooid, revs);
}
- add_one_commit(noid->hash, revs);
+ add_one_commit(noid, revs);
return 0;
}
static int handle_fork_point(int argc, const char **argv)
{
- unsigned char sha1[20];
+ struct object_id oid;
char *refname;
const char *commitname;
struct rev_collect revs;
@@ -155,7 +155,7 @@ static int handle_fork_point(int argc, const char **argv)
struct commit_list *bases;
int i, ret = 0;
- switch (dwim_ref(argv[0], strlen(argv[0]), sha1, &refname)) {
+ switch (dwim_ref(argv[0], strlen(argv[0]), oid.hash, &refname)) {
case 0:
die("No such ref: '%s'", argv[0]);
case 1:
@@ -165,16 +165,16 @@ static int handle_fork_point(int argc, const char **argv)
}
commitname = (argc == 2) ? argv[1] : "HEAD";
- if (get_sha1(commitname, sha1))
+ if (get_oid(commitname, &oid))
die("Not a valid object name: '%s'", commitname);
- derived = lookup_commit_reference(sha1);
+ derived = lookup_commit_reference(oid.hash);
memset(&revs, 0, sizeof(revs));
revs.initial = 1;
for_each_reflog_ent(refname, collect_one_reflog_ent, &revs);
- if (!revs.nr && !get_sha1(refname, sha1))
- add_one_commit(sha1, &revs);
+ if (!revs.nr && !get_oid(refname, &oid))
+ add_one_commit(&oid, &revs);
for (i = 0; i < revs.nr; i++)
revs.commit[i]->object.flags &= ~TMP_MARK;