aboutsummaryrefslogtreecommitdiff
path: root/commit.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-11 10:33:36 -0700
committerJunio C Hamano <gitster@pobox.com>2014-09-11 10:33:36 -0700
commit1ebe6a825a1ff12e12905e28265aa30e269700d6 (patch)
tree0ad33ffa41525b67198a5d756a8e5beedee2ea73 /commit.h
parentf28763d7561f66c0c6ff9b5d48146a0f923781d3 (diff)
parent2e3dfb216991974b60fdb1933eb3331e03383e61 (diff)
downloadgit-1ebe6a825a1ff12e12905e28265aa30e269700d6.tar.gz
git-1ebe6a825a1ff12e12905e28265aa30e269700d6.tar.xz
Merge branch 'jk/name-decoration-alloc'
The API to allocate the structure to keep track of commit decoration was cumbersome to use, inviting lazy code to overallocate memory. * jk/name-decoration-alloc: log-tree: use FLEX_ARRAY in name_decoration log-tree: make name_decoration hash static log-tree: make add_name_decoration a public function
Diffstat (limited to 'commit.h')
-rw-r--r--commit.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/commit.h b/commit.h
index aa8c3ca50..a401ddfbc 100644
--- a/commit.h
+++ b/commit.h
@@ -26,13 +26,25 @@ extern int save_commit_buffer;
extern const char *commit_type;
/* While we can decorate any object with a name, it's only used for commits.. */
-extern struct decoration name_decoration;
struct name_decoration {
struct name_decoration *next;
int type;
- char name[1];
+ char name[FLEX_ARRAY];
};
+enum decoration_type {
+ DECORATION_NONE = 0,
+ DECORATION_REF_LOCAL,
+ DECORATION_REF_REMOTE,
+ DECORATION_REF_TAG,
+ DECORATION_REF_STASH,
+ DECORATION_REF_HEAD,
+ DECORATION_GRAFTED,
+};
+
+void add_name_decoration(enum decoration_type type, const char *name, struct object *obj);
+const struct name_decoration *get_name_decoration(const struct object *obj);
+
struct commit *lookup_commit(const unsigned char *sha1);
struct commit *lookup_commit_reference(const unsigned char *sha1);
struct commit *lookup_commit_reference_gently(const unsigned char *sha1,