diff options
Diffstat (limited to 'builtin/describe.c')
-rw-r--r-- | builtin/describe.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/builtin/describe.c b/builtin/describe.c index e17c4b4c69..55b4baaa22 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -1,6 +1,9 @@ -#define USE_THE_INDEX_COMPATIBILITY_MACROS +#define USE_THE_INDEX_VARIABLE #include "cache.h" #include "config.h" +#include "environment.h" +#include "gettext.h" +#include "hex.h" #include "lockfile.h" #include "commit.h" #include "tag.h" @@ -8,10 +11,12 @@ #include "refs.h" #include "builtin.h" #include "exec-cmd.h" +#include "object-name.h" #include "parse-options.h" #include "revision.h" #include "diff.h" #include "hashmap.h" +#include "setup.h" #include "strvec.h" #include "run-command.h" #include "object-store.h" @@ -23,8 +28,9 @@ define_commit_slab(commit_names, struct commit_name *); static const char * const describe_usage[] = { - N_("git describe [<options>] [<commit-ish>...]"), - N_("git describe [<options>] --dirty"), + N_("git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"), + N_("git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"), + N_("git describe <blob>"), NULL }; @@ -260,7 +266,7 @@ static unsigned long finish_depth_computation( best->depth++; while (parents) { struct commit *p = parents->item; - parse_commit(p); + repo_parse_commit(the_repository, p); if (!(p->object.flags & SEEN)) commit_list_insert_by_date(p, list); p->object.flags |= c->object.flags; @@ -297,7 +303,8 @@ static void append_name(struct commit_name *n, struct strbuf *dst) static void append_suffix(int depth, const struct object_id *oid, struct strbuf *dst) { - strbuf_addf(dst, "-%d-g%s", depth, find_unique_abbrev(oid, abbrev)); + strbuf_addf(dst, "-%d-g%s", depth, + repo_find_unique_abbrev(the_repository, oid, abbrev)); } static void describe_commit(struct object_id *oid, struct strbuf *dst) @@ -402,7 +409,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst) } while (parents) { struct commit *p = parents->item; - parse_commit(p); + repo_parse_commit(the_repository, p); if (!(p->object.flags & SEEN)) commit_list_insert_by_date(p, &list); p->object.flags |= c->object.flags; @@ -530,7 +537,7 @@ static void describe(const char *arg, int last_one) if (debug) fprintf(stderr, _("describe %s\n"), arg); - if (get_oid(arg, &oid)) + if (repo_get_oid(the_repository, arg, &oid)) die(_("Not a valid object name %s"), arg); cmit = lookup_commit_reference_gently(the_repository, &oid, 1); @@ -652,10 +659,13 @@ int cmd_describe(int argc, const char **argv, const char *prefix) int fd, result; setup_work_tree(); - read_cache(); + prepare_repo_settings(the_repository); + the_repository->settings.command_requires_full_index = 0; + repo_read_index(the_repository); refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL); - fd = hold_locked_index(&index_lock, 0); + fd = repo_hold_locked_index(the_repository, + &index_lock, 0); if (0 <= fd) repo_update_index_if_able(the_repository, &index_lock); |