From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (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 87DB3311C2D for ; Fri, 7 Aug 2026 07:08:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.151 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786086520; cv=none; b=IU0FSRF2pycxzY+2eDG+Y3TqoPx2tsNXTF4Yrf1P4VGxPJTQ2lWa5iCAv6uG5Bstd8aqf2STltZPHAUQ1WDOovlWg10IXlPiWAKt7LPRPO/KQnJCKWY/BqJoyiEAHJ1OaCy5c1K0OpdzLHi+An+NoKFfvzHSEj9cpyAykf39Tj8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786086520; c=relaxed/simple; bh=A2gjj16BvBmaNBtr1haCczN4X1pppZbC16CouvgFnwU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KxSmQ51geu4lSj3jHU6UN4RhuETam1rn93cVEIk+Kw8jECjkf8gRYAxC+Mdo0O+zAM8OyQItVsYQEiF/nqr4AEo4kJo6gcFlyuvb6jOsMwMquJViQc9lf2XDSqrn6N8/VogU5nXpOrXsvJ6XVnMEQgm2zaXT2+NNnIoFVOzqS2w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject 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=GFrcugPS; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=RSi8CBt+; arc=none smtp.client-ip=103.168.172.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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="GFrcugPS"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="RSi8CBt+" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 77D2DEC01A5; Fri, 7 Aug 2026 03:08:38 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Fri, 07 Aug 2026 03:08:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc: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=1786086518; x=1786172918; bh=DsyaTORfe0 rkAK/MTt2C0DQDFWm6Dn8XIojGRU7QTkE=; b=GFrcugPSAEQbhz4N81U19x8rwA ke0TejPZzRn34ezEyQq0UuzFcLufKwY746OuM6hwHE8cBizfdp5ybiUuN41Tjeci H8Tnf/CORhzLmX2wmK8oB1r2RDKplDAonCJ6ORCTuO2Aflt9TnKNq/3/XM9zFr3w dZE8+8IklW1F+ToJIo69cfHU2dXxMRNzHaKlVKyRb8sJB36+Vctf3dYe4GiZDAPz WXX9vY6U/41XQC6fdXoqiuHuSS5pMAzgXzz5RW9jJ1q7bRAjonzM2zzLyuubAdSe 1q9oBE3yoFTNkww6IZCrq9L/PufEFVpy+jPeETu3rE+a4VsBuYFEm1q1nAaw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1786086518; x=1786172918; bh=DsyaTORfe0rkAK/MT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HkrxkzH5GyxdecBlw7raWK99tw X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 Aug 2026 03:08:37 -0400 (EDT) Received: by mail (OpenSMTPD) with ESMTPSA id 45bc560e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 7 Aug 2026 07:08:36 +0000 (UTC) Date: Fri, 7 Aug 2026 09:08:33 +0200 From: Patrick Steinhardt To: Vincent Mailhol Cc: git@vger.kernel.org, Junio C Hamano , Philippe Blain Subject: Re: [PATCH v2 1/4] completion: add 'git history' subcommands Message-ID: References: <20260806-history_autocompletion-v2-0-7e60f52a1c20@kernel.org> <20260806-history_autocompletion-v2-1-7e60f52a1c20@kernel.org> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Aug 07, 2026 at 08:44:41AM +0200, Vincent Mailhol wrote: > On 07/08/2026 at 08:30, Patrick Steinhardt wrote: > > On Thu, Aug 06, 2026 at 10:27:36PM +0200, Vincent Mailhol wrote: > >> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash > >> index e875787710..7372e2919b 100644 > >> --- a/contrib/completion/git-completion.bash > >> +++ b/contrib/completion/git-completion.bash > >> @@ -2137,6 +2137,54 @@ _git_help () > >> fi > >> } > >> > >> +__git_history_has_revision () > >> +{ > >> + local i > >> + > >> + for ((i = __git_cmd_idx + 2; i < cword; i++)); do > >> + case "${words[i]}" in > >> + --empty|--update-refs) > >> + ((i++)) > >> + ;; > > > > This will unfortunately be quite a pain to maintain going forward, as we > > now have to be aware of updating this site every single time we add a > > new option that accepts a parameter. > > Do you foreseen such new parameters? Yes, I'm very sure we'll gain more parameters for those commands. Commit signing, sign-offs, handling of notes are all things that are currently being discussed, and they likely will require new options. > > I don't really have a good idea for how to fix that reliably though, I > > have to admit. Maybe we should just mostly ignore this edge case and > > always complete references, unless we have seen a `--`? That can be > > checked rather easily via `__git_hash_doubledash`. > > My toughs are that if such a special case ever surface, we can just > dispatch it earlier before we check for the > __git_history_has_revision, like this: > > ---8<--- > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash > index d313780d8b..786fcb5e16 100644 > --- a/contrib/completion/git-completion.bash > +++ b/contrib/completion/git-completion.bash > @@ -2193,6 +2193,15 @@ _git_history () > esac > fi > > + # Subcommands which takes something else than a revision > + case "$subcommand" in > + foo) > + # 'git history foo' take a file first > + __git_complete_index_file "--cached" > + return > + ;; > + esac > + > if ! __git_history_has_revision; then > __git_complete_refs > return > ---8<--- > > This seems reasonable to me. Once we know what this mysterious new > command would be, maybe we can find a smarter and more tailored > solution, but at the moment, I would not call this a blocker. I'm not really concerned about new subcommands for now, true. But hardcoding the parameters as we do above feels error prone to me and will very likely diverge as the command evolves. Patrick