Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion: git: --fixup: problem with _describe -2V and duplicate commit subjects
- X-seq: zsh-workers 34770
- From: Daniel Hahler <genml+zsh-workers@xxxxxxxxxx>
- To: Zsh Hackers' List <zsh-workers@xxxxxxx>
- Subject: Re: completion: git: --fixup: problem with _describe -2V and duplicate commit subjects
- Date: Tue, 24 Mar 2015 01:07:48 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h= content-transfer-encoding:content-type:content-type:in-reply-to :references:subject:subject:mime-version:user-agent:from:from :date:date:message-id:received:received; s=postfix2; t= 1427155668; bh=b+BO/B1rIQ8Ior9pzi8E8E52RIyy7AGv+UDqYXud77s=; b=p J/V4TTj28ohaNgkYDTGQQJeGa7SJ0HJ3oTcBx9tHn69SbAOdeGADbEse4H+WDvMf BzxmF/vxvp/mE1RJ0KnCpaJ0iRTa7Sopra1hmF5TFeKS+b/S38hYDcpfxfxLn0iu 2j6PLht/SxJ6naUmwplfWOx5Ltq+JCyvySZeJjOo7Q=
- In-reply-to: <55108E24.2030404@thequod.de>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <55108E24.2030404@thequod.de>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 23.03.2015 23:05, I wrote:
> I've noticed that with duplicate descriptions for different commits,
> the new completion for --fixup (__git_recent_commits) does not behave
> properly, triggered by the "-2V" used with _describe.
>
> When completing "git commit --fixup=" in a repo with two commits having
> "init" as its subject:
>
> Without "-2V":
>
> -- commit object name --
> b1fc0ca 05a98c0 -- init
>
> With "-2V":
>
> -- commit object name --
> -- init
> -- commit object name --
> b1fc0ca 05a98c0
>
> This does not only affect the duplicate commits, but will move all
> hashes to a separate "commit object name" section, leaving the
> descriptions without them.
>
> This was added in 236da69, where the options are passed on to next_label.
As a workaround I could imagine also adding the date, which is useful
by itself:
diff --git i/Completion/Unix/Command/_git w/Completion/Unix/Command/_git
index 5524cb0..d1b3617 100644
- --- i/Completion/Unix/Command/_git
+++ w/Completion/Unix/Command/_git
@@ -5644,14 +5644,14 @@ __git_commit_objects () {
__git_recent_commits () {
local gitdir expl start
declare -a descr tags heads commits
- - local i j k
+ local i j k l
# Careful: most %d will expand to the empty string. Quote properly!
- - : "${(A)commits::=${(@f)"$(_call_program commits git --no-pager log -20 --format='%h%n%d%n%s')"}}"
+ : "${(A)commits::=${(@f)"$(_call_program commits git --no-pager log -20 --format='%h%n%d%n%s%n%cd')"}}"
__git_command_successful $pipestatus || return 1
- - for i j k in "$commits[@]" ; do
- - descr+=($i:$k)
+ for i j k l in "$commits[@]" ; do
+ descr+=($i:"$k ($l)")
j=${${j# \(}%\)} # strip leading ' (' and trailing ')'
for j in ${(s:, :)j}; do
if [[ $j == 'tag: '* ]] ; then
It would be nice if this could be shortened, e.g. by removing the timezone offset and
removing the current year, month etc.
There's a "relative date" option ("%cr"), but that might produce duplicates again.
If this can be fixed, it might be a good alternative to "%cd".
I've noticed btw that with `zsh -f` this is not the same, but commits are not grouped
together and appear to get sorted. Therefore some zstyle might be involved here.
Regards,
Daniel.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iD8DBQFVEKrUfAK/hT/mPgARAhroAKCgOQca7N6owZ7WzlOfLVe5Y8D2hgCgg/Jf
hLLdL0+U0tqv23HgBXeTw+o=
=YFev
-----END PGP SIGNATURE-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author