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 1267 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 5c2d2cd6; Fri, 5 Aug 2022 04:59:51 +0000 (UTC) Return-Path: Received: from mail.kasad.com (mail.kasad.com [140.82.7.10]) by lists.zx2c4.com (OpenSMTPD) with ESMTPS id 67c46fd3 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Fri, 5 Aug 2022 04:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kasad.com; i=@kasad.com; q=dns/txt; s=mail; t=1659675589; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=Tg7eflCBgZsipeILbJyyLlvNhKU091ykDh9P3pAWa+o=; b=aVfsE+a+6IXoYbE8BGLXcR2nLThwmDD5ZOjEYipM7Sg+IGM1tne0TEqt1bjkfekJVXRSd P2K5CO55mqloATv8wNZq+HIYXdkgNT2Q5bZe3VkGLIS/Os2xYU/Zikk5YLkm2hLolYrl9y3 HrpA74m06/Y66rEkkFDj6XT4pBrIJ+DZFnZhqIt6LGLjoNZi8jgIUOF21ZPiq55k5sPVEFu zBWjDH21V0JjNafU3A93mtB8SuQd2XnErZqFlVbIfNApUJcF9IMaL9aIeEtrkdNvzroCBsO KqGcJIBXAabcpDiVN+BisD0Apt/lpRVUfsNDteC3kLs+J4XNb706UwLybi9w== 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 5A25727375; Thu, 4 Aug 2022 21:59:49 -0700 (PDT) From: Kian Kasad To: cgit@lists.zx2c4.com Cc: Kian Kasad Subject: [PATCH 1/6] Implement parsing of new enable-commit-graph option Date: Thu, 4 Aug 2022 21:59:34 -0700 Message-Id: <20220805045939.57987-2-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" The enable-commit-graph option has been changed from a boolean option to a string option. It takes the following values: "none" or "0": Disable the display of commit graphs completely. The graph page will be disabled and the log page will not show commit graphs. "combined" or "1": Disable the graph page and show the commit graph on the log page. The commit age is still displayed in a separate column. This follows the same behavior as before when this option was set to "1". "separate": Enable the graph page and give it its own tab. The graph page is the same as the log page except it displays the commit graph *instead of* the commit age. The log page shows the commit age and not the commit graph. The "0" and "1" option values should be avoided in new configurations and only exist for backwards compatibility. --- cgit.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/cgit.c b/cgit.c index 08d81a1..ce7b291 100644 --- a/cgit.c +++ b/cgit.c @@ -62,9 +62,14 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); else if (!strcmp(name, "enable-blame")) repo->enable_blame = atoi(value); - else if (!strcmp(name, "enable-commit-graph")) - repo->enable_commit_graph = atoi(value); - else if (!strcmp(name, "enable-log-filecount")) + else if (!strcmp(name, "enable-commit-graph")) { + if (!strcmp(value, "none") || !strcmp(value, "0")) + repo->enable_commit_graph = 0; + else if (!strcmp(value, "combined") || !strcmp(value, "1")) + repo->enable_commit_graph = 1; + else if (!strcmp(value, "separate")) + repo->enable_commit_graph = 2; + } else if (!strcmp(name, "enable-log-filecount")) repo->enable_log_filecount = atoi(value); else if (!strcmp(name, "enable-log-linecount")) repo->enable_log_linecount = atoi(value); @@ -179,9 +184,14 @@ static void config_cb(const char *name, const char *value) ctx.cfg.enable_index_owner = atoi(value); else if (!strcmp(name, "enable-blame")) ctx.cfg.enable_blame = atoi(value); - else if (!strcmp(name, "enable-commit-graph")) - ctx.cfg.enable_commit_graph = atoi(value); - else if (!strcmp(name, "enable-log-filecount")) + else if (!strcmp(name, "enable-commit-graph")) { + if (!strcmp(value, "none") || !strcmp(value, "0")) + ctx.cfg.enable_commit_graph = 0; + else if (!strcmp(value, "combined") || !strcmp(value, "1")) + ctx.cfg.enable_commit_graph = 1; + else if (!strcmp(value, "separate")) + ctx.cfg.enable_commit_graph = 2; + } else if (!strcmp(name, "enable-log-filecount")) ctx.cfg.enable_log_filecount = atoi(value); else if (!strcmp(name, "enable-log-linecount")) ctx.cfg.enable_log_linecount = atoi(value); @@ -818,8 +828,12 @@ static void print_repo(FILE *f, struct cgit_repo *repo) fprintf(f, "repo.clone-url=%s\n", repo->clone_url); fprintf(f, "repo.enable-blame=%d\n", repo->enable_blame); - fprintf(f, "repo.enable-commit-graph=%d\n", - repo->enable_commit_graph); + if (repo->enable_commit_graph) { + if (repo->enable_commit_graph == 1) + fprintf(f, "repo.enable-commit-graph=combined\n"); + if (repo->enable_commit_graph == 2) + fprintf(f, "repo.enable-commit-graph=separate\n"); + } fprintf(f, "repo.enable-log-filecount=%d\n", repo->enable_log_filecount); fprintf(f, "repo.enable-log-linecount=%d\n", -- 2.37.1