From 0521c68b063ca337185ea4843076480b10a82d1d Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Mon, 3 Dec 2018 09:18:20 +0100 Subject: [PATCH] Avoid deleting cache when killing a long cdg --- zsh/gclone.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zsh/gclone.zsh b/zsh/gclone.zsh index 8cad278..653a3f5 100644 --- a/zsh/gclone.zsh +++ b/zsh/gclone.zsh @@ -102,9 +102,11 @@ if [ -d "$GCLONE_PATH" ]; then compdef _cdg cdg _cdg_refresh_cache() { + tmpfile=`mktemp` find $GCLONE_PATH -maxdepth 3 \ -not -name ".cdgcache" \ - -not -name "git" | sort > $GCLONE_PATH/.cdgcache + -not -name "git" | sort > $tmpfile + mv $tmpfile $GCLONE_PATH/.cdgcache } _cdg_existing_dirs() {