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=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1008 invoked from network); 9 Mar 2023 19:28:06 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 9 Mar 2023 19:28:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:References:From:In-reply-to:cc:Reply-To: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=NHORIcJAqvyQ9RwyTFUblMBEvn6Snxa2+jWQ7HTvEIk=; b=D1gp5drURoRCqm1gniPQinw0IH i7Cr/ihQ5PMjggvyOWYF0cKFzucDb1fzonBjDYe44lTnmc/TaFGua+HE84i/ZORuDThrmNfzZEbnW wHBtY8MyghirgkK3xArkOFFVsI0dwPspivYpFoZqC74jyZ3f3EdTBStvT1eqGDQPXqJj1EWQx3R0/ qlsx0paBI6whMGH1b9zx0Bi5GD9XQQPHRbCKri5KcSaMND+g0oDXnVrs4bsayKvs8tn24GErpSgJ5 ZrEzLE4R3lDBySG3IdHOmpWdvYh+lYExEWWeiqcpVb/3A5W9DyIKHwhEJudJ65uLlUd82uFvG9lrU 6lm+BJ2g==; Received: by zero.zsh.org with local id 1paLvp-000Cwz-0n; Thu, 09 Mar 2023 19:28:05 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1paLva-000Ce6-Iw; Thu, 09 Mar 2023 19:27:50 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.95) (envelope-from ) id 1paLvY-0005rP-V2; Thu, 09 Mar 2023 20:27:49 +0100 cc: zsh-workers@zsh.org In-reply-to: <20230309123303.77hztdd63lvxafg4@eliaspc> From: Oliver Kiddle References: <20230309123303.77hztdd63lvxafg4@eliaspc> To: eliasghafari Subject: Re: [BUG]Filename autocompletion using git-bare repos (--git-dir=... --work-tree=...) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22529.1678390068.1@hydra> Date: Thu, 09 Mar 2023 20:27:48 +0100 Message-ID: <22530-1678390068.958410@dJKq.2wyk.2KSv> X-Seq: 51545 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: eliasghafari wrote: > I'm using a git bare repo to manage my files with this alias: "alias config='git --git-dir=$HOME/.local/share/dotfiles --work-tree=$HOME'", > While using git bare repo: > config rm --cached doesn't show anything. > So after investigating a bit, I found that the problem lied in the > expansion of the address of the git-dir and I found that by modifying > this line: > (( $+opt_args[--git-dir] )) && local -x GIT_DIR=${(Q)${~opt_args[--git-dir]}} && printf("\n${(Q)${~opt_args[--git-dir]}}\n") > which shows that the address passed to GIT_DIR is "$HOME/.local/share/dotfiles" without the "$HOME" being expanded to "/home/user". > > I fixed this by replacing the Q modifier with e, but please note that I I would suggest you try using ~ instead of $HOME in your alias: alias config='git --git-dir=~/.local/share/dotfiles --work-tree=~' The tilde in ${~opt_args[--git-dir]}} ensures that tildes are expanded. While using (e) is arguably the right thing to do, it will expand things like command-substitution and we've always intentionally shied away from expanding anything that could have side-effects when parsing the command-line for completion. The modifiers don't allow you to pick-and-choose expansions so there isn't a trivial way to expand variable references without expanding more problematic things. Oliver