diff options
author | Joe Anakata | 2016-02-22 18:45:53 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2016-02-22 18:46:33 +0100 |
commit | de6098be6a65a4758ff8eac6359bd6fd30ba7bd3 (patch) | |
tree | 26ef2a8a74989348c2ec5bf17d0e1ac2a525294f | |
parent | 94c02bbf732d938c92df4961026c4d8f6fd4c37e (diff) | |
download | cgit-de6098be6a65a4758ff8eac6359bd6fd30ba7bd3.tar.gz cgit-de6098be6a65a4758ff8eac6359bd6fd30ba7bd3.tar.bz2 cgit-de6098be6a65a4758ff8eac6359bd6fd30ba7bd3.zip |
ui-plain: fix to show a repo's root directory listing in plain view
This is to fix the case of accessing http://host.com/cgit.cgi/repo.git/plain/
There is code here to make this case work (match_baselen is set to -1
for top-of-the-tree views) but the unsigned to signed comparison was
always false in this case, causing an empty directory listing without
this fix.
Signed-off-by: Joe Anakata <jea-signup-github@anakata.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | ui-plain.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -143,7 +143,7 @@ static int walk_tree(const unsigned char *sha1, struct strbuf *base, | |||
143 | walk_tree_ctx->match = 2; | 143 | walk_tree_ctx->match = 2; |
144 | return READ_TREE_RECURSIVE; | 144 | return READ_TREE_RECURSIVE; |
145 | } | 145 | } |
146 | } else if (base->len > walk_tree_ctx->match_baselen) { | 146 | } else if (base->len < INT_MAX && (int)base->len > walk_tree_ctx->match_baselen) { |
147 | print_dir_entry(sha1, base->buf, base->len, pathname, mode); | 147 | print_dir_entry(sha1, base->buf, base->len, pathname, mode); |
148 | walk_tree_ctx->match = 2; | 148 | walk_tree_ctx->match = 2; |
149 | } else if (S_ISDIR(mode)) { | 149 | } else if (S_ISDIR(mode)) { |