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 12867 invoked from network); 23 Jul 2020 21:08:05 -0000 Received: from krantz.zx2c4.com (192.95.5.69) by inbox.vuxu.org with ESMTPUTF8; 23 Jul 2020 21:08:05 -0000 Received: by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 4d0b547a; Thu, 23 Jul 2020 20:45:14 +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 fb50980c (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Thu, 23 Jul 2020 20:45:12 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id CDD2817CB for ; Thu, 23 Jul 2020 17:08:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Thu, 23 Jul 2020 17:08:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h= from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=oceYVt/C+JBJ4 j983AxpbCG749Oe27LdexRU2fhJmKA=; b=xv2kDkn7eNPyVVfKAtuVOtuk/eq6c V5OtsfwFYKMfdbCbKLOsbThxaR+WoK8DmolN8K4wQMYGxEIH/twaob3PRF1t9YHL ahNO8PPTacYREWmBmaj8zrLnlyCPZjIlhL34GOmExfb1MWbVcjbXGF40atqFaKUH E9De1qoogvZMxEa/Y/H8bRXcR4/W8Hc/g4Eh531X/I9ccdmai8rk3T8etO/AMaJr L4GvHDYFCilQXk20Rrt7Gk1h4hRZQ36gkFvkOJ7k2Pu1lc6qmDTV7WmxlDBWdkp2 iuaHfAbnKlUa1vRikFVPL81mliieqEEf+4abAGHziLRoP2j+J/ywwIwUg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=oceYVt/C+JBJ4j983AxpbCG749Oe27LdexRU2fhJmKA=; b=aHQ6eI3s K5SuTHk4ddpJdKfvCW1YGxFEVVsOvVQDSXvc3xlKBxnU+uk6pIzpHDIr8F0A9EVt UMgCpIhYIHkuHKlSBlQ0CmpYZoIVtpJFzILsmSQt1BpL8hJqVgcm3cnyDKe40HDh ut6+xFW9Sz/YK/jG2yx104yBH9zbZbUcOu/O9Y0PO3HVz+uddBQa7/L2FZ1M7a6g fhx7u766z1DaaaSd9dmWjF1uRS7yUBGGEK3jwz1FHhAwDd03Af0S0tFEGq6DT2T2 FlkKgvO8I6+K68lp+pq+PuGvInKcENvD8J0GldaRkfjYVXbe+LyeAHH1NBn7M4tq RZko+bQTc7HjZA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrhedugdduheeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlhihsshgrucftohhsshcuoehhihesrghlhihsshgrrdhi sheqnecuggftrfgrthhtvghrnhepgeejhfeikeeftddtveffvddtueeludduueejgfeuie eltefftdfguefgueevheehnecuffhomhgrihhnpehqrhihrdhprghgvgenucfkphepgeei rdektddrudegvddrkeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepqhihlhhishhsseigvddvtddrqhihlhhishhsrdhnvght 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 C054E3280064 for ; Thu, 23 Jul 2020 17:08:00 -0400 (EDT) Received: by x220.qyliss.net (Postfix, from userid 1000) id 6639842E; Thu, 23 Jul 2020 21:07:59 +0000 (UTC) From: Alyssa Ross To: cgit@lists.zx2c4.com Subject: [PATCH v2] ui-shared: add "this commit" option to switch form Date: Thu, 23 Jul 2020 21:07:44 +0000 Message-Id: <20200723210744.10221-1-hi@alyssa.is> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200723204820.16776-1-hi@alyssa.is> References: <20200723204820.16776-1-hi@alyssa.is> 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 --- The first version of this patch had the parameters to html_option the wrong way round. ui-shared.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui-shared.c b/ui-shared.c index d2358f2..812a099 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(oid_to_hex(&oid), "this commit", 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