zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] String equal when compared, processed differently via //
Date: Wed, 21 Sep 2016 11:14:32 +0200	[thread overview]
Message-ID: <CAKc7PVCjbaHiAm4ssJGtLLk-tN3o8SuN+wgzLUJUeeG2PFcVMA@mail.gmail.com> (raw)
In-Reply-To: <CAKc7PVAdnzTRk8mUZVrFJHKWr_Q9-8whffw7DAUpnkYqwX24yg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1657 bytes --]

It's easy to test as a minimal test case, actually. If one will get
along with the complicated git format – %x01 is just $'\1'.

I attach minimal.zsh. It reveals bug when extendedglob is added to
emulate -LR zsh. Just to be run in any git directory, hoping that any
log message will have "(HEAD -> master, origin/master)" at top.
Interestingly, --max-count=1 instead of 2 stops the bug.

Example runs in two different repositories:

15f1acdUpdated README.md (HEAD -> master, origin/master)4 days
agoSebastian Gniazdowski
0280384Information on source of *foo*~^*bar*4 days agoSebastian Gniazdowski
15f1acd 'Updated README.md'
0280384 'Information on source of *foo*~^*bar*' >< '4 days ago'
Sebastian Gniazdowski

e6d9a0eA stub for uizcm, with binding (^O^U) (HEAD -> master)3 hours
agoSebastian Gniazdowski
feb4624myctags: Message about recompilation request (origin/master)3
hours agoSebastian Gniazdowski
e6d9a0e 'A stub for uizcm, with binding (^O^U)'
feb4624 'myctags: Message about recompilation request' >
(origin/master)< '3 hours ago' Sebastian Gniazdowski

It can be seen that third line doesn't have (HEAD -> master) etc.

Attached code:

====================================

#!/usr/bin/env zsh

emulate -LR zsh
setopt extendedglob

gitcmd=( git log --max-count=2
--pretty=format:'%h%x01%s%x02%d%x03%cr%x04%an' --abbrev-commit )
gitout=( "${(@f)"$( "${gitcmd[@]}" )"}" )

print -rl -- "${gitout[@]}"

gitout=( "${gitout[@]//(#b)([^$'\1']#)$'\1'([^$'\2']#)$'\2'([^$'\3']#)$'\3'([^$'\4']#)$'\4'(*)/${match[1]}
${(q-)match[2]}} >${match[3]}< ${(q-)match[4]} ${match[5]}" )

print -rl -- "${gitout[@]}"

[-- Attachment #2: minimal.zsh --]
[-- Type: application/octet-stream, Size: 423 bytes --]

#!/usr/bin/env zsh

emulate -LR zsh
setopt extendedglob

gitcmd=( git log --max-count=2 --pretty=format:'%h%x01%s%x02%d%x03%cr%x04%an' --abbrev-commit )
gitout=( "${(@f)"$( "${gitcmd[@]}" )"}" )

print -rl -- "${gitout[@]}"

gitout=( "${gitout[@]//(#b)([^$'\1']#)$'\1'([^$'\2']#)$'\2'([^$'\3']#)$'\3'([^$'\4']#)$'\4'(*)/${match[1]} ${(q-)match[2]}} >${match[3]}< ${(q-)match[4]} ${match[5]}" )

print -rl -- "${gitout[@]}"

  reply	other threads:[~2016-09-21 16:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21  8:57 Sebastian Gniazdowski
2016-09-21  9:14 ` Sebastian Gniazdowski [this message]
2016-09-21  9:19   ` Sebastian Gniazdowski
2016-09-21  9:35   ` Sebastian Gniazdowski
2016-09-21 10:35     ` Sebastian Gniazdowski
2016-09-21 10:37       ` Sebastian Gniazdowski
2016-09-21 21:13         ` Bart Schaefer
2016-09-22 16:48           ` Sebastian Gniazdowski
2016-09-22 16:50           ` Sebastian Gniazdowski
2016-09-21 11:09 ` Sebastian Gniazdowski
2016-09-21 17:59 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKc7PVCjbaHiAm4ssJGtLLk-tN3o8SuN+wgzLUJUeeG2PFcVMA@mail.gmail.com \
    --to=sgniazdowski@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).