Skip to content

Tool seems to assume source-dir has git commit if it contains .git directory #1349

@Gozala

Description

@Gozala

Is this a feature request or a bug?

This is a bug

What is the current behavior?

If you start a web-extension and did git init but have not yet committed any changes this seems to trigger a bug in the implementation causing a crash. Here is the trace:

MOZ_DISABLE_CONTENT_SANDBOX=1 web-ext run --firefox=nightly

(node:19028) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory,open '/Users/gozala/Projects/libdweb-template/.git/packed-refs'
    at Object.fs.openSync (fs.js:663:18)
    at Object.fs.readFileSync (fs.js:568:33)
    at Object.long (/Users/gozala/Projects/libdweb-template/node_modules/git-rev-sync/index.js:109:31)
    at defaultVersionGetter (/Users/gozala/Projects/libdweb-template/node_modules/web-ext/dist/webpack:/src/program.js:266:53)
    at Program._callee$ (/Users/gozala/Projects/libdweb-template/node_modules/web-ext/dist/webpack:/src/program.js:159:21)
    at tryCatch (/Users/gozala/Projects/libdweb-template/node_modules/regenerator-runtime/runtime.js:62:40)    at Generator.invoke [as _invoke] (/Users/gozala/Projects/libdweb-template/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/gozala/Projects/libdweb-template/node_modules/regenerator-runtime/runtime.js:114:21)
    at step (/Users/gozala/Projects/libdweb-template/node_modules/web-ext/dist/webpack:/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:1)
    at /Users/gozala/Projects/libdweb-template/node_modules/web-ext/dist/webpack:/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:1
(node:19028) 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: 1)
(node:19028) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js processwith a non-zero exit code.

If I create a commit this issue no longer occurs, neither it does if git init has not being run. It is also worth noting that .git/packed-refs does not exists after first commit as well, but presumably something else does causing differ code path.

What is the expected or desired behavior?

web-ext run should behave same regardless of git repo state

Version information (for bug reports)

  • Firefox version: 63.0a1 (2018-07-26) (64-bit)
  • Your OS and version: macOS 10.13.6 Beta (17G47b)
node --version && npm --version && web-ext --version
v9.5.0
5.6.0
master-065188db35a4f63c2d17ff744cc1de2601a62222

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions