diff options
author | June McEnroe | 2022-02-13 12:07:49 -0500 |
---|---|---|
committer | June McEnroe | 2022-02-13 12:10:49 -0500 |
commit | 516175469a8c6895496ef909b487992deb45f460 (patch) | |
tree | e0e8b4d38f05e870089de8babc0d3aca3bb4d3b0 | |
parent | Fix crash trying to print "this commit" on 404s (diff) | |
parent | git: update to v2.32.0 (diff) | |
download | cgit-516175469a8c6895496ef909b487992deb45f460.tar.gz cgit-516175469a8c6895496ef909b487992deb45f460.zip |
Merge up to git v2.32.0
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | cache.c | 6 | ||||
-rw-r--r-- | cgit.c | 16 | ||||
-rw-r--r-- | cgit.css | 2 | ||||
-rw-r--r-- | cgit.h | 8 | ||||
-rw-r--r-- | cmd.c | 18 | ||||
-rwxr-xr-x | filters/commit-links.sh | 2 | ||||
-rwxr-xr-x | filters/html-converters/md2html | 7 | ||||
m--------- | git | 0 | ||||
-rw-r--r-- | parsing.c | 5 | ||||
-rwxr-xr-x | tests/setup.sh | 12 | ||||
-rwxr-xr-x | tests/t0001-validate-git-versions.sh | 4 | ||||
-rwxr-xr-x | tests/t0105-commit.sh | 2 | ||||
-rwxr-xr-x | tests/t0107-snapshot.sh | 17 | ||||
-rwxr-xr-x | tests/t0109-gitconfig.sh | 2 | ||||
-rw-r--r-- | ui-blame.c | 26 | ||||
-rw-r--r-- | ui-blob.c | 20 | ||||
-rw-r--r-- | ui-commit.c | 10 | ||||
-rw-r--r-- | ui-diff.c | 8 | ||||
-rw-r--r-- | ui-log.c | 42 | ||||
-rw-r--r-- | ui-patch.c | 2 | ||||
-rw-r--r-- | ui-plain.c | 13 | ||||
-rw-r--r-- | ui-shared.c | 49 | ||||
-rw-r--r-- | ui-snapshot.c | 24 | ||||
-rw-r--r-- | ui-stats.c | 48 | ||||
-rw-r--r-- | ui-tag.c | 6 | ||||
-rw-r--r-- | ui-tree.c | 21 |
27 files changed, 179 insertions, 193 deletions
diff --git a/Makefile b/Makefile index 49109ad..d13c5bd 100644 --- a/Makefile +++ b/Makefile | |||
@@ -14,7 +14,7 @@ htmldir = $(docdir) | |||
14 | pdfdir = $(docdir) | 14 | pdfdir = $(docdir) |
15 | mandir = $(prefix)/share/man | 15 | mandir = $(prefix)/share/man |
16 | SHA1_HEADER = <openssl/sha.h> | 16 | SHA1_HEADER = <openssl/sha.h> |
17 | GIT_VER = 2.25.1 | 17 | GIT_VER = 2.32.0 |
18 | GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz | 18 | GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz |
19 | INSTALL = install | 19 | INSTALL = install |
20 | COPYTREE = cp -r | 20 | COPYTREE = cp -r |
diff --git a/cache.c b/cache.c index 580c0e8..578b73b 100644 --- a/cache.c +++ b/cache.c | |||
@@ -408,12 +408,12 @@ int cache_process(int size, const char *path, const char *key, int ttl, | |||
408 | static char *sprintftime(const char *format, time_t time) | 408 | static char *sprintftime(const char *format, time_t time) |
409 | { | 409 | { |
410 | static char buf[64]; | 410 | static char buf[64]; |
411 | struct tm *tm; | 411 | struct tm tm; |
412 | 412 | ||
413 | if (!time) | 413 | if (!time) |
414 | return NULL; | 414 | return NULL; |
415 | tm = gmtime(&time); | 415 | gmtime_r(&time, &tm); |
416 | strftime(buf, sizeof(buf)-1, format, tm); | 416 | strftime(buf, sizeof(buf)-1, format, &tm); |
417 | return buf; | 417 | return buf; |
418 | } | 418 | } |
419 | 419 | ||
diff --git a/cgit.c b/cgit.c index d8ea221..40825cb 100644 --- a/cgit.c +++ b/cgit.c | |||
@@ -324,11 +324,11 @@ static void querystring_cb(const char *name, const char *value) | |||
324 | ctx.qry.head = xstrdup(value); | 324 | ctx.qry.head = xstrdup(value); |
325 | ctx.qry.has_symref = 1; | 325 | ctx.qry.has_symref = 1; |
326 | } else if (!strcmp(name, "id")) { | 326 | } else if (!strcmp(name, "id")) { |
327 | ctx.qry.sha1 = xstrdup(value); | 327 | ctx.qry.oid = xstrdup(value); |
328 | ctx.qry.has_sha1 = 1; | 328 | ctx.qry.has_oid = 1; |
329 | } else if (!strcmp(name, "id2")) { | 329 | } else if (!strcmp(name, "id2")) { |
330 | ctx.qry.sha2 = xstrdup(value); | 330 | ctx.qry.oid2 = xstrdup(value); |
331 | ctx.qry.has_sha1 = 1; | 331 | ctx.qry.has_oid = 1; |
332 | } else if (!strcmp(name, "ofs")) { | 332 | } else if (!strcmp(name, "ofs")) { |
333 | ctx.qry.ofs = atoi(value); | 333 | ctx.qry.ofs = atoi(value); |
334 | } else if (!strcmp(name, "path")) { | 334 | } else if (!strcmp(name, "path")) { |
@@ -992,9 +992,9 @@ static void cgit_parse_args(int argc, const char **argv) | |||
992 | } else if (skip_prefix(argv[i], "--head=", &arg)) { | 992 | } else if (skip_prefix(argv[i], "--head=", &arg)) { |
993 | ctx.qry.head = xstrdup(arg); | 993 | ctx.qry.head = xstrdup(arg); |
994 | ctx.qry.has_symref = 1; | 994 | ctx.qry.has_symref = 1; |
995 | } else if (skip_prefix(argv[i], "--sha1=", &arg)) { | 995 | } else if (skip_prefix(argv[i], "--oid=", &arg)) { |
996 | ctx.qry.sha1 = xstrdup(arg); | 996 | ctx.qry.oid = xstrdup(arg); |
997 | ctx.qry.has_sha1 = 1; | 997 | ctx.qry.has_oid = 1; |
998 | } else if (skip_prefix(argv[i], "--ofs=", &arg)) { | 998 | } else if (skip_prefix(argv[i], "--ofs=", &arg)) { |
999 | ctx.qry.ofs = atoi(arg); | 999 | ctx.qry.ofs = atoi(arg); |
1000 | } else if (skip_prefix(argv[i], "--scan-tree=", &arg) || | 1000 | } else if (skip_prefix(argv[i], "--scan-tree=", &arg) || |
@@ -1037,7 +1037,7 @@ static int calc_ttl(void) | |||
1037 | if (!strcmp(ctx.qry.page, "snapshot")) | 1037 | if (!strcmp(ctx.qry.page, "snapshot")) |
1038 | return ctx.cfg.cache_snapshot_ttl; | 1038 | return ctx.cfg.cache_snapshot_ttl; |
1039 | 1039 | ||
1040 | if (ctx.qry.has_sha1) | 1040 | if (ctx.qry.has_oid) |
1041 | return ctx.cfg.cache_static_ttl; | 1041 | return ctx.cfg.cache_static_ttl; |
1042 | 1042 | ||
1043 | if (ctx.qry.has_symref) | 1043 | if (ctx.qry.has_symref) |
diff --git a/cgit.css b/cgit.css index 36826b0..f3dbb7a 100644 --- a/cgit.css +++ b/cgit.css | |||
@@ -550,7 +550,7 @@ div#cgit table.diff td span.del { | |||
550 | color: red; | 550 | color: red; |
551 | } | 551 | } |
552 | 552 | ||
553 | div#cgit .sha1 { | 553 | div#cgit .oid { |
554 | font-family: monospace; | 554 | font-family: monospace; |
555 | font-size: 90%; | 555 | font-size: 90%; |
556 | } | 556 | } |
diff --git a/cgit.h b/cgit.h index 7ec46b4..69b5c13 100644 --- a/cgit.h +++ b/cgit.h | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <tag.h> | 14 | #include <tag.h> |
15 | #include <diff.h> | 15 | #include <diff.h> |
16 | #include <diffcore.h> | 16 | #include <diffcore.h> |
17 | #include <argv-array.h> | 17 | #include <strvec.h> |
18 | #include <refs.h> | 18 | #include <refs.h> |
19 | #include <revision.h> | 19 | #include <revision.h> |
20 | #include <log-tree.h> | 20 | #include <log-tree.h> |
@@ -164,7 +164,7 @@ struct reflist { | |||
164 | 164 | ||
165 | struct cgit_query { | 165 | struct cgit_query { |
166 | int has_symref; | 166 | int has_symref; |
167 | int has_sha1; | 167 | int has_oid; |
168 | int has_difftype; | 168 | int has_difftype; |
169 | char *raw; | 169 | char *raw; |
170 | char *repo; | 170 | char *repo; |
@@ -172,8 +172,8 @@ struct cgit_query { | |||
172 | char *search; | 172 | char *search; |
173 | char *grep; | 173 | char *grep; |
174 | char *head; | 174 | char *head; |
175 | char *sha1; | 175 | char *oid; |
176 | char *sha2; | 176 | char *oid2; |
177 | char *path; | 177 | char *path; |
178 | char *name; | 178 | char *name; |
179 | char *url; | 179 | char *url; |
diff --git a/cmd.c b/cmd.c index bf6d8f5..0eb75b1 100644 --- a/cmd.c +++ b/cmd.c | |||
@@ -74,22 +74,22 @@ static void blame_fn(void) | |||
74 | 74 | ||
75 | static void blob_fn(void) | 75 | static void blob_fn(void) |
76 | { | 76 | { |
77 | cgit_print_blob(ctx.qry.sha1, ctx.qry.path, ctx.qry.head, 0); | 77 | cgit_print_blob(ctx.qry.oid, ctx.qry.path, ctx.qry.head, 0); |
78 | } | 78 | } |
79 | 79 | ||
80 | static void commit_fn(void) | 80 | static void commit_fn(void) |
81 | { | 81 | { |
82 | cgit_print_commit(ctx.qry.sha1, ctx.qry.path); | 82 | cgit_print_commit(ctx.qry.oid, ctx.qry.path); |
83 | } | 83 | } |
84 | 84 | ||
85 | static void diff_fn(void) | 85 | static void diff_fn(void) |
86 | { | 86 | { |
87 | cgit_print_diff(ctx.qry.sha1, ctx.qry.sha2, ctx.qry.path, 1, 0); | 87 | cgit_print_diff(ctx.qry.oid, ctx.qry.oid2, ctx.qry.path, 1, 0); |
88 | } | 88 | } |
89 | 89 | ||
90 | static void rawdiff_fn(void) | 90 | static void rawdiff_fn(void) |
91 | { | 91 | { |
92 | cgit_print_diff(ctx.qry.sha1, ctx.qry.sha2, ctx.qry.path, 1, 1); | 92 | cgit_print_diff(ctx.qry.oid, ctx.qry.oid2, ctx.qry.path, 1, 1); |
93 | } | 93 | } |
94 | 94 | ||
95 | static void info_fn(void) | 95 | static void info_fn(void) |
@@ -99,7 +99,7 @@ static void info_fn(void) | |||
99 | 99 | ||
100 | static void log_fn(void) | 100 | static void log_fn(void) |
101 | { | 101 | { |
102 | cgit_print_log(ctx.qry.sha1, ctx.qry.ofs, ctx.cfg.max_commit_count, | 102 | cgit_print_log(ctx.qry.oid, ctx.qry.ofs, ctx.cfg.max_commit_count, |
103 | ctx.qry.grep, ctx.qry.search, ctx.qry.path, 1, | 103 | ctx.qry.grep, ctx.qry.search, ctx.qry.path, 1, |
104 | ctx.repo->enable_commit_graph, | 104 | ctx.repo->enable_commit_graph, |
105 | ctx.repo->commit_sort); | 105 | ctx.repo->commit_sort); |
@@ -125,7 +125,7 @@ static void repolist_fn(void) | |||
125 | 125 | ||
126 | static void patch_fn(void) | 126 | static void patch_fn(void) |
127 | { | 127 | { |
128 | cgit_print_patch(ctx.qry.sha1, ctx.qry.sha2, ctx.qry.path); | 128 | cgit_print_patch(ctx.qry.oid, ctx.qry.oid2, ctx.qry.path); |
129 | } | 129 | } |
130 | 130 | ||
131 | static void plain_fn(void) | 131 | static void plain_fn(void) |
@@ -140,7 +140,7 @@ static void refs_fn(void) | |||
140 | 140 | ||
141 | static void snapshot_fn(void) | 141 | static void snapshot_fn(void) |
142 | { | 142 | { |
143 | cgit_print_snapshot(ctx.qry.head, ctx.qry.sha1, ctx.qry.path, | 143 | cgit_print_snapshot(ctx.qry.head, ctx.qry.oid, ctx.qry.path, |
144 | ctx.qry.nohead); | 144 | ctx.qry.nohead); |
145 | } | 145 | } |
146 | 146 | ||
@@ -156,12 +156,12 @@ static void summary_fn(void) | |||
156 | 156 | ||
157 | static void tag_fn(void) | 157 | static void tag_fn(void) |
158 | { | 158 | { |
159 | cgit_print_tag(ctx.qry.sha1); | 159 | cgit_print_tag(ctx.qry.oid); |
160 | } | 160 | } |
161 | 161 | ||
162 | static void tree_fn(void) | 162 | static void tree_fn(void) |
163 | { | 163 | { |
164 | cgit_print_tree(ctx.qry.sha1, ctx.qry.path); | 164 | cgit_print_tree(ctx.qry.oid, ctx.qry.path); |
165 | } | 165 | } |
166 | 166 | ||
167 | #define def_cmd(name, want_repo, want_vpath, is_clone) \ | 167 | #define def_cmd(name, want_repo, want_vpath, is_clone) \ |
diff --git a/filters/commit-links.sh b/filters/commit-links.sh index 5881952..796ac30 100755 --- a/filters/commit-links.sh +++ b/filters/commit-links.sh | |||
@@ -19,7 +19,7 @@ regex='' | |||
19 | 19 | ||
20 | # This expression generates links to commits referenced by their SHA1. | 20 | # This expression generates links to commits referenced by their SHA1. |
21 | regex=$regex' | 21 | regex=$regex' |
22 | s|\b([0-9a-fA-F]{7,40})\b|<a href="./?id=\1">\1</a>|g' | 22 | s|\b([0-9a-fA-F]{7,64})\b|<a href="./?id=\1">\1</a>|g' |
23 | 23 | ||
24 | # This expression generates links to a fictional bugtracker. | 24 | # This expression generates links to a fictional bugtracker. |
25 | regex=$regex' | 25 | regex=$regex' |
diff --git a/filters/html-converters/md2html b/filters/html-converters/md2html index dc20f42..59f43a8 100755 --- a/filters/html-converters/md2html +++ b/filters/html-converters/md2html | |||
@@ -86,11 +86,7 @@ div#cgit .markdown-body h1 a.toclink, div#cgit .markdown-body h2 a.toclink, div# | |||
86 | margin: 15px 0; | 86 | margin: 15px 0; |
87 | } | 87 | } |
88 | .markdown-body hr { | 88 | .markdown-body hr { |
89 | background: transparent url("/dirty-shade.png") repeat-x 0 0; | 89 | border: 2px solid #ccc; |
90 | border: 0 none; | ||
91 | color: #ccc; | ||
92 | height: 4px; | ||
93 | padding: 0; | ||
94 | } | 90 | } |
95 | .markdown-body>h2:first-child, .markdown-body>h1:first-child, .markdown-body>h1:first-child+h2, .markdown-body>h3:first-child, .markdown-body>h4:first-child, .markdown-body>h5:first-child, .markdown-body>h6:first-child { | 91 | .markdown-body>h2:first-child, .markdown-body>h1:first-child, .markdown-body>h1:first-child+h2, .markdown-body>h3:first-child, .markdown-body>h4:first-child, .markdown-body>h5:first-child, .markdown-body>h6:first-child { |
96 | margin-top: 0; | 92 | margin-top: 0; |
@@ -301,6 +297,7 @@ markdown.markdownFromFile( | |||
301 | "markdown.extensions.fenced_code", | 297 | "markdown.extensions.fenced_code", |
302 | "markdown.extensions.codehilite", | 298 | "markdown.extensions.codehilite", |
303 | "markdown.extensions.tables", | 299 | "markdown.extensions.tables", |
300 | "markdown.extensions.sane_lists", | ||
304 | TocExtension(anchorlink=True)], | 301 | TocExtension(anchorlink=True)], |
305 | extension_configs={ | 302 | extension_configs={ |
306 | "markdown.extensions.codehilite":{"css_class":"highlight"}}) | 303 | "markdown.extensions.codehilite":{"css_class":"highlight"}}) |
diff --git a/git b/git | |||
Subproject c522f061d551c9bb8684a7c3859b2ece4499b56 | Subproject ebf3c04b262aa27fbb97f8a0156c2347fecafaf | ||
diff --git a/parsing.c b/parsing.c index 93b4767..72b59b3 100644 --- a/parsing.c +++ b/parsing.c | |||
@@ -127,7 +127,6 @@ static int end_of_header(const char *p) | |||
127 | 127 | ||
128 | struct commitinfo *cgit_parse_commit(struct commit *commit) | 128 | struct commitinfo *cgit_parse_commit(struct commit *commit) |
129 | { | 129 | { |
130 | const int sha1hex_len = 40; | ||
131 | struct commitinfo *ret; | 130 | struct commitinfo *ret; |
132 | const char *p = repo_get_commit_buffer(the_repository, commit, NULL); | 131 | const char *p = repo_get_commit_buffer(the_repository, commit, NULL); |
133 | const char *t; | 132 | const char *t; |
@@ -140,10 +139,10 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) | |||
140 | 139 | ||
141 | if (!skip_prefix(p, "tree ", &p)) | 140 | if (!skip_prefix(p, "tree ", &p)) |
142 | die("Bad commit: %s", oid_to_hex(&commit->object.oid)); | 141 | die("Bad commit: %s", oid_to_hex(&commit->object.oid)); |
143 | p += sha1hex_len + 1; | 142 | p += the_hash_algo->hexsz + 1; |
144 | 143 | ||
145 | while (skip_prefix(p, "parent ", &p)) | 144 | while (skip_prefix(p, "parent ", &p)) |
146 | p += sha1hex_len + 1; | 145 | p += the_hash_algo->hexsz + 1; |
147 | 146 | ||
148 | if (p && skip_prefix(p, "author ", &p)) { | 147 | if (p && skip_prefix(p, "author ", &p)) { |
149 | parse_user(p, &ret->author, &ret->author_email, | 148 | parse_user(p, &ret->author, &ret->author_email, |
diff --git a/tests/setup.sh b/tests/setup.sh index 5879348..8db810f 100755 --- a/tests/setup.sh +++ b/tests/setup.sh | |||
@@ -80,13 +80,17 @@ mkrepo() { | |||
80 | git commit -m "commit $n" | 80 | git commit -m "commit $n" |
81 | n=$(expr $n + 1) | 81 | n=$(expr $n + 1) |
82 | done | 82 | done |
83 | if test "$3" = "testplus" | 83 | case "$3" in |
84 | then | 84 | testplus) |
85 | echo "hello" >a+b | 85 | echo "hello" >a+b |
86 | git add a+b | 86 | git add a+b |
87 | git commit -m "add a+b" | 87 | git commit -m "add a+b" |
88 | git branch "1+2" | 88 | git branch "1+2" |
89 | fi | 89 | ;; |
90 | commit-graph) | ||
91 | git commit-graph write | ||
92 | ;; | ||
93 | esac | ||
90 | ) | 94 | ) |
91 | } | 95 | } |
92 | 96 | ||
@@ -95,7 +99,7 @@ setup_repos() | |||
95 | rm -rf cache | 99 | rm -rf cache |
96 | mkdir -p cache | 100 | mkdir -p cache |
97 | mkrepo repos/foo 5 >/dev/null | 101 | mkrepo repos/foo 5 >/dev/null |
98 | mkrepo repos/bar 50 >/dev/null | 102 | mkrepo repos/bar 50 commit-graph >/dev/null |
99 | mkrepo repos/foo+bar 10 testplus >/dev/null | 103 | mkrepo repos/foo+bar 10 testplus >/dev/null |
100 | mkrepo "repos/with space" 2 >/dev/null | 104 | mkrepo "repos/with space" 2 >/dev/null |
101 | mkrepo repos/filter 5 testplus >/dev/null | 105 | mkrepo repos/filter 5 testplus >/dev/null |
diff --git a/tests/t0001-validate-git-versions.sh b/tests/t0001-validate-git-versions.sh index 73bd32f..dd84fe3 100755 --- a/tests/t0001-validate-git-versions.sh +++ b/tests/t0001-validate-git-versions.sh | |||
@@ -33,10 +33,10 @@ test_expect_success 'test submodule version matches Makefile' ' | |||
33 | else | 33 | else |
34 | ( | 34 | ( |
35 | cd ../.. && | 35 | cd ../.. && |
36 | sm_sha1=$(git ls-files --stage -- git | | 36 | sm_oid=$(git ls-files --stage -- git | |
37 | sed -e "s/^[0-9]* \\([0-9a-f]*\\) [0-9] .*$/\\1/") && | 37 | sed -e "s/^[0-9]* \\([0-9a-f]*\\) [0-9] .*$/\\1/") && |
38 | cd git && | 38 | cd git && |
39 | git describe --match "v[0-9]*" $sm_sha1 | 39 | git describe --match "v[0-9]*" $sm_oid |
40 | ) | sed -e "s/^v//" -e "s/-/./" >sm_version && | 40 | ) | sed -e "s/^v//" -e "s/-/./" >sm_version && |
41 | test_cmp sm_version makefile_version | 41 | test_cmp sm_version makefile_version |
42 | fi | 42 | fi |
diff --git a/tests/t0105-commit.sh b/tests/t0105-commit.sh index d5ff96c..cfed1e7 100755 --- a/tests/t0105-commit.sh +++ b/tests/t0105-commit.sh | |||
@@ -25,7 +25,7 @@ test_expect_success 'get root commit' ' | |||
25 | ' | 25 | ' |
26 | 26 | ||
27 | test_expect_success 'root commit contains diffstat' ' | 27 | test_expect_success 'root commit contains diffstat' ' |
28 | grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40\}.>file-1</a>" tmp | 28 | grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40,64\}.>file-1</a>" tmp |
29 | ' | 29 | ' |
30 | 30 | ||
31 | test_expect_success 'root commit contains diff' ' | 31 | test_expect_success 'root commit contains diff' ' |
diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh index c164d3e..0811ec4 100755 --- a/tests/t0107-snapshot.sh +++ b/tests/t0107-snapshot.sh | |||
@@ -25,7 +25,7 @@ test_expect_success 'verify gzip format' ' | |||
25 | 25 | ||
26 | test_expect_success 'untar' ' | 26 | test_expect_success 'untar' ' |
27 | rm -rf master && | 27 | rm -rf master && |
28 | tar -xzf master.tar.gz | 28 | gzip -dc master.tar.gz | tar -xf - |
29 | ' | 29 | ' |
30 | 30 | ||
31 | test_expect_success 'count files' ' | 31 | test_expect_success 'count files' ' |
@@ -61,13 +61,12 @@ test_expect_success LZIP 'strip off the header lines' ' | |||
61 | ' | 61 | ' |
62 | 62 | ||
63 | test_expect_success LZIP 'verify lzip format' ' | 63 | test_expect_success LZIP 'verify lzip format' ' |
64 | lzip --test master.tar.lz && | 64 | lzip --test master.tar.lz |
65 | cp master.tar.lz /tmp/. | ||
66 | ' | 65 | ' |
67 | 66 | ||
68 | test_expect_success LZIP 'untar' ' | 67 | test_expect_success LZIP 'untar' ' |
69 | rm -rf master && | 68 | rm -rf master && |
70 | tar --lzip -xf master.tar.lz | 69 | lzip -dc master.tar.lz | tar -xf - |
71 | ' | 70 | ' |
72 | 71 | ||
73 | test_expect_success LZIP 'count files' ' | 72 | test_expect_success LZIP 'count files' ' |
@@ -103,13 +102,12 @@ test_expect_success XZ 'strip off the header lines' ' | |||
103 | ' | 102 | ' |
104 | 103 | ||
105 | test_expect_success XZ 'verify xz format' ' | 104 | test_expect_success XZ 'verify xz format' ' |
106 | xz --test master.tar.xz && | 105 | xz --test master.tar.xz |
107 | cp master.tar.xz /tmp/. | ||
108 | ' | 106 | ' |
109 | 107 | ||
110 | test_expect_success XZ 'untar' ' | 108 | test_expect_success XZ 'untar' ' |
111 | rm -rf master && | 109 | rm -rf master && |
112 | tar --xz -xf master.tar.xz | 110 | xz -dc master.tar.xz | tar -xf - |
113 | ' | 111 | ' |
114 | 112 | ||
115 | test_expect_success XZ 'count files' ' | 113 | test_expect_success XZ 'count files' ' |
@@ -145,13 +143,12 @@ test_expect_success ZSTD 'strip off the header lines' ' | |||
145 | ' | 143 | ' |
146 | 144 | ||
147 | test_expect_success ZSTD 'verify zstd format' ' | 145 | test_expect_success ZSTD 'verify zstd format' ' |
148 | zstd --test master.tar.zst && | 146 | zstd --test master.tar.zst |
149 | cp master.tar.zst /tmp/. | ||
150 | ' | 147 | ' |
151 | 148 | ||
152 | test_expect_success ZSTD 'untar' ' | 149 | test_expect_success ZSTD 'untar' ' |
153 | rm -rf master && | 150 | rm -rf master && |
154 | tar --zstd -xf master.tar.zst | 151 | zstd -dc master.tar.zst | tar -xf - |
155 | ' | 152 | ' |
156 | 153 | ||
157 | test_expect_success ZSTD 'count files' ' | 154 | test_expect_success ZSTD 'count files' ' |
diff --git a/tests/t0109-gitconfig.sh b/tests/t0109-gitconfig.sh index 8cee75c..189ef28 100755 --- a/tests/t0109-gitconfig.sh +++ b/tests/t0109-gitconfig.sh | |||
@@ -25,7 +25,7 @@ test_no_home_access () { | |||
25 | -E CGIT_CONFIG="$PWD/cgitrc" \ | 25 | -E CGIT_CONFIG="$PWD/cgitrc" \ |
26 | -E QUERY_STRING="url=$1" \ | 26 | -E QUERY_STRING="url=$1" \ |
27 | -e access -f -o strace.out cgit && | 27 | -e access -f -o strace.out cgit && |
28 | test_must_fail grep "$non_existent_path" strace.out | 28 | ! grep "$non_existent_path" strace.out |
29 | } | 29 | } |
30 | 30 | ||
31 | test_no_home_access_success() { | 31 | test_no_home_access_success() { |
diff --git a/ui-blame.c b/ui-blame.c index 08832cd..4adec2b 100644 --- a/ui-blame.c +++ b/ui-blame.c | |||
@@ -10,7 +10,7 @@ | |||
10 | #include "ui-blame.h" | 10 | #include "ui-blame.h" |
11 | #include "html.h" | 11 | #include "html.h" |
12 | #include "ui-shared.h" | 12 | #include "ui-shared.h" |
13 | #include "argv-array.h" | 13 | #include "strvec.h" |
14 | #include "blame.h" | 14 | #include "blame.h" |
15 | 15 | ||
16 | 16 | ||
@@ -48,7 +48,7 @@ static void emit_blame_entry_hash(struct blame_entry *ent) | |||
48 | unsigned long line = 0; | 48 | unsigned long line = 0; |
49 | 49 | ||
50 | char *detail = emit_suspect_detail(suspect); | 50 | char *detail = emit_suspect_detail(suspect); |
51 | html("<span class='sha1'>"); | 51 | html("<span class='oid'>"); |
52 | cgit_commit_link(find_unique_abbrev(oid, DEFAULT_ABBREV), detail, | 52 | cgit_commit_link(find_unique_abbrev(oid, DEFAULT_ABBREV), detail, |
53 | NULL, ctx.qry.head, oid_to_hex(oid), suspect->path); | 53 | NULL, ctx.qry.head, oid_to_hex(oid), suspect->path); |
54 | html("</span>"); | 54 | html("</span>"); |
@@ -104,7 +104,7 @@ static void print_object(const struct object_id *oid, const char *path, | |||
104 | enum object_type type; | 104 | enum object_type type; |
105 | char *buf; | 105 | char *buf; |
106 | unsigned long size; | 106 | unsigned long size; |
107 | struct argv_array rev_argv = ARGV_ARRAY_INIT; | 107 | struct strvec rev_argv = STRVEC_INIT; |
108 | struct rev_info revs; | 108 | struct rev_info revs; |
109 | struct blame_scoreboard sb; | 109 | struct blame_scoreboard sb; |
110 | struct blame_origin *o; | 110 | struct blame_origin *o; |
@@ -124,15 +124,16 @@ static void print_object(const struct object_id *oid, const char *path, | |||
124 | return; | 124 | return; |
125 | } | 125 | } |
126 | 126 | ||
127 | argv_array_push(&rev_argv, "blame"); | 127 | strvec_push(&rev_argv, "blame"); |
128 | argv_array_push(&rev_argv, rev); | 128 | strvec_push(&rev_argv, rev); |
129 | init_revisions(&revs, NULL); | 129 | init_revisions(&revs, NULL); |
130 | revs.diffopt.flags.allow_textconv = 1; | 130 | revs.diffopt.flags.allow_textconv = 1; |
131 | setup_revisions(rev_argv.argc, rev_argv.argv, &revs, NULL); | 131 | setup_revisions(rev_argv.nr, rev_argv.v, &revs, NULL); |
132 | init_scoreboard(&sb); | 132 | init_scoreboard(&sb); |
133 | sb.revs = &revs; | 133 | sb.revs = &revs; |
134 | sb.repo = the_repository; | 134 | sb.repo = the_repository; |
135 | setup_scoreboard(&sb, path, &o); | 135 | sb.path = path; |
136 | setup_scoreboard(&sb, &o); | ||
136 | o->suspects = blame_entry_prepend(NULL, 0, sb.num_lines, o); | 137 | o->suspects = blame_entry_prepend(NULL, 0, sb.num_lines, o); |
137 | prio_queue_put(&sb.commits, o->commit); | 138 | prio_queue_put(&sb.commits, o->commit); |
138 | blame_origin_decref(o); | 139 | blame_origin_decref(o); |
@@ -224,8 +225,7 @@ cleanup: | |||
224 | } | 225 | } |
225 | 226 | ||
226 | static int walk_tree(const struct object_id *oid, struct strbuf *base, | 227 | static int walk_tree(const struct object_id *oid, struct strbuf *base, |
227 | const char *pathname, unsigned mode, int stage, | 228 | const char *pathname, unsigned mode, void *cbdata) |
228 | void *cbdata) | ||
229 | { | 229 | { |
230 | struct walk_tree_context *walk_tree_ctx = cbdata; | 230 | struct walk_tree_context *walk_tree_ctx = cbdata; |
231 | 231 | ||
@@ -260,7 +260,7 @@ static int basedir_len(const char *path) | |||
260 | 260 | ||
261 | void cgit_print_blame(void) | 261 | void cgit_print_blame(void) |
262 | { | 262 | { |
263 | const char *rev = ctx.qry.sha1; | 263 | const char *rev = ctx.qry.oid; |
264 | struct object_id oid; | 264 | struct object_id oid; |
265 | struct commit *commit; | 265 | struct commit *commit; |
266 | struct pathspec_item path_items = { | 266 | struct pathspec_item path_items = { |
@@ -294,10 +294,8 @@ void cgit_print_blame(void) | |||
294 | walk_tree_ctx.match_baselen = (path_items.match) ? | 294 | walk_tree_ctx.match_baselen = (path_items.match) ? |
295 | basedir_len(path_items.match) : -1; | 295 | basedir_len(path_items.match) : -1; |
296 | 296 | ||
297 | read_tree_recursive(the_repository, | 297 | read_tree(the_repository, repo_get_commit_tree(the_repository, commit), |
298 | repo_get_commit_tree(the_repository, commit), | 298 | &paths, walk_tree, &walk_tree_ctx); |
299 | "", 0, 0, | ||
300 | &paths, walk_tree, &walk_tree_ctx); | ||
301 | if (!walk_tree_ctx.state) | 299 | if (!walk_tree_ctx.state) |
302 | cgit_print_error_page(404, "Not found", "Not found"); | 300 | cgit_print_error_page(404, "Not found", "Not found"); |
303 | else if (walk_tree_ctx.state == 2) | 301 | else if (walk_tree_ctx.state == 2) |
diff --git a/ui-blob.c b/ui-blob.c index f76c641..c10ae42 100644 --- a/ui-blob.c +++ b/ui-blob.c | |||
@@ -19,7 +19,7 @@ struct walk_tree_context { | |||
19 | }; | 19 | }; |
20 | 20 | ||
21 | static int walk_tree(const struct object_id *oid, struct strbuf *base, | 21 | static int walk_tree(const struct object_id *oid, struct strbuf *base, |
22 | const char *pathname, unsigned mode, int stage, void *cbdata) | 22 | const char *pathname, unsigned mode, void *cbdata) |
23 | { | 23 | { |
24 | struct walk_tree_context *walk_tree_ctx = cbdata; | 24 | struct walk_tree_context *walk_tree_ctx = cbdata; |
25 | 25 | ||
@@ -56,9 +56,9 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only) | |||
56 | goto done; | 56 | goto done; |
57 | if (oid_object_info(the_repository, &oid, &size) != OBJ_COMMIT) | 57 | if (oid_object_info(the_repository, &oid, &size) != OBJ_COMMIT) |
58 | goto done; | 58 | goto done; |
59 | read_tree_recursive(the_repository, | 59 | read_tree(the_repository, |
60 | repo_get_commit_tree(the_repository, lookup_commit_reference(the_repository, &oid)), | 60 | repo_get_commit_tree(the_repository, lookup_commit_reference(the_repository, &oid)), |
61 | "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | 61 | &paths, walk_tree, &walk_tree_ctx); |
62 | 62 | ||
63 | done: | 63 | done: |
64 | free(path_items.match); | 64 | free(path_items.match); |
@@ -92,10 +92,8 @@ int cgit_print_file(char *path, const char *head, int file_only) | |||
92 | type = oid_object_info(the_repository, &oid, &size); | 92 | type = oid_object_info(the_repository, &oid, &size); |
93 | if (type == OBJ_COMMIT) { | 93 | if (type == OBJ_COMMIT) { |
94 | commit = lookup_commit_reference(the_repository, &oid); | 94 | commit = lookup_commit_reference(the_repository, &oid); |
95 | read_tree_recursive(the_repository, | 95 | read_tree(the_repository, repo_get_commit_tree(the_repository, commit), |
96 | repo_get_commit_tree(the_repository, commit), | 96 | &paths, walk_tree, &walk_tree_ctx); |
97 | "", 0, 0, &paths, walk_tree, | ||
98 | &walk_tree_ctx); | ||
99 | if (!walk_tree_ctx.found_path) | 97 | if (!walk_tree_ctx.found_path) |
100 | return -1; | 98 | return -1; |
101 | type = oid_object_info(the_repository, &oid, &size); | 99 | type = oid_object_info(the_repository, &oid, &size); |
@@ -151,10 +149,8 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl | |||
151 | 149 | ||
152 | if ((!hex) && type == OBJ_COMMIT && path) { | 150 | if ((!hex) && type == OBJ_COMMIT && path) { |
153 | commit = lookup_commit_reference(the_repository, &oid); | 151 | commit = lookup_commit_reference(the_repository, &oid); |
154 | read_tree_recursive(the_repository, | 152 | read_tree(the_repository, repo_get_commit_tree(the_repository, commit), |
155 | repo_get_commit_tree(the_repository, commit), | 153 | &paths, walk_tree, &walk_tree_ctx); |
156 | "", 0, 0, &paths, walk_tree, | ||
157 | &walk_tree_ctx); | ||
158 | type = oid_object_info(the_repository, &oid, &size); | 154 | type = oid_object_info(the_repository, &oid, &size); |
159 | } | 155 | } |
160 | 156 | ||
diff --git a/ui-commit.c b/ui-commit.c index ee5d2c7..b49259e 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -71,13 +71,13 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
71 | html_txt(show_date(info->committer_date, info->committer_tz, | 71 | html_txt(show_date(info->committer_date, info->committer_tz, |
72 | cgit_date_mode(DATE_ISO8601))); | 72 | cgit_date_mode(DATE_ISO8601))); |
73 | html("</td></tr>\n"); | 73 | html("</td></tr>\n"); |
74 | html("<tr><th>commit</th><td colspan='2' class='sha1'>"); | 74 | html("<tr><th>commit</th><td colspan='2' class='oid'>"); |
75 | tmp = oid_to_hex(&commit->object.oid); | 75 | tmp = oid_to_hex(&commit->object.oid); |
76 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix); | 76 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix); |
77 | html(" ("); | 77 | html(" ("); |
78 | cgit_patch_link("patch", NULL, NULL, NULL, tmp, prefix); | 78 | cgit_patch_link("patch", NULL, NULL, NULL, tmp, prefix); |
79 | html(")</td></tr>\n"); | 79 | html(")</td></tr>\n"); |
80 | html("<tr><th>tree</th><td colspan='2' class='sha1'>"); | 80 | html("<tr><th>tree</th><td colspan='2' class='oid'>"); |
81 | tmp = xstrdup(hex); | 81 | tmp = xstrdup(hex); |
82 | cgit_tree_link(oid_to_hex(get_commit_tree_oid(commit)), NULL, NULL, | 82 | cgit_tree_link(oid_to_hex(get_commit_tree_oid(commit)), NULL, NULL, |
83 | ctx.qry.head, tmp, NULL); | 83 | ctx.qry.head, tmp, NULL); |
@@ -96,7 +96,7 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
96 | continue; | 96 | continue; |
97 | } | 97 | } |
98 | html("<tr><th>parent</th>" | 98 | html("<tr><th>parent</th>" |
99 | "<td colspan='2' class='sha1'>"); | 99 | "<td colspan='2' class='oid'>"); |
100 | tmp = tmp2 = oid_to_hex(&p->item->object.oid); | 100 | tmp = tmp2 = oid_to_hex(&p->item->object.oid); |
101 | if (ctx.repo->enable_subject_links) { | 101 | if (ctx.repo->enable_subject_links) { |
102 | parent_info = cgit_parse_commit(parent); | 102 | parent_info = cgit_parse_commit(parent); |
@@ -110,7 +110,7 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
110 | parents++; | 110 | parents++; |
111 | } | 111 | } |
112 | if (ctx.repo->snapshots) { | 112 | if (ctx.repo->snapshots) { |
113 | html("<tr><th>download</th><td colspan='2' class='sha1'>"); | 113 | html("<tr><th>download</th><td colspan='2' class='oid'>"); |
114 | cgit_print_snapshot_links(ctx.repo, hex, "<br/>"); | 114 | cgit_print_snapshot_links(ctx.repo, hex, "<br/>"); |
115 | html("</td></tr>"); | 115 | html("</td></tr>"); |
116 | } | 116 | } |
@@ -140,7 +140,7 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
140 | tmp = oid_to_hex(&commit->parents->item->object.oid); | 140 | tmp = oid_to_hex(&commit->parents->item->object.oid); |
141 | else | 141 | else |
142 | tmp = NULL; | 142 | tmp = NULL; |
143 | cgit_print_diff(ctx.qry.sha1, tmp, prefix, 0, 0); | 143 | cgit_print_diff(ctx.qry.oid, tmp, prefix, 0, 0); |
144 | } | 144 | } |
145 | strbuf_release(¬es); | 145 | strbuf_release(¬es); |
146 | cgit_free_commitinfo(info); | 146 | cgit_free_commitinfo(info); |
diff --git a/ui-diff.c b/ui-diff.c index 97c1ca0..2a64ae8 100644 --- a/ui-diff.c +++ b/ui-diff.c | |||
@@ -97,8 +97,8 @@ static void print_fileinfo(struct fileinfo *info) | |||
97 | html("]</span>"); | 97 | html("]</span>"); |
98 | } | 98 | } |
99 | htmlf("</td><td class='%s'>", class); | 99 | htmlf("</td><td class='%s'>", class); |
100 | cgit_diff_link(info->new_path, NULL, NULL, ctx.qry.head, ctx.qry.sha1, | 100 | cgit_diff_link(info->new_path, NULL, NULL, ctx.qry.head, ctx.qry.oid, |
101 | ctx.qry.sha2, info->new_path); | 101 | ctx.qry.oid2, info->new_path); |
102 | if (info->status == DIFF_STATUS_COPIED || info->status == DIFF_STATUS_RENAMED) { | 102 | if (info->status == DIFF_STATUS_COPIED || info->status == DIFF_STATUS_RENAMED) { |
103 | htmlf(" (%s from ", | 103 | htmlf(" (%s from ", |
104 | info->status == DIFF_STATUS_COPIED ? "copied" : "renamed"); | 104 | info->status == DIFF_STATUS_COPIED ? "copied" : "renamed"); |
@@ -194,8 +194,8 @@ static void cgit_print_diffstat(const struct object_id *old_oid, | |||
194 | int i; | 194 | int i; |
195 | 195 | ||
196 | html("<div class='diffstat-header'>"); | 196 | html("<div class='diffstat-header'>"); |
197 | cgit_diff_link("Diffstat", NULL, NULL, ctx.qry.head, ctx.qry.sha1, | 197 | cgit_diff_link("Diffstat", NULL, NULL, ctx.qry.head, ctx.qry.oid, |
198 | ctx.qry.sha2, NULL); | 198 | ctx.qry.oid2, NULL); |
199 | if (prefix) { | 199 | if (prefix) { |
200 | html(" (limited to '"); | 200 | html(" (limited to '"); |
201 | html_txt(prefix); | 201 | html_txt(prefix); |
diff --git a/ui-log.c b/ui-log.c index 773950c..b443ca7 100644 --- a/ui-log.c +++ b/ui-log.c | |||
@@ -10,7 +10,7 @@ | |||
10 | #include "ui-log.h" | 10 | #include "ui-log.h" |
11 | #include "html.h" | 11 | #include "html.h" |
12 | #include "ui-shared.h" | 12 | #include "ui-shared.h" |
13 | #include "argv-array.h" | 13 | #include "strvec.h" |
14 | 14 | ||
15 | static int files, add_lines, rem_lines, lines_counted; | 15 | static int files, add_lines, rem_lines, lines_counted; |
16 | 16 | ||
@@ -65,7 +65,7 @@ void show_commit_decorations(struct commit *commit) | |||
65 | return; | 65 | return; |
66 | html("<span class='decoration'>"); | 66 | html("<span class='decoration'>"); |
67 | while (deco) { | 67 | while (deco) { |
68 | struct object_id peeled; | 68 | struct object_id oid_tag, peeled; |
69 | int is_annotated = 0; | 69 | int is_annotated = 0; |
70 | 70 | ||
71 | strlcpy(buf, prettify_refname(deco->name), sizeof(buf)); | 71 | strlcpy(buf, prettify_refname(deco->name), sizeof(buf)); |
@@ -82,8 +82,8 @@ void show_commit_decorations(struct commit *commit) | |||
82 | break; | 82 | break; |
83 | case DECORATION_REF_TAG: | 83 | case DECORATION_REF_TAG: |
84 | html(" "); | 84 | html(" "); |
85 | if (!peel_ref(deco->name, &peeled)) | 85 | if (!read_ref(deco->name, &oid_tag) && !peel_iterated_oid(&oid_tag, &peeled)) |
86 | is_annotated = !oidcmp(&commit->object.oid, &peeled); | 86 | is_annotated = !oideq(&oid_tag, &peeled); |
87 | cgit_tag_link(buf, NULL, is_annotated ? "tag-annotated-deco" : "tag-deco", buf); | 87 | cgit_tag_link(buf, NULL, is_annotated ? "tag-annotated-deco" : "tag-deco", buf); |
88 | break; | 88 | break; |
89 | case DECORATION_REF_REMOTE: | 89 | case DECORATION_REF_REMOTE: |
@@ -371,23 +371,23 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
371 | { | 371 | { |
372 | struct rev_info rev; | 372 | struct rev_info rev; |
373 | struct commit *commit; | 373 | struct commit *commit; |
374 | struct argv_array rev_argv = ARGV_ARRAY_INIT; | 374 | struct strvec rev_argv = STRVEC_INIT; |
375 | int i, columns = commit_graph ? 4 : 3; | 375 | int i, columns = commit_graph ? 4 : 3; |
376 | int must_free_tip = 0; | 376 | int must_free_tip = 0; |
377 | 377 | ||
378 | /* rev_argv.argv[0] will be ignored by setup_revisions */ | 378 | /* rev_argv.argv[0] will be ignored by setup_revisions */ |
379 | argv_array_push(&rev_argv, "log_rev_setup"); | 379 | strvec_push(&rev_argv, "log_rev_setup"); |
380 | 380 | ||
381 | if (!tip) | 381 | if (!tip) |
382 | tip = ctx.qry.head; | 382 | tip = ctx.qry.head; |
383 | tip = disambiguate_ref(tip, &must_free_tip); | 383 | tip = disambiguate_ref(tip, &must_free_tip); |
384 | argv_array_push(&rev_argv, tip); | 384 | strvec_push(&rev_argv, tip); |
385 | 385 | ||
386 | if (grep && pattern && *pattern) { | 386 | if (grep && pattern && *pattern) { |
387 | pattern = xstrdup(pattern); | 387 | pattern = xstrdup(pattern); |
388 | if (!strcmp(grep, "grep") || !strcmp(grep, "author") || | 388 | if (!strcmp(grep, "grep") || !strcmp(grep, "author") || |
389 | !strcmp(grep, "committer")) { | 389 | !strcmp(grep, "committer")) { |
390 | argv_array_pushf(&rev_argv, "--%s=%s", grep, pattern); | 390 | strvec_pushf(&rev_argv, "--%s=%s", grep, pattern); |
391 | } else if (!strcmp(grep, "range")) { | 391 | } else if (!strcmp(grep, "range")) { |
392 | char *arg; | 392 | char *arg; |
393 | /* Split the pattern at whitespace and add each token | 393 | /* Split the pattern at whitespace and add each token |
@@ -395,14 +395,14 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
395 | * rev-list options. Also, replace the previously | 395 | * rev-list options. Also, replace the previously |
396 | * pushed tip (it's no longer relevant). | 396 | * pushed tip (it's no longer relevant). |
397 | */ | 397 | */ |
398 | argv_array_pop(&rev_argv); | 398 | strvec_pop(&rev_argv); |
399 | while ((arg = next_token(&pattern))) { | 399 | while ((arg = next_token(&pattern))) { |
400 | if (*arg == '-') { | 400 | if (*arg == '-') { |
401 | fprintf(stderr, "Bad range expr: %s\n", | 401 | fprintf(stderr, "Bad range expr: %s\n", |
402 | arg); | 402 | arg); |
403 | break; | 403 | break; |
404 | } | 404 | } |
405 | argv_array_push(&rev_argv, arg); | 405 | strvec_push(&rev_argv, arg); |
406 | } | 406 | } |
407 | } | 407 | } |
408 | } | 408 | } |
@@ -417,22 +417,22 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
417 | } | 417 | } |
418 | 418 | ||
419 | if (commit_graph && !ctx.qry.follow) { | 419 | if (commit_graph && !ctx.qry.follow) { |
420 | argv_array_push(&rev_argv, "--graph"); | 420 | strvec_push(&rev_argv, "--graph"); |
421 | argv_array_push(&rev_argv, "--color"); | 421 | strvec_push(&rev_argv, "--color"); |
422 | graph_set_column_colors(column_colors_html, | 422 | graph_set_column_colors(column_colors_html, |
423 | COLUMN_COLORS_HTML_MAX); | 423 | COLUMN_COLORS_HTML_MAX); |
424 | } | 424 | } |
425 | 425 | ||
426 | if (commit_sort == 1) | 426 | if (commit_sort == 1) |
427 | argv_array_push(&rev_argv, "--date-order"); | 427 | strvec_push(&rev_argv, "--date-order"); |
428 | else if (commit_sort == 2) | 428 | else if (commit_sort == 2) |
429 | argv_array_push(&rev_argv, "--topo-order"); | 429 | strvec_push(&rev_argv, "--topo-order"); |
430 | 430 | ||
431 | if (path && ctx.qry.follow) | 431 | if (path && ctx.qry.follow) |
432 | argv_array_push(&rev_argv, "--follow"); | 432 | strvec_push(&rev_argv, "--follow"); |
433 | argv_array_push(&rev_argv, "--"); | 433 | strvec_push(&rev_argv, "--"); |
434 | if (path) | 434 | if (path) |
435 | argv_array_push(&rev_argv, path); | 435 | strvec_push(&rev_argv, path); |
436 | 436 | ||
437 | init_revisions(&rev, NULL); | 437 | init_revisions(&rev, NULL); |
438 | rev.abbrev = DEFAULT_ABBREV; | 438 | rev.abbrev = DEFAULT_ABBREV; |
@@ -441,7 +441,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
441 | rev.show_root_diff = 0; | 441 | rev.show_root_diff = 0; |
442 | rev.ignore_missing = 1; | 442 | rev.ignore_missing = 1; |
443 | rev.simplify_history = 1; | 443 | rev.simplify_history = 1; |
444 | setup_revisions(rev_argv.argc, rev_argv.argv, &rev, NULL); | 444 | setup_revisions(rev_argv.nr, rev_argv.v, &rev, NULL); |
445 | load_ref_decorations(NULL, DECORATE_FULL_REFS); | 445 | load_ref_decorations(NULL, DECORATE_FULL_REFS); |
446 | rev.show_decorations = 1; | 446 | rev.show_decorations = 1; |
447 | rev.grep_filter.ignore_case = 1; | 447 | rev.grep_filter.ignore_case = 1; |
@@ -468,7 +468,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
468 | if (pager) { | 468 | if (pager) { |
469 | html(" ("); | 469 | html(" ("); |
470 | cgit_log_link(ctx.qry.showmsg ? "Collapse" : "Expand", NULL, | 470 | cgit_log_link(ctx.qry.showmsg ? "Collapse" : "Expand", NULL, |
471 | NULL, ctx.qry.head, ctx.qry.sha1, | 471 | NULL, ctx.qry.head, ctx.qry.oid, |
472 | ctx.qry.vpath, ctx.qry.ofs, ctx.qry.grep, | 472 | ctx.qry.vpath, ctx.qry.ofs, ctx.qry.grep, |
473 | ctx.qry.search, ctx.qry.showmsg ? 0 : 1, | 473 | ctx.qry.search, ctx.qry.showmsg ? 0 : 1, |
474 | ctx.qry.follow); | 474 | ctx.qry.follow); |
@@ -524,7 +524,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
524 | if (ofs > 0) { | 524 | if (ofs > 0) { |
525 | html("<li>"); | 525 | html("<li>"); |
526 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, | 526 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, |
527 | ctx.qry.sha1, ctx.qry.vpath, | 527 | ctx.qry.oid, ctx.qry.vpath, |
528 | ofs - cnt, ctx.qry.grep, | 528 | ofs - cnt, ctx.qry.grep, |
529 | ctx.qry.search, ctx.qry.showmsg, | 529 | ctx.qry.search, ctx.qry.showmsg, |
530 | ctx.qry.follow); | 530 | ctx.qry.follow); |
@@ -533,7 +533,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
533 | if ((commit = get_revision(&rev)) != NULL) { | 533 | if ((commit = get_revision(&rev)) != NULL) { |
534 | html("<li>"); | 534 | html("<li>"); |
535 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, | 535 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, |
536 | ctx.qry.sha1, ctx.qry.vpath, | 536 | ctx.qry.oid, ctx.qry.vpath, |
537 | ofs + cnt, ctx.qry.grep, | 537 | ofs + cnt, ctx.qry.grep, |
538 | ctx.qry.search, ctx.qry.showmsg, | 538 | ctx.qry.search, ctx.qry.showmsg, |
539 | ctx.qry.follow); | 539 | ctx.qry.follow); |
diff --git a/ui-patch.c b/ui-patch.c index 5a96410..4ac03cb 100644 --- a/ui-patch.c +++ b/ui-patch.c | |||
@@ -61,7 +61,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, | |||
61 | } | 61 | } |
62 | 62 | ||
63 | if (is_null_oid(&old_rev_oid)) { | 63 | if (is_null_oid(&old_rev_oid)) { |
64 | memcpy(rev_range, oid_to_hex(&new_rev_oid), GIT_SHA1_HEXSZ + 1); | 64 | memcpy(rev_range, oid_to_hex(&new_rev_oid), the_hash_algo->hexsz + 1); |
65 | } else { | 65 | } else { |
66 | xsnprintf(rev_range, REV_RANGE_LEN, "%s..%s", oid_to_hex(&old_rev_oid), | 66 | xsnprintf(rev_range, REV_RANGE_LEN, "%s..%s", oid_to_hex(&old_rev_oid), |
67 | oid_to_hex(&new_rev_oid)); | 67 | oid_to_hex(&new_rev_oid)); |
diff --git a/ui-plain.c b/ui-plain.c index 2a7b18c..65a205f 100644 --- a/ui-plain.c +++ b/ui-plain.c | |||
@@ -99,7 +99,7 @@ static void print_dir(const struct object_id *oid, const char *base, | |||
99 | fullpath = NULL; | 99 | fullpath = NULL; |
100 | } | 100 | } |
101 | html("<li>"); | 101 | html("<li>"); |
102 | cgit_plain_link("../", NULL, NULL, ctx.qry.head, ctx.qry.sha1, | 102 | cgit_plain_link("../", NULL, NULL, ctx.qry.head, ctx.qry.oid, |
103 | fullpath); | 103 | fullpath); |
104 | html("</li>\n"); | 104 | html("</li>\n"); |
105 | } | 105 | } |
@@ -118,7 +118,7 @@ static void print_dir_entry(const struct object_id *oid, const char *base, | |||
118 | if (S_ISGITLINK(mode)) { | 118 | if (S_ISGITLINK(mode)) { |
119 | cgit_submodule_link(NULL, fullpath, oid_to_hex(oid)); | 119 | cgit_submodule_link(NULL, fullpath, oid_to_hex(oid)); |
120 | } else | 120 | } else |
121 | cgit_plain_link(path, NULL, NULL, ctx.qry.head, ctx.qry.sha1, | 121 | cgit_plain_link(path, NULL, NULL, ctx.qry.head, ctx.qry.oid, |
122 | fullpath); | 122 | fullpath); |
123 | html("</li>\n"); | 123 | html("</li>\n"); |
124 | free(fullpath); | 124 | free(fullpath); |
@@ -130,7 +130,7 @@ static void print_dir_tail(void) | |||
130 | } | 130 | } |
131 | 131 | ||
132 | static int walk_tree(const struct object_id *oid, struct strbuf *base, | 132 | static int walk_tree(const struct object_id *oid, struct strbuf *base, |
133 | const char *pathname, unsigned mode, int stage, void *cbdata) | 133 | const char *pathname, unsigned mode, void *cbdata) |
134 | { | 134 | { |
135 | struct walk_tree_context *walk_tree_ctx = cbdata; | 135 | struct walk_tree_context *walk_tree_ctx = cbdata; |
136 | 136 | ||
@@ -163,7 +163,7 @@ static int basedir_len(const char *path) | |||
163 | 163 | ||
164 | void cgit_print_plain(void) | 164 | void cgit_print_plain(void) |
165 | { | 165 | { |
166 | const char *rev = ctx.qry.sha1; | 166 | const char *rev = ctx.qry.oid; |
167 | struct object_id oid; | 167 | struct object_id oid; |
168 | struct commit *commit; | 168 | struct commit *commit; |
169 | struct pathspec_item path_items = { | 169 | struct pathspec_item path_items = { |
@@ -198,9 +198,8 @@ void cgit_print_plain(void) | |||
198 | } | 198 | } |
199 | else | 199 | else |
200 | walk_tree_ctx.match_baselen = basedir_len(path_items.match); | 200 | walk_tree_ctx.match_baselen = basedir_len(path_items.match); |
201 | read_tree_recursive(the_repository, | 201 | read_tree(the_repository, repo_get_commit_tree(the_repository, commit), |
202 | repo_get_commit_tree(the_repository, commit), | 202 | &paths, walk_tree, &walk_tree_ctx); |
203 | "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | ||
204 | if (!walk_tree_ctx.match) | 203 | if (!walk_tree_ctx.match) |
205 | cgit_print_error_page(404, "Not found", "Not found"); | 204 | cgit_print_error_page(404, "Not found", "Not found"); |
206 | else if (walk_tree_ctx.match == 2) | 205 | else if (walk_tree_ctx.match == 2) |
diff --git a/ui-shared.c b/ui-shared.c index 09c4c94..225a363 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -22,10 +22,11 @@ static char *http_date(time_t t) | |||
22 | static char month[][4] = | 22 | static char month[][4] = |
23 | {"Jan", "Feb", "Mar", "Apr", "May", "Jun", | 23 | {"Jan", "Feb", "Mar", "Apr", "May", "Jun", |
24 | "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; | 24 | "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; |
25 | struct tm *tm = gmtime(&t); | 25 | struct tm tm; |
26 | return fmt("%s, %02d %s %04d %02d:%02d:%02d GMT", day[tm->tm_wday], | 26 | gmtime_r(&t, &tm); |
27 | tm->tm_mday, month[tm->tm_mon], 1900 + tm->tm_year, | 27 | return fmt("%s, %02d %s %04d %02d:%02d:%02d GMT", day[tm.tm_wday], |
28 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 28 | tm.tm_mday, month[tm.tm_mon], 1900 + tm.tm_year, |
29 | tm.tm_hour, tm.tm_min, tm.tm_sec); | ||
29 | } | 30 | } |
30 | 31 | ||
31 | void cgit_print_error(const char *fmt, ...) | 32 | void cgit_print_error(const char *fmt, ...) |
@@ -521,45 +522,45 @@ static void cgit_self_link(char *name, const char *title, const char *class) | |||
521 | else if (!strcmp(ctx.qry.page, "summary")) | 522 | else if (!strcmp(ctx.qry.page, "summary")) |
522 | cgit_summary_link(name, title, class, ctx.qry.head); | 523 | cgit_summary_link(name, title, class, ctx.qry.head); |
523 | else if (!strcmp(ctx.qry.page, "tag")) | 524 | else if (!strcmp(ctx.qry.page, "tag")) |
524 | cgit_tag_link(name, title, class, ctx.qry.has_sha1 ? | 525 | cgit_tag_link(name, title, class, ctx.qry.has_oid ? |
525 | ctx.qry.sha1 : ctx.qry.head); | 526 | ctx.qry.oid : ctx.qry.head); |
526 | else if (!strcmp(ctx.qry.page, "tree")) | 527 | else if (!strcmp(ctx.qry.page, "tree")) |
527 | cgit_tree_link(name, title, class, ctx.qry.head, | 528 | cgit_tree_link(name, title, class, ctx.qry.head, |
528 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 529 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
529 | ctx.qry.path); | 530 | ctx.qry.path); |
530 | else if (!strcmp(ctx.qry.page, "plain")) | 531 | else if (!strcmp(ctx.qry.page, "plain")) |
531 | cgit_plain_link(name, title, class, ctx.qry.head, | 532 | cgit_plain_link(name, title, class, ctx.qry.head, |
532 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 533 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
533 | ctx.qry.path); | 534 | ctx.qry.path); |
534 | else if (!strcmp(ctx.qry.page, "blame")) | 535 | else if (!strcmp(ctx.qry.page, "blame")) |
535 | cgit_blame_link(name, title, class, ctx.qry.head, | 536 | cgit_blame_link(name, title, class, ctx.qry.head, |
536 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 537 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
537 | ctx.qry.path); | 538 | ctx.qry.path); |
538 | else if (!strcmp(ctx.qry.page, "log")) | 539 | else if (!strcmp(ctx.qry.page, "log")) |
539 | cgit_log_link(name, title, class, ctx.qry.head, | 540 | cgit_log_link(name, title, class, ctx.qry.head, |
540 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 541 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
541 | ctx.qry.path, ctx.qry.ofs, | 542 | ctx.qry.path, ctx.qry.ofs, |
542 | ctx.qry.grep, ctx.qry.search, | 543 | ctx.qry.grep, ctx.qry.search, |
543 | ctx.qry.showmsg, ctx.qry.follow); | 544 | ctx.qry.showmsg, ctx.qry.follow); |
544 | else if (!strcmp(ctx.qry.page, "commit")) | 545 | else if (!strcmp(ctx.qry.page, "commit")) |
545 | cgit_commit_link(name, title, class, ctx.qry.head, | 546 | cgit_commit_link(name, title, class, ctx.qry.head, |
546 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 547 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
547 | ctx.qry.path); | 548 | ctx.qry.path); |
548 | else if (!strcmp(ctx.qry.page, "patch")) | 549 | else if (!strcmp(ctx.qry.page, "patch")) |
549 | cgit_patch_link(name, title, class, ctx.qry.head, | 550 | cgit_patch_link(name, title, class, ctx.qry.head, |
550 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 551 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
551 | ctx.qry.path); | 552 | ctx.qry.path); |
552 | else if (!strcmp(ctx.qry.page, "refs")) | 553 | else if (!strcmp(ctx.qry.page, "refs")) |
553 | cgit_refs_link(name, title, class, ctx.qry.head, | 554 | cgit_refs_link(name, title, class, ctx.qry.head, |
554 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 555 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
555 | ctx.qry.path); | 556 | ctx.qry.path); |
556 | else if (!strcmp(ctx.qry.page, "snapshot")) | 557 | else if (!strcmp(ctx.qry.page, "snapshot")) |
557 | cgit_snapshot_link(name, title, class, ctx.qry.head, | 558 | cgit_snapshot_link(name, title, class, ctx.qry.head, |
558 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 559 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
559 | ctx.qry.path); | 560 | ctx.qry.path); |
560 | else if (!strcmp(ctx.qry.page, "diff")) | 561 | else if (!strcmp(ctx.qry.page, "diff")) |
561 | cgit_diff_link(name, title, class, ctx.qry.head, | 562 | cgit_diff_link(name, title, class, ctx.qry.head, |
562 | ctx.qry.sha1, ctx.qry.sha2, | 563 | ctx.qry.oid, ctx.qry.oid2, |
563 | ctx.qry.path); | 564 | ctx.qry.path); |
564 | else if (!strcmp(ctx.qry.page, "stats")) | 565 | else if (!strcmp(ctx.qry.page, "stats")) |
565 | cgit_stats_link(name, title, class, ctx.qry.head, | 566 | cgit_stats_link(name, title, class, ctx.qry.head, |
@@ -927,10 +928,10 @@ void cgit_add_hidden_formfields(int incl_head, int incl_search, | |||
927 | strcmp(ctx.qry.head, ctx.repo->defbranch)) | 928 | strcmp(ctx.qry.head, ctx.repo->defbranch)) |
928 | html_hidden("h", ctx.qry.head); | 929 | html_hidden("h", ctx.qry.head); |
929 | 930 | ||
930 | if (ctx.qry.sha1) | 931 | if (ctx.qry.oid) |
931 | html_hidden("id", ctx.qry.sha1); | 932 | html_hidden("id", ctx.qry.oid); |
932 | if (ctx.qry.sha2) | 933 | if (ctx.qry.oid2) |
933 | html_hidden("id2", ctx.qry.sha2); | 934 | html_hidden("id2", ctx.qry.oid2); |
934 | if (ctx.qry.showmsg) | 935 | if (ctx.qry.showmsg) |
935 | html_hidden("showmsg", "1"); | 936 | html_hidden("showmsg", "1"); |
936 | 937 | ||
@@ -1059,7 +1060,7 @@ void cgit_print_pageheader(void) | |||
1059 | ctx.qry.head); | 1060 | ctx.qry.head); |
1060 | html(" "); | 1061 | html(" "); |
1061 | cgit_refs_link("refs", NULL, hc("refs"), ctx.qry.head, | 1062 | cgit_refs_link("refs", NULL, hc("refs"), ctx.qry.head, |
1062 | ctx.qry.sha1, NULL); | 1063 | ctx.qry.oid, NULL); |
1063 | html(" "); | 1064 | html(" "); |
1064 | cgit_log_link("log", NULL, hc("log"), ctx.qry.head, | 1065 | cgit_log_link("log", NULL, hc("log"), ctx.qry.head, |
1065 | NULL, ctx.qry.vpath, 0, NULL, NULL, | 1066 | NULL, ctx.qry.vpath, 0, NULL, NULL, |
@@ -1067,16 +1068,16 @@ void cgit_print_pageheader(void) | |||
1067 | html(" "); | 1068 | html(" "); |
1068 | if (ctx.qry.page && !strcmp(ctx.qry.page, "blame")) | 1069 | if (ctx.qry.page && !strcmp(ctx.qry.page, "blame")) |
1069 | cgit_blame_link("blame", NULL, hc("blame"), ctx.qry.head, | 1070 | cgit_blame_link("blame", NULL, hc("blame"), ctx.qry.head, |
1070 | ctx.qry.sha1, ctx.qry.vpath); | 1071 | ctx.qry.oid, ctx.qry.vpath); |
1071 | else | 1072 | else |
1072 | cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head, | 1073 | cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head, |
1073 | ctx.qry.sha1, ctx.qry.vpath); | 1074 | ctx.qry.oid, ctx.qry.vpath); |
1074 | html(" "); | 1075 | html(" "); |
1075 | cgit_commit_link("commit", NULL, hc("commit"), | 1076 | cgit_commit_link("commit", NULL, hc("commit"), |
1076 | ctx.qry.head, ctx.qry.sha1, ctx.qry.vpath); | 1077 | ctx.qry.head, ctx.qry.oid, ctx.qry.vpath); |
1077 | html(" "); | 1078 | html(" "); |
1078 | cgit_diff_link("diff", NULL, hc("diff"), ctx.qry.head, | 1079 | cgit_diff_link("diff", NULL, hc("diff"), ctx.qry.head, |
1079 | ctx.qry.sha1, ctx.qry.sha2, ctx.qry.vpath); | 1080 | ctx.qry.oid, ctx.qry.oid2, ctx.qry.vpath); |
1080 | if (ctx.repo->max_stats) { | 1081 | if (ctx.repo->max_stats) { |
1081 | html(" "); | 1082 | html(" "); |
1082 | cgit_stats_link("stats", NULL, hc("stats"), | 1083 | cgit_stats_link("stats", NULL, hc("stats"), |
diff --git a/ui-snapshot.c b/ui-snapshot.c index 8b81e37..2801393 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c | |||
@@ -13,35 +13,35 @@ | |||
13 | 13 | ||
14 | static int write_archive_type(const char *format, const char *hex, const char *prefix) | 14 | static int write_archive_type(const char *format, const char *hex, const char *prefix) |
15 | { | 15 | { |
16 | struct argv_array argv = ARGV_ARRAY_INIT; | 16 | struct strvec argv = STRVEC_INIT; |
17 | const char **nargv; | 17 | const char **nargv; |
18 | int result; | 18 | int result; |
19 | argv_array_push(&argv, "snapshot"); | 19 | strvec_push(&argv, "snapshot"); |
20 | argv_array_push(&argv, format); | 20 | strvec_push(&argv, format); |
21 | if (prefix) { | 21 | if (prefix) { |
22 | struct strbuf buf = STRBUF_INIT; | 22 | struct strbuf buf = STRBUF_INIT; |
23 | strbuf_addstr(&buf, prefix); | 23 | strbuf_addstr(&buf, prefix); |
24 | strbuf_addch(&buf, '/'); | 24 | strbuf_addch(&buf, '/'); |
25 | argv_array_push(&argv, "--prefix"); | 25 | strvec_push(&argv, "--prefix"); |
26 | argv_array_push(&argv, buf.buf); | 26 | strvec_push(&argv, buf.buf); |
27 | strbuf_release(&buf); | 27 | strbuf_release(&buf); |
28 | } | 28 | } |
29 | argv_array_push(&argv, hex); | 29 | strvec_push(&argv, hex); |
30 | /* | 30 | /* |
31 | * Now we need to copy the pointers to arguments into a new | 31 | * Now we need to copy the pointers to arguments into a new |
32 | * structure because write_archive will rearrange its arguments | 32 | * structure because write_archive will rearrange its arguments |
33 | * which may result in duplicated/missing entries causing leaks | 33 | * which may result in duplicated/missing entries causing leaks |
34 | * or double-frees in argv_array_clear. | 34 | * or double-frees in strvec_clear. |
35 | */ | 35 | */ |
36 | nargv = xmalloc(sizeof(char *) * (argv.argc + 1)); | 36 | nargv = xmalloc(sizeof(char *) * (argv.nr + 1)); |
37 | /* argv_array guarantees a trailing NULL entry. */ | 37 | /* strvec guarantees a trailing NULL entry. */ |
38 | memcpy(nargv, argv.argv, sizeof(char *) * (argv.argc + 1)); | 38 | memcpy(nargv, argv.v, sizeof(char *) * (argv.nr + 1)); |
39 | 39 | ||
40 | if (fflush(stdout)) | 40 | if (fflush(stdout)) |
41 | return errno; | 41 | return errno; |
42 | 42 | ||
43 | result = write_archive(argv.argc, nargv, NULL, the_repository, NULL, 0); | 43 | result = write_archive(argv.nr, nargv, NULL, the_repository, NULL, 0); |
44 | argv_array_clear(&argv); | 44 | strvec_clear(&argv); |
45 | free(nargv); | 45 | free(nargv); |
46 | return result; | 46 | return result; |
47 | } | 47 | } |
diff --git a/ui-stats.c b/ui-stats.c index 7272a61..09b3625 100644 --- a/ui-stats.c +++ b/ui-stats.c | |||
@@ -166,7 +166,7 @@ static void add_commit(struct string_list *authors, struct commit *commit, | |||
166 | struct authorstat *authorstat; | 166 | struct authorstat *authorstat; |
167 | struct string_list *items; | 167 | struct string_list *items; |
168 | char *tmp; | 168 | char *tmp; |
169 | struct tm *date; | 169 | struct tm date; |
170 | time_t t; | 170 | time_t t; |
171 | uintptr_t *counter; | 171 | uintptr_t *counter; |
172 | 172 | ||
@@ -180,9 +180,9 @@ static void add_commit(struct string_list *authors, struct commit *commit, | |||
180 | authorstat = author->util; | 180 | authorstat = author->util; |
181 | items = &authorstat->list; | 181 | items = &authorstat->list; |
182 | t = info->committer_date; | 182 | t = info->committer_date; |
183 | date = gmtime(&t); | 183 | gmtime_r(&t, &date); |
184 | period->trunc(date); | 184 | period->trunc(&date); |
185 | tmp = xstrdup(period->pretty(date)); | 185 | tmp = xstrdup(period->pretty(&date)); |
186 | item = string_list_insert(items, tmp); | 186 | item = string_list_insert(items, tmp); |
187 | counter = (uintptr_t *)&item->util; | 187 | counter = (uintptr_t *)&item->util; |
188 | if (*counter) | 188 | if (*counter) |
@@ -215,15 +215,15 @@ static struct string_list collect_stats(const struct cgit_period *period) | |||
215 | int argc = 3; | 215 | int argc = 3; |
216 | time_t now; | 216 | time_t now; |
217 | long i; | 217 | long i; |
218 | struct tm *tm; | 218 | struct tm tm; |
219 | char tmp[11]; | 219 | char tmp[11]; |
220 | 220 | ||
221 | time(&now); | 221 | time(&now); |
222 | tm = gmtime(&now); | 222 | gmtime_r(&now, &tm); |
223 | period->trunc(tm); | 223 | period->trunc(&tm); |
224 | for (i = 1; i < period->count; i++) | 224 | for (i = 1; i < period->count; i++) |
225 | period->dec(tm); | 225 | period->dec(&tm); |
226 | strftime(tmp, sizeof(tmp), "%Y-%m-%d", tm); | 226 | strftime(tmp, sizeof(tmp), "%Y-%m-%d", &tm); |
227 | argv[2] = xstrdup(fmt("--since=%s", tmp)); | 227 | argv[2] = xstrdup(fmt("--since=%s", tmp)); |
228 | if (ctx.qry.path) { | 228 | if (ctx.qry.path) { |
229 | argv[3] = "--"; | 229 | argv[3] = "--"; |
@@ -261,21 +261,21 @@ static void print_combined_authorrow(struct string_list *authors, int from, | |||
261 | struct string_list_item *date; | 261 | struct string_list_item *date; |
262 | time_t now; | 262 | time_t now; |
263 | long i, j, total, subtotal; | 263 | long i, j, total, subtotal; |
264 | struct tm *tm; | 264 | struct tm tm; |
265 | char *tmp; | 265 | char *tmp; |
266 | 266 | ||
267 | time(&now); | 267 | time(&now); |
268 | tm = gmtime(&now); | 268 | gmtime_r(&now, &tm); |
269 | period->trunc(tm); | 269 | period->trunc(&tm); |
270 | for (i = 1; i < period->count; i++) | 270 | for (i = 1; i < period->count; i++) |
271 | period->dec(tm); | 271 | period->dec(&tm); |
272 | 272 | ||
273 | total = 0; | 273 | total = 0; |
274 | htmlf("<tr><td class='%s'>%s</td>", leftclass, | 274 | htmlf("<tr><td class='%s'>%s</td>", leftclass, |
275 | fmt(name, to - from + 1)); | 275 | fmt(name, to - from + 1)); |
276 | for (j = 0; j < period->count; j++) { | 276 | for (j = 0; j < period->count; j++) { |
277 | tmp = period->pretty(tm); | 277 | tmp = period->pretty(&tm); |
278 | period->inc(tm); | 278 | period->inc(&tm); |
279 | subtotal = 0; | 279 | subtotal = 0; |
280 | for (i = from; i <= to; i++) { | 280 | for (i = from; i <= to; i++) { |
281 | author = &authors->items[i]; | 281 | author = &authors->items[i]; |
@@ -300,20 +300,20 @@ static void print_authors(struct string_list *authors, int top, | |||
300 | struct string_list_item *date; | 300 | struct string_list_item *date; |
301 | time_t now; | 301 | time_t now; |
302 | long i, j, total; | 302 | long i, j, total; |
303 | struct tm *tm; | 303 | struct tm tm; |
304 | char *tmp; | 304 | char *tmp; |
305 | 305 | ||
306 | time(&now); | 306 | time(&now); |
307 | tm = gmtime(&now); | 307 | gmtime_r(&now, &tm); |
308 | period->trunc(tm); | 308 | period->trunc(&tm); |
309 | for (i = 1; i < period->count; i++) | 309 | for (i = 1; i < period->count; i++) |
310 | period->dec(tm); | 310 | period->dec(&tm); |
311 | 311 | ||
312 | html("<table class='stats'><tr><th>Author</th>"); | 312 | html("<table class='stats'><tr><th>Author</th>"); |
313 | for (j = 0; j < period->count; j++) { | 313 | for (j = 0; j < period->count; j++) { |
314 | tmp = period->pretty(tm); | 314 | tmp = period->pretty(&tm); |
315 | htmlf("<th>%s</th>", tmp); | 315 | htmlf("<th>%s</th>", tmp); |
316 | period->inc(tm); | 316 | period->inc(&tm); |
317 | } | 317 | } |
318 | html("<th>Total</th></tr>\n"); | 318 | html("<th>Total</th></tr>\n"); |
319 | 319 | ||
@@ -329,10 +329,10 @@ static void print_authors(struct string_list *authors, int top, | |||
329 | items = &authorstat->list; | 329 | items = &authorstat->list; |
330 | total = 0; | 330 | total = 0; |
331 | for (j = 0; j < period->count; j++) | 331 | for (j = 0; j < period->count; j++) |
332 | period->dec(tm); | 332 | period->dec(&tm); |
333 | for (j = 0; j < period->count; j++) { | 333 | for (j = 0; j < period->count; j++) { |
334 | tmp = period->pretty(tm); | 334 | tmp = period->pretty(&tm); |
335 | period->inc(tm); | 335 | period->inc(&tm); |
336 | date = string_list_lookup(items, tmp); | 336 | date = string_list_lookup(items, tmp); |
337 | if (!date) | 337 | if (!date) |
338 | html("<td>0</td>"); | 338 | html("<td>0</td>"); |
diff --git a/ui-tag.c b/ui-tag.c index c499516..0595242 100644 --- a/ui-tag.c +++ b/ui-tag.c | |||
@@ -33,7 +33,7 @@ static void print_tag_content(char *buf) | |||
33 | 33 | ||
34 | static void print_download_links(char *revname) | 34 | static void print_download_links(char *revname) |
35 | { | 35 | { |
36 | html("<tr><th>download</th><td class='sha1'>"); | 36 | html("<tr><th>download</th><td class='oid'>"); |
37 | cgit_print_snapshot_links(ctx.repo, revname, "<br/>"); | 37 | cgit_print_snapshot_links(ctx.repo, revname, "<br/>"); |
38 | html("</td></tr>"); | 38 | html("</td></tr>"); |
39 | } | 39 | } |
@@ -91,7 +91,7 @@ void cgit_print_tag(char *revname) | |||
91 | cgit_close_filter(ctx.repo->email_filter); | 91 | cgit_close_filter(ctx.repo->email_filter); |
92 | html("</td></tr>\n"); | 92 | html("</td></tr>\n"); |
93 | } | 93 | } |
94 | html("<tr><td>tagged object</td><td class='sha1'>"); | 94 | html("<tr><td>tagged object</td><td class='oid'>"); |
95 | cgit_object_link(tag->tagged); | 95 | cgit_object_link(tag->tagged); |
96 | html("</td></tr>\n"); | 96 | html("</td></tr>\n"); |
97 | if (ctx.repo->snapshots) | 97 | if (ctx.repo->snapshots) |
@@ -106,7 +106,7 @@ void cgit_print_tag(char *revname) | |||
106 | html("<tr><td>tag name</td><td>"); | 106 | html("<tr><td>tag name</td><td>"); |
107 | html_txt(revname); | 107 | html_txt(revname); |
108 | html("</td></tr>\n"); | 108 | html("</td></tr>\n"); |
109 | html("<tr><td>tagged object</td><td class='sha1'>"); | 109 | html("<tr><td>tagged object</td><td class='oid'>"); |
110 | cgit_object_link(obj); | 110 | cgit_object_link(obj); |
111 | html("</td></tr>\n"); | 111 | html("</td></tr>\n"); |
112 | if (ctx.repo->snapshots) | 112 | if (ctx.repo->snapshots) |
diff --git a/ui-tree.c b/ui-tree.c index 34e7e63..21e0b88 100644 --- a/ui-tree.c +++ b/ui-tree.c | |||
@@ -141,8 +141,7 @@ struct single_tree_ctx { | |||
141 | }; | 141 | }; |
142 | 142 | ||
143 | static int single_tree_cb(const struct object_id *oid, struct strbuf *base, | 143 | static int single_tree_cb(const struct object_id *oid, struct strbuf *base, |
144 | const char *pathname, unsigned mode, int stage, | 144 | const char *pathname, unsigned mode, void *cbdata) |
145 | void *cbdata) | ||
146 | { | 145 | { |
147 | struct single_tree_ctx *ctx = cbdata; | 146 | struct single_tree_ctx *ctx = cbdata; |
148 | 147 | ||
@@ -187,8 +186,7 @@ static void write_tree_link(const struct object_id *oid, char *name, | |||
187 | tree_ctx.name = NULL; | 186 | tree_ctx.name = NULL; |
188 | tree_ctx.count = 0; | 187 | tree_ctx.count = 0; |
189 | 188 | ||
190 | read_tree_recursive(the_repository, tree, "", 0, 1, | 189 | read_tree(the_repository, tree, &paths, single_tree_cb, &tree_ctx); |
191 | &paths, single_tree_cb, &tree_ctx); | ||
192 | 190 | ||
193 | if (tree_ctx.count != 1) | 191 | if (tree_ctx.count != 1) |
194 | break; | 192 | break; |
@@ -201,7 +199,7 @@ static void write_tree_link(const struct object_id *oid, char *name, | |||
201 | } | 199 | } |
202 | 200 | ||
203 | static int ls_item(const struct object_id *oid, struct strbuf *base, | 201 | static int ls_item(const struct object_id *oid, struct strbuf *base, |
204 | const char *pathname, unsigned mode, int stage, void *cbdata) | 202 | const char *pathname, unsigned mode, void *cbdata) |
205 | { | 203 | { |
206 | struct walk_tree_context *walk_tree_ctx = cbdata; | 204 | struct walk_tree_context *walk_tree_ctx = cbdata; |
207 | char *name; | 205 | char *name; |
@@ -320,14 +318,13 @@ static void ls_tree(const struct object_id *oid, const char *path, struct walk_t | |||
320 | } | 318 | } |
321 | 319 | ||
322 | ls_head(); | 320 | ls_head(); |
323 | read_tree_recursive(the_repository, tree, "", 0, 1, | 321 | read_tree(the_repository, tree, &paths, ls_item, walk_tree_ctx); |
324 | &paths, ls_item, walk_tree_ctx); | ||
325 | ls_tail(); | 322 | ls_tail(); |
326 | } | 323 | } |
327 | 324 | ||
328 | 325 | ||
329 | static int walk_tree(const struct object_id *oid, struct strbuf *base, | 326 | static int walk_tree(const struct object_id *oid, struct strbuf *base, |
330 | const char *pathname, unsigned mode, int stage, void *cbdata) | 327 | const char *pathname, unsigned mode, void *cbdata) |
331 | { | 328 | { |
332 | struct walk_tree_context *walk_tree_ctx = cbdata; | 329 | struct walk_tree_context *walk_tree_ctx = cbdata; |
333 | 330 | ||
@@ -352,7 +349,7 @@ static int walk_tree(const struct object_id *oid, struct strbuf *base, | |||
352 | return 0; | 349 | return 0; |
353 | } | 350 | } |
354 | } | 351 | } |
355 | ls_item(oid, base, pathname, mode, stage, walk_tree_ctx); | 352 | ls_item(oid, base, pathname, mode, walk_tree_ctx); |
356 | return 0; | 353 | return 0; |
357 | } | 354 | } |
358 | 355 | ||
@@ -400,10 +397,8 @@ void cgit_print_tree(const char *rev, char *path) | |||
400 | goto cleanup; | 397 | goto cleanup; |
401 | } | 398 | } |
402 | 399 | ||
403 | read_tree_recursive(the_repository, | 400 | read_tree(the_repository, repo_get_commit_tree(the_repository, commit), |
404 | repo_get_commit_tree(the_repository, commit), | 401 | &paths, walk_tree, &walk_tree_ctx); |
405 | "", 0, 0, | ||
406 | &paths, walk_tree, &walk_tree_ctx); | ||
407 | if (walk_tree_ctx.state == 1) | 402 | if (walk_tree_ctx.state == 1) |
408 | ls_tail(); | 403 | ls_tail(); |
409 | else if (walk_tree_ctx.state == 2) | 404 | else if (walk_tree_ctx.state == 2) |