Fix paths without directories

This commit is contained in:
Rodrigo Pombo 2019-02-18 15:09:32 -03:00
parent e803429650
commit da993e17b2
2 changed files with 6 additions and 2 deletions

View File

@ -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;
}

View File

@ -1 +0,0 @@
- fix `./cli$ git-file-history server.js`