summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archive.c6
-rw-r--r--bisect.c2
-rw-r--r--blob.c6
-rw-r--r--blob.h2
-rw-r--r--branch.c16
-rw-r--r--builtin/am.c18
-rw-r--r--builtin/blame.c14
-rw-r--r--builtin/branch.c6
-rw-r--r--builtin/checkout.c18
-rw-r--r--builtin/clone.c4
-rw-r--r--builtin/commit-tree.c2
-rw-r--r--builtin/commit.c8
-rw-r--r--builtin/describe.c10
-rw-r--r--builtin/diff-tree.c8
-rw-r--r--builtin/diff.c6
-rw-r--r--builtin/fast-export.c8
-rw-r--r--builtin/fetch.c7
-rw-r--r--builtin/fmt-merge-msg.c8
-rw-r--r--builtin/fsck.c16
-rw-r--r--builtin/grep.c2
-rw-r--r--builtin/index-pack.c56
-rw-r--r--builtin/log.c10
-rw-r--r--builtin/ls-files.c6
-rw-r--r--builtin/ls-tree.c6
-rw-r--r--builtin/merge-base.c6
-rw-r--r--builtin/merge-tree.c10
-rw-r--r--builtin/merge.c12
-rw-r--r--builtin/name-rev.c32
-rw-r--r--builtin/notes.c2
-rw-r--r--builtin/pack-objects.c71
-rw-r--r--builtin/prune.c7
-rw-r--r--builtin/pull.c14
-rw-r--r--builtin/read-tree.c10
-rw-r--r--builtin/receive-pack.c8
-rw-r--r--builtin/reflog.c36
-rw-r--r--builtin/replace.c6
-rw-r--r--builtin/reset.c10
-rw-r--r--builtin/rev-list.c2
-rw-r--r--builtin/rev-parse.c56
-rw-r--r--builtin/show-branch.c4
-rw-r--r--builtin/tag.c66
-rw-r--r--builtin/unpack-objects.c65
-rw-r--r--builtin/verify-commit.c12
-rw-r--r--bulk-checkin.c4
-rw-r--r--bundle.c39
-rw-r--r--bundle.h4
-rw-r--r--cache-tree.c33
-rw-r--r--cache-tree.h3
-rw-r--r--cache.h4
-rw-r--r--commit.c38
-rw-r--r--commit.h16
-rw-r--r--diff-lib.c12
-rw-r--r--diff.c4
-rw-r--r--diff.h2
-rw-r--r--fast-import.c447
-rw-r--r--fetch-pack.c97
-rw-r--r--fsck.c6
-rw-r--r--http-backend.c2
-rw-r--r--http-push.c55
-rw-r--r--list-objects.c4
-rw-r--r--log-tree.c26
-rw-r--r--merge-recursive.c16
-rw-r--r--merge.c4
-rw-r--r--notes-cache.c29
-rw-r--r--notes-cache.h4
-rw-r--r--notes-merge.c26
-rw-r--r--notes-utils.c18
-rw-r--r--object.c38
-rw-r--r--object.h8
-rw-r--r--pack-bitmap-write.c8
-rw-r--r--pack-bitmap.c4
-rw-r--r--pack-check.c25
-rw-r--r--pack-objects.c8
-rw-r--r--pack-write.c10
-rw-r--r--pack.h4
-rw-r--r--parse-options-cb.c6
-rw-r--r--pretty.c2
-rw-r--r--reachable.c8
-rw-r--r--ref-filter.c38
-rw-r--r--ref-filter.h2
-rw-r--r--reflog-walk.c6
-rw-r--r--refs.c4
-rw-r--r--refs.h6
-rw-r--r--refs/files-backend.c156
-rw-r--r--refs/ref-cache.c4
-rw-r--r--refs/ref-cache.h2
-rw-r--r--refs/refs-internal.h4
-rw-r--r--remote.c17
-rw-r--r--revision.c76
-rw-r--r--revision.h6
-rw-r--r--sequencer.c59
-rw-r--r--server-info.c2
-rw-r--r--sha1_name.c38
-rw-r--r--shallow.c34
-rw-r--r--submodule.c24
-rw-r--r--submodule.h8
-rw-r--r--t/helper/test-dump-cache-tree.c4
-rw-r--r--t/helper/test-match-trees.c4
-rw-r--r--tag.c25
-rw-r--r--tag.h2
-rw-r--r--transport.c2
-rw-r--r--tree.c22
-rw-r--r--tree.h4
-rw-r--r--upload-pack.c60
-rw-r--r--walker.c8
-rw-r--r--wt-status.c2
106 files changed, 1173 insertions, 1134 deletions
diff --git a/archive.c b/archive.c
index 60b8891986..b15a922dab 100644
--- a/archive.c
+++ b/archive.c
@@ -360,7 +360,7 @@ static void parse_treeish_arg(const char **argv,
if (get_sha1(name, oid.hash))
die("Not a valid object name");
- commit = lookup_commit_reference_gently(oid.hash, 1);
+ commit = lookup_commit_reference_gently(&oid, 1);
if (commit) {
commit_sha1 = commit->object.oid.hash;
archive_time = commit->date;
@@ -369,7 +369,7 @@ static void parse_treeish_arg(const char **argv,
archive_time = time(NULL);
}
- tree = parse_tree_indirect(oid.hash);
+ tree = parse_tree_indirect(&oid);
if (tree == NULL)
die("not a tree object");
@@ -383,7 +383,7 @@ static void parse_treeish_arg(const char **argv,
if (err || !S_ISDIR(mode))
die("current working directory is untracked");
- tree = parse_tree_indirect(tree_oid.hash);
+ tree = parse_tree_indirect(&tree_oid);
}
ar_args->tree = tree;
ar_args->commit_sha1 = commit_sha1;
diff --git a/bisect.c b/bisect.c
index 08c9fb7266..bb5af3ea3d 100644
--- a/bisect.c
+++ b/bisect.c
@@ -705,7 +705,7 @@ static int bisect_checkout(const unsigned char *bisect_rev, int no_checkout)
static struct commit *get_commit_reference(const struct object_id *oid)
{
- struct commit *r = lookup_commit_reference(oid->hash);
+ struct commit *r = lookup_commit_reference(oid);
if (!r)
die(_("Not a valid commit name %s"), oid_to_hex(oid));
return r;
diff --git a/blob.c b/blob.c
index 1fcb8e44b0..fa2ab4f7a7 100644
--- a/blob.c
+++ b/blob.c
@@ -3,11 +3,11 @@
const char *blob_type = "blob";
-struct blob *lookup_blob(const unsigned char *sha1)
+struct blob *lookup_blob(const struct object_id *oid)
{
- struct object *obj = lookup_object(sha1);
+ struct object *obj = lookup_object(oid->hash);
if (!obj)
- return create_object(sha1, alloc_blob_node());
+ return create_object(oid->hash, alloc_blob_node());
return object_as_type(obj, OBJ_BLOB, 0);
}
diff --git a/blob.h b/blob.h
index 59b394eea3..4460616831 100644
--- a/blob.h
+++ b/blob.h
@@ -9,7 +9,7 @@ struct blob {
struct object object;
};
-struct blob *lookup_blob(const unsigned char *sha1);
+struct blob *lookup_blob(const struct object_id *oid);
int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size);
diff --git a/branch.c b/branch.c
index bb9eb60dcd..985316eb76 100644
--- a/branch.c
+++ b/branch.c
@@ -191,9 +191,9 @@ int validate_new_branchname(const char *name, struct strbuf *ref,
if (!attr_only) {
const char *head;
- unsigned char sha1[20];
+ struct object_id oid;
- head = resolve_ref_unsafe("HEAD", 0, sha1, NULL);
+ head = resolve_ref_unsafe("HEAD", 0, oid.hash, NULL);
if (!is_bare_repository() && head && !strcmp(head, ref->buf))
die(_("Cannot force update the current branch."));
}
@@ -233,7 +233,7 @@ void create_branch(const char *name, const char *start_name,
int quiet, enum branch_track track)
{
struct commit *commit;
- unsigned char sha1[20];
+ struct object_id oid;
char *real_ref;
struct strbuf ref = STRBUF_INIT;
int forcing = 0;
@@ -253,7 +253,7 @@ void create_branch(const char *name, const char *start_name,
}
real_ref = NULL;
- if (get_sha1(start_name, sha1)) {
+ if (get_oid(start_name, &oid)) {
if (explicit_tracking) {
if (advice_set_upstream_failure) {
error(_(upstream_missing), start_name);
@@ -265,7 +265,7 @@ void create_branch(const char *name, const char *start_name,
die(_("Not a valid object name: '%s'."), start_name);
}
- switch (dwim_ref(start_name, strlen(start_name), sha1, &real_ref)) {
+ switch (dwim_ref(start_name, strlen(start_name), oid.hash, &real_ref)) {
case 0:
/* Not branching from any existing branch */
if (explicit_tracking)
@@ -286,9 +286,9 @@ void create_branch(const char *name, const char *start_name,
break;
}
- if ((commit = lookup_commit_reference(sha1)) == NULL)
+ if ((commit = lookup_commit_reference(&oid)) == NULL)
die(_("Not a valid branch point: '%s'."), start_name);
- hashcpy(sha1, commit->object.oid.hash);
+ oidcpy(&oid, &commit->object.oid);
if (reflog)
log_all_ref_updates = LOG_REFS_NORMAL;
@@ -306,7 +306,7 @@ void create_branch(const char *name, const char *start_name,
transaction = ref_transaction_begin(&err);
if (!transaction ||
ref_transaction_update(transaction, ref.buf,
- sha1, forcing ? NULL : null_sha1,
+ oid.hash, forcing ? NULL : null_sha1,
0, msg, &err) ||
ref_transaction_commit(transaction, &err))
die("%s", err.buf);
diff --git a/builtin/am.c b/builtin/am.c
index 8e9ac1144d..2ec1d7b71e 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1145,7 +1145,7 @@ static int index_has_changes(struct strbuf *sb)
DIFF_OPT_SET(&opt, EXIT_WITH_STATUS);
if (!sb)
DIFF_OPT_SET(&opt, QUICK);
- do_diff_cache(head.hash, &opt);
+ do_diff_cache(&head, &opt);
diffcore_std(&opt);
for (i = 0; sb && i < diff_queued_diff.nr; i++) {
if (i)
@@ -1447,9 +1447,9 @@ static void write_index_patch(const struct am_state *state)
FILE *fp;
if (!get_sha1_tree("HEAD", head.hash))
- tree = lookup_tree(head.hash);
+ tree = lookup_tree(&head);
else
- tree = lookup_tree(EMPTY_TREE_SHA1_BIN);
+ tree = lookup_tree(&empty_tree_oid);
fp = xfopen(am_path(state, "patch"), "w");
init_revisions(&rev_info, NULL);
@@ -1482,7 +1482,7 @@ static int parse_mail_rebase(struct am_state *state, const char *mail)
if (get_mail_commit_oid(&commit_oid, mail) < 0)
die(_("could not parse %s"), mail);
- commit = lookup_commit_or_die(commit_oid.hash, mail);
+ commit = lookup_commit_or_die(&commit_oid, mail);
get_commit_info(state, commit);
@@ -1612,7 +1612,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
init_revisions(&rev_info, NULL);
rev_info.diffopt.output_format = DIFF_FORMAT_NAME_STATUS;
diff_opt_parse(&rev_info.diffopt, &diff_filter_str, 1, rev_info.prefix);
- add_pending_sha1(&rev_info, "HEAD", our_tree.hash, 0);
+ add_pending_oid(&rev_info, "HEAD", &our_tree, 0);
diff_setup_done(&rev_info.diffopt);
run_diff_index(&rev_info, 1);
}
@@ -1677,7 +1677,7 @@ static void do_commit(const struct am_state *state)
if (!get_sha1_commit("HEAD", parent.hash)) {
old_oid = &parent;
- commit_list_insert(lookup_commit(parent.hash), &parents);
+ commit_list_insert(lookup_commit(&parent), &parents);
} else {
old_oid = NULL;
say(state, stderr, _("applying to an empty history"));
@@ -2039,11 +2039,11 @@ static int clean_index(const struct object_id *head, const struct object_id *rem
struct tree *head_tree, *remote_tree, *index_tree;
struct object_id index;
- head_tree = parse_tree_indirect(head->hash);
+ head_tree = parse_tree_indirect(head);
if (!head_tree)
return error(_("Could not parse object '%s'."), oid_to_hex(head));
- remote_tree = parse_tree_indirect(remote->hash);
+ remote_tree = parse_tree_indirect(remote);
if (!remote_tree)
return error(_("Could not parse object '%s'."), oid_to_hex(remote));
@@ -2055,7 +2055,7 @@ static int clean_index(const struct object_id *head, const struct object_id *rem
if (write_cache_as_tree(index.hash, 0, NULL))
return -1;
- index_tree = parse_tree_indirect(index.hash);
+ index_tree = parse_tree_indirect(&index);
if (!index_tree)
return error(_("Could not parse object '%s'."), oid_to_hex(&index));
diff --git a/builtin/blame.c b/builtin/blame.c
index f00eda1637..1043e5376f 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -563,7 +563,7 @@ static struct origin *find_origin(struct scoreboard *sb,
diff_setup_done(&diff_opts);
if (is_null_oid(&origin->commit->object.oid))
- do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
+ do_diff_cache(&parent->tree->object.oid, &diff_opts);
else
diff_tree_sha1(parent->tree->object.oid.hash,
origin->commit->tree->object.oid.hash,
@@ -633,7 +633,7 @@ static struct origin *find_rename(struct scoreboard *sb,
diff_setup_done(&diff_opts);
if (is_null_oid(&origin->commit->object.oid))
- do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
+ do_diff_cache(&parent->tree->object.oid, &diff_opts);
else
diff_tree_sha1(parent->tree->object.oid.hash,
origin->commit->tree->object.oid.hash,
@@ -1272,7 +1272,7 @@ static void find_copy_in_parent(struct scoreboard *sb,
DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
if (is_null_oid(&target->commit->object.oid))
- do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
+ do_diff_cache(&parent->tree->object.oid, &diff_opts);
else
diff_tree_sha1(parent->tree->object.oid.hash,
target->commit->tree->object.oid.hash,
@@ -2253,7 +2253,7 @@ static struct commit_list **append_parent(struct commit_list **tail, const struc
{
struct commit *parent;
- parent = lookup_commit_reference(oid->hash);
+ parent = lookup_commit_reference(oid);
if (!parent)
die("no such commit %s", oid_to_hex(oid));
return &commit_list_insert(parent, tail)->next;
@@ -2461,7 +2461,7 @@ static const char *dwim_reverse_initial(struct scoreboard *sb)
*/
struct object *obj;
struct commit *head_commit;
- unsigned char head_sha1[20];
+ struct object_id head_oid;
if (sb->revs->pending.nr != 1)
return NULL;
@@ -2473,9 +2473,9 @@ static const char *dwim_reverse_initial(struct scoreboard *sb)
return NULL;
/* Do we have HEAD? */
- if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, head_sha1, NULL))
+ if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, head_oid.hash, NULL))
return NULL;
- head_commit = lookup_commit_reference_gently(head_sha1, 1);
+ head_commit = lookup_commit_reference_gently(&head_oid, 1);
if (!head_commit)
return NULL;
diff --git a/builtin/branch.c b/builtin/branch.c
index 48a513a84d..83fcda43dc 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -124,7 +124,7 @@ static int branch_merged(int kind, const char *name,
(reference_name = reference_name_to_free =
resolve_refdup(upstream, RESOLVE_REF_READING,
oid.hash, NULL)) != NULL)
- reference_rev = lookup_commit_reference(oid.hash);
+ reference_rev = lookup_commit_reference(&oid);
}
if (!reference_rev)
reference_rev = head_rev;
@@ -157,7 +157,7 @@ static int check_branch_commit(const char *branchname, const char *refname,
const struct object_id *oid, struct commit *head_rev,
int kinds, int force)
{
- struct commit *rev = lookup_commit_reference(oid->hash);
+ struct commit *rev = lookup_commit_reference(oid);
if (!rev) {
error(_("Couldn't look up commit object for '%s'"), refname);
return -1;
@@ -211,7 +211,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
}
if (!force) {
- head_rev = lookup_commit_reference(head_oid.hash);
+ head_rev = lookup_commi