John Keeping | 18 May 2013 19:46
Picon

[PATCH 1/2] tests: introduce strip_header() helper function

This means that we can avoid hardcoding the number of headers we expect
CGit to generate in test cases and simply remove whatever headers happen
to by there when we are checking body content.

Signed-off-by: John Keeping <john@...>
---
This was previously sent with a different command message and
justification[1] but wasn't picked up.  I still think this is a useful
function to have in the test suite and it's used by patch 2/2 here.

 tests/setup.sh          | 8 ++++++++
 tests/t0107-snapshot.sh | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/setup.sh b/tests/setup.sh
index a573444..1d8677a 100755
--- a/tests/setup.sh
+++ b/tests/setup.sh
 <at>  <at>  -98,4 +98,12  <at>  <at>  cgit_url()
 	CGIT_CONFIG="$PWD/cgitrc" QUERY_STRING="url=$1" cgit
 }

+strip_headers () {
+	while read -r line
+	do
+		test -z "$line" && break
+	done
+	cat
+}
+
(Continue reading)

John Keeping | 18 May 2013 19:28
Picon

[PATCH] cache.c: fix cache_ls

Commit fb3655d (use struct strbuf instead of static buffers, 2013-04-06)
broke the logic in cache.c::cache_ls by failing to set slot->cache_name
before calling open_slot.

While fixing this, also free the strbufs added by that commit once we're
done with them.

Signed-off-by: John Keeping <john@...>
---
 cache.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/cache.c b/cache.c
index c1d777b..74a1795 100644
--- a/cache.c
+++ b/cache.c
 <at>  <at>  -316,6 +316,7  <at>  <at>  int cache_process(int size, const char *path, const char *key, int ttl,
 	struct strbuf filename = STRBUF_INIT;
 	struct strbuf lockname = STRBUF_INIT;
 	struct cache_slot slot;
+	int result;

 	/* If the cache is disabled, just generate the content */
 	if (size <= 0) {
 <at>  <at>  -343,11 +344,15  <at>  <at>  int cache_process(int size, const char *path, const char *key, int ttl,
 	slot.fn = fn;
 	slot.cbdata = cbdata;
 	slot.ttl = ttl;
-	slot.cache_name = strbuf_detach(&filename, NULL);
-	slot.lock_name = strbuf_detach(&lockname, NULL);
(Continue reading)

John Keeping | 18 May 2013 18:48
Picon

Re: [RFC] Relocate repos when using scan-path

On Sat, May 18, 2013 at 06:20:56PM +0200, Jason A. Donenfeld wrote:
> On Sat, May 18, 2013 at 6:06 PM, John Keeping <john@...> wrote:
> > That might still break SSH; for a proper solution I think we need
> > something like this (untested).
> 
> Why? What's git-daemon have anything to do with SSH?

Nothing, but the same problem of moving repositories applies.

We can solve HTTP with a 301 redirect but not git:// or ssh:// and
people seem to use absolute paths with SSH if they're not using Gitolite
or an equivalent, which makes it harder to move repositories accessed in
that way.
John Keeping | 18 May 2013 17:21
Picon

[PATCH] shared.c: use die_errno() where appropriate

This replaces some code that is re-implementing die_errno by just
calling the function.

Signed-off-by: John Keeping <john@...>
---
From a quick grep, these are the only places where it makes sense to
replace die with die_errno.

 shared.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/shared.c b/shared.c
index 4369378..919a99e 100644
--- a/shared.c
+++ b/shared.c
 <at>  <at>  -15,21 +15,21  <at>  <at>  struct cgit_context ctx;
 int chk_zero(int result, char *msg)
 {
 	if (result != 0)
-		die("%s: %s", msg, strerror(errno));
+		die_errno("%s", msg);
 	return result;
 }

 int chk_positive(int result, char *msg)
 {
 	if (result <= 0)
-		die("%s: %s", msg, strerror(errno));
+		die_errno("%s", msg);
 	return result;
(Continue reading)

John Keeping | 18 May 2013 16:57
Picon

[PATCH] html.c: die when write fails

If we fail to write HTML output once, there's no point carrying on so
just write a failure message once and die.  By using Git's die_errno
function we also let the user know in what way the write failed.

Signed-off-by: John Keeping <john@...>
---
 html.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/html.c b/html.c
index f7772dc..03277db 100644
--- a/html.c
+++ b/html.c
 <at>  <at>  -78,7 +78,7  <at>  <at>  char *fmtalloc(const char *format, ...)
 void html_raw(const char *data, size_t size)
 {
 	if (write(htmlfd, data, size) != size)
-		fprintf(stderr, "[html.c] html output truncated.\n");
+		die_errno("write error on html output");
 }

 void html(const char *txt)
--

-- 
1.8.3.rc2.285.gfc18c2c
John Keeping | 18 May 2013 16:54
Picon

[PATCH] ui-log: add <span/> around commit decorations

This helps projects that have a large number of tags to display them all
using custom CSS.

The default stylesheet has not been updated since what is useful for
projects with a lot of tags is not the same as what is useful for
projects with only a small number of decorations per commit.

Suggested-by: Konstantin Ryabitsev <mricon@...>
Signed-off-by: John Keeping <john@...>
---
 ui-log.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ui-log.c b/ui-log.c
index 2aa12c3..6f1249b 100644
--- a/ui-log.c
+++ b/ui-log.c
 <at>  <at>  -61,6 +61,7  <at>  <at>  void show_commit_decorations(struct commit *commit)

 	buf[sizeof(buf) - 1] = 0;
 	deco = lookup_decoration(&name_decoration, &commit->object);
+	html("<span class='decoration'>");
 	while (deco) {
 		if (!prefixcmp(deco->name, "refs/heads/")) {
 			strncpy(buf, deco->name + 11, sizeof(buf) - 1);
 <at>  <at>  -94,6 +95,7  <at>  <at>  void show_commit_decorations(struct commit *commit)
 next:
 		deco = deco->next;
 	}
+	html("</span>");
(Continue reading)

John Keeping | 18 May 2013 16:17
Picon

[PATCH] Makefile: fix parallel "make test"

When building the "test" target we depend on both cgit and building the
Git tools.  By doing this with two targets we end up running make in the
git/ directory twice, concurrently if using parallel make, which causes
us to build more than we need and potentially builds incorrectly if
multi-step build-then-move operations overlap.

Fix this by instead calling back into the makefile so that we alter the
"cgit" target to also build the Git tools.

Signed-off-by: John Keeping <john@...>
---
 Makefile | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 77c676d..0fe0bc2 100644
--- a/Makefile
+++ b/Makefile
 <at>  <at>  -64,12 +64,10  <at>  <at>  endif
 all:: cgit

 cgit:
-	$(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) -f ../cgit.mk ../cgit NO_CURL=1
+	$(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) -f ../cgit.mk ../cgit $(EXTRA_GIT_TARGETS) NO_CURL=1

-git:
-	$(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1
-
-test: all git
+test:
(Continue reading)

Konstantin Ryabitsev | 13 May 2013 16:27

RFE: Add <span> around tag decorations

Hi, all:

Android projects have *silly* amounts of tags, e.g. take a look at this
page:

https://www.codeaurora.org/cgit/external/gigabyte/platform/hardware/ti/omap3/

You will notice that it's pretty broken because of the horizontal
scroll. We can work around this with CSS, but only when decorations are
inside its own element, such as <span> (believe, me, I tried). Here's
how it looks in a patched version of cgit 0.9.1 that implements the
<span>, plus some css hacking to make the tag display not suck (hover
over commit to show the tags):

https://www-stg.codeaurora.org/cgit/external/gigabyte/platform/hardware/ti/omap3/

The change to make is in show_commit_decorations. My C is not good at
all, so I'm sending this in python/C pseudocode (heh) instead of a patch ;).

if not len(deco):
        return

html("<span class='deco-span'>");
while (deco) {
        ...
}
html ("</span>");

As it's just an additional span, it shouldn't break any existing CSS
configurations, but will allow projects that abuse^W use extensive
(Continue reading)

Florian Pritz | 13 May 2013 15:56
Picon

[RFC] Relocate repos when using scan-path


Hi,

Having now seen section-from-path now I think this feature is pretty
useful, but to fully utilize it I'd have to move around some repos for a
proper directory structure.

Since I want to keep URLs working for existing clones I thought about
placing symlinks in the old location, but then cgit will display each
repo twice.

Should there be an option to ignore symlinks, a (per repo) list of valid
paths for the index or something else to keep cgit's index list clean?

Lars Hjemli | 13 May 2013 15:04
Picon

[TEST] list forwarding

Test forwarding from hjemli.net to the new list

--

-- 
larsh
Jason A. Donenfeld | 13 May 2013 13:54
Favicon

New Mailing List

Hi folks,

Lars and I have been working together to transition the mailing list
over to some new infrastructure.

The new mailing email address is now:<cgit@...>.

The configuration should be more or less identical, and all
subscribers have been moved over. The old email address will forward
to this new one, so long as Lars keeps his forwarder up and running.

Sign up: http://lists.zx2c4.com/mailman/listinfo/cgit
Archives: http://lists.zx2c4.com/pipermail/cgit/

Please let me know if there are any problems.

Thanks,
Jason

Gmane