From da993e17b2211c252b3ce51bc137bfcf111344e8 Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Mon, 18 Feb 2019 15:09:32 -0300 Subject: [PATCH] Fix paths without directories --- cli/git.js | 7 ++++++- cli/todo.md | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) delete mode 100644 cli/todo.md diff --git a/cli/git.js b/cli/git.js index 3182fea..3aabcc9 100644 --- a/cli/git.js +++ b/cli/git.js @@ -1,4 +1,5 @@ const execa = require("execa"); +const pather = require("path"); async function getCommits(path) { const format = `{"hash":"%h","author":{"login":"%aN"},"date":"%ad"},`; @@ -36,7 +37,11 @@ async function getCommits(path) { } async function getContent(commit, path) { - const { stdout } = await execa("git", ["show", `${commit.hash}:${path}`]); + const { stdout } = await execa( + "git", + ["show", `${commit.hash}:./${pather.basename(path)}`], + { cwd: pather.dirname(path) } + ); return stdout; } diff --git a/cli/todo.md b/cli/todo.md deleted file mode 100644 index db6876e..0000000 --- a/cli/todo.md +++ /dev/null @@ -1 +0,0 @@ -- fix `./cli$ git-file-history server.js`