List for cgit developers and users
 help / color / mirror / Atom feed
From: jea-signup-cgit at anakata.org (Joe Anakata)
Subject: [PATCH] ui-plain: fix to show a repo's root directory listing in plain view
Date: Sun, 21 Feb 2016 23:36:53 -0800	[thread overview]
Message-ID: <20160222073653.BC7EB82322@gnosis.slac.com> (raw)


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 at anakata.org>
---
 ui-plain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui-plain.c b/ui-plain.c
index ff85113..b4e3bef 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -143,7 +143,7 @@ static int walk_tree(const unsigned char *sha1, struct strbuf *base,
 			walk_tree_ctx->match = 2;
 			return READ_TREE_RECURSIVE;
 		}
-	} else if (base->len > walk_tree_ctx->match_baselen) {
+	} else if ((int)base->len > walk_tree_ctx->match_baselen) {
 		print_dir_entry(sha1, base->buf, base->len, pathname, mode);
 		walk_tree_ctx->match = 2;
 	} else if (S_ISDIR(mode)) {
-- 
1.9.1


             reply	other threads:[~2016-02-22  7:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22  7:36 jea-signup-cgit [this message]
2016-02-22 17:47 ` Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160222073653.BC7EB82322@gnosis.slac.com \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).