]>
Commit | Line | Data |
---|---|---|
06d5535a KK |
1 | commit 93d8ef8f1de4385c565049e1ccd7fdd25e6c14d7 |
2 | Author: John Keeping <john@keeping.me.uk> | |
3 | Date: Sun Jul 27 11:56:18 2014 +0100 | |
4 | ||
5 | parsing.c: make commit buffer const | |
6 | ||
7 | This will be required in order to incorporate the changes to commit | |
8 | buffer handling in Git 2.0.2. | |
9 | ||
10 | Signed-off-by: John Keeping <john@keeping.me.uk> | |
11 | ||
12 | diff --git a/parsing.c b/parsing.c | |
13 | index 073f46f..edb3416 100644 | |
14 | --- a/parsing.c | |
15 | +++ b/parsing.c | |
16 | @@ -69,9 +69,9 @@ static char *substr(const char *head, const char *tail) | |
17 | return buf; | |
18 | } | |
19 | ||
20 | -static char *parse_user(char *t, char **name, char **email, unsigned long *date) | |
21 | +static const char *parse_user(const char *t, char **name, char **email, unsigned long *date) | |
22 | { | |
23 | - char *p = t; | |
24 | + const char *p = t; | |
25 | int mode = 1; | |
26 | ||
27 | while (p && *p) { | |
28 | @@ -132,7 +132,7 @@ static const char *reencode(char **txt, const char *src_enc, const char *dst_enc | |
29 | struct commitinfo *cgit_parse_commit(struct commit *commit) | |
30 | { | |
31 | struct commitinfo *ret; | |
32 | - char *p = commit->buffer, *t; | |
33 | + const char *p = commit->buffer, *t; | |
34 | ||
35 | ret = xmalloc(sizeof(*ret)); | |
36 | ret->commit = commit; | |
37 | @@ -223,7 +223,7 @@ struct taginfo *cgit_parse_tag(struct tag *tag) | |
38 | void *data; | |
39 | enum object_type type; | |
40 | unsigned long size; | |
41 | - char *p; | |
42 | + const char *p; | |
43 | struct taginfo *ret; | |
44 | ||
45 | data = read_sha1_file(tag->object.sha1, &type, &size); | |
46 | commit 865afe0eb1b5e6485fe0f65472e6635266e393b1 | |
47 | Author: John Keeping <john@keeping.me.uk> | |
48 | Date: Sun Jul 27 11:56:19 2014 +0100 | |
49 | ||
50 | git: update to v2.0.3 | |
51 | ||
52 | This is slightly more involved than just bumping the version number | |
53 | because it pulls in a change to convert the commit buffer to a slab, | |
54 | removing the "buffer" field from "struct commit". All sites that access | |
55 | "commit->buffer" have been changed to use the new functions provided for | |
56 | this purpose. | |
57 | ||
58 | Signed-off-by: John Keeping <john@keeping.me.uk> | |
59 | ||
60 | diff --git a/Makefile b/Makefile | |
61 | index bf8be02..93b525a 100644 | |
62 | --- a/Makefile | |
63 | +++ b/Makefile | |
64 | @@ -14,7 +14,7 @@ htmldir = $(docdir) | |
65 | pdfdir = $(docdir) | |
66 | mandir = $(prefix)/share/man | |
67 | SHA1_HEADER = <openssl/sha.h> | |
68 | -GIT_VER = 2.0.1 | |
69 | +GIT_VER = 2.0.3 | |
70 | GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz | |
71 | INSTALL = install | |
72 | COPYTREE = cp -r | |
73 | diff --git a/parsing.c b/parsing.c | |
74 | index edb3416..3dbd122 100644 | |
75 | --- a/parsing.c | |
76 | +++ b/parsing.c | |
77 | @@ -132,7 +132,8 @@ static const char *reencode(char **txt, const char *src_enc, const char *dst_enc | |
78 | struct commitinfo *cgit_parse_commit(struct commit *commit) | |
79 | { | |
80 | struct commitinfo *ret; | |
81 | - const char *p = commit->buffer, *t; | |
82 | + const char *p = get_cached_commit_buffer(commit, NULL); | |
83 | + const char *t; | |
84 | ||
85 | ret = xmalloc(sizeof(*ret)); | |
86 | ret->commit = commit; | |
87 | diff --git a/ui-atom.c b/ui-atom.c | |
88 | index b22d745..e2b39ee 100644 | |
89 | --- a/ui-atom.c | |
90 | +++ b/ui-atom.c | |
91 | @@ -133,8 +133,7 @@ void cgit_print_atom(char *tip, char *path, int max_count) | |
92 | } | |
93 | while ((commit = get_revision(&rev)) != NULL) { | |
94 | add_entry(commit, host); | |
95 | - free(commit->buffer); | |
96 | - commit->buffer = NULL; | |
97 | + free_commit_buffer(commit); | |
98 | free_commit_list(commit->parents); | |
99 | commit->parents = NULL; | |
100 | } | |
101 | diff --git a/ui-log.c b/ui-log.c | |
102 | index b5846e4..bcdb666 100644 | |
103 | --- a/ui-log.c | |
104 | +++ b/ui-log.c | |
105 | @@ -388,16 +388,14 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |
106 | ofs = 0; | |
107 | ||
108 | for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { | |
109 | - free(commit->buffer); | |
110 | - commit->buffer = NULL; | |
111 | + free_commit_buffer(commit); | |
112 | free_commit_list(commit->parents); | |
113 | commit->parents = NULL; | |
114 | } | |
115 | ||
116 | for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { | |
117 | print_commit(commit, &rev); | |
118 | - free(commit->buffer); | |
119 | - commit->buffer = NULL; | |
120 | + free_commit_buffer(commit); | |
121 | free_commit_list(commit->parents); | |
122 | commit->parents = NULL; | |
123 | } | |
124 | diff --git a/ui-stats.c b/ui-stats.c | |
125 | index bc27308..6f13c32 100644 | |
126 | --- a/ui-stats.c | |
127 | +++ b/ui-stats.c | |
128 | @@ -244,7 +244,7 @@ static struct string_list collect_stats(struct cgit_period *period) | |
129 | memset(&authors, 0, sizeof(authors)); | |
130 | while ((commit = get_revision(&rev)) != NULL) { | |
131 | add_commit(&authors, commit, period); | |
132 | - free(commit->buffer); | |
133 | + free_commit_buffer(commit); | |
134 | free_commit_list(commit->parents); | |
135 | } | |
136 | return authors; |