marlonrichert / zsh-snap

⚡️ Znap! Fast, easy-to-use tools for Zsh dotfiles & plugins, plus git repos
MIT License
1.34k stars 40 forks source link

znap always pulls ohmyzsh plugins on zsh startup #257

Closed terala-work closed 11 months ago

terala-work commented 1 year ago

Describe the bug

When zsh is restarted, znap pulls ohmyzsh every time zsh is started. Other plugins are not pulled.

Steps To Reproduce

  1. znap source ohmyzsh/ohmyzsh lib/{git,theme-and-appearance}
  2. Quit zsh
  3. Launch zsh

Expected behavior

znap not pull ohmyzsh repo again

Observed behavior

znap pulls ohmyzsh repo every time when zsh is started.

Environment:

Additional context

.zshrc contents:

  # Load via znap
  zstyle ':znap:*' repos-dir ~/.znap/repos
  ZSH_CUSTOM=~/.znap/custom
  source ~/.znap/znap.zsh

 # Load plugins
 # For oh-my-zsh and related themes
 znap source ohmyzsh/ohmyzsh lib/{git,theme-and-appearance}

It shows this log every time zsh starts.

remote: Enumerating objects: 1340, done.
remote: Counting objects: 100% (1340/1340), done.
remote: Compressing objects: 100% (1289/1289), done.
remote: Total 1340 (delta 30), reused 1140 (delta 27), pack-reused 0
Receiving objects: 100% (1340/1340), 1.99 MiB | 4.05 MiB/s, done.
Resolving deltas: 100% (30/30), done.

The repo exists in ~/.zshrc/repos/ohmyzsh/ohmyzsh

╭─raviterala@Ravis-MacBook-Pro ~
╰─$ cd .znap/repos/ohmyzsh/ohmyzsh 
╭─raviterala@Ravis-MacBook-Pro ~[ohmyzsh] ‹master ✓›
╰─$ ls -lah               
total 144
drwxr-xr-x   23 raviterala  staff   736B Jun 30 06:23 .
drwxr-xr-x    3 raviterala  staff    96B Jun 30 06:23 ..
-rw-r--r--@   1 raviterala  staff   115B Jun 30 06:23 .editorconfig
drwxr-xr-x@  13 raviterala  staff   416B Jun 30 06:23 .git
drwxr-xr-x@   7 raviterala  staff   224B Jun 30 06:23 .github
-rw-r--r--@   1 raviterala  staff   109B Jun 30 06:23 .gitignore
-rw-r--r--@   1 raviterala  staff   131B Jun 30 06:23 .gitpod.Dockerfile
-rw-r--r--@   1 raviterala  staff   259B Jun 30 06:23 .gitpod.yml
-rw-r--r--@   1 raviterala  staff    49B Jun 30 06:23 .prettierrc
-rw-r--r--@   1 raviterala  staff   3.3K Jun 30 06:23 CODE_OF_CONDUCT.md
-rw-r--r--@   1 raviterala  staff   9.0K Jun 30 06:23 CONTRIBUTING.md
-rw-r--r--@   1 raviterala  staff   1.1K Jun 30 06:23 LICENSE.txt
-rw-r--r--@   1 raviterala  staff    18K Jun 30 06:23 README.md
-rw-r--r--@   1 raviterala  staff   1.1K Jun 30 06:23 SECURITY.md
drwxr-xr-x@   3 raviterala  staff    96B Jun 30 06:23 cache
drwxr-xr-x@   5 raviterala  staff   160B Jun 30 06:23 custom
drwxr-xr-x@  22 raviterala  staff   704B Jun 30 06:23 lib
drwxr-xr-x@   3 raviterala  staff    96B Jun 30 06:23 log
-rw-r--r--@   1 raviterala  staff   7.1K Jun 30 06:23 oh-my-zsh.sh
drwxr-xr-x@ 326 raviterala  staff    10K Jun 30 06:23 plugins
drwxr-xr-x@   3 raviterala  staff    96B Jun 30 06:23 templates
drwxr-xr-x@ 144 raviterala  staff   4.5K Jun 30 06:23 themes
drwxr-xr-x@   9 raviterala  staff   288B Jun 30 06:23 tools

Not sure why it clones this repo all the time.

terala-work commented 1 year ago

@marlonrichert : Any thing I can do to help with this issue?

marlonrichert commented 1 year ago

You could run functions -T .znap.source .znap.source.link before running znap source ohmyzsh/ohmyzsh lib/{git,theme-and-appearance} and share the output here.

terala-work commented 1 year ago

Added this to my .zshrc:

# Load plugins
# For oh-my-zsh and related themes
functions -T .znap.source .znap.source.link
znap source ohmyzsh/ohmyzsh lib/{git,theme-and-appearance}

This is the output:

Last login: Thu Jul 13 07:52:15 on ttys006
+.znap.source:4> zmodload -Fa zsh/files b:zf_rm
+.znap.source:6> ((  3  ))
+.znap.source:12> [[ ohmyzsh/ohmyzsh == */* ]]
+.znap.source:13> .znap.clone ohmyzsh/ohmyzsh
Cloning into '/Users/raviterala/.znap/repos/ohmyzsh/ohmyzsh'...
remote: Enumerating objects: 1340, done.
remote: Counting objects: 100% (1340/1340), done.
remote: Compressing objects: 100% (1287/1287), done.
remote: Total 1340 (delta 32), reused 1143 (delta 29), pack-reused 0
Receiving objects: 100% (1340/1340), 1.99 MiB | 4.43 MiB/s, done.
Resolving deltas: 100% (32/32), done.
+.znap.source:16> private _P__repo=/Users/raviterala/.znap/repos/ohmyzsh/ohmyzsh
+.znap.source:18> private _P__state=/Users/raviterala/.local/state/znap
+.znap.source:19> private _P__file='' _P__src=''
+.znap.source:20> shift
+.znap.source:22> _P__src=lib/git
+.znap.source:23> [[ -h /Users/raviterala/.local/state/ohmyzsh/ohmyzsh.lib.git ]]
+.znap.source:26> _P__file=/Users/raviterala/.local/state/znap/ohmyzsh/ohmyzsh.lib.git
+.znap.source:27> [[ -r /Users/raviterala/.znap/repos/ohmyzsh/ohmyzsh/lib/git.zsh ]]
+.znap.source:37> .znap.source:ohmyzsh.lib.git /Users/raviterala/.znap/repos/ohmyzsh/ohmyzsh/lib/git.zsh
+.znap.source:39> TRY_BLOCK_ERROR=''
+.znap.source:40> unfunction .znap.source:ohmyzsh.lib.git
+.znap.source:22> _P__src=lib/theme-and-appearance
+.znap.source:23> [[ -h /Users/raviterala/.local/state/ohmyzsh/ohmyzsh.lib.theme-and-appearance ]]
+.znap.source:26> _P__file=/Users/raviterala/.local/state/znap/ohmyzsh/ohmyzsh.lib.theme-and-appearance
+.znap.source:27> [[ -r /Users/raviterala/.znap/repos/ohmyzsh/ohmyzsh/lib/theme-and-appearance.zsh ]]
+.znap.source:37> .znap.source:ohmyzsh.lib.theme-and-appearance /Users/raviterala/.znap/repos/ohmyzsh/ohmyzsh/lib/theme-and-appearance.zsh
+.znap.source:39> TRY_BLOCK_ERROR=''
+.znap.source:40> unfunction .znap.source:ohmyzsh.lib.theme-and-appearance
+.znap.source:4> zmodload -Fa zsh/files b:zf_rm
+.znap.source:6> ((  1  ))
+.znap.source:12> [[ chrissicool/zsh-256color == */* ]]
+.znap.source:13> .znap.clone chrissicool/zsh-256color
+.znap.source:16> private _P__repo=/Users/raviterala/.znap/repos/chrissicool/zsh-256color
+.znap.source:18> private _P__state=/Users/raviterala/.local/state/znap
+.znap.source:19> private _P__file='' _P__src=''
+.znap.source:20> shift
+.znap.source:22> _P__src=
+.znap.source:23> [[ -h /Users/raviterala/.local/state/chrissicool/zsh-256color ]]
+.znap.source:26> _P__file=/Users/raviterala/.local/state/znap/chrissicool/zsh-256color
+.znap.source:27> [[ -r /Users/raviterala/.znap/repos/chrissicool/zsh-256color/zsh-256color.plugin.zsh ]]
+.znap.source:37> .znap.source:zsh-256color /Users/raviterala/.znap/repos/chrissicool/zsh-256color/zsh-256color.plugin.zsh
+.znap.source:39> TRY_BLOCK_ERROR=''
+.znap.source:40> unfunction .znap.source:zsh-256color
+.znap.source:4> zmodload -Fa zsh/files b:zf_rm
+.znap.source:6> ((  1  ))
+.znap.source:12> [[ CristianCantoro/colorbira-zsh-theme == */* ]]
+.znap.source:13> .znap.clone CristianCantoro/colorbira-zsh-theme
+.znap.source:16> private _P__repo=/Users/raviterala/.znap/repos/CristianCantoro/colorbira-zsh-theme
+.znap.source:18> private _P__state=/Users/raviterala/.local/state/znap
+.znap.source:19> private _P__file='' _P__src=''
+.znap.source:20> shift
+.znap.source:22> _P__src=
+.znap.source:23> [[ -h /Users/raviterala/.local/state/CristianCantoro/colorbira-zsh-theme ]]
+.znap.source:26> _P__file=/Users/raviterala/.local/state/znap/CristianCantoro/colorbira-zsh-theme
+.znap.source:27> [[ -r /Users/raviterala/.znap/repos/CristianCantoro/colorbira-zsh-theme/colorbira.zsh-theme ]]
+.znap.source:37> .znap.source:colorbira-zsh-theme /Users/raviterala/.znap/repos/CristianCantoro/colorbira-zsh-theme/colorbira.zsh-theme
+.znap.source:39> TRY_BLOCK_ERROR=''
+.znap.source:40> unfunction .znap.source:colorbira-zsh-theme
+.znap.source:4> zmodload -Fa zsh/files b:zf_rm
+.znap.source:6> ((  1  ))
+.znap.source:12> [[ jonmosco/kube-ps1 == */* ]]
+.znap.source:13> .znap.clone jonmosco/kube-ps1
+.znap.source:16> private _P__repo=/Users/raviterala/.znap/repos/jonmosco/kube-ps1
+.znap.source:18> private _P__state=/Users/raviterala/.local/state/znap
+.znap.source:19> private _P__file='' _P__src=''
+.znap.source:20> shift
+.znap.source:22> _P__src=
+.znap.source:23> [[ -h /Users/raviterala/.local/state/jonmosco/kube-ps1 ]]
+.znap.source:26> _P__file=/Users/raviterala/.local/state/znap/jonmosco/kube-ps1
+.znap.source:27> [[ -r /Users/raviterala/.znap/repos/jonmosco/kube-ps1/kube-ps1.sh ]]
+.znap.source:37> .znap.source:kube-ps1 /Users/raviterala/.znap/repos/jonmosco/kube-ps1/kube-ps1.sh
+.znap.source:39> TRY_BLOCK_ERROR=''
+.znap.source:40> unfunction .znap.source:kube-ps1
+.znap.source:4> zmodload -Fa zsh/files b:zf_rm
+.znap.source:6> ((  1  ))
+.znap.source:12> [[ marlonrichert/zsh-autocomplete == */* ]]
+.znap.source:13> .znap.clone marlonrichert/zsh-autocomplete
+.znap.source:16> private _P__repo=/Users/raviterala/.znap/repos/marlonrichert/zsh-autocomplete
+.znap.source:18> private _P__state=/Users/raviterala/.local/state/znap
+.znap.source:19> private _P__file='' _P__src=''
+.znap.source:20> shift
+.znap.source:22> _P__src=
+.znap.source:23> [[ -h /Users/raviterala/.local/state/marlonrichert/zsh-autocomplete ]]
+.znap.source:26> _P__file=/Users/raviterala/.local/state/znap/marlonrichert/zsh-autocomplete
+.znap.source:27> [[ -r /Users/raviterala/.znap/repos/marlonrichert/zsh-autocomplete/zsh-autocomplete.plugin.zsh ]]
+.znap.source:37> .znap.source:zsh-autocomplete /Users/raviterala/.znap/repos/marlonrichert/zsh-autocomplete/zsh-autocomplete.plugin.zsh
+.znap.source:39> TRY_BLOCK_ERROR=''
+.znap.source:40> unfunction .znap.source:zsh-autocomplete
+.znap.source:4> zmodload -Fa zsh/files b:zf_rm
+.znap.source:6> ((  1  ))
+.znap.source:12> [[ marlonrichert/zsh-edit == */* ]]
+.znap.source:13> .znap.clone marlonrichert/zsh-edit
+.znap.source:16> private _P__repo=/Users/raviterala/.znap/repos/marlonrichert/zsh-edit
+.znap.source:18> private _P__state=/Users/raviterala/.local/state/znap
+.znap.source:19> private _P__file='' _P__src=''
+.znap.source:20> shift
+.znap.source:22> _P__src=
+.znap.source:23> [[ -h /Users/raviterala/.local/state/marlonrichert/zsh-edit ]]
+.znap.source:26> _P__file=/Users/raviterala/.local/state/znap/marlonrichert/zsh-edit
+.znap.source:27> [[ -r /Users/raviterala/.znap/repos/marlonrichert/zsh-edit/zsh-edit.plugin.zsh ]]
+.znap.source:37> .znap.source:zsh-edit /Users/raviterala/.znap/repos/marlonrichert/zsh-edit/zsh-edit.plugin.zsh
+.znap.source:39> TRY_BLOCK_ERROR=''
+.znap.source:40> unfunction .znap.source:zsh-edit
+.znap.source:4> zmodload -Fa zsh/files b:zf_rm
+.znap.source:6> ((  1  ))
+.znap.source:12> [[ peterhurford/git-aliases.zsh == */* ]]
+.znap.source:13> .znap.clone peterhurford/git-aliases.zsh
+.znap.source:16> private _P__repo=/Users/raviterala/.znap/repos/peterhurford/git-aliases.zsh
+.znap.source:18> private _P__state=/Users/raviterala/.local/state/znap
+.znap.source:19> private _P__file='' _P__src=''
+.znap.source:20> shift
+.znap.source:22> _P__src=
+.znap.source:23> [[ -h /Users/raviterala/.local/state/peterhurford/git-aliases.zsh ]]
+.znap.source:26> _P__file=/Users/raviterala/.local/state/znap/peterhurford/git-aliases.zsh
+.znap.source:27> [[ -r /Users/raviterala/.znap/repos/peterhurford/git-aliases.zsh/git-aliases.plugin.zsh ]]
+.znap.source:37> .znap.source:git-aliases.zsh /Users/raviterala/.znap/repos/peterhurford/git-aliases.zsh/git-aliases.plugin.zsh
+.znap.source:39> TRY_BLOCK_ERROR=''
+.znap.source:40> unfunction .znap.source:git-aliases.zsh
+.znap.source:4> zmodload -Fa zsh/files b:zf_rm
+.znap.source:6> ((  1  ))
+.znap.source:12> [[ tjquillan/zsh-pipenv == */* ]]
+.znap.source:13> .znap.clone tjquillan/zsh-pipenv
+.znap.source:16> private _P__repo=/Users/raviterala/.znap/repos/tjquillan/zsh-pipenv
+.znap.source:18> private _P__state=/Users/raviterala/.local/state/znap
+.znap.source:19> private _P__file='' _P__src=''
+.znap.source:20> shift
+.znap.source:22> _P__src=
+.znap.source:23> [[ -h /Users/raviterala/.local/state/tjquillan/zsh-pipenv ]]
+.znap.source:26> _P__file=/Users/raviterala/.local/state/znap/tjquillan/zsh-pipenv
+.znap.source:27> [[ -r /Users/raviterala/.znap/repos/tjquillan/zsh-pipenv/zsh-pipenv.plugin.zsh ]]
+.znap.source:37> .znap.source:zsh-pipenv /Users/raviterala/.znap/repos/tjquillan/zsh-pipenv/zsh-pipenv.plugin.zsh
+.znap.source:39> TRY_BLOCK_ERROR=''
+.znap.source:40> unfunction .znap.source:zsh-pipenv
+.znap.source:4> zmodload -Fa zsh/files b:zf_rm
+.znap.source:6> ((  1  ))
+.znap.source:12> [[ unixorn/git-extra-commands == */* ]]
+.znap.source:13> .znap.clone unixorn/git-extra-commands
+.znap.source:16> private _P__repo=/Users/raviterala/.znap/repos/unixorn/git-extra-commands
+.znap.source:18> private _P__state=/Users/raviterala/.local/state/znap
+.znap.source:19> private _P__file='' _P__src=''
+.znap.source:20> shift
+.znap.source:22> _P__src=
+.znap.source:23> [[ -h /Users/raviterala/.local/state/unixorn/git-extra-commands ]]
+.znap.source:26> _P__file=/Users/raviterala/.local/state/znap/unixorn/git-extra-commands
+.znap.source:27> [[ -r /Users/raviterala/.znap/repos/unixorn/git-extra-commands/git-extra-commands.plugin.zsh ]]
+.znap.source:37> .znap.source:git-extra-commands /Users/raviterala/.znap/repos/unixorn/git-extra-commands/git-extra-commands.plugin.zsh
+.znap.source:39> TRY_BLOCK_ERROR=''
+.znap.source:40> unfunction .znap.source:git-extra-commands
+.znap.source:4> zmodload -Fa zsh/files b:zf_rm
+.znap.source:6> ((  1  ))
+.znap.source:12> [[ zdharma-continuum/fast-syntax-highlighting == */* ]]
+.znap.source:13> .znap.clone zdharma-continuum/fast-syntax-highlighting
+.znap.source:16> private _P__repo=/Users/raviterala/.znap/repos/zdharma-continuum/fast-syntax-highlighting
+.znap.source:18> private _P__state=/Users/raviterala/.local/state/znap
+.znap.source:19> private _P__file='' _P__src=''
+.znap.source:20> shift
+.znap.source:22> _P__src=
+.znap.source:23> [[ -h /Users/raviterala/.local/state/zdharma-continuum/fast-syntax-highlighting ]]
+.znap.source:26> _P__file=/Users/raviterala/.local/state/znap/zdharma-continuum/fast-syntax-highlighting
+.znap.source:27> [[ -r /Users/raviterala/.znap/repos/zdharma-continuum/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh ]]
+.znap.source:37> .znap.source:fast-syntax-highlighting /Users/raviterala/.znap/repos/zdharma-continuum/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
zsh-syntax-highlighting: unhandled ZLE widget 'reverse-yank-pop'
+.znap.source:39> TRY_BLOCK_ERROR=''
+.znap.source:40> unfunction .znap.source:fast-syntax-highlighting
+.znap.source:4> zmodload -Fa zsh/files b:zf_rm
+.znap.source:6> ((  1  ))
+.znap.source:12> [[ zsh-users/zsh-autosuggestions == */* ]]
+.znap.source:13> .znap.clone zsh-users/zsh-autosuggestions
+.znap.source:16> private _P__repo=/Users/raviterala/.znap/repos/zsh-users/zsh-autosuggestions
+.znap.source:18> private _P__state=/Users/raviterala/.local/state/znap
+.znap.source:19> private _P__file='' _P__src=''
+.znap.source:20> shift
+.znap.source:22> _P__src=
+.znap.source:23> [[ -h /Users/raviterala/.local/state/zsh-users/zsh-autosuggestions ]]
+.znap.source:26> _P__file=/Users/raviterala/.local/state/znap/zsh-users/zsh-autosuggestions
+.znap.source:27> [[ -r /Users/raviterala/.znap/repos/zsh-users/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh ]]
+.znap.source:37> .znap.source:zsh-autosuggestions /Users/raviterala/.znap/repos/zsh-users/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
+.znap.source:39> TRY_BLOCK_ERROR=''
+.znap.source:40> unfunction .znap.source:zsh-autosuggestions
.znap.prompt.load:16: repos[1]: parameter not set
╭─raviterala@Ravis-MacBook-Pro ~
terala-work commented 1 year ago

@marlonrichert anything I do to help with this issue?

atamanroman commented 1 year ago

I have the same problem. If I do znap install ohmyzsh/ohmyzsh repeatedly, it's always cloned again. This does only happen with ohmyzsh/ohmyzsh but I couldn't find the cause yet 🤔

Edit:

Looks like this was caused by this line:

zstyle ':znap:*' repos-dir "$XDG_CONFIG_HOME/zsh/znap/external"
marlonrichert commented 1 year ago

@terala-work Thanks! Can you try again but with functions -T .znap.clone.task?

terala-work commented 1 year ago

@terala-work Thanks! Can you try again but with functions -T .znap.clone.task?

Here it is:

Last login: Wed Aug 16 13:07:50 on ttys000
+.znap.clone.task:2> emulate -L zsh
+.znap.clone.task:4> setopt extendedglob globstarshort nullglob rcexpandparam localloops pipefail NO_shortloops NO_unset warncreateglobal
+.znap.clone.task:5> zmodload -Fa zsh/files b:zf_mkdir b:zf_mv b:zf_rm
+.znap.clone.task:6> autoload -Uz is-at-least
+.znap.clone.task:8> private server=https://github.com/ url=ohmyzsh/ohmyzsh
+.znap.clone.task:9> [[ ohmyzsh/ohmyzsh != (*/*/*|*:*|*.git(|/)) ]]
+.znap.clone.task:10> url=https://github.com/ohmyzsh/ohmyzsh.git
+.znap.clone.task:12> local gitdir=''
+.znap.clone.task:13> ..znap.repos-dir
+.znap.clone.task:15> local -P name=ohmyzsh/ohmyzsh
+.znap.clone.task:16> private new='' old=/Users/raviterala/.znap/repos/ohmyzsh
+.znap.clone.task:18> [[ -d /Users/raviterala/.znap/repos/ohmyzsh ]]
+.znap.clone.task:19> new=+.znap.clone.task:20> git -C /Users/raviterala/.znap/repos/ohmyzsh remote get-url origin
+.znap.clone.task:19> new=/Users/raviterala/.znap/repos/marlonrichert/zsh-snap
+.znap.clone.task:22> [[ -d /Users/raviterala/.znap/repos/marlonrichert/zsh-snap ]]
+.znap.clone.task:23> zf_rm -rf /Users/raviterala/.znap/repos/ohmyzsh
+.znap.clone.task:31> private repo=/Users/raviterala/.znap/repos/ohmyzsh/ohmyzsh
+.znap.clone.task:32> [[ -d /Users/raviterala/.znap/repos/ohmyzsh/ohmyzsh ]]
+.znap.clone.task:35> zf_mkdir -p /Users/raviterala/.znap/repos/ohmyzsh/ohmyzsh
+.znap.clone.task:36> git -C /Users/raviterala/.znap/repos clone --depth 1 --recurse-submodules --shallow-submodules https://github.com/ohmyzsh/ohmyzsh.git /Users/raviterala/.znap/repos/ohmyzsh/ohmyzsh
Cloning into '/Users/raviterala/.znap/repos/ohmyzsh/ohmyzsh'...
remote: Enumerating objects: 1340, done.
remote: Counting objects: 100% (1340/1340), done.
remote: Compressing objects: 100% (1291/1291), done.
remote: Total 1340 (delta 27), reused 1162 (delta 25), pack-reused 0
Receiving objects: 100% (1340/1340), 2.00 MiB | 4.70 MiB/s, done.
Resolving deltas: 100% (27/27), done.
+.znap.clone.task:37> [[ -v _comp_dumpfile && -f /Users/raviterala/.cache/zsh/compdump ]]
+.znap.clone.task:39> .znap.ignore ohmyzsh/ohmyzsh '*.zwc'
+.znap.clone.task:41> true
+.znap.clone.task:40> .znap.compile /Users/raviterala/.znap/repos/ohmyzsh/ohmyzsh
+.znap.clone.task:2> emulate -L zsh
+.znap.clone.task:4> setopt extendedglob globstarshort nullglob rcexpandparam localloops pipefail NO_shortloops NO_unset warncreateglobal
+.znap.clone.task:5> zmodload -Fa zsh/files b:zf_mkdir b:zf_mv b:zf_rm
+.znap.clone.task:6> autoload -Uz is-at-least
+.znap.clone.task:8> private server=https://github.com/ url=chrissicool/zsh-256color
+.znap.clone.task:9> [[ chrissicool/zsh-256color != (*/*/*|*:*|*.git(|/)) ]]
+.znap.clone.task:10> url=https://github.com/chrissicool/zsh-256color.git
+.znap.clone.task:12> local gitdir=''
+.znap.clone.task:13> ..znap.repos-dir
+.znap.clone.task:15> local -P name=chrissicool/zsh-256color
+.znap.clone.task:16> private new='' old=/Users/raviterala/.znap/repos/zsh-256color
+.znap.clone.task:18> [[ -d /Users/raviterala/.znap/repos/zsh-256color ]]
+.znap.clone.task:31> private repo=/Users/raviterala/.znap/repos/chrissicool/zsh-256color
+.znap.clone.task:32> [[ -d /Users/raviterala/.znap/repos/chrissicool/zsh-256color ]]
+.znap.clone.task:33> return
+.znap.clone.task:2> emulate -L zsh
+.znap.clone.task:4> setopt extendedglob globstarshort nullglob rcexpandparam localloops pipefail NO_shortloops NO_unset warncreateglobal
+.znap.clone.task:5> zmodload -Fa zsh/files b:zf_mkdir b:zf_mv b:zf_rm
+.znap.clone.task:6> autoload -Uz is-at-least
+.znap.clone.task:8> private server=https://github.com/ url=CristianCantoro/colorbira-zsh-theme
+.znap.clone.task:9> [[ CristianCantoro/colorbira-zsh-theme != (*/*/*|*:*|*.git(|/)) ]]
+.znap.clone.task:10> url=https://github.com/CristianCantoro/colorbira-zsh-theme.git
+.znap.clone.task:12> local gitdir=''
+.znap.clone.task:13> ..znap.repos-dir
+.znap.clone.task:15> local -P name=CristianCantoro/colorbira-zsh-theme
+.znap.clone.task:16> private new='' old=/Users/raviterala/.znap/repos/colorbira-zsh-theme
+.znap.clone.task:18> [[ -d /Users/raviterala/.znap/repos/colorbira-zsh-theme ]]
+.znap.clone.task:31> private repo=/Users/raviterala/.znap/repos/CristianCantoro/colorbira-zsh-theme
+.znap.clone.task:32> [[ -d /Users/raviterala/.znap/repos/CristianCantoro/colorbira-zsh-theme ]]
+.znap.clone.task:33> return
+.znap.clone.task:2> emulate -L zsh
+.znap.clone.task:4> setopt extendedglob globstarshort nullglob rcexpandparam localloops pipefail NO_shortloops NO_unset warncreateglobal
+.znap.clone.task:5> zmodload -Fa zsh/files b:zf_mkdir b:zf_mv b:zf_rm
+.znap.clone.task:6> autoload -Uz is-at-least
+.znap.clone.task:8> private server=https://github.com/ url=jonmosco/kube-ps1
+.znap.clone.task:9> [[ jonmosco/kube-ps1 != (*/*/*|*:*|*.git(|/)) ]]
+.znap.clone.task:10> url=https://github.com/jonmosco/kube-ps1.git
+.znap.clone.task:12> local gitdir=''
+.znap.clone.task:13> ..znap.repos-dir
+.znap.clone.task:15> local -P name=jonmosco/kube-ps1
+.znap.clone.task:16> private new='' old=/Users/raviterala/.znap/repos/kube-ps1
+.znap.clone.task:18> [[ -d /Users/raviterala/.znap/repos/kube-ps1 ]]
+.znap.clone.task:31> private repo=/Users/raviterala/.znap/repos/jonmosco/kube-ps1
+.znap.clone.task:32> [[ -d /Users/raviterala/.znap/repos/jonmosco/kube-ps1 ]]
+.znap.clone.task:33> return
+.znap.clone.task:2> emulate -L zsh
+.znap.clone.task:4> setopt extendedglob globstarshort nullglob rcexpandparam localloops pipefail NO_shortloops NO_unset warncreateglobal
+.znap.clone.task:5> zmodload -Fa zsh/files b:zf_mkdir b:zf_mv b:zf_rm
+.znap.clone.task:6> autoload -Uz is-at-least
+.znap.clone.task:8> private server=https://github.com/ url=marlonrichert/zsh-autocomplete
+.znap.clone.task:9> [[ marlonrichert/zsh-autocomplete != (*/*/*|*:*|*.git(|/)) ]]
+.znap.clone.task:10> url=https://github.com/marlonrichert/zsh-autocomplete.git
+.znap.clone.task:12> local gitdir=''
+.znap.clone.task:13> ..znap.repos-dir
+.znap.clone.task:15> local -P name=marlonrichert/zsh-autocomplete
+.znap.clone.task:16> private new='' old=/Users/raviterala/.znap/repos/zsh-autocomplete
+.znap.clone.task:18> [[ -d /Users/raviterala/.znap/repos/zsh-autocomplete ]]
+.znap.clone.task:31> private repo=/Users/raviterala/.znap/repos/marlonrichert/zsh-autocomplete
+.znap.clone.task:32> [[ -d /Users/raviterala/.znap/repos/marlonrichert/zsh-autocomplete ]]
+.znap.clone.task:33> return
+.znap.clone.task:2> emulate -L zsh
+.znap.clone.task:4> setopt extendedglob globstarshort nullglob rcexpandparam localloops pipefail NO_shortloops NO_unset warncreateglobal
+.znap.clone.task:5> zmodload -Fa zsh/files b:zf_mkdir b:zf_mv b:zf_rm
+.znap.clone.task:6> autoload -Uz is-at-least
+.znap.clone.task:8> private server=https://github.com/ url=marlonrichert/zsh-edit
+.znap.clone.task:9> [[ marlonrichert/zsh-edit != (*/*/*|*:*|*.git(|/)) ]]
+.znap.clone.task:10> url=https://github.com/marlonrichert/zsh-edit.git
+.znap.clone.task:12> local gitdir=''
+.znap.clone.task:13> ..znap.repos-dir
+.znap.clone.task:15> local -P name=marlonrichert/zsh-edit
+.znap.clone.task:16> private new='' old=/Users/raviterala/.znap/repos/zsh-edit
+.znap.clone.task:18> [[ -d /Users/raviterala/.znap/repos/zsh-edit ]]
+.znap.clone.task:31> private repo=/Users/raviterala/.znap/repos/marlonrichert/zsh-edit
+.znap.clone.task:32> [[ -d /Users/raviterala/.znap/repos/marlonrichert/zsh-edit ]]
+.znap.clone.task:33> return
+.znap.clone.task:2> emulate -L zsh
+.znap.clone.task:4> setopt extendedglob globstarshort nullglob rcexpandparam localloops pipefail NO_shortloops NO_unset warncreateglobal
+.znap.clone.task:5> zmodload -Fa zsh/files b:zf_mkdir b:zf_mv b:zf_rm
+.znap.clone.task:6> autoload -Uz is-at-least
+.znap.clone.task:8> private server=https://github.com/ url=peterhurford/git-aliases.zsh
+.znap.clone.task:9> [[ peterhurford/git-aliases.zsh != (*/*/*|*:*|*.git(|/)) ]]
+.znap.clone.task:10> url=https://github.com/peterhurford/git-aliases.zsh.git
+.znap.clone.task:12> local gitdir=''
+.znap.clone.task:13> ..znap.repos-dir
+.znap.clone.task:15> local -P name=peterhurford/git-aliases.zsh
+.znap.clone.task:16> private new='' old=/Users/raviterala/.znap/repos/git-aliases.zsh
+.znap.clone.task:18> [[ -d /Users/raviterala/.znap/repos/git-aliases.zsh ]]
+.znap.clone.task:31> private repo=/Users/raviterala/.znap/repos/peterhurford/git-aliases.zsh
+.znap.clone.task:32> [[ -d /Users/raviterala/.znap/repos/peterhurford/git-aliases.zsh ]]
+.znap.clone.task:33> return
+.znap.clone.task:2> emulate -L zsh
+.znap.clone.task:4> setopt extendedglob globstarshort nullglob rcexpandparam localloops pipefail NO_shortloops NO_unset warncreateglobal
+.znap.clone.task:5> zmodload -Fa zsh/files b:zf_mkdir b:zf_mv b:zf_rm
+.znap.clone.task:6> autoload -Uz is-at-least
+.znap.clone.task:8> private server=https://github.com/ url=tjquillan/zsh-pipenv
+.znap.clone.task:9> [[ tjquillan/zsh-pipenv != (*/*/*|*:*|*.git(|/)) ]]
+.znap.clone.task:10> url=https://github.com/tjquillan/zsh-pipenv.git
+.znap.clone.task:12> local gitdir=''
+.znap.clone.task:13> ..znap.repos-dir
+.znap.clone.task:15> local -P name=tjquillan/zsh-pipenv
+.znap.clone.task:16> private new='' old=/Users/raviterala/.znap/repos/zsh-pipenv
+.znap.clone.task:18> [[ -d /Users/raviterala/.znap/repos/zsh-pipenv ]]
+.znap.clone.task:31> private repo=/Users/raviterala/.znap/repos/tjquillan/zsh-pipenv
+.znap.clone.task:32> [[ -d /Users/raviterala/.znap/repos/tjquillan/zsh-pipenv ]]
+.znap.clone.task:33> return
+.znap.clone.task:2> emulate -L zsh
+.znap.clone.task:4> setopt extendedglob globstarshort nullglob rcexpandparam localloops pipefail NO_shortloops NO_unset warncreateglobal
+.znap.clone.task:5> zmodload -Fa zsh/files b:zf_mkdir b:zf_mv b:zf_rm
+.znap.clone.task:6> autoload -Uz is-at-least
+.znap.clone.task:8> private server=https://github.com/ url=unixorn/git-extra-commands
+.znap.clone.task:9> [[ unixorn/git-extra-commands != (*/*/*|*:*|*.git(|/)) ]]
+.znap.clone.task:10> url=https://github.com/unixorn/git-extra-commands.git
+.znap.clone.task:12> local gitdir=''
+.znap.clone.task:13> ..znap.repos-dir
+.znap.clone.task:15> local -P name=unixorn/git-extra-commands
+.znap.clone.task:16> private new='' old=/Users/raviterala/.znap/repos/git-extra-commands
+.znap.clone.task:18> [[ -d /Users/raviterala/.znap/repos/git-extra-commands ]]
+.znap.clone.task:31> private repo=/Users/raviterala/.znap/repos/unixorn/git-extra-commands
+.znap.clone.task:32> [[ -d /Users/raviterala/.znap/repos/unixorn/git-extra-commands ]]
+.znap.clone.task:33> return
+.znap.clone.task:2> emulate -L zsh
+.znap.clone.task:4> setopt extendedglob globstarshort nullglob rcexpandparam localloops pipefail NO_shortloops NO_unset warncreateglobal
+.znap.clone.task:5> zmodload -Fa zsh/files b:zf_mkdir b:zf_mv b:zf_rm
+.znap.clone.task:6> autoload -Uz is-at-least
+.znap.clone.task:8> private server=https://github.com/ url=zdharma-continuum/fast-syntax-highlighting
+.znap.clone.task:9> [[ zdharma-continuum/fast-syntax-highlighting != (*/*/*|*:*|*.git(|/)) ]]
+.znap.clone.task:10> url=https://github.com/zdharma-continuum/fast-syntax-highlighting.git
+.znap.clone.task:12> local gitdir=''
+.znap.clone.task:13> ..znap.repos-dir
+.znap.clone.task:15> local -P name=zdharma-continuum/fast-syntax-highlighting
+.znap.clone.task:16> private new='' old=/Users/raviterala/.znap/repos/fast-syntax-highlighting
+.znap.clone.task:18> [[ -d /Users/raviterala/.znap/repos/fast-syntax-highlighting ]]
+.znap.clone.task:31> private repo=/Users/raviterala/.znap/repos/zdharma-continuum/fast-syntax-highlighting
+.znap.clone.task:32> [[ -d /Users/raviterala/.znap/repos/zdharma-continuum/fast-syntax-highlighting ]]
+.znap.clone.task:33> return
zsh-syntax-highlighting: unhandled ZLE widget 'reverse-yank-pop'
+.znap.clone.task:2> emulate -L zsh
+.znap.clone.task:4> setopt extendedglob globstarshort nullglob rcexpandparam localloops pipefail NO_shortloops NO_unset warncreateglobal
+.znap.clone.task:5> zmodload -Fa zsh/files b:zf_mkdir b:zf_mv b:zf_rm
+.znap.clone.task:6> autoload -Uz is-at-least
+.znap.clone.task:8> private server=https://github.com/ url=zsh-users/zsh-autosuggestions
+.znap.clone.task:9> [[ zsh-users/zsh-autosuggestions != (*/*/*|*:*|*.git(|/)) ]]
+.znap.clone.task:10> url=https://github.com/zsh-users/zsh-autosuggestions.git
+.znap.clone.task:12> local gitdir=''
+.znap.clone.task:13> ..znap.repos-dir
+.znap.clone.task:15> local -P name=zsh-users/zsh-autosuggestions
+.znap.clone.task:16> private new='' old=/Users/raviterala/.znap/repos/zsh-autosuggestions
+.znap.clone.task:18> [[ -d /Users/raviterala/.znap/repos/zsh-autosuggestions ]]
+.znap.clone.task:31> private repo=/Users/raviterala/.znap/repos/zsh-users/zsh-autosuggestions
+.znap.clone.task:32> [[ -d /Users/raviterala/.znap/repos/zsh-users/zsh-autosuggestions ]]
+.znap.clone.task:33> return
.znap.prompt.load:16: repos[1]: parameter not set
╭─raviterala@Ravis-MacBook-Pro ~
marlonrichert commented 1 year ago

Ah, I forgot that the repo can have the same name as the user. Thanks, this should be easy to fix.

ppwwyyxx commented 1 year ago

Running into the same problem.

rcloran commented 1 year ago

It looks like everyone running into this problem might have their "repos" directory as a child of the znap repository itself.

In @terala-work's case, the znap repo is ~/.znap, and others are placed as children of ~/.znap/repos. That means that the check for "repository-ness" at https://github.com/marlonrichert/zsh-snap/blob/main/functions/.znap.clone.task#L19-L21 succeeds, and so triggers the deletion in the next line. The intent of that code is not clear to me, is it some sort of migration from a previous directory structure?

Anyways, the workaround is to move your znap repository to be a sibling of your ohmyzsh or whatever other repositories. eg:

russell@zip .znap % pwd
/Users/russell/.znap
russell@zip .znap % mkdir -p repos/znap
russell@zip .znap % mv .git* .zsh* * repos/znap/
mv: rename repos to repos/znap/repos: Invalid argument
russell@zip .znap % ls
repos
russell@zip .znap % sed -I '' 's,\.znap/znap.zsh,.znap/repos/znap/znap.zsh,' ~/.zshrc
russell@zip .znap % cat ~/.zshrc
zstyle ':znap:*' repos-dir ~/.znap/repos
source ~/.znap/repos/znap/znap.zsh

znap source ohmyzsh/ohmyzsh lib/{git,theme-and-appearance}
russell@zip .znap % zsh -i
russell@zip .znap %

(Please don't just copy-paste the example commands above, there are plenty of assumptions based on the fact that I'm just testing on a very bare-bones setup, I was just hoping it offered some clarification of the explanation I gave above)

vhdirk commented 1 year ago

@rcloran Not sure why, but your conclusions do not hold up for me.

My repos dir has never been a child of the znap repo, yet it always clones the ohmyzsh repo over and over again. My 'solution' thus far has been to just fork the ohmyzsh repo so that I can just clone vhdirk/ohmyzsh instead.

rcloran commented 1 year ago

My repos dir has never been a child of the znap repo

I realized while writing the commit message for the fix that it could be caused by /any/ git repo being in the parent of your repos directory. For example, if you manage your dot files with a plain git clone into ~ that might be the case.

Or, more generally, if git remote get-url origin exits with status code 0 while inside the repos/ohmyzsh directory, this will be triggered.

vhdirk commented 1 year ago

Ah yes indeed. I had my repos dir setup as a child of my dotfiles repo. That was pretty useless anyway. Even though this classifies as a workaround for me, I'm happy with it :D

terala-work commented 1 year ago

@rcloran I verified that your workaround works for me. Is there a better way to fix this issue? This workaround also works if I move ~/.znap to ~/.config/znap and clone zsh-snap in ~/.config/znap/repos/znap folder. Since most distros/setups usually don't source control ~/.config folder, this might be a safer option.

rcloran commented 1 year ago

@rcloran I verified that your workaround works for me. Is there a better way to fix this issue?

Good to hear. The fix is in #269, which is waiting for review. You could apply that locally if you want 🤷‍♂️.

terala-work commented 1 year ago

@rcloran I verified that this fix works.

terala-work commented 1 year ago

@marlonrichert would you mind merging @rcloran's PR? This fixes both my issues.