OPT_END()
};
struct ls_tree_cmdmode_to_fmt *m2f = ls_tree_cmdmode_format;
- struct object_context obj_context = {0};
int ret;
repo_config(the_repository, git_default_config, NULL);
ls_tree_usage, ls_tree_options);
if (argc < 1)
usage_with_options(ls_tree_usage, ls_tree_options);
- if (get_oid_with_context(the_repository, argv[0],
- GET_OID_HASH_ANY, &oid,
- &obj_context))
+ if (repo_get_oid_with_flags(the_repository, argv[0], &oid,
+ GET_OID_HASH_ANY))
die("Not a valid object name %s", argv[0]);
/*
ret = !!read_tree(the_repository, tree, &options.pathspec, fn, &options);
clear_pathspec(&options.pathspec);
- object_context_release(&obj_context);
return ret;
}
struct object_id oid;
unsigned int flags = 0;
const char *name = NULL;
- struct object_context unused;
struct strbuf buf = STRBUF_INIT;
int seen_end_of_options = 0;
enum format_type format = FORMAT_DEFAULT;
name++;
type = REVERSED;
}
- if (!get_oid_with_context(the_repository, name,
- flags, &oid, &unused)) {
- object_context_release(&unused);
+ if (!repo_get_oid_with_flags(the_repository, name, &oid,
+ flags)) {
if (output_algo)
repo_oid_to_algop(the_repository, &oid,
output_algo, &oid);
show_rev(type, &oid, name);
continue;
}
- object_context_release(&unused);
if (verify)
die_no_single_rev(quiet);
if (has_dashdash)
int quiet = 0;
const char *stash_msg = NULL;
struct object_id obj;
- struct object_context dummy = {0};
struct option options[] = {
OPT__QUIET(&quiet, N_("be quiet")),
OPT_STRING('m', "message", &stash_msg, "message",
return -1;
}
- if (get_oid_with_context(the_repository,
- argv[0], quiet ? GET_OID_QUIETLY : 0, &obj,
- &dummy)) {
+ if (repo_get_oid_with_flags(the_repository, argv[0], &obj,
+ quiet ? GET_OID_QUIETLY : 0)) {
if (!quiet)
fprintf_ln(stderr, _("Cannot update %s with %s"),
ref_stash, argv[0]);
ret = do_store_stash(&obj, stash_msg, quiet);
out:
- object_context_release(&dummy);
return ret;
}
const char **argv)
{
struct object_id base;
- struct object_context unused;
struct commit *prev;
struct commit_list *items = NULL, **iter = &items, *cur;
int res = 0;
struct commit *stash;
if (parse_stash_revision(&revision, argv[i], 1) ||
- get_oid_with_context(r, revision.buf,
- GET_OID_QUIETLY | GET_OID_GENTLY,
- &oid, &unused)) {
+ repo_get_oid_with_flags(r, revision.buf, &oid,
+ GET_OID_QUIETLY |
+ GET_OID_GENTLY)) {
res = error(_("unable to find stash entry %s"), argv[i]);
goto out;
}
struct filter *filter)
{
struct filter_sparse_data *d = xcalloc(1, sizeof(*d));
- struct object_context oc;
struct object_id sparse_oid;
- if (get_oid_with_context(the_repository,
- filter_options->sparse_oid_name,
- GET_OID_BLOB, &sparse_oid, &oc))
+ if (repo_get_oid_with_flags(the_repository,
+ filter_options->sparse_oid_name,
+ &sparse_oid, GET_OID_BLOB))
die(_("unable to access sparse blob in '%s'"),
filter_options->sparse_oid_name);
if (add_patterns_from_blob_to_list(&sparse_oid, "", 0, &d->pl) < 0)
filter->filter_data = d;
filter->filter_object_fn = filter_sparse;
filter->free_fn = filter_sparse_free;
-
- object_context_release(&oc);
}
/*
const char *name,
struct object_id *oid)
{
- struct object_context unused;
- int ret = get_oid_with_context(r, name, GET_OID_COMMITTISH,
- oid, &unused);
- object_context_release(&unused);
- return ret;
+ return repo_get_oid_with_flags(r, name, oid, GET_OID_COMMITTISH);
}
int repo_get_oid_treeish(struct repository *r,
const char *name,
struct object_id *oid)
{
- struct object_context unused;
- int ret = get_oid_with_context(r, name, GET_OID_TREEISH,
- oid, &unused);
- object_context_release(&unused);
- return ret;
+ return repo_get_oid_with_flags(r, name, oid, GET_OID_TREEISH);
}
int repo_get_oid_commit(struct repository *r,
const char *name,
struct object_id *oid)
{
- struct object_context unused;
- int ret = get_oid_with_context(r, name, GET_OID_COMMIT,
- oid, &unused);
- object_context_release(&unused);
- return ret;
+ return repo_get_oid_with_flags(r, name, oid, GET_OID_COMMIT);
}
int repo_get_oid_tree(struct repository *r,
const char *name,
struct object_id *oid)
{
- struct object_context unused;
- int ret = get_oid_with_context(r, name, GET_OID_TREE,
- oid, &unused);
- object_context_release(&unused);
- return ret;
+ return repo_get_oid_with_flags(r, name, oid, GET_OID_TREE);
}
int repo_get_oid_blob(struct repository *r,
const char *name,
struct object_id *oid)
{
- struct object_context unused;
- int ret = get_oid_with_context(r, name, GET_OID_BLOB,
- oid, &unused);
- object_context_release(&unused);
- return ret;
+ return repo_get_oid_with_flags(r, name, oid, GET_OID_BLOB);
}
/* Must be called only when object_name:filename doesn't exist. */