git-history icon indicating copy to clipboard operation
git-history copied to clipboard

[CLI] UnhandledPromiseRejectionWarning when file was renamed

Open lhermann opened this issue 6 years ago • 5 comments

I got the following error when using the cli command on a file:

$ npx git-file-history  frontend-nuxt/components/project-index/Project.vue 
npx: installed 36 in 2.806s
Running at http://localhost:3000
(node:46252) UnhandledPromiseRejectionWarning: Error: Command failed: git show 8f85d56:frontend-nuxt/components/project-index/Project.vue
fatal: Path 'frontend-nuxt/components/project-index/Project.vue' exists on disk, but not in '8f85d56'.


    at makeError (/Users/lhermann/.npm/_npx/46252/lib/node_modules/git-file-history/node_modules/execa/index.js:174:9)
    at Promise.all.then.arr (/Users/lhermann/.npm/_npx/46252/lib/node_modules/git-file-history/node_modules/execa/index.js:278:16)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
(node:46252) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:46252) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I investigated and found out that this commit mentions the file, but it was renamed:

$ git log -M --summary 8f85d56
commit 8f85d567cd4dee018dd5146e6f2001ef245f467b
Author: Lukas Hermann <[email protected]>
Date:   Tue Feb 12 19:32:20 2019 +0800

    feat: make project list universaly usable [E4A-78]

 create mode 100644 frontend-nuxt/components/project-index/ProjectCompact.vue
 rename frontend-nuxt/components/project-index/{Project.vue => ProjectDefault.vue} (93%)
 create mode 100644 frontend-nuxt/components/project-index/index.vue

Looks like git-history can not handle this. Probably a bug?

lhermann avatar Feb 13 '19 03:02 lhermann

Oh, I need to use the old file path instead of the current one.

pomber avatar Feb 13 '19 20:02 pomber

+1

agiratech-vigneshm avatar Feb 14 '19 05:02 agiratech-vigneshm

Hmm, --follow is causing some other issues (see #81), we'll drop it for now.

pomber avatar Feb 14 '19 17:02 pomber

Could you try with the new version? npx [email protected] your/file

pomber avatar Feb 14 '19 19:02 pomber

Thanks for taking time for this! Teems like the problem persists:

$ npx [email protected] frontend-nuxt/components/project-index/Project.vue
npx: installed 36 in 2.995s
Running at http://localhost:3000
(node:41527) UnhandledPromiseRejectionWarning: Error: Command failed: git show 8f85d56:frontend-nuxt/components/project-index/Project.vue
fatal: Path 'frontend-nuxt/components/project-index/Project.vue' exists on disk, but not in '8f85d56'.

Some more context: I renamed Project.vue into something else, and then later renamed it back. Maybe this fact is troubling git-file-history.

lhermann avatar Feb 15 '19 01:02 lhermann