List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH] ui-log.c: do not show remote heads if enable-remote-branches=0
@ 2011-10-04 11:09 
  2012-01-03 15:39 ` hjemli
  0 siblings, 1 reply; 4+ messages in thread
From:  @ 2011-10-04 11:09 UTC (permalink / raw)


If remote branches are not enabled, the branches are still listed in the log view. This patch
removes them if enable-remote-branches=0.

---
 ui-log.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/ui-log.c b/ui-log.c
index 4a295bd..64f90da 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -76,6 +76,10 @@ void show_commit_decorations(struct commit *commit)
                        cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf);
                }
                else if (!prefixcmp(deco->name, "refs/remotes/")) {
+                       if(!ctx.repo->enable_remote_branches) {
+                               deco = deco->next;
+                               continue;
+                       }
                        strncpy(buf, deco->name + 13, sizeof(buf) - 1);
                        cgit_log_link(buf, NULL, "remote-deco", NULL,
                                      sha1_to_hex(commit->object.sha1),
-- 
1.7.4.1




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ui-log.c: do not show remote heads if enable-remote-branches=0
  2011-10-04 11:09 [PATCH] ui-log.c: do not show remote heads if enable-remote-branches=0 
@ 2012-01-03 15:39 ` hjemli
  2012-01-03 15:43   ` 
  0 siblings, 1 reply; 4+ messages in thread
From: hjemli @ 2012-01-03 15:39 UTC (permalink / raw)


On Tue, Oct 4, 2011 at 13:09, Georg M?ller <georgmueller at gmx.net> wrote:
> If remote branches are not enabled, the branches are still listed in the log view. This patch
> removes them if enable-remote-branches=0.
>
> ---
> ?ui-log.c | ? ?4 ++++
> ?1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/ui-log.c b/ui-log.c
> index 4a295bd..64f90da 100644
> --- a/ui-log.c
> +++ b/ui-log.c
> @@ -76,6 +76,10 @@ void show_commit_decorations(struct commit *commit)
> ? ? ? ? ? ? ? ? ? ? ? ?cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf);
> ? ? ? ? ? ? ? ?}
> ? ? ? ? ? ? ? ?else if (!prefixcmp(deco->name, "refs/remotes/")) {
> + ? ? ? ? ? ? ? ? ? ? ? if(!ctx.repo->enable_remote_branches) {
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? deco = deco->next;
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? continue;
> + ? ? ? ? ? ? ? ? ? ? ? }
> ? ? ? ? ? ? ? ? ? ? ? ?strncpy(buf, deco->name + 13, sizeof(buf) - 1);
> ? ? ? ? ? ? ? ? ? ? ? ?cgit_log_link(buf, NULL, "remote-deco", NULL,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sha1_to_hex(commit->object.sha1),


Your patch had corrupted whitespace, so while fixing it I also
sligthly modified it:

diff --git a/ui-log.c b/ui-log.c
index 15ed6a3..b67c2ef 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -76,6 +76,8 @@ void show_commit_decorations(struct commit *commit)
 			cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf);
 		}
 		else if (!prefixcmp(deco->name, "refs/remotes/")) {
+			if (!ctx.repo->enable_remote_branches)
+				goto next;
 			strncpy(buf, deco->name + 13, sizeof(buf) - 1);
 			cgit_log_link(buf, NULL, "remote-deco", NULL,
 				      sha1_to_hex(commit->object.sha1),
@@ -88,6 +90,7 @@ void show_commit_decorations(struct commit *commit)
 					 sha1_to_hex(commit->object.sha1),
 					 ctx.qry.vpath, 0);
 		}
+next:
 		deco = deco->next;
 	}
 }


Are you ok with this?

-- 
larsh




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ui-log.c: do not show remote heads if enable-remote-branches=0
  2012-01-03 15:39 ` hjemli
@ 2012-01-03 15:43   ` 
  2012-01-03 15:46     ` hjemli
  0 siblings, 1 reply; 4+ messages in thread
From:  @ 2012-01-03 15:43 UTC (permalink / raw)


>
> Your patch had corrupted whitespace, so while fixing it I also
> sligthly modified it:
>
> ...
>
> Are you ok with this?
>

Sure :)
Sorry for the whitespace issues.

Best regards,
Georg




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ui-log.c: do not show remote heads if enable-remote-branches=0
  2012-01-03 15:43   ` 
@ 2012-01-03 15:46     ` hjemli
  0 siblings, 0 replies; 4+ messages in thread
From: hjemli @ 2012-01-03 15:46 UTC (permalink / raw)


On Tue, Jan 3, 2012 at 16:43, Georg M?ller <georgmueller at gmx.net> wrote:
>>
>> Your patch had corrupted whitespace, so while fixing it I also
>> sligthly modified it:
>>
>> ...
>>
>> Are you ok with this?
>>
>
> Sure :)

Good, then I'll attribute it to you when applying to stable.

> Sorry for the whitespace issues.

Np, sorry for the late reply.

--
larsh




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-03 15:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-04 11:09 [PATCH] ui-log.c: do not show remote heads if enable-remote-branches=0 
2012-01-03 15:39 ` hjemli
2012-01-03 15:43   ` 
2012-01-03 15:46     ` hjemli

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).