[PATCH] Remove no-op link from submodule entries

2015-03-05 Thread Lukas Fleischer
Instead of linking to the current page (href='#'), do not add a link
to a submodule entry at all if the module-link setting is not used.

Signed-off-by: Lukas Fleischer c...@cryptocrack.de
---
 cgit.css|  2 +-
 ui-shared.c | 41 -
 2 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/cgit.css b/cgit.css
index 6888cde..82c755c 100644
--- a/cgit.css
+++ b/cgit.css
@@ -254,7 +254,7 @@ div#cgit div.error {
margin: 1em 2em;
 }
 
-div#cgit a.ls-blob, div#cgit a.ls-dir, div#cgit a.ls-mod {
+div#cgit a.ls-blob, div#cgit a.ls-dir, div#cgit .ls-mod {
font-family: monospace;
 }
 
diff --git a/ui-shared.c b/ui-shared.c
index ff03cb2..c8c1ae0 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -555,25 +555,32 @@ void cgit_submodule_link(const char *class, char *path, 
const char *rev)
item = lookup_path(list, path);
}
}
-   html(a );
-   if (class)
-   htmlf(class='%s' , class);
-   html(href=');
-   if (item) {
-   html_attrf(item-util, rev);
-   } else if (ctx.repo-module_link) {
-   dir = strrchr(path, '/');
-   if (dir)
-   dir++;
-   else
-   dir = path;
-   html_attrf(ctx.repo-module_link, dir, rev);
+   if (item || ctx.repo-module_link) {
+   html(a );
+   if (class)
+   htmlf(class='%s' , class);
+   html(href=');
+   if (item) {
+   html_attrf(item-util, rev);
+   } else {
+   dir = strrchr(path, '/');
+   if (dir)
+   dir++;
+   else
+   dir = path;
+   html_attrf(ctx.repo-module_link, dir, rev);
+   }
+   html(');
+   html_txt(path);
+   html(/a);
} else {
-   html(#);
+   html(span);
+   if (class)
+   htmlf( class='%s', class);
+   html();
+   html_txt(path);
+   html(/span);
}
-   html(');
-   html_txt(path);
-   html(/a);
html_txtf( @ %.7s, rev);
if (item  tail)
path[len - 1] = tail;
-- 
2.3.1

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH] Support .git/category files

2015-03-05 Thread Lukas Fleischer
On Thu, 05 Mar 2015 at 18:15:04, Jan-Marek Glogowski wrote:
 Gitweb reads .git/category to set a repository section for
 grouping. This handles the file in the same way a .git/description
 file is handled.
 
 The file section takes precedence over the ctx.cfg.section_from_path
 setting.
 ---
  cgit.c  |  2 +-
  cgit.h  |  1 +
  scan-tree.c | 20 +++-
  shared.c|  1 +
  4 files changed, 22 insertions(+), 2 deletions(-)
 [...]

There already are at least two ways to achieve the same thing (using the
Git configuration variables gitweb.category or cgit.section and
repository-specific cgitrc files). Do we really need another
alternative? Is this just for GitWeb compatibility or does this have any
advantages over the existing options?
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH] Support .git/category files

2015-03-05 Thread Jan-Marek Glogowski
Am 05.03.2015 um 18:38 schrieb John Keeping:
 What's the advantage of this over using enable-git-config=1 and
 cgit.section (we even support gitweb.section as an alias)?

Well - I have 100+ repositories, which already have the category file.
There is no advantage over any other method.

Am 05.03.2015 um 18:41 schrieb Lukas Fleischer:
 There already are at least two ways to achieve the same thing (using
 the Git configuration variables gitweb.category or cgit.section and
 repository-specific cgitrc files). Do we really need another
 alternative? Is this just for GitWeb compatibility or does this have
 any advantages over the existing options?

Yes - it's just GitWeb compatibility, like - I guess - the
description file support just the few lines before my path.

JMG
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH] Support .git/category files

2015-03-05 Thread John Keeping
On Thu, Mar 05, 2015 at 06:50:47PM +0100, Jan-Marek Glogowski wrote:
 Am 05.03.2015 um 18:38 schrieb John Keeping:
  What's the advantage of this over using enable-git-config=1 and
  cgit.section (we even support gitweb.section as an alias)?
 
 Well - I have 100+ repositories, which already have the category file.
 There is no advantage over any other method.
 
 Am 05.03.2015 um 18:41 schrieb Lukas Fleischer:
  There already are at least two ways to achieve the same thing (using
  the Git configuration variables gitweb.category or cgit.section and
  repository-specific cgitrc files). Do we really need another
  alternative? Is this just for GitWeb compatibility or does this have
  any advantages over the existing options?
 
 Yes - it's just GitWeb compatibility, like - I guess - the
 description file support just the few lines before my path.

The description file is a bit different though - it's in the default
repository template that ships with Git and is used by the sample hooks
that ship there.

I'm not sure category is similar enough, particularly when you can do:

for repo in $repositories
do
git -C $repo config gitweb.category $(cat $repo/category) 

rm -f $repo/category
done

and still have a configuration that works with both Gitweb and CGit.
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH] Support .git/category files

2015-03-05 Thread Jan-Marek Glogowski
Gitweb reads .git/category to set a repository section for
grouping. This handles the file in the same way a .git/description
file is handled.

The file section takes precedence over the ctx.cfg.section_from_path
setting.
---
 cgit.c  |  2 +-
 cgit.h  |  1 +
 scan-tree.c | 20 +++-
 shared.c|  1 +
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/cgit.c b/cgit.c
index 0ad8171..239f709 100644
--- a/cgit.c
+++ b/cgit.c
@@ -377,7 +377,7 @@ static void prepare_context(void)
ctx.cfg.root_desc = a fast webinterface for the git dscm;
ctx.cfg.scan_hidden_path = 0;
ctx.cfg.script_name = CGIT_SCRIPT_NAME;
-   ctx.cfg.section = ;
+   ctx.cfg.section = cgit_default_repo_section;
ctx.cfg.repository_sort = name;
ctx.cfg.section_sort = 1;
ctx.cfg.summary_branches = 10;
diff --git a/cgit.h b/cgit.h
index 16f8092..ea9aef9 100644
--- a/cgit.h
+++ b/cgit.h
@@ -318,6 +318,7 @@ extern struct cgit_context ctx;
 extern const struct cgit_snapshot_format cgit_snapshot_formats[];
 
 extern char *cgit_default_repo_desc;
+extern char *cgit_default_repo_section;
 extern struct cgit_repo *cgit_add_repo(const char *url);
 extern struct cgit_repo *cgit_get_repoinfo(const char *url);
 extern void cgit_repo_config_cb(const char *name, const char *value);
diff --git a/scan-tree.c b/scan-tree.c
index e900ad9..c7ba509 100644
--- a/scan-tree.c
+++ b/scan-tree.c
@@ -149,7 +149,25 @@ static void add_repo(const char *base, struct strbuf 
*path, repo_config_fn fn)
strbuf_setlen(path, pathlen);
}
 
-   if (ctx.cfg.section_from_path) {
+   if (repo-section == cgit_default_repo_section || !repo-section) {
+   strbuf_addstr(path, category);
+   if (!stat(path-buf, st) 
+   !readfile(path-buf, repo-section, size)) {
+   // trim category, as gitweb does
+   while (size  0  isspace((unsigned 
char)repo-section[size - 1]))
+   size--;
+   if (size == 0) {
+   free(repo-section);
+   repo-section = cgit_default_repo_section;
+   }
+   else
+   repo-section[size] = '\0';
+   }
+   strbuf_setlen(path, pathlen);
+   }
+
+   if (ctx.cfg.section_from_path
+ (repo-section == cgit_default_repo_section || !repo-section)) 
{
n = ctx.cfg.section_from_path;
if (n  0) {
slash = rel.buf - 1;
diff --git a/shared.c b/shared.c
index ae17d78..4b21da2 100644
--- a/shared.c
+++ b/shared.c
@@ -34,6 +34,7 @@ int chk_non_negative(int result, char *msg)
 }
 
 char *cgit_default_repo_desc = [no description];
+char *cgit_default_repo_section = ;
 struct cgit_repo *cgit_add_repo(const char *url)
 {
struct cgit_repo *ret;
-- 
1.9.1

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Support for submodules in tree view?

2015-03-05 Thread Dunnigan, Terrence J
Hi all,

We are using cgit 0.10.1. Some of our repos have submodules, and when I look at 
a tree view I see the name of the submodule with its current hash, e.g.

m-  Utilities @ 350bc94

The submodule names are all hyperlinks, but the actual link is just a #. So 
clicking on it doesn't do anything.

Is this the correct behavior? Or something on my system improperly configured 
to support submodules?

Thanks,

Terry
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Support for submodules in tree view?

2015-03-05 Thread John Keeping
On Thu, Mar 05, 2015 at 06:19:31PM +, Dunnigan, Terrence J wrote:
 We are using cgit 0.10.1. Some of our repos have submodules, and when
 I look at a tree view I see the name of the submodule with its current
 hash, e.g.
 
 m-  Utilities @ 350bc94
 
 The submodule names are all hyperlinks, but the actual link is just a
 #. So clicking on it doesn't do anything.
 
 Is this the correct behavior? Or something on my system improperly
 configured to support submodules?

You probably need to set the module-link configuration variable in
your cgitrc file.

Since it's possible for submodules to link to a different server, there
isn't really much CGit can do in the general case.  Note that there's
also repo.module-link.path in case your submodule paths don't match
up to their URLs, although I'm quite surprised we don't support a filter
to map submodule URLs to links - something to go on the TODO list
perhaps...
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Support for submodules in tree view?

2015-03-05 Thread Lukas Fleischer
On Thu, 05 Mar 2015 at 19:25:53, John Keeping wrote:
 On Thu, Mar 05, 2015 at 06:19:31PM +, Dunnigan, Terrence J wrote:
  We are using cgit 0.10.1. Some of our repos have submodules, and when
  I look at a tree view I see the name of the submodule with its current
  hash, e.g.
  
  m-  Utilities @ 350bc94
  
  The submodule names are all hyperlinks, but the actual link is just a
  #. So clicking on it doesn't do anything.
  
  Is this the correct behavior? Or something on my system improperly
  configured to support submodules?
 
 You probably need to set the module-link configuration variable in
 your cgitrc file.
 
 Since it's possible for submodules to link to a different server, there
 isn't really much CGit can do in the general case.  Note that there's
 also repo.module-link.path in case your submodule paths don't match
 up to their URLs, although I'm quite surprised we don't support a filter
 to map submodule URLs to links - something to go on the TODO list
 perhaps...

What do you think about hiding the # link, though? I don't think it is
a good idea to pretend there is a link when there isn't...

-- 8 --
diff --git a/ui-shared.c b/ui-shared.c
index ff03cb2..0eeab6f 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -555,25 +555,27 @@ void cgit_submodule_link(const char *class, char *path, 
const char *rev)
item = lookup_path(list, path);
}
}
-   html(a );
-   if (class)
-   htmlf(class='%s' , class);
-   html(href=');
-   if (item) {
-   html_attrf(item-util, rev);
-   } else if (ctx.repo-module_link) {
-   dir = strrchr(path, '/');
-   if (dir)
-   dir++;
-   else
-   dir = path;
-   html_attrf(ctx.repo-module_link, dir, rev);
+   if (item || ctx.repo-module_link) {
+   html(a );
+   if (class)
+   htmlf(class='%s' , class);
+   html(href=');
+   if (item) {
+   html_attrf(item-util, rev);
+   } else {
+   dir = strrchr(path, '/');
+   if (dir)
+   dir++;
+   else
+   dir = path;
+   html_attrf(ctx.repo-module_link, dir, rev);
+   }
+   html(');
+   html_txt(path);
+   html(/a);
} else {
-   html(#);
+   html_txt(path);
}
-   html(');
-   html_txt(path);
-   html(/a);
html_txtf( @ %.7s, rev);
if (item  tail)
path[len - 1] = tail;
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Support for submodules in tree view?

2015-03-05 Thread John Keeping
On Thu, Mar 05, 2015 at 07:31:01PM +0100, Lukas Fleischer wrote:
 On Thu, 05 Mar 2015 at 19:25:53, John Keeping wrote:
  On Thu, Mar 05, 2015 at 06:19:31PM +, Dunnigan, Terrence J wrote:
   We are using cgit 0.10.1. Some of our repos have submodules, and when
   I look at a tree view I see the name of the submodule with its current
   hash, e.g.
   
   m-  Utilities @ 350bc94
   
   The submodule names are all hyperlinks, but the actual link is just a
   #. So clicking on it doesn't do anything.
   
   Is this the correct behavior? Or something on my system improperly
   configured to support submodules?
  
  You probably need to set the module-link configuration variable in
  your cgitrc file.
  
  Since it's possible for submodules to link to a different server, there
  isn't really much CGit can do in the general case.  Note that there's
  also repo.module-link.path in case your submodule paths don't match
  up to their URLs, although I'm quite surprised we don't support a filter
  to map submodule URLs to links - something to go on the TODO list
  perhaps...
 
 What do you think about hiding the # link, though? I don't think it is
 a good idea to pretend there is a link when there isn't...

Good idea.  My one concern would be that it hinders discovery of the
module-link feature, but I think that is outweighed by the fact that it
is perfectly reasonable for someone to only want to link some of the
submodules in their system to a web interface.

 -- 8 --
 diff --git a/ui-shared.c b/ui-shared.c
 index ff03cb2..0eeab6f 100644
 --- a/ui-shared.c
 +++ b/ui-shared.c
 @@ -555,25 +555,27 @@ void cgit_submodule_link(const char *class, char *path, 
 const char *rev)
 item = lookup_path(list, path);
 }
 }
 -   html(a );
 -   if (class)
 -   htmlf(class='%s' , class);
 -   html(href=');
 -   if (item) {
 -   html_attrf(item-util, rev);
 -   } else if (ctx.repo-module_link) {
 -   dir = strrchr(path, '/');
 -   if (dir)
 -   dir++;
 -   else
 -   dir = path;
 -   html_attrf(ctx.repo-module_link, dir, rev);
 +   if (item || ctx.repo-module_link) {
 +   html(a );
 +   if (class)
 +   htmlf(class='%s' , class);
 +   html(href=');
 +   if (item) {
 +   html_attrf(item-util, rev);
 +   } else {
 +   dir = strrchr(path, '/');
 +   if (dir)
 +   dir++;
 +   else
 +   dir = path;
 +   html_attrf(ctx.repo-module_link, dir, rev);
 +   }
 +   html(');
 +   html_txt(path);
 +   html(/a);
 } else {
 -   html(#);
 +   html_txt(path);
 }
 -   html(');
 -   html_txt(path);
 -   html(/a);
 html_txtf( @ %.7s, rev);
 if (item  tail)
 path[len - 1] = tail;
 ___
 CGit mailing list
 CGit@lists.zx2c4.com
 http://lists.zx2c4.com/mailman/listinfo/cgit
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Description for section and link for repos

2015-03-05 Thread John Keeping
On Thu, Mar 05, 2015 at 10:51:09AM +0100, Pablo Rauzy wrote:
 Hello again, and thanks for your quick response.
 
 On 2015-03-05, John Keeping wrote:
  On Thu, Mar 05, 2015 at 09:22:55AM +0100, Pablo Rauzy wrote:
  My first question is about sections.
  I would like to be able to add a title and a little description for each
  section, just like I can with the cgit.desc configuration for each the
  git repos.
  
  Example : http://clandest.in/sensi
  Here I would like the title to be clandest.in / sensi rather than just
  clandest.in, and I would like the description to be SEN Security
  Inspector rather than the root description.
 
  Are you currently using section-from-path?  If you use the
  repo.section configuration option then you can name the sections
  however you want, but this is not possible if you are generating the
  sections automatically.
 
 Indeed I am using section-from-path, but the name of the sections are
 just fine.
 
 What I was looking for is the possibility to for instance make cgit
 using a file called description in the directory that it makes a
 section as description of that section.

I don't think this has ever been supported.

I hadn't realised that http://clandest.in/sensi wasn't the root of the
repository.  CGit doesn't generate any links to the section pages so I'm
not sure much thought has gone into the formatting of those pages.

  If you're combining CGit with Gitolite you may be able to avoid listing
  repositories twice by using CGit's enable-git-config option to
  configure the repo.section variable (I'm not sure if you can set a
  config variable on a group of repositories in Gitolite, but I think you
  should be able to).
 
 I'm not using Gitolite.
 
  My second question is about repository.
  I would like to add title and a link to a project home page somewhere
  else than on the logo.
  
  Example : http://clandest.in/sensi/finja
  Here I would like the title to be clandest.in / sensi / finja rather
  than index : finja, and I would like to add a tab homepage after
  diff which would link to http://pablo.rauzy.name/sensi/finja.html in
  this example.
  
  
  Is what I'm looking for already possible? If yes, how? If not, I think
  it would be a nice addition.
 
  I don't think this is currently possible.  Note that the word index is
  actually a link to the list of repositories.
 
 Yes I noticed that, but I find it less nice than having the root-title
 for the link.
 
  For the homepage link, have you considered simply adding a link to the
  repository's readme (on the about tab)?  I thought there was a way to
  make the about tab the default instead of the summary tab, but I
  can't find it when I go looking so I must be wrong about that.
 
 That is exactly what I did for now. Maybe it is enough. I'll see with
 the time how much I like it this way :).
 
 FWIW, here is the filter I wrote to make link clickable in plaintext
 READMEs: http://paste.fulltxt.net/LKdVjbHaY (it is quick and dirty, it
 simply considers that anything between  and  and starting with http
 is a link).

Note that there is a collection of scripts in the filters directory
that will handle Markdown, ReStructuredText and a variety of other
formats.
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH] Simplify commit and tag parsing

2015-03-05 Thread Jason A. Donenfeld
This commit breaks ui-tag. The first few lines of tag messages are cut off.
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH] Simplify commit and tag parsing

2015-03-05 Thread John Keeping
On Thu, Mar 05, 2015 at 11:46:55AM +0100, Jason A. Donenfeld wrote:
 This commit breaks ui-tag. The first few lines of tag messages are cut off.

It looks like parse_user() consumes the trailing LF on the user line, so
next_header_line() ends up skipping the blank line at the end of the
header.

I suspect the right answer is to stop parse_user() eating the LF since
all of the call sites go through next_header_line() after this patch.
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Description for section and link for repos

2015-03-05 Thread John Keeping
On Thu, Mar 05, 2015 at 09:22:55AM +0100, Pablo Rauzy wrote:
 My first question is about sections.
 I would like to be able to add a title and a little description for each
 section, just like I can with the cgit.desc configuration for each the
 git repos.
 
 Example : http://clandest.in/sensi
 Here I would like the title to be clandest.in / sensi rather than just
 clandest.in, and I would like the description to be SEN Security
 Inspector rather than the root description.

Are you currently using section-from-path?  If you use the
repo.section configuration option then you can name the sections
however you want, but this is not possible if you are generating the
sections automatically.

If you're combining CGit with Gitolite you may be able to avoid listing
repositories twice by using CGit's enable-git-config option to
configure the repo.section variable (I'm not sure if you can set a
config variable on a group of repositories in Gitolite, but I think you
should be able to).

 My second question is about repository.
 I would like to add title and a link to a project home page somewhere
 else than on the logo.
 
 Example : http://clandest.in/sensi/finja
 Here I would like the title to be clandest.in / sensi / finja rather
 than index : finja, and I would like to add a tab homepage after
 diff which would link to http://pablo.rauzy.name/sensi/finja.html in
 this example.
 
 
 Is what I'm looking for already possible? If yes, how? If not, I think
 it would be a nice addition.

I don't think this is currently possible.  Note that the word index is
actually a link to the list of repositories.

For the homepage link, have you considered simply adding a link to the
repository's readme (on the about tab)?  I thought there was a way to
make the about tab the default instead of the summary tab, but I
can't find it when I go looking so I must be wrong about that.
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Description for section and link for repos

2015-03-05 Thread Pablo Rauzy
Hello again, and thanks for your quick response.

On 2015-03-05, John Keeping wrote:
 On Thu, Mar 05, 2015 at 09:22:55AM +0100, Pablo Rauzy wrote:
 My first question is about sections.
 I would like to be able to add a title and a little description for each
 section, just like I can with the cgit.desc configuration for each the
 git repos.
 
 Example : http://clandest.in/sensi
 Here I would like the title to be clandest.in / sensi rather than just
 clandest.in, and I would like the description to be SEN Security
 Inspector rather than the root description.

 Are you currently using section-from-path?  If you use the
 repo.section configuration option then you can name the sections
 however you want, but this is not possible if you are generating the
 sections automatically.

Indeed I am using section-from-path, but the name of the sections are
just fine.

What I was looking for is the possibility to for instance make cgit
using a file called description in the directory that it makes a
section as description of that section.

 If you're combining CGit with Gitolite you may be able to avoid listing
 repositories twice by using CGit's enable-git-config option to
 configure the repo.section variable (I'm not sure if you can set a
 config variable on a group of repositories in Gitolite, but I think you
 should be able to).

I'm not using Gitolite.

 My second question is about repository.
 I would like to add title and a link to a project home page somewhere
 else than on the logo.
 
 Example : http://clandest.in/sensi/finja
 Here I would like the title to be clandest.in / sensi / finja rather
 than index : finja, and I would like to add a tab homepage after
 diff which would link to http://pablo.rauzy.name/sensi/finja.html in
 this example.
 
 
 Is what I'm looking for already possible? If yes, how? If not, I think
 it would be a nice addition.

 I don't think this is currently possible.  Note that the word index is
 actually a link to the list of repositories.

Yes I noticed that, but I find it less nice than having the root-title
for the link.

 For the homepage link, have you considered simply adding a link to the
 repository's readme (on the about tab)?  I thought there was a way to
 make the about tab the default instead of the summary tab, but I
 can't find it when I go looking so I must be wrong about that.

That is exactly what I did for now. Maybe it is enough. I'll see with
the time how much I like it this way :).

FWIW, here is the filter I wrote to make link clickable in plaintext
READMEs: http://paste.fulltxt.net/LKdVjbHaY (it is quick and dirty, it
simply considers that anything between  and  and starting with http
is a link).

Thanks again for your really quick answer!


Cheers,
-- 
Pablo Rauzy.
http://pablo.rauzy.name/


signature.asc
Description: PGP signature
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 2/2] Drop return value from parse_user()

2015-03-05 Thread Lukas Fleischer
In commit 936295c (Simplify commit and tag parsing, 2015-03-03), the
commit and tag parsing code was refactored. This broke tag messages in
ui-tag since the line after the tagger header was erroneously skipped.
Rework parse_user() and skip the line manually outside parse_user().

Signed-off-by: Lukas Fleischer c...@cryptocrack.de
---
 parsing.c | 18 +++---
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/parsing.c b/parsing.c
index dcaf2b3..f903c7c 100644
--- a/parsing.c
+++ b/parsing.c
@@ -69,13 +69,12 @@ static char *substr(const char *head, const char *tail)
return buf;
 }
 
-static const char *parse_user(const char *t, char **name, char **email, 
unsigned long *date)
+static void parse_user(const char *t, char **name, char **email, unsigned long 
*date)
 {
-   const char *line_end = strchrnul(t, '\n');
struct ident_split ident;
unsigned email_len;
 
-   if (!split_ident_line(ident, t, line_end - t)) {
+   if (!split_ident_line(ident, t, strchrnul(t, '\n') - t)) {
*name = substr(ident.name_begin, ident.name_end);
 
email_len = ident.mail_end - ident.mail_begin;
@@ -85,11 +84,6 @@ static const char *parse_user(const char *t, char **name, 
char **email, unsigned
if (ident.date_begin)
*date = strtoul(ident.date_begin, NULL, 10);
}
-
-   if (*line_end)
-   return line_end + 1;
-   else
-   return line_end;
 }
 
 #ifdef NO_ICONV
@@ -152,13 +146,15 @@ struct commitinfo *cgit_parse_commit(struct commit 
*commit)
p += sha1hex_len + 1;
 
if (p  skip_prefix(p, author , p)) {
-   p = parse_user(p, ret-author, ret-author_email,
+   parse_user(p, ret-author, ret-author_email,
ret-author_date);
+   p = next_header_line(p);
}
 
if (p  skip_prefix(p, committer , p)) {
-   p = parse_user(p, ret-committer, ret-committer_email,
+   parse_user(p, ret-committer, ret-committer_email,
ret-committer_date);
+   p = next_header_line(p);
}
 
if (p  skip_prefix(p, encoding , p)) {
@@ -211,7 +207,7 @@ struct taginfo *cgit_parse_tag(struct tag *tag)
 
for (p = data; !end_of_header(p); p = next_header_line(p)) {
if (skip_prefix(p, tagger , p)) {
-   p = parse_user(p, ret-tagger, ret-tagger_email,
+   parse_user(p, ret-tagger, ret-tagger_email,
ret-tagger_date);
}
}
-- 
2.3.1

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 1/2] Remove leading newline characters from tag messages

2015-03-05 Thread Lukas Fleischer
Fixes a regression introduced in commit 936295c (Simplify commit and tag
parsing, 2015-03-03).

Signed-off-by: Lukas Fleischer c...@cryptocrack.de
---
 parsing.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/parsing.c b/parsing.c
index 0db181b..dcaf2b3 100644
--- a/parsing.c
+++ b/parsing.c
@@ -216,6 +216,9 @@ struct taginfo *cgit_parse_tag(struct tag *tag)
}
}
 
+   while (p  *p == '\n')
+   p++;
+
if (p  *p)
ret-msg = xstrdup(p);
 
-- 
2.3.1

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[ANNOUNCE] CGIT v0.11.1 Released

2015-03-05 Thread Jason A. Donenfeld
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hi folks,

CGit 0.11.1 is now available, with some important bug fixes, as well as
tweaks done for the new gitweb.gentoo.org site.

== CGit on the Web ==

* homepage: http://git.zx2c4.com/cgit/about/
* git repository: http://git.zx2c4.com/cgit/
* git clone: git://git.zx2c4.com/cgit
* mailing list: cgit@lists.zx2c4.com
* mailing list subscribe: http://lists.zx2c4.com/mailman/listinfo/cgit

== ChangeLog v0.11.1 ==

10 files changed, 127 insertions(+), 113 deletions(-)

Changes:

* Uses internally Git 2.3.1
* Optimized commit and tag parsing
* The sample simple-authentication.lua has been hardened

Bug fixes:

* When clicking on an owner in the index, use the right query string for
  searching
* When filtering in the index, make the sorting links point to the same
  filtered page of results
* Also, the same as above, but with pagination links
* F_SETLK is now used to avoid creating stale lock files

== Downloading ==

* http://git.zx2c4.com/cgit/snapshot/cgit-0.11.1.tar.xz
  fce62bd440891f796fa0e471dfd539ca0e5521b4 (sha1)

* For verification git tag v0.11.1 is signed with my public key:
  zx2c4.com/keys/AB9942E6D4A4CFC3412620A749FC7012A5DE03AE.asc

Thanks to everyone who contributed to this release!


Jason Donenfeld
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQIcBAEBCAAGBQJU+HDWAAoJEEn8cBKl3gOuE0IP/2ZRQ9EIjF+1b3QsL8XrTq0R
sWC74YN82uvzp/eOQei5O2FeglTYCKn4QWMG4f/zjQK9jhhBRGOkcIaYHaDWCTQw
Q39NELHeDCwl8aTjSa9FPYv4l9+w5j2M1eajcOvKg8PlvyyQJuJ7ryZNsT+W6O7T
zLmaQc4HKixv/pw7qbjg2AcwCchMxfLtyqZL/zIOtFXhTKLsVMywsfj8DMb7f5cD
L6ImDRoufVX5CKeJcZi0kEXHD8WQRnw3+jvKfCom3nClc/17mqusjWJ/q2WvsGQP
3uQ8ZnX1effjlFZD3mSwR+05yZeRVdDAuFkneQqhqUlYexadIP+jf6MT7c1n6s3U
NIBPMiGEM8ORSmWHYjnn0+8BZk31sWb8cml7g8zUnafH5OknGw7y58LqvwEBnzfk
ua8NK2cmBcGjZzpexWxwJxdZlOdYV4VKETEeZQc3s9LRyqkmxQkxNBq9ArhT+hjU
emlioZihVlxm2MJkbgynPgCSJJT7ipkNHgbE/odh1oxwjKhXtJ4HUdH00WqUxvEx
9nSavmzoYSf4Ir7lrgH5YXO4MEqCZKl07NUplcbhyxA1IeHKty3JhtOJfNKzSgVx
mV4zTUR2eRMESGmpIXUDM6hqhiZW8ZRSFm1lk3CizGhMkAR4/Qd3KBrDl6HhN87X
mJAbYOfJzvUYBx0AeBJx
=aQkx
-END PGP SIGNATURE-
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit