jandamm/zgenom

Option MARK_DIRS makes `zgenom update` fail

henk84 opened this issue ยท 3 comments

Hi

zgenom update uses filename generation to find the worktrees of loaded plugins in

repo="${repo%/.git/}"

When MARK_DIRS is set this fails:

# for repo in ~/.zgenom/**/*/.git/; do echo ${repo%/.git/}; done
/home/henk/.zgenom/sources/https-COLON--SLASH--SLASH-github.com-SLASH-greymd/tmux-xpanes/___/.git//
/home/henk/.zgenom/sources/https-COLON--SLASH--SLASH-github.com-SLASH-joel-porquet/zsh-dircolors-solarized/___/.git//
/home/henk/.zgenom/sources/https-COLON--SLASH--SLASH-github.com-SLASH-laurenkt/zsh-vimto/___/.git//
/home/henk/.zgenom/sources/https-COLON--SLASH--SLASH-github.com-SLASH-MichaelAquilina/zsh-you-should-use/___/.git//
/home/henk/.zgenom/sources/https-COLON--SLASH--SLASH-github.com-SLASH-nojhan/liquidprompt/___/.git//
/home/henk/.zgenom/sources/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users/zsh-completions/___/.git//

After unsetting:

# unsetopt markdirs
# for repo in ~/.zgenom/**/*/.git/; do echo ${repo%/.git/}; done
/home/henk/.zgenom/sources/https-COLON--SLASH--SLASH-github.com-SLASH-greymd/tmux-xpanes/___
/home/henk/.zgenom/sources/https-COLON--SLASH--SLASH-github.com-SLASH-joel-porquet/zsh-dircolors-solarized/___
/home/henk/.zgenom/sources/https-COLON--SLASH--SLASH-github.com-SLASH-laurenkt/zsh-vimto/___
/home/henk/.zgenom/sources/https-COLON--SLASH--SLASH-github.com-SLASH-MichaelAquilina/zsh-you-should-use/___
/home/henk/.zgenom/sources/https-COLON--SLASH--SLASH-github.com-SLASH-nojhan/liquidprompt/___
/home/henk/.zgenom/sources/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users/zsh-completions/___

This breaks updating:

# zgenom update
-- zgenom: Updating 'https-COLON--SLASH--SLASH-github.com-SLASH-greymd/tmux-xpanes/___/.git//' ...
fatal: this operation must be run in a work tree

-- zgenom: Updating 'https-COLON--SLASH--SLASH-github.com-SLASH-joel-porquet/zsh-dircolors-solarized/___/.git//' ...
fatal: this operation must be run in a work tree

-- zgenom: Updating 'https-COLON--SLASH--SLASH-github.com-SLASH-laurenkt/zsh-vimto/___/.git//' ...
fatal: this operation must be run in a work tree

-- zgenom: Updating 'https-COLON--SLASH--SLASH-github.com-SLASH-MichaelAquilina/zsh-you-should-use/___/.git//' ...
fatal: this operation must be run in a work tree

-- zgenom: Updating 'https-COLON--SLASH--SLASH-github.com-SLASH-nojhan/liquidprompt/___/.git//' ...
fatal: this operation must be run in a work tree

-- zgenom: Updating 'https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users/zsh-completions/___/.git//' ...
fatal: this operation must be run in a work tree

-- zgenom: Deleting `/home/henk/.zgenom/sources/init.zsh` ...

Other functions might also be affected, e.g. clean removed all installed plugins.

I have no suggestion how to fix this.

Iโ€™ll be happy to provide more info if you let me know what you need.

Thank you @henk84 for reporting this. (There are just so many options to test them all ๐Ÿ˜…)

There is one function which generates the path.
So it should be an easy fix applying it at only one place.

I'll fix it in the next few days ๐Ÿ‘

This issue is fixed in #127.

zgenom clean is working since it does not rely on finding .git folders.
zgenom update fails to remove /.git/ from the end with markdirs since its /.git//.

With localoptions we can unsetopt markdirs for zgenom update without interfering with the users global settings. ๐Ÿ‘

Another option would be to apply the M glob modifier and then always expect markdirs enabled.

I'll test this out in the next days and then merge it. Feel free to check out the PR and test it as well ๐Ÿ™‚

I'll test this out in the next days and then merge it. Feel free to check out the PR and test it as well slightly_smiling_face

Works for me, thanks!