From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a2-smtp.messagingengine.com (fout-a2-smtp.messagingengine.com [103.168.172.145]) (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 CFD6B37F8A5 for ; Mon, 17 Aug 2026 19:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.145 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786994976; cv=none; b=fUSzDX60P0FPV/TmffMiukIczBSBRzFwUzUGjykUhnB+50quhDfNGyTZzOJPxwkoF4GuItcEftMgAexT/3zNifa6ETT9WfLQIQ8NPD1WL9Uv34z6Cy2N7FLlqY/2ZRfwfYxXhcr5mcAdcLr6iAFFPE5ePwJUOapEsK5cjd6Nlvo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786994976; c=relaxed/simple; bh=rz1cwgARTK8CTMM/Su4u5uxXCOn7JyKER/xfMLH3v08=; h=MIME-Version:Date:From:To:Cc:Message-Id:In-Reply-To:References: Subject:Content-Type; b=W4OIA/0d4IjBxluBYwH2WIdgJPapzz98OudpUiONsl+kQ9chynKdVFyQ5CZqUqkFD1EhysLl8rwdMNCTLASP1TftQgHaXLmu00j2ePRpa/87IDlhw6TvjgNccm5xSZm+m6IrwbDrsDw0Mb2gY/b8nzsHNHRurA+qYYKDxxnKIo8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lengemann.net; spf=pass smtp.mailfrom=lengemann.net; dkim=pass (2048-bit key) header.d=lengemann.net header.i=@lengemann.net header.b=fd3Bmpyp; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=lku9fye4; arc=none smtp.client-ip=103.168.172.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lengemann.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lengemann.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lengemann.net header.i=@lengemann.net header.b="fd3Bmpyp"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="lku9fye4" Received: from ams-compute-02.internal (ams-compute-02.internal [10.64.2.62]) by mailfout.phl.internal (Postfix) with ESMTP id 190D6EC0281; Mon, 17 Aug 2026 15:29:31 -0400 (EDT) Received: from ams-imap-15 ([10.64.2.35]) by ams-compute-02.internal (MEProxy); Mon, 17 Aug 2026 15:29:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lengemann.net; h=cc:cc:content-transfer-encoding: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=1786994970; x=1787081370; bh=NgWIVnfD8wPB0x93eGBpCeombHcyNZHd +5hJ5FNyfcw=; b=fd3BmpypxnBgpPakupCR3K14YHhSzjN0YeKhgYwLATD17n6i ZdnlEn6I7fMDGQB5/LAb2E7Sn4aFy8dhH5B+z9avMINyeeyj1lrjmqwy5D+67CfT 4vj/jPvbNIJa0Zh9P1AY91RKkR0OS4zC09GJS4jan6g8M0kHD1u9OLitorpasJ61 d0iNmOb7I/mFt96ZyhK1LGCE1zxXuNa60qAcHnJMEhhJhvZAGs29LTy0/3uPycBs +zcvQWp6qK4B+mLpEEtC1nNzbAx7RtBNTrP8h/0+yZzs9QR75jqkKrDC01P3QSbp eHTZfiqxzRfAEdM36ZaZBTcckCDvGO4sHU33WQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=1786994970; x= 1787081370;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3jNd/TdkLPGmSldtmj9lqg X-ME-Proxy: Feedback-ID: i6aa14946:Fastmail Received: by mailuser.ams.internal (Postfix, from userid 501) id 1759C22C0075; Mon, 17 Aug 2026 15:29:27 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ThreadId: AqhX4vTKywgV Date: Mon, 17 Aug 2026 21:29:05 +0200 From: "Lutz Lengemann" To: "D. Ben Knoble" , "Lutz Lengemann" Cc: git@vger.kernel.org, "Junio C Hamano" Message-Id: In-Reply-To: References: Subject: Re: [PATCH] completion: zsh: support completion after "git -C " Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi Ben (Resending, my earlier reply was rejected by the list for being HTML.) On Wed, Jul 15, 2026, at 00:34, D. Ben Knoble wrote: > Any progress here? I just found my local copy of this patch and was > briefly surprised to see it hadn't graduated anywhere (until I > realized conversation had stalled at this point). Sorry for the very late reply, I was on holiday and then other life things got in the way of answering :( I do have a v2 ready, which I have just pushed to my fork, and which follows this message. Junio C Hamano writes: > Doesn't it want to do something similar to what __git_main in > git-completion.bash does at the beginning, namely, this part? It does, thanks. v2 no longer skips only leading -C options, but walks the words in front of the command and skips over the global options and, where they take one, their arguments, like __git_main does. That also makes "git -p checkout " and "git --git-dir= checkout " complete the arguments of the command, which they did not before. Two related gaps are left alone, as they are bugs in the _arguments specification rather than in the command lookup: -c is not listed there at all, and --git-dir and friends are spelled "--git-dir=-", which accepts only "--git-dir=", not the "--git-dir " form. I can send patches for those separately. "D. Ben Knoble" writes: > But we mark these local, so how do they propagate to the other > functions? zsh scoping is dynamic, not lexical, so a variable declared "local" in __git_zsh_main is visible in the functions that are called from it, the bash helpers included. That is how __git_dir and __git_cmd_idx are handed down already, and __git_C_args works the same way. > We should probably note in the log message that the _directories > completion will not account for previous -C I added a note about this in the log message. > I think we could do _slightly_ better by using a state "->dir" or > something, accumulating the current prefix, and passing that to > _directories as a prefix with -W I tried that and it works, but it changes what -C offers, which is more than fixing the completion after -C, so I left it out; happy to send it on top. Two things to watch out for there: the accumulated path has to be made absolute, as -W with ".." gave me the directories of "/", and the accumulation has to stop before the word that is being completed. > By the way, I've realized that "git -" has the same problem (a > giant list of files after the other option completions) That one is older than this patch: the file listing comes from the fallback at the end of _git, let _ret && _default && _ret=0 which is where the "use-compctl" and "globbed-files" tags in your _complete_help dump come from. I could not reproduce the repeated description block with "zsh -f" and only the _complete completer, so something in my setup or yours may differ there. Either way it wants its own topic. I hope that the change now looks good, and if there is anything I should still look at just tell me. Thank you very much Lutz