From 0acffc084f1ef107f50ad49a4e00916dcd1eafb7 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Mon, 18 Oct 2021 15:39:31 -0700 Subject: [PATCH] Allow indexing outside notebook directory Fixes: https://github.com/mickael-menu/zk/issues/89 --- CHANGELOG.md | 7 ++++++- internal/core/note_index.go | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d68bec93..3100351a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,12 @@ All notable changes to this project will be documented in this file. - +## Unreleased + +### Fixed + +* [#89](https://github.com/mickael-menu/zk/issues/89) Calling `zk index` from outside the notebook (contributed by [@adamreese](https://github.com/mickael-menu/zk/pull/90)). + ## 0.7.0 diff --git a/internal/core/note_index.go b/internal/core/note_index.go index a4988ace..d958617f 100644 --- a/internal/core/note_index.go +++ b/internal/core/note_index.go @@ -123,7 +123,7 @@ func (t *indexTask) execute(callback func(change paths.DiffChange)) (NoteIndexin // FIXME: Use the FS? count, err := paths.Diff(source, target, force, func(change paths.DiffChange) error { callback(change) - absPath := filepath.Join(change.Path) + absPath := filepath.Join(t.path, change.Path) switch change.Kind { case paths.DiffAdded: