Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
describe: use commit-slab for commit names instead of commit->util
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Sat, 19 May 2018 05:28:20 +0000
(07:28 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 21 May 2018 05:07:20 +0000
(14:07 +0900)
It's done so that commit->util can be removed. See more explanation in
the commit that removes commit->util.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/describe.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
4e0df4e
)
diff --git
a/builtin/describe.c
b/builtin/describe.c
index b5afc4584632d35afe26f4c3d0dfb09e777518b1..1b6ca425537870bf874a0cd8e910df5c592afa62 100644
(file)
--- a/
builtin/describe.c
+++ b/
builtin/describe.c
@@
-15,9
+15,12
@@
#include "run-command.h"
#include "revision.h"
#include "list-objects.h"
#include "run-command.h"
#include "revision.h"
#include "list-objects.h"
+#include "commit-slab.h"
#define MAX_TAGS (FLAG_BITS - 1)
#define MAX_TAGS (FLAG_BITS - 1)
+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"),
static const char * const describe_usage[] = {
N_("git describe [<options>] [<commit-ish>...]"),
N_("git describe [<options>] --dirty"),
@@
-37,6
+40,7
@@
static struct string_list patterns = STRING_LIST_INIT_NODUP;
static struct string_list exclude_patterns = STRING_LIST_INIT_NODUP;
static int always;
static const char *suffix, *dirty, *broken;
static struct string_list exclude_patterns = STRING_LIST_INIT_NODUP;
static int always;
static const char *suffix, *dirty, *broken;
+static struct commit_names commit_names;
/* diff-index command arguments to check if working tree is dirty. */
static const char *diff_index_args[] = {
/* diff-index command arguments to check if working tree is dirty. */
static const char *diff_index_args[] = {
@@
-321,11
+325,14
@@
static void describe_commit(struct object_id *oid, struct strbuf *dst)
if (!have_util) {
struct hashmap_iter iter;
struct commit *c;
if (!have_util) {
struct hashmap_iter iter;
struct commit *c;
- struct commit_name *n = hashmap_iter_first(&names, &iter);
+ struct commit_name *n;
+
+ init_commit_names(&commit_names);
+ n = hashmap_iter_first(&names, &iter);
for (; n; n = hashmap_iter_next(&iter)) {
c = lookup_commit_reference_gently(&n->peeled, 1);
if (c)
for (; n; n = hashmap_iter_next(&iter)) {
c = lookup_commit_reference_gently(&n->peeled, 1);
if (c)
-
c->util
= n;
+
*commit_names_at(&commit_names, c)
= n;
}
have_util = 1;
}
}
have_util = 1;
}
@@
-336,8
+343,11
@@
static void describe_commit(struct object_id *oid, struct strbuf *dst)
while (list) {
struct commit *c = pop_commit(&list);
struct commit_list *parents = c->parents;
while (list) {
struct commit *c = pop_commit(&list);
struct commit_list *parents = c->parents;
+ struct commit_name **slot;
+
seen_commits++;
seen_commits++;
- n = c->util;
+ slot = commit_names_peek(&commit_names, c);
+ n = slot ? *slot : NULL;
if (n) {
if (!tags && !all && n->prio < 2) {
unannotated_cnt++;
if (n) {
if (!tags && !all && n->prio < 2) {
unannotated_cnt++;