zsh-workers
 help / color / mirror / code / Atom feed
* ZSH Shell support - Bug with a special character
@ 2014-02-28 17:00 Tobias
  2014-02-28 18:37 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Tobias @ 2014-02-28 17:00 UTC (permalink / raw)
  To: zsh-workers

Hi,

I'm just trying to run this script:
     git reset HEAD^
I'm using git to try to reset the code to a branch behind and zsh 
returns this message:
     zsh: no matches found: HEAD^

Thank you in advance,

Tobias Basteiro


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ZSH Shell support - Bug with a special character
  2014-02-28 17:00 ZSH Shell support - Bug with a special character Tobias
@ 2014-02-28 18:37 ` Peter Stephenson
  2014-02-28 19:54   ` Frank Terbeck
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2014-02-28 18:37 UTC (permalink / raw)
  To: Tobias, zsh-workers

On Fri, 28 Feb 2014 14:00:46 -0300
Tobias <tobias.basteiro@openenglish.com> wrote:
> I'm just trying to run this script:
>      git reset HEAD^
> I'm using git to try to reset the code to a branch behind and zsh 
> returns this message:
>      zsh: no matches found: HEAD^

You have the EXTENDED_GLOB option set, in which ^ is a special
character.

If you don't need it, simply remove it from the start up file where it's
turned on or add "unsetopt EXTENDED_GLOB" after whatever code is setting
it.

If you do need EXTENDED_GLOB for other purposes but don't need that
particular syntax, and you have the latest version of zsh, you can turn
off that pattern character,

disable -p '^'

pws


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ZSH Shell support - Bug with a special character
  2014-02-28 18:37 ` Peter Stephenson
@ 2014-02-28 19:54   ` Frank Terbeck
  2014-02-28 21:18     ` Mikael Magnusson
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Terbeck @ 2014-02-28 19:54 UTC (permalink / raw)
  To: zsh-workers

Peter Stephenson wrote:
> Tobias <tobias.basteiro@openenglish.com> wrote:
>> I'm just trying to run this script:
>>      git reset HEAD^
[...]
>>      zsh: no matches found: HEAD^
[...]
> If you don't need it, simply remove it from the start up file where it's
> turned on or add "unsetopt EXTENDED_GLOB" after whatever code is setting
> it.
>
> If you do need EXTENDED_GLOB for other purposes but don't need that
> particular syntax, and you have the latest version of zsh, you can turn
> off that pattern character,
>
> disable -p '^'

For completeness: Since ^ is just a globbing character with EXTENDED_GLOB,
like * or ? are with normal globbing, you can also just:

  % git reset 'HEAD^'

  or

  % git reset "HEAD^"

  or

  % git reset HEAD\^

But since the Tobias thought the behaviour was a bug, he' probably okay
with Peter's `disable' advice.


Regards, Frank


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ZSH Shell support - Bug with a special character
  2014-02-28 19:54   ` Frank Terbeck
@ 2014-02-28 21:18     ` Mikael Magnusson
  2014-03-01  0:06       ` Aaron Schrab
  0 siblings, 1 reply; 5+ messages in thread
From: Mikael Magnusson @ 2014-02-28 21:18 UTC (permalink / raw)
  To: Frank Terbeck; +Cc: zsh workers

On 28 February 2014 20:54, Frank Terbeck <ft@bewatermyfriend.org> wrote:
> Peter Stephenson wrote:
>> Tobias <tobias.basteiro@openenglish.com> wrote:
>>> I'm just trying to run this script:
>>>      git reset HEAD^
> [...]
>>>      zsh: no matches found: HEAD^
> [...]
>> If you don't need it, simply remove it from the start up file where it's
>> turned on or add "unsetopt EXTENDED_GLOB" after whatever code is setting
>> it.
>>
>> If you do need EXTENDED_GLOB for other purposes but don't need that
>> particular syntax, and you have the latest version of zsh, you can turn
>> off that pattern character,
>>
>> disable -p '^'
>
> For completeness: Since ^ is just a globbing character with EXTENDED_GLOB,
> like * or ? are with normal globbing, you can also just:
>
>   % git reset 'HEAD^'
>
>   or
>
>   % git reset "HEAD^"
>
>   or
>
>   % git reset HEAD\^
>
> But since the Tobias thought the behaviour was a bug, he' probably okay
> with Peter's `disable' advice.

You can also just do
% git reset HEAD~
which has the advantage of not being shifted on american keyboards,
and doesn't require escaping in zsh. (As a side note, you can also do
git symbolic-ref h HEAD and then you can say git reset h~ (yes, I'm
very lazy)).

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ZSH Shell support - Bug with a special character
  2014-02-28 21:18     ` Mikael Magnusson
@ 2014-03-01  0:06       ` Aaron Schrab
  0 siblings, 0 replies; 5+ messages in thread
From: Aaron Schrab @ 2014-03-01  0:06 UTC (permalink / raw)
  To: zsh-workers

>> Peter Stephenson wrote:
>>> If you don't need it, simply remove it from the start up file where 
>>> it's turned on or add "unsetopt EXTENDED_GLOB" after whatever code 
>>> is setting it.

One could also do `setopt NULL_GLOB`.  Which would get behaviour closer 
to the default from bash when a glob pattern doesn't match anything.  
Although that can lead to getting accustomed to not quoting things that 
should be which could come back to bite you later.

At 22:18 +0100 28 Feb 2014, Mikael Magnusson <mikachu@gmail.com> wrote:
>You can also just do
>% git reset HEAD~
>which has the advantage of not being shifted on american keyboards,
>and doesn't require escaping in zsh.

The ~ character requires shift on every American keyboard that I've ever 
used, and I'm an American.

While this is a suitable alternative when used by itself, and I use it 
myself for this very reason, it may be important to note that ~ and ^ 
are not equivalent if followed by a number.  A trailing number is valid 
after either one, but the meaning is very different.  And translating 
from ^ to ~ in that case is likely to produce a result, but not the 
intended result; translating the other way would be more likely to 
result in an error.

>(As a side note, you can also do
>git symbolic-ref h HEAD and then you can say git reset h~ (yes, I'm
>very lazy)).

Starting with git 1.8.5, `@` is a builtin alias for HEAD.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-03-01  0:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-28 17:00 ZSH Shell support - Bug with a special character Tobias
2014-02-28 18:37 ` Peter Stephenson
2014-02-28 19:54   ` Frank Terbeck
2014-02-28 21:18     ` Mikael Magnusson
2014-03-01  0:06       ` Aaron Schrab

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).