From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1291 invoked from network); 5 Aug 2022 05:00:13 -0000 Received: from lists.zx2c4.com (165.227.139.114) by inbox.vuxu.org with ESMTPUTF8; 5 Aug 2022 05:00:13 -0000 Received: by lists.zx2c4.com (OpenSMTPD) with ESMTP id 42e0e536; Fri, 5 Aug 2022 04:59:57 +0000 (UTC) Return-Path: Received: from mail.kasad.com (mail.kasad.com [2001:19f0:5:46cc:5400:2ff:fed9:9eba]) by lists.zx2c4.com (OpenSMTPD) with ESMTPS id 19d486fb (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Fri, 5 Aug 2022 04:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kasad.com; i=@kasad.com; q=dns/txt; s=mail; t=1659675594; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=mwjT1OUJwoNlWo8o9HwzG0yqsItCUfwomNPlobnFwJE=; b=ZSxySNIbv4xbQMRN8l4hqoTFUD7YhPykDTF6geyBh7dhXCb6UPkTIxmHHP2GPcpp5Ceby ObiHSvjjbFgaDUAKW/Rt5LS2dfOJLMMfK7Gv/79qNcHOBEtQXOHBTnebPJelMMCrPNjBO+r 7coh+k1p5Aotea6swmAcaYPR3r17pbvUZuuGYqlcXO8k11C24VpsHbuQ7KeiG63UoxBrz3K +f6JlkklGUSt7wWkOLAUmYCF/jVFisKM8s9o6/RMuQRyB2ivNhi+TI+tf2JJEXsVjpkqDOq KWrybSYIs//xxs3I7x/4lRtlaXLIGkASRAyaoifsCJK756wwEcpOlpN5hqmA== Received: from localhost (c-98-35-26-36.hsd1.ca.comcast.net [98.35.26.36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail.kasad.com (Postfix) with ESMTPSA id 9E08327377; Thu, 4 Aug 2022 21:59:54 -0700 (PDT) From: Kian Kasad To: cgit@lists.zx2c4.com Cc: Kian Kasad Subject: [PATCH 5/6] Add graph page tab if enable-commit-graph is set to "separate" Date: Thu, 4 Aug 2022 21:59:38 -0700 Message-Id: <20220805045939.57987-6-kian@kasad.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220805045939.57987-1-kian@kasad.com> References: <20211230210820.3ncgngexbbhlpbdq@frisbee.local> <20220805045939.57987-1-kian@kasad.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: cgit@lists.zx2c4.com X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: List for cgit developers and users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: cgit-bounces@lists.zx2c4.com Sender: "CGit" If "enable-commit-graph" is set to "separate", a tab is added in the navigation bar for the graph page. It sits next to the "log" link. --- ui-shared.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/ui-shared.c b/ui-shared.c index acd8ab5..a0c326e 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -401,6 +401,49 @@ void cgit_log_link(const char *name, const char *title, const char *class, html(""); } +void cgit_graph_link(const char *name, const char *title, const char *class, + const char *head, const char *rev, const char *path, + int ofs, const char *grep, const char *pattern, int showmsg, + int follow) +{ + char *delim; + + delim = repolink(title, class, "graph", head, path); + if (rev && ctx.qry.head && strcmp(rev, ctx.qry.head)) { + html(delim); + html("id="); + html_url_arg(rev); + delim = "&"; + } + if (grep && pattern) { + html(delim); + html("qt="); + html_url_arg(grep); + delim = "&"; + html(delim); + html("q="); + html_url_arg(pattern); + } + if (ofs > 0) { + html(delim); + html("ofs="); + htmlf("%d", ofs); + delim = "&"; + } + if (showmsg) { + html(delim); + html("showmsg=1"); + delim = "&"; + } + if (follow) { + html(delim); + html("follow=1"); + } + html("'>"); + html_txt(name); + html(""); +} + void cgit_commit_link(const char *name, const char *title, const char *class, const char *head, const char *rev, const char *path) { @@ -1043,6 +1086,10 @@ void cgit_print_pageheader(void) cgit_log_link("log", NULL, hc("log"), ctx.qry.head, NULL, ctx.qry.vpath, 0, NULL, NULL, ctx.qry.showmsg, ctx.qry.follow); + if (ctx.repo->enable_commit_graph == 2) + cgit_graph_link("graph", NULL, hc("graph"), ctx.qry.head, + NULL, ctx.qry.vpath, 0, NULL, NULL, + ctx.qry.showmsg, ctx.qry.follow); if (ctx.qry.page && !strcmp(ctx.qry.page, "blame")) cgit_blame_link("blame", NULL, hc("blame"), ctx.qry.head, ctx.qry.oid, ctx.qry.vpath); -- 2.37.1