Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] _git: offer changed files relative to current directory
- X-seq: zsh-workers 27459
- From: ÅtÄpÃn NÄmec <stepnem@xxxxxxxxx>
- To: "Alexey I. Froloff" <raorn@xxxxxxxxxxxx>
- Subject: Re: [PATCH] _git: offer changed files relative to current directory
- Date: Sat, 5 Dec 2009 13:07:54 +0100
- Cc: Zsh list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mail-followup-to:references:mime-version:content-type :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=5580eOBKFIj5KYUC0CJnyNsFhr3MAZA28IHWU9aVTjs=; b=W7SMdHt0Kl6MKhUo7iA3spPhrZfp67NLdr2bOTjnvvrMcAVDtBfyxJ4+JACHXTLcg+ c6h5uDYQcHB8q1qqHD25Ix7phX1LvDVMammi5FnbQpZQsLXAj4ntNgk/iIAtroh+dQbl 4lFd5i58dp6sQo0WIRsapCbohK68kaxScR8So=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; b=GOxuFuxuWzCkKS1m/bNx7U3pno88zyl5feBDZ+xkjbbVoIaMR8Q9SK9hl6j9/UxjLS BJ0AnwxuTCFQfnh3sy1HENa1O665OaKPBEP66I716OXL5B/RnOdzVAq87js4a5Bo6Byj lXOrXuiVW5HS3kZmXD2Wc36SExG34yVkjF9YM=
- In-reply-to: <1259973163-20919-1-git-send-email-raorn@xxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: "Alexey I. Froloff" <raorn@xxxxxxxxxxxx>, Zsh list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1259973163-20919-1-git-send-email-raorn@xxxxxxxxxxxx>
On Sat, Dec 05, 2009 at 03:32:43AM +0300, Alexey I. Froloff wrote:
> __git_changed_files() behavior should match git-commit, pass --relative
> to git-diff-index then looking for changed files.
>
> Signed-off-by: Alexey I. Froloff <raorn@xxxxxxxxxxxx>
> ---
> Completion/Unix/Command/_git | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
> index e483133..dd3617b 100644
> --- a/Completion/Unix/Command/_git
> +++ b/Completion/Unix/Command/_git
> @@ -2826,7 +2826,7 @@ __git_unmerged_files () {
> __git_changed_files () {
> local -a files
>
> - files=(${(ps:\0:)"$(_call_program files git diff-index -z --name-only --no-color HEAD 2>/dev/null)"})
> + files=(${(ps:\0:)"$(_call_program files git diff-index -z --name-only --no-color --relative HEAD 2>/dev/null)"})
> __git_command_successful || return
>
> _wanted files expl 'index file' _multi_parts $@ - / files
> --
> 1.6.5.3
>
No, this is wrong as far as I recall.
I was solving the same problem before some time. Your solution (i.e.
git-diff-index --relative) only displays the changed files under a
subdirectory, which is incorrect when not in the repository root.
I solved the problem by writing a 50 line or so "ueberfunction" which
manually relativizes the paths returned by git-diff-index to the correct
form required by git-commit (i.e. relative to the current directory, no
matter what it is -- and still displaying all the changed files not only
under the current directory, but from the whole repository). Seems to
work, but I don't really feel very "proud" of it so I haven't tried to
share it so far.
ÅtÄpÃn
Messages sorted by:
Reverse Date,
Date,
Thread,
Author