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=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 11499 invoked from network); 23 Jul 2020 20:56:35 -0000 Received: from krantz.zx2c4.com (192.95.5.69) by inbox.vuxu.org with ESMTPUTF8; 23 Jul 2020 20:56:35 -0000 Received: by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 78a12d27; Thu, 23 Jul 2020 20:33:43 +0000 (UTC) Return-Path: Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTPS id c1b163fc (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Thu, 23 Jul 2020 20:33:40 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 1311A17B3 for ; Thu, 23 Jul 2020 16:49:10 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Thu, 23 Jul 2020 16:49:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h= from:to:subject:date:message-id:mime-version :content-transfer-encoding; s=fm3; bh=JPjXCprMv/6CwS5oJ0JQdvQCYp Lp1XpG9jwM6jVFdd0=; b=dhFj7dZ9TjJZQ/hKM8QRBfxrz01Zl5J27vsxMsaEha nh16BkTCfKNZUlw6ZpL9G9CYCEjCpiLun8dHNNetch90I4TII1n0cw0X7do4C9s7 VkAa5bse/EojPgbEs6fb74f4nqSb5bY+IVqNRUFiUffvGBzuWswYswcRgOXmNJyk BeFP9F2DPZ3lfSU3XYJJGB5JIABwDjJMybkQKASh1pMfeO9L+ZXc5aUOfl87hqJB bvayLX8dIdWVt8Cmn1KAFAySkrJA/oSeHlGwGlMH3hNHmcNgACWpDrftyKRpwPYn BZvKu0NDp9bhS/OcTQ2rfznoYoOe/r1Zdd9n+xZ7dHBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=JPjXCprMv/6CwS5oJ 0JQdvQCYpLp1XpG9jwM6jVFdd0=; b=fVaI+81u09S7THEF3RaIQUAT9dx7pSuDA yYwZf4rs0SxD8Xf7SXtyGW4tpzAi94Npm1z2rCm7nBLg5RN+mGjz4t+zxBkVK/bF f7tb8CVapnHPCrffkQHuTrQrK0SszVk9OdjbgfWACKFF3J93VdYU2Zqn2pt4DsT7 V2LEvaDVc8WugZfcPIh0n3vKI3v35UtuTudmYiOrIh3NmlP5FDR+RmQ9r0jmkgzx nRZcAUGwRB5I0RLMGvwWVUF7/lcaWlTvGYVwhX4jqaXxdgq1asIcmZpHIy48Nk88 ar3cEbu5GLAx+zksum+0XQMoQYTRjF0shl0rIYU8U3YY7qCeEcNoA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrhedugdduheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgggfestdekredtre dttdenucfhrhhomheptehlhihsshgrucftohhsshcuoehhihesrghlhihsshgrrdhisheq necuggftrfgrthhtvghrnhepvefhhedvtdejjefhtdffkeejuddutdehgfevuedukedvke fhffetgfeileejffetnecuffhomhgrihhnpehqrhihrdhprghgvgenucfkphepgeeirdek tddrudegvddrkeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepqhihlhhishhsseigvddvtddrqhihlhhishhsrdhnvght X-ME-Proxy: Received: from x220.qyliss.net (p2e508e53.dip0.t-ipconnect.de [46.80.142.83]) by mail.messagingengine.com (Postfix) with ESMTPA id 492C030600DC for ; Thu, 23 Jul 2020 16:49:09 -0400 (EDT) Received: by x220.qyliss.net (Postfix, from userid 1000) id 27245398; Thu, 23 Jul 2020 20:49:07 +0000 (UTC) From: Alyssa Ross To: cgit@lists.zx2c4.com Subject: [PATCH] ui-shared: add "this commit" option to switch form Date: Thu, 23 Jul 2020 20:48:21 +0000 Message-Id: <20200723204820.16776-1-hi@alyssa.is> X-Mailer: git-send-email 2.27.0 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" Branches are grouped into their own section to make the "this commit" option visually distinct. Adding this option will result in two options being marked as selected if a branch has the same name as a commit oid. But that would cause all sorts of other problems anyway (attempting to switch to the branch would actually give you the commit, etc.), so let's not worry about that. A "permalink" link on the blob view next to the "plain" link would probably be more discoverable, but that would only work for the blob view. The switch UI is visible everywhere. Signed-off-by: Alyssa Ross --- ui-shared.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui-shared.c b/ui-shared.c index d2358f2..e1a3603 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -893,6 +893,15 @@ void cgit_add_clone_urls(void (*fn)(const char *)) add_clone_urls(fn, ctx.cfg.clone_prefix, ctx.repo->url); } +static int print_this_commit_option(void) +{ + struct object_id oid; + if (get_oid(ctx.qry.head, &oid)) + return 1; + html_option("this commit", oid_to_hex(&oid), ctx.qry.head); + return 0; +} + static int print_branch_option(const char *refname, const struct object_id *oid, int flags, void *cb_data) { @@ -1000,9 +1009,12 @@ static void print_header(void) html("
\n"); cgit_add_hidden_formfields(0, 1, ctx.qry.page); html(" "); html(""); html("
"); -- 2.27.0