From patchwork Fri Apr 19 09:51:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13636077 Received: from wfhigh7-smtp.messagingengine.com (wfhigh7-smtp.messagingengine.com [64.147.123.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 594527C08E for ; Fri, 19 Apr 2024 09:51:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713520318; cv=none; b=p2FbEbBqrTtGLAE21RZ4obmzRpiRGSxHMuzW86783TgsCwJF5o3pdg8yv0peBnOtPjmBl0KPzgfwik67dMsmIb2w6JpuA7h1MuZhHFsRt/W5JO2vT9c0Ufg2uOes/1dUhGvot3/sn9x/Q8orYZ+jekVx1dc+Q5S2bcxNtTKEbXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713520318; c=relaxed/simple; bh=BomxAql219KiCcUf2UPYs0hdooTVxeLtzqX3+SWqnbE=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=i5HinQIng6XBYF3RBYn7UjFe6x+IWbDbKZHndjURAl223VG21oFdkwP0g3mLBkZp1lXttHcQHyFGMDrQMFTVcqKAlX6nDIlDcXfrII3nsd6abHPA//fL6ONFAsBJ1cKYd+vsTPdvSh9RSVQ2Ik0ZljY0E8VrY2wVupYti5IfU8g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=nhC5G2FR; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=bW5vjXww; arc=none smtp.client-ip=64.147.123.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="nhC5G2FR"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="bW5vjXww" Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfhigh.west.internal (Postfix) with ESMTP id 70D2418000A7 for ; Fri, 19 Apr 2024 05:51:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Fri, 19 Apr 2024 05:51:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1713520315; x=1713606715; bh=6vpZf8ZGqW Koa+XaQL0ADDhbgXDCtyX06uA3fpwJzlg=; b=nhC5G2FRlxDOllkkVU9vWsU8wN Pxnw85NBzuEnVOFcqRPXi1vVMNL5wj2X31Obsk1B0SsLioC3zNFqPQxhc32RJBTc 2fwrKA4OT3oWJCbSvQ2ZAeBf9bka/F4nyHtyVLzcQ/gUGOqW/6N5jp6EdroFq4f1 +9/YL6e1fA+IX9pn9q5uQYzWDF8y6tXWGCcemHlE+9kxxps2NLgede55rOZ8kMDN 4cqnLe8fnBP38AX58Rdh2o844QB5FhBk8TgduOoBVLIZZ8pTVVeNh86eh46ZUwtJ lOl3288wmvQDDErtA/flqinAHL2AySe/VL2SrvqPTPjj+u0HrQt0rFc/+mGg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1713520315; x=1713606715; bh=6vpZf8ZGqWKoa+XaQL0ADDhbgXDC tyX06uA3fpwJzlg=; b=bW5vjXwwDLIJeJ/uUqLRlY4E/EMSvJ9nw85CCAwcj5XV 6Gc3oN/M70vKqj+x64D1KxcETeGlKv7FBCa9bD4FjPS9z9tACL+Xw58XdYphTIx7 E52f0RI3ew0igpn8SroNa5gM8jVLAw8g6C1CncNSCnAFbaYhs4+box03CbnaPEWx UrYjMv9k2192YSR67Vh0VhSLrEPox8rr7JYO8okS7K+Vu14s3ESwbQGmmz3nNUQy 9TWt0qE9FwnEm+L5o9O/Wvx9swcJ4azdfhcRovFHAX5O4515K9YnKyxhYH16xutc 7oouio4shbk5o68Uq834NcaZsPIBULqYdxKXKLC/1g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudekvddgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggujgesghdtre ertddtvdenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehp khhsrdhimheqnecuggftrfgrthhtvghrnhepheeghfdtfeeuffehkefgffduleffjedthf dvjeektdfhhedvlefgtefgvdettdfhnecuvehluhhsthgvrhfuihiivgepfeenucfrrghr rghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 19 Apr 2024 05:51:55 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id 124f7516 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 19 Apr 2024 09:51:28 +0000 (UTC) Date: Fri, 19 Apr 2024 11:51:52 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Subject: [PATCH 10/11] builtin/shortlog: don't set up revisions without repo Message-ID: <508e28ed1e21e9c646cec8473a65137d33f1df23.1713519789.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: It is possible to run git-shortlog(1) outside of a repository by passing it output from git-log(1) via standard input. Obviously, as there is no repository in that context, it is thus unsupported to pass any revisions as arguments. Reghardless of that we still end up calling `setup_revisions()`. While that works alright, it is somewhat strange. Furthermore, this is about to cause problems when we unset the default object hash. Refactor the code to only call `setup_revisions()` when we have a repository. This is safe to do as we already verify that there are no arguments when running outside of a repository anyway. Signed-off-by: Patrick Steinhardt --- builtin/shortlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/shortlog.c b/builtin/shortlog.c index 3c7cd2d6ef..d4daf31e22 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -435,7 +435,7 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix) usage_with_options(shortlog_usage, options); } - if (setup_revisions(argc, argv, &rev, NULL) != 1) { + if (!nongit && setup_revisions(argc, argv, &rev, NULL) != 1) { error(_("unrecognized argument: %s"), argv[1]); usage_with_options(shortlog_usage, options); }