Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to config gerrit refs in Zsh?

Tags:

bash

zsh

In my team, we use gerrit for code review.

As you know, gerrit uses the magical 'refs/for/*'.


Since I do not want to type

git push origin HEAD:refs/for/*

every time I push to remote,

I tried to change my git repository's config like below.

git config remote.origin.push refs/heads/*:refs/for/*

Changing config works well in bash,

but it fails in my zsh with an error like below.

zsh: no matches found: refs/heads/*:refs/for/*

I think that using an asterisk in zsh is somewhat different with bash,

but I cannot know exactly what the problem is.


How can I solve this problem? or impossible in zsh?

Thanks in advance.

like image 667
breadmj Avatar asked Sep 14 '25 20:09

breadmj


1 Answers

By default when bash fails to glob it puts the whole pattern into the arguments unchanged. When zsh fails to glob it does not run command at all which I find more convenient in most cases. Both shells can be configured, zsh has at least three other modes: do like bash, remove pattern from arguments and remove pattern from arguments unless there are no patterns with match. These behaviors are achieved by unsetting NOMATCH or setting CSH_NULL_GLOB or NULL_GLOB respectively.

I would suggest keeping current behavior and using various escaping methods: 'refs/heads/*:refs/for/*' (double quotes also work) or refs/heads/\*:refs/for/\*.

like image 160
ZyX Avatar answered Sep 17 '25 11:09

ZyX