Giter Site home page Giter Site logo

git-hours's Introduction

Status badge

git-hours

Estimate time spent on a git repository.

For example time spent on Twitter's Bootstrap

bootstrap git:(master) git-hours
{

  ...

  "total": {
    "hours": 9959,
    "commits": 11470
  }
}

From a person working 8 hours per day, it would take more than 3 years to build Bootstrap.

Please note that the information might not be accurate enough to be used in billing.

Install

$ npm install -g git-hours

NOTE: If for some reason git-hours won't work, try to npm install -g nodegit.

git-hours depends on nodegit. It might be a bit tricky to install. If installing git-hours fails for some reason, probably it was because nodegit couldn't be installed. Check their documentation for troubleshooting.

How it works

The algorithm for estimating hours is quite simple. For each author in the commit history, do the following:



Go through all commits and compare the difference between them in time.




If the difference is smaller or equal then a given threshold, group the commits to a same coding session.




If the difference is bigger than a given threshold, the coding session is finished.




To compensate the first commit whose work is unknown, we add extra hours to the coding session.




Continue until we have determined all coding sessions and sum the hours made by individual authors.


The algorithm in ~30 lines of code.

Usage

In root of a git repository run:

$ git-hours

Note: repository is not detected if you are not in the root of repository!

Help

Usage: git-hours [options]

Options:

  -h, --help                                 output usage information
  -V, --version                              output the version number
  -d, --max-commit-diff [max-commit-diff]    maximum difference in minutes between commits counted to one session. Default: 120
  -a, --first-commit-add [first-commit-add]  how many minutes first commit of session should add to total. Default: 120
  -s, --since [since-certain-date]           Analyze data since certain date. [always|yesterday|tonight|lastweek|yyyy-mm-dd] Default: always'
  -e, --email [emailOther=emailMain]         Group person by email address. Default: none
  -u, --until [until-certain-date]           Analyze data until certain date. [always|yesterday|today|lastweek|thisweek|yyyy-mm-dd] Default: always
  -m, --merge-request [false|true]           Include merge requests into calculation.  Default: true
  -p, --path [git-repo]                      Git repository to analyze. Default: .
  -b, --branch [branch-name]                 Analyze only data on the specified branch. Default: all branches

Examples:

 - Estimate hours of project

     $ git-hours

 - Estimate hours in repository where developers commit more seldom: they might have 4h(240min) pause between commits

     $ git-hours --max-commit-diff 240

 - Estimate hours in repository where developer works 5 hours before first commit in day

     $ git-hours --first-commit-add 300

 - Estimate hours work in repository since yesterday

   $ git-hours --since yesterday

 - Estimate hours work in repository since 2015-01-31

   $ git-hours --since 2015-01-31

- Estimate hours work in repository on the "master" branch

   $ git-hours --branch master

For more details, visit https://github.com/kimmobrunfeldt/git-hours

git-hours's People

Contributors

adg29 avatar crooy avatar dependabot[bot] avatar dshook avatar fabiosoft avatar guypaddock avatar kh0r avatar kimmobrunfeldt avatar mrpjer avatar nicolas-van avatar pieroblunda avatar qgustavor avatar swarmiakimmo avatar vdloo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-hours's Issues

--first-commit-add does not have any effect

Regardless if I put 0 or 1000 or nothing for first-commit-add it does not make any difference for the number of hours calculated.

$ git-hours 
{
  "X": {
    "name": "X",
    "hours": 233,
    "commits": 1218
  },
  "total": {
    "hours": 233,
    "commits": 1218
  }
}
$ git-hours --first-commit-add=0
{
  "X": {
    "name": "X",
    "hours": 233,
    "commits": 1218
  },
  "total": {
    "hours": 233,
    "commits": 1218
  }
}
$ git-hours --first-commit-add=1000
{
  "X": {
    "name": "X",
    "hours": 233,
    "commits": 1218
  },
  "total": {
    "hours": 233,
    "commits": 1218
  }
}
$ git-hours --version
1.5.0

It seems --max-commit-diff might have the same problem. Just installed git-hours with npm.

Installation problems

Well, I installed it npm install -g git-hours, however when I tried to run git hours, I got:

module.js: 340
      throw err;
            ^
Error: Cannot find module 'c:\Users\Joberto\Projetos\Uux\GIT\itaas\node_modules\git-hours\index.js'

git-hours doesn't install

Same error as #14 is reported when attempting to run git-hours.

First was using node 8.10.0, but I tried switching to the latest 5 and latest 4 using nvm and I still couldn't get it working.

Addition: I also tried installing the latest version of nodegit which doesn't produce an error when I install it (sudo npm install -g [email protected]) and that didn't work either

Fix nodegit dependency

This is a new issue which combines these issues:

Workaround for the nodegit issues is to use node version 0.12x. You can do it either by using nvm or following the vagrant installation guide in readme.

The real solution is to update nodegit dependency or open up a new issue to nodegit repo if it isn't working with a new node release. I have now tested to update nodegit to version 0.8.0. It seems to work with node 5.0.0 but there's a new bug which makes it useless: nodegit/nodegit#866. Let's wait until nodegit gets their releases together.

Git hours does not work on Node 5.4.0

I have Node 5.4.0, installed from homebrew on OS X 10.11.2. Git hours install succeeds but it does not work.

$ node -v
v5.4.0
$ npm install -g git-hours
/usr/local/bin/git-hours -> /usr/local/lib/node_modules/git-hours/src/index.js

> [email protected] install /usr/local/lib/node_modules/git-hours/node_modules/nodegit
> node lifecycleScripts/install

[nodegit] Fetching binary from S3.
[nodegit] Failed to install prebuilt binary, building manually.
[nodegit] Making sure dependencies are available and native code is generated
[nodegit] Something is missing, retrieving dependencies and regenerating code
[email protected] /usr/local/lib/node_modules/nodegit
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
└── [email protected]

/usr/local/lib
`-- [email protected]
  +-- [email protected]
  +-- [email protected]
  | `-- [email protected]
  +-- [email protected]
  +-- [email protected]
  `-- [email protected]
    +-- [email protected]
    | +-- [email protected]
    | +-- [email protected]
    | `-- [email protected]
    |   `-- [email protected]
    |     +-- [email protected]
    |     | `-- [email protected]
    |     +-- [email protected]
    |     +-- [email protected]
    |     | `-- [email protected]
    |     |   +-- [email protected]
    |     |   `-- [email protected]
    |     +-- [email protected]
    |     `-- [email protected]
    +-- [email protected]
    | +-- [email protected]
    | | `-- [email protected]
    | |   `-- [email protected]
    | |     `-- [email protected]
    | +-- [email protected]
    | | +-- [email protected]
    | | | `-- [email protected]
    | | |   `-- [email protected]
    | | `-- [email protected]
    | |   `-- [email protected]
    | |     `-- [email protected]
    | +-- [email protected]
    | | `-- [email protected]
    | |   +-- [email protected]
    | |   | `-- [email protected]
    | |   +-- [email protected]
    | |   +-- [email protected]
    | |   | `-- [email protected]
    | |   |   `-- [email protected]
    | |   `-- [email protected]
    | |     `-- [email protected]
    | +-- [email protected]
    | | `-- [email protected]
    | `-- [email protected]
    |   +-- [email protected]
    |   | `-- [email protected]
    |   +-- [email protected]
    |   | `-- [email protected]
    |   +-- [email protected]
    |   | `-- [email protected]
    |   `-- [email protected]
    |     `-- [email protected]
    +-- [email protected]
    | `-- [email protected]
    +-- [email protected]
    | +-- [email protected]
    | | `-- [email protected]
    | +-- [email protected]
    | | `-- [email protected]
    | +-- [email protected]
    | | `-- [email protected]
    | +-- [email protected]
    | +-- [email protected]
    | +-- [email protected]
    | | `-- [email protected]
    | |   `-- [email protected]
    | +-- [email protected]
    | | `-- [email protected]
    | |   `-- [email protected]
    | |     `-- [email protected]
    | |       +-- [email protected]
    | |       `-- [email protected]
    | +-- [email protected]
    | +-- [email protected]
    | | `-- [email protected]
    | |   `-- [email protected]
    | |     `-- [email protected]
    | `-- [email protected]
    +-- [email protected]
    | `-- [email protected]
    |   `-- [email protected]
    `-- [email protected]
      +-- [email protected]
      `-- [email protected]
        `-- [email protected]

$ git hours
module.js:328
    throw err;
    ^

Error: Cannot find module '../build/Debug/nodegit.node'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/git-hours/node_modules/nodegit/lib/nodegit.js:16:12)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/git-hours/src/index.js:4:11)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)

ruby

I had to install loads of software just to run this 30 lines of code! (vagrant, virtualBox, vagrant plugin scp, gitnode) In the end i couldnt run it :D

As a recommendation next time do it in ruby. Mac os X already suports it!
and ruby gems are the way to go.

git-hours doesn't install with node 12

I'm using and Ubuntu 18.04 with node 12.6.0.

When I type npm install -g git-hours (using a working nvm configuration) I get this:

 nico@nico-Inspiron-7590  ~/code/git-hours   master  npm install -g git-hours
/home/nico/.nvm/versions/node/v12.6.0/bin/git-hours -> /home/nico/.nvm/versions/node/v12.6.0/lib/node_modules/git-hours/src/index.js

> [email protected] install /home/nico/.nvm/versions/node/v12.6.0/lib/node_modules/git-hours/node_modules/nodegit
> node lifecycleScripts/install

/home/nico/.nvm/versions/node/v12.6.0/lib/node_modules/git-hours/node_modules/promisify-node/utils/args.js:9
  var args = func.toString().match(/function\s.*?\(([^)]*)\)/)[1];
                                                              ^

TypeError: Cannot read property '1' of null
    at module.exports (/home/nico/.nvm/versions/node/v12.6.0/lib/node_modules/git-hours/node_modules/promisify-node/utils/args.js:9:63)
    at /home/nico/.nvm/versions/node/v12.6.0/lib/node_modules/git-hours/node_modules/promisify-node/index.js:79:29
    at Array.filter (<anonymous>)
    at processExports (/home/nico/.nvm/versions/node/v12.6.0/lib/node_modules/git-hours/node_modules/promisify-node/index.js:60:6)
    at module.exports (/home/nico/.nvm/versions/node/v12.6.0/lib/node_modules/git-hours/node_modules/promisify-node/index.js:112:10)
    at Object.<anonymous> (/home/nico/.nvm/versions/node/v12.6.0/lib/node_modules/git-hours/node_modules/nodegit/generate/scripts/generateNativeCode.js:3:13)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node lifecycleScripts/install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nico/.npm/_logs/2019-09-05T11_28_16_147Z-debug.log

Vagrant Test Fails

I didn't try installing via NPM but followed instructions to test with vagrant. Got an error, also tried installing nodegit inside the vagrant vb, both before and after install nodegit I got the following error:

vagrant@vagrant-ubuntu-trusty-64:~/bootstrap$ git hours
module.js:338
    throw err;
          ^
Error: Cannot find module '../build/Debug/nodegit.node'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/lib/node_modules/git-hours/node_modules/nodegit/dist/nodegit.js:18:12)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/lib/node_modules/git-hours/src/index.js:4:11)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

Error within vagrant

After following the vagrant instruction:

$ git clone https://github.com/kimmobrunfeldt/git-hours
$ cd git-hours
$ vagrant up && vagrant ssh

I clone a repo and tried git hours.

vagrant@git-hours:~/electron$ git hours

module.js:340
    throw err;
          ^
Error: Cannot find module '../build/Debug/nodegit.node'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/lib/node_modules/git-hours/node_modules/nodegit/lib/nodegit.js:16:12)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/lib/node_modules/git-hours/src/index.js:4:11)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

At least commit count is wrong

Using a random repo I have:

$ git-hours
total commits: 1371
$ git rev-list --count --all
690

Maybe it's duplicating commits that were merged from another branch?

Installation failed: TypeError: Cannot read property '1' of null

I am trying to install git-hours on Ubuntu 18.04 and I am getting an error:

/usr/local/lib/node_modules/git-hours/node_modules/promisify-node/utils/args.js:9
  var args = func.toString().match(/function\s.*?\(([^)]*)\)/)[1];
                                                              ^

TypeError: Cannot read property '1' of null
    at module.exports (/usr/local/lib/node_modules/git-hours/node_modules/promisify-node/utils/args.js:9:63)
    at /usr/local/lib/node_modules/git-hours/node_modules/promisify-node/index.js:79:29
    at Array.filter (<anonymous>)
    at processExports (/usr/local/lib/node_modules/git-hours/node_modules/promisify-node/index.js:60:6)
    at module.exports (/usr/local/lib/node_modules/git-hours/node_modules/promisify-node/index.js:112:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/git-hours/node_modules/nodegit/generate/scripts/generateNativeCode.js:3:13)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

Installing nodegit fails

I couldn't manage to run the program after building. So, I tried the Vagrant method.
This resulted in some build errors for nodegit, I have attached a log below:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'precise64'...

�[KProgress: 60%
�[KProgress: 90%
�[K==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: git-hours_default_1443006363068_89836
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.2.0
default: VirtualBox Version: 5.0
==> default: Setting hostname...
==> default: Mounting shared folders...
default: /vagrant => C:/Users/SwiftPengu/Documents/git-hours
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: Ign http://us.archive.ubuntu.com precise InRelease
==> default: Ign http://us.archive.ubuntu.com precise-updates InRelease
==> default: Ign http://us.archive.ubuntu.com precise-backports InRelease
==> default: Hit http://us.archive.ubuntu.com precise Release.gpg
==> default: Get:1 http://us.archive.ubuntu.com precise-updates Release.gpg [198 B]
==> default: Get:2 http://us.archive.ubuntu.com precise-backports Release.gpg [198 B]
==> default: Hit http://us.archive.ubuntu.com precise Release
==> default: Get:3 http://us.archive.ubuntu.com precise-updates Release [196 kB]
==> default: Get:4 http://us.archive.ubuntu.com precise-backports Release [54.3 kB]
==> default: Ign http://security.ubuntu.com precise-security InRelease
==> default: Get:5 http://security.ubuntu.com precise-security Release.gpg [198 B]
==> default: Get:6 http://security.ubuntu.com precise-security Release [54.3 kB]
==> default: Hit http://us.archive.ubuntu.com precise/main Sources
==> default: Hit http://us.archive.ubuntu.com precise/restricted Sources
==> default: Hit http://us.archive.ubuntu.com precise/universe Sources
==> default: Hit http://us.archive.ubuntu.com precise/multiverse Sources
==> default: Hit http://us.archive.ubuntu.com precise/main amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise/restricted amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise/universe amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise/multiverse amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise/main i386 Packages
==> default: Get:7 http://security.ubuntu.com precise-security/main Sources [134 kB]
==> default: Hit http://us.archive.ubuntu.com precise/restricted i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise/universe i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise/multiverse i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise/main TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise/multiverse TranslationIndex
==> default: Get:8 http://security.ubuntu.com precise-security/restricted Sources [3,759 B]
==> default: Get:9 http://security.ubuntu.com precise-security/universe Sources [43.9 kB]
==> default: Get:10 http://security.ubuntu.com precise-security/multiverse Sources [2,199 B]
==> default: Get:11 http://security.ubuntu.com precise-security/main amd64 Packages [544 kB]
==> default: Hit http://us.archive.ubuntu.com precise/restricted TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise/universe TranslationIndex
==> default: Get:12 http://us.archive.ubuntu.com precise-updates/main Sources [492 kB]
==> default: Get:13 http://security.ubuntu.com precise-security/restricted amd64 Packages [8,943 B]
==> default: Get:14 http://security.ubuntu.com precise-security/universe amd64 Packages [124 kB]
==> default: Get:15 http://security.ubuntu.com precise-security/multiverse amd64 Packages [2,695 B]
==> default: Get:16 http://security.ubuntu.com precise-security/main i386 Packages [598 kB]
==> default: Get:17 http://security.ubuntu.com precise-security/restricted i386 Packages [8,939 B]
==> default: Get:18 http://security.ubuntu.com precise-security/universe i386 Packages [132 kB]
==> default: Get:19 http://security.ubuntu.com precise-security/multiverse i386 Packages [2,872 B]
==> default: Get:20 http://security.ubuntu.com precise-security/main TranslationIndex [208 B]
==> default: Get:21 http://security.ubuntu.com precise-security/multiverse TranslationIndex [199 B]
==> default: Get:22 http://security.ubuntu.com precise-security/restricted TranslationIndex [202 B]
==> default: Get:23 http://security.ubuntu.com precise-security/universe TranslationIndex [205 B]
==> default: Get:24 http://security.ubuntu.com precise-security/main Translation-en [239 kB]
==> default: Get:25 http://security.ubuntu.com precise-security/multiverse Translation-en [1,408 B]
==> default: Get:26 http://security.ubuntu.com precise-security/restricted Translation-en [2,066 B]
==> default: Get:27 http://security.ubuntu.com precise-security/universe Translation-en [78.0 kB]
==> default: Get:28 http://us.archive.ubuntu.com precise-updates/restricted Sources [8,024 B]
==> default: Get:29 http://us.archive.ubuntu.com precise-updates/universe Sources [122 kB]
==> default: Get:30 http://us.archive.ubuntu.com precise-updates/multiverse Sources [9,733 B]
==> default: Get:31 http://us.archive.ubuntu.com precise-updates/main amd64 Packages [933 kB]
==> default: Get:32 http://us.archive.ubuntu.com precise-updates/restricted amd64 Packages [13.7 kB]
==> default: Get:33 http://us.archive.ubuntu.com precise-updates/universe amd64 Packages [269 kB]
==> default: Get:34 http://us.archive.ubuntu.com precise-updates/multiverse amd64 Packages [16.5 kB]
==> default: Get:35 http://us.archive.ubuntu.com precise-updates/main i386 Packages [984 kB]
==> default: Get:36 http://us.archive.ubuntu.com precise-updates/restricted i386 Packages [13.6 kB]
==> default: Get:37 http://us.archive.ubuntu.com precise-updates/universe i386 Packages [278 kB]
==> default: Get:38 http://us.archive.ubuntu.com precise-updates/multiverse i386 Packages [16.7 kB]
==> default: Get:39 http://us.archive.ubuntu.com precise-updates/main TranslationIndex [10.6 kB]
==> default: Get:40 http://us.archive.ubuntu.com precise-updates/multiverse TranslationIndex [7,613 B]
==> default: Get:41 http://us.archive.ubuntu.com precise-updates/restricted TranslationIndex [7,297 B]
==> default: Get:42 http://us.archive.ubuntu.com precise-updates/universe TranslationIndex [8,333 B]
==> default: Get:43 http://us.archive.ubuntu.com precise-backports/main Sources [5,411 B]
==> default: Get:44 http://us.archive.ubuntu.com precise-backports/restricted Sources [28 B]
==> default: Get:45 http://us.archive.ubuntu.com precise-backports/universe Sources [42.8 kB]
==> default: Get:46 http://us.archive.ubuntu.com precise-backports/multiverse Sources [5,750 B]
==> default: Get:47 http://us.archive.ubuntu.com precise-backports/main amd64 Packages [5,491 B]
==> default: Get:48 http://us.archive.ubuntu.com precise-backports/restricted amd64 Packages [28 B]
==> default: Get:49 http://us.archive.ubuntu.com precise-backports/universe amd64 Packages [44.2 kB]
==> default: Get:50 http://us.archive.ubuntu.com precise-backports/multiverse amd64 Packages [5,419 B]
==> default: Get:51 http://us.archive.ubuntu.com precise-backports/main i386 Packages [5,484 B]
==> default: Get:52 http://us.archive.ubuntu.com precise-backports/restricted i386 Packages [28 B]
==> default: Get:53 http://us.archive.ubuntu.com precise-backports/universe i386 Packages [44.0 kB]
==> default: Get:54 http://us.archive.ubuntu.com precise-backports/multiverse i386 Packages [5,413 B]
==> default: Get:55 http://us.archive.ubuntu.com precise-backports/main TranslationIndex [202 B]
==> default: Get:56 http://us.archive.ubuntu.com precise-backports/multiverse TranslationIndex [202 B]
==> default: Get:57 http://us.archive.ubuntu.com precise-backports/restricted TranslationIndex [193 B]
==> default: Get:58 http://us.archive.ubuntu.com precise-backports/universe TranslationIndex [205 B]
==> default: Hit http://us.archive.ubuntu.com precise/main Translation-en
==> default: Hit http://us.archive.ubuntu.com precise/multiverse Translation-en
==> default: Hit http://us.archive.ubuntu.com precise/restricted Translation-en
==> default: Hit http://us.archive.ubuntu.com precise/universe Translation-en
==> default: Get:59 http://us.archive.ubuntu.com precise-updates/main Translation-en [405 kB]
==> default: Get:60 http://us.archive.ubuntu.com precise-updates/multiverse Translation-en [9,603 B]
==> default: Get:61 http://us.archive.ubuntu.com precise-updates/restricted Translation-en [2,982 B]
==> default: Get:62 http://us.archive.ubuntu.com precise-updates/universe Translation-en [160 kB]
==> default: Get:63 http://us.archive.ubuntu.com precise-backports/main Translation-en [4,911 B]
==> default: Get:64 http://us.archive.ubuntu.com precise-backports/multiverse Translation-en [4,838 B]
==> default: Hit http://us.archive.ubuntu.com precise-backports/restricted Translation-en
==> default: Get:65 http://us.archive.ubuntu.com precise-backports/universe Translation-en [35.0 kB]
==> default: Fetched 6,209 kB in 11s (538 kB/s)
==> default: Reading package lists...
==> default: Reading package lists...
==> default: Building dependency tree...
==> default: Reading state information...
==> default: The following extra packages will be installed:
==> default: g++-4.6 git-man liberror-perl libstdc++6-4.6-dev patch python-minimal
==> default: python-pycurl unattended-upgrades
==> default: Suggested packages:
==> default: g++-multilib g++-4.6-multilib gcc-4.6-doc libstdc++6-4.6-dbg git-daemon-run
==> default: git-daemon-sysvinit git-doc git-el git-arch git-cvs git-svn git-email
==> default: git-gui gitk gitweb libstdc++6-4.6-doc make-doc diffutils-doc python-doc
==> default: python-tk libcurl4-gnutls-dev python-pycurl-dbg bsd-mailx
==> default: The following NEW packages will be installed:
==> default: g++ g++-4.6 git git-man liberror-perl libstdc++6-4.6-dev make patch
==> default: python-pycurl python-software-properties unattended-upgrades
==> default: The following packages will be upgraded:
==> default: python python-minimal
==> default: 2 upgraded, 11 newly installed, 0 to remove and 181 not upgraded.
==> default: Need to get 15.9 MB of archives.
==> default: After this operation, 41.8 MB of additional disk space will be used.
==> default: Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main python-minimal amd64 2.7.3-0ubuntu2.2 [29.7 kB]
==> default: Get:2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main python amd64 2.7.3-0ubuntu2.2 [168 kB]
==> default: Get:3 http://us.archive.ubuntu.com/ubuntu/ precise/main libstdc++6-4.6-dev amd64 4.6.3-1ubuntu5 [1,660 kB]
==> default: Get:4 http://us.archive.ubuntu.com/ubuntu/ precise/main g++-4.6 amd64 4.6.3-1ubuntu5 [6,954 kB]
==> default: Get:5 http://us.archive.ubuntu.com/ubuntu/ precise/main g++ amd64 4:4.6.3-1ubuntu5 [1,442 B]
==> default: Get:6 http://us.archive.ubuntu.com/ubuntu/ precise/main liberror-perl all 0.17-1 [23.8 kB]
==> default: Get:7 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main git-man all 1:1.7.9.5-1ubuntu0.1 [631 kB]
==> default: Get:8 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main git amd64 1:1.7.9.5-1ubuntu0.1 [6,097 kB]
==> default: Get:9 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main make amd64 3.81-8.1ubuntu1.1 [119 kB]
==> default: Get:10 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main patch amd64 2.6.1-3ubuntu0.1 [80.0 kB]
==> default: Get:11 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main unattended-upgrades all 0.76ubuntu1.1 [24.7 kB]
==> default: Get:12 http://us.archive.ubuntu.com/ubuntu/ precise/main python-pycurl amd64 7.19.0-4ubuntu3 [49.2 kB]
==> default: Get:13 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main python-software-properties all 0.82.7.7 [23.5 kB]
==> default: dpkg-preconfigure: unable to re-open stdin: No such file or directory
==> default: Fetched 15.9 MB in 34s (465 kB/s)
==> default: (Reading database ...
==> default: 51095 files and directories currently installed.)
==> default: Preparing to replace python-minimal 2.7.3-0ubuntu2 (using .../python-minimal_2.7.3-0ubuntu2.2_amd64.deb) ...
==> default: Unpacking replacement python-minimal ...
==> default: Processing triggers for man-db ...
==> default: Setting up python-minimal (2.7.3-0ubuntu2.2) ...
==> default: (Reading database ...
==> default: 51095 files and directories currently installed.)
==> default: Preparing to replace python 2.7.3-0ubuntu2 (using .../python_2.7.3-0ubuntu2.2_amd64.deb) ...
==> default: Unpacking replacement python ...
==> default: Selecting previously unselected package libstdc++6-4.6-dev.
==> default: Unpacking libstdc++6-4.6-dev (from .../libstdc++6-4.6-dev_4.6.3-1ubuntu5_amd64.deb) ...
==> default: Selecting previously unselected package g++-4.6.
==> default: Unpacking g++-4.6 (from .../g++-4.6_4.6.3-1ubuntu5_amd64.deb) ...
==> default: Selecting previously unselected package g++.
==> default: Unpacking g++ (from .../g++_4%3a4.6.3-1ubuntu5_amd64.deb) ...
==> default: Selecting previously unselected package liberror-perl.
==> default: Unpacking liberror-perl (from .../liberror-perl_0.17-1_all.deb) ...
==> default: Selecting previously unselected package git-man.
==> default: Unpacking git-man (from .../git-man_1%3a1.7.9.5-1ubuntu0.1_all.deb) ...
==> default: Selecting previously unselected package git.
==> default: Unpacking git (from .../git_1%3a1.7.9.5-1ubuntu0.1_amd64.deb) ...
==> default: Selecting previously unselected package make.
==> default: Unpacking make (from .../make_3.81-8.1ubuntu1.1_amd64.deb) ...
==> default: Selecting previously unselected package patch.
==> default: Unpacking patch (from .../patch_2.6.1-3ubuntu0.1_amd64.deb) ...
==> default: Selecting previously unselected package unattended-upgrades.
==> default: Unpacking unattended-upgrades (from .../unattended-upgrades_0.76ubuntu1.1_all.deb) ...
==> default: Selecting previously unselected package python-pycurl.
==> default: Unpacking python-pycurl (from .../python-pycurl_7.19.0-4ubuntu3_amd64.deb) ...
==> default: Selecting previously unselected package python-software-properties.
==> default: Unpacking python-software-properties (from .../python-software-properties_0.82.7.7_all.deb) ...
==> default: Processing triggers for man-db ...
==> default: Processing triggers for ureadahead ...
==> default: ureadahead will be reprofiled on next reboot
==> default: Setting up python (2.7.3-0ubuntu2.2) ...
==> default: Setting up liberror-perl (0.17-1) ...
==> default: Setting up git-man (1:1.7.9.5-1ubuntu0.1) ...
==> default: Setting up git (1:1.7.9.5-1ubuntu0.1) ...
==> default: Setting up make (3.81-8.1ubuntu1.1) ...
==> default: Setting up patch (2.6.1-3ubuntu0.1) ...
==> default: Setting up unattended-upgrades (0.76ubuntu1.1) ...
==> default: Setting up python-pycurl (7.19.0-4ubuntu3) ...
==> default: Setting up python-software-properties (0.82.7.7) ...
==> default: Setting up g++-4.6 (4.6.3-1ubuntu5) ...
==> default: Setting up g++ (4:4.6.3-1ubuntu5) ...
==> default: update-alternatives:
==> default: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode.
==> default: Setting up libstdc++6-4.6-dev (4.6.3-1ubuntu5) ...
==> default: gpg:
==> default: keyring /tmp/tmp54xj3n/secring.gpg' created ==> default: gpg: ==> default: keyring/tmp/tmp54xj3n/pubring.gpg' created
==> default: gpg:
==> default: requesting key C7917B12 from hkp server keyserver.ubuntu.com
==> default: gpg:
==> default: /tmp/tmp54xj3n/trustdb.gpg: trustdb created
==> default: gpg:
==> default: key C7917B12: public key "Launchpad chrislea" imported
==> default: gpg:
==> default: Total number processed: 1
==> default: gpg:
==> default: imported: 1
==> default: (RSA: 1)
==> default: OK
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: Ign http://ppa.launchpad.net precise InRelease
==> default: Ign http://security.ubuntu.com precise-security InRelease
==> default: Get:1 http://ppa.launchpad.net precise Release.gpg [316 B]
==> default: Hit http://security.ubuntu.com precise-security Release.gpg
==> default: Get:2 http://ppa.launchpad.net precise Release [12.9 kB]
==> default: Hit http://security.ubuntu.com precise-security Release
==> default: Get:3 http://ppa.launchpad.net precise/main Sources [830 B]
==> default: Hit http://security.ubuntu.com precise-security/main Sources
==> default: Get:4 http://ppa.launchpad.net precise/main amd64 Packages [970 B]
==> default: Get:5 http://ppa.launchpad.net precise/main i386 Packages [968 B]
==> default: Get:6 http://ppa.launchpad.net precise/main TranslationIndex [199 B]
==> default: Hit http://security.ubuntu.com precise-security/restricted Sources
==> default: Hit http://security.ubuntu.com precise-security/universe Sources
==> default: Hit http://security.ubuntu.com precise-security/multiverse Sources
==> default: Hit http://security.ubuntu.com precise-security/main amd64 Packages
==> default: Hit http://security.ubuntu.com precise-security/restricted amd64 Packages
==> default: Get:7 http://ppa.launchpad.net precise/main Translation-en [727 B]
==> default: Hit http://security.ubuntu.com precise-security/universe amd64 Packages
==> default: Hit http://security.ubuntu.com precise-security/multiverse amd64 Packages
==> default: Hit http://security.ubuntu.com precise-security/main i386 Packages
==> default: Hit http://security.ubuntu.com precise-security/restricted i386 Packages
==> default: Hit http://security.ubuntu.com precise-security/universe i386 Packages
==> default: Hit http://security.ubuntu.com precise-security/multiverse i386 Packages
==> default: Hit http://security.ubuntu.com precise-security/main TranslationIndex
==> default: Hit http://security.ubuntu.com precise-security/multiverse TranslationIndex
==> default: Hit http://security.ubuntu.com precise-security/restricted TranslationIndex
==> default: Hit http://security.ubuntu.com precise-security/universe TranslationIndex
==> default: Hit http://security.ubuntu.com precise-security/main Translation-en
==> default: Hit http://security.ubuntu.com precise-security/multiverse Translation-en
==> default: Hit http://security.ubuntu.com precise-security/restricted Translation-en
==> default: Hit http://security.ubuntu.com precise-security/universe Translation-en
==> default: Ign http://us.archive.ubuntu.com precise InRelease
==> default: Ign http://us.archive.ubuntu.com precise-updates InRelease
==> default: Ign http://us.archive.ubuntu.com precise-backports InRelease
==> default: Hit http://us.archive.ubuntu.com precise Release.gpg
==> default: Hit http://us.archive.ubuntu.com precise-updates Release.gpg
==> default: Hit http://us.archive.ubuntu.com precise-backports Release.gpg
==> default: Hit http://us.archive.ubuntu.com precise Release
==> default: Hit http://us.archive.ubuntu.com precise-updates Release
==> default: Hit http://us.archive.ubuntu.com precise-backports Release
==> default: Hit http://us.archive.ubuntu.com precise/main Sources
==> default: Hit http://us.archive.ubuntu.com precise/restricted Sources
==> default: Hit http://us.archive.ubuntu.com precise/universe Sources
==> default: Hit http://us.archive.ubuntu.com precise/multiverse Sources
==> default: Hit http://us.archive.ubuntu.com precise/main amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise/restricted amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise/universe amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise/multiverse amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise/main i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise/restricted i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise/universe i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise/multiverse i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise/main TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise/multiverse TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise/restricted TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise/universe TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise-updates/main Sources
==> default: Hit http://us.archive.ubuntu.com precise-updates/restricted Sources
==> default: Hit http://us.archive.ubuntu.com precise-updates/universe Sources
==> default: Hit http://us.archive.ubuntu.com precise-updates/multiverse Sources
==> default: Hit http://us.archive.ubuntu.com precise-updates/main amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise-updates/restricted amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise-updates/universe amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise-updates/multiverse amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise-updates/main i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise-updates/restricted i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise-updates/universe i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise-updates/multiverse i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise-updates/main TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise-updates/multiverse TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise-updates/restricted TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise-updates/universe TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise-backports/main Sources
==> default: Hit http://us.archive.ubuntu.com precise-backports/restricted Sources
==> default: Hit http://us.archive.ubuntu.com precise-backports/universe Sources
==> default: Hit http://us.archive.ubuntu.com precise-backports/multiverse Sources
==> default: Hit http://us.archive.ubuntu.com precise-backports/main amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise-backports/restricted amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise-backports/universe amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise-backports/multiverse amd64 Packages
==> default: Hit http://us.archive.ubuntu.com precise-backports/main i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise-backports/restricted i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise-backports/universe i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise-backports/multiverse i386 Packages
==> default: Hit http://us.archive.ubuntu.com precise-backports/main TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise-backports/multiverse TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise-backports/restricted TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise-backports/universe TranslationIndex
==> default: Hit http://us.archive.ubuntu.com precise/main Translation-en
==> default: Hit http://us.archive.ubuntu.com precise/multiverse Translation-en
==> default: Hit http://us.archive.ubuntu.com precise/restricted Translation-en
==> default: Hit http://us.archive.ubuntu.com precise/universe Translation-en
==> default: Hit http://us.archive.ubuntu.com precise-updates/main Translation-en
==> default: Hit http://us.archive.ubuntu.com precise-updates/multiverse Translation-en
==> default: Hit http://us.archive.ubuntu.com precise-updates/restricted Translation-en
==> default: Hit http://us.archive.ubuntu.com precise-updates/universe Translation-en
==> default: Hit http://us.archive.ubuntu.com precise-backports/main Translation-en
==> default: Hit http://us.archive.ubuntu.com precise-backports/multiverse Translation-en
==> default: Hit http://us.archive.ubuntu.com precise-backports/restricted Translation-en
==> default: Hit http://us.archive.ubuntu.com precise-backports/universe Translation-en
==> default: Fetched 16.9 kB in 1s (10.8 kB/s)
==> default: Reading package lists...
==> default: Reading package lists...
==> default: Building dependency tree...
==> default: Reading state information...
==> default: The following extra packages will be installed:
==> default: rlwrap
==> default: The following NEW packages will be installed:
==> default: nodejs rlwrap
==> default: 0 upgraded, 2 newly installed, 0 to remove and 181 not upgraded.
==> default: Need to get 6,100 kB of archives.
==> default: After this operation, 18.6 MB of additional disk space will be used.
==> default: Get:1 http://ppa.launchpad.net/chris-lea/node.js/ubuntu/ precise/main nodejs amd64 0.10.37-1chl1precise1 [6,019 kB]
==> default: Get:2 http://us.archive.ubuntu.com/ubuntu/ precise/universe rlwrap amd64 0.37-2 [81.0 kB]
==> default: dpkg-preconfigure: unable to re-open stdin: No such file or directory
==> default: Fetched 6,100 kB in 2s (2,260 kB/s)
==> default: Selecting previously unselected package rlwrap.
==> default: (Reading database ...
==> default: 52600 files and directories currently installed.)
==> default: Unpacking rlwrap (from .../rlwrap_0.37-2_amd64.deb) ...
==> default: Selecting previously unselected package nodejs.
==> default: Unpacking nodejs (from .../nodejs_0.10.37-1chl1
precise1_amd64.deb) ...
==> default: Processing triggers for man-db ...
==> default: Setting up rlwrap (0.37-2) ...
==> default: update-alternatives:
==> default: using /usr/bin/rlwrap to provide /usr/bin/readline-editor (readline-editor) in auto mode.
==> default: Setting up nodejs (0.10.37-1chl1~precise1) ...
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: /usr/bin/_mocha -> /usr/lib/node_modules/mocha/bin/_mocha
==> default: /usr/bin/mocha -> /usr/lib/node_modules/mocha/bin/mocha
==> default:
==> default: > [email protected] install /usr/lib/node_modules/nodegit
==> default: > node lifecycleScripts/install
==> default: [nodegit] Fetching binary from S3.
==> default: [nodegit] Failed to install prebuilt binary, building manually.
==> default: [nodegit] Making sure dependencies are available and native code is generated
==> default: [nodegit] Everything is ready to go, attempting compilation
==> default: [nodegit] Building native node module.
==> default: { [Error: Command failed: npm ERR! addLocal Could not install /usr/lib/node_modules/nodegit
==> default: npm ERR! Linux 3.2.0-23-generic
==> default: npm ERR! argv "node" "/usr/lib/node_modules/nodegit/node_modules/.bin/npm" "install" "--ignore-scripts"
==> default: npm ERR! node v0.10.37
==> default: npm ERR! npm v2.14.5
==> default: npm ERR! path /root/.npm/nodegit/0.4.1/package
==> default: npm ERR! code EACCES
==> default: npm ERR! errno 3
==> default:
==> default: npm ERR! Error: EACCES, mkdir '/root/.npm/nodegit/0.4.1/package'
==> default: npm ERR! { [Error: EACCES, mkdir '/root/.npm/nodegit/0.4.1/package']
==> default: npm ERR! errno: 3,
==> default: npm ERR! code: 'EACCES',
==> default: npm ERR! path: '/root/.npm/nodegit/0.4.1/package' }
==> default: npm ERR!
==> default: npm ERR! Please try running this command again as root/Administrator.
==> default:
==> default: npm ERR! Please include the following file with any support request:
==> default: npm ERR! /usr/lib/node_modules/nodegit/npm-debug.log
==> default: ] killed: false, code: 3, signal: null }
==> default: undefined
==> default: [email protected] /usr/lib/node_modules/mocha
==> default: ├── [email protected]
==> default: ├── [email protected]
==> default: ├── [email protected]
==> default: ├── [email protected]
==> default: ├── [email protected]
==> default: ├── [email protected] ([email protected])
==> default: ├── [email protected] ([email protected])
==> default: ├── [email protected] ([email protected], [email protected])
==> default: └── [email protected] ([email protected], [email protected], [email protected])
==> default:
==> default: [email protected] /usr/lib/node_modules/nodegit
==> default: ├── [email protected] ([email protected])
==> default: ├── [email protected] ([email protected])
==> default: ├── [email protected] ([email protected], [email protected])
==> default: ├── [email protected] ([email protected], [email protected], [email protected])
==> default: └── [email protected]
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default:
==> default: > [email protected] install /usr/lib/node_modules/git-hours/node_modules/nodegit
==> default: > node lifecycleScripts/install
==> default: [nodegit] Fetching binary from S3.
==> default: [nodegit] Failed to install prebuilt binary, building manually.
==> default: [nodegit] Making sure dependencies are available and native code is generated
==> default: [nodegit] Everything is ready to go, attempting compilation
==> default: [nodegit] Building native node module.
==> default: { [Error: Command failed: npm ERR! tar.pack Could not write /home/vagrant/.npm/nodegit/0.4.1/package.tgz
==> default: npm ERR! addLocalDirectory Could not pack /usr/lib/node_modules/git-hours/node_modules/nodegit to /home/vagrant/.npm/nodegit/0.4.1/package.tgz
==> default: npm ERR! addLocal Could not install /usr/lib/node_modules/git-hours/node_modules/nodegit
==> default: npm ERR! Linux 3.2.0-23-generic
==> default: npm ERR! argv "node" "/usr/lib/node_modules/git-hours/node_modules/nodegit/node_modules/.bin/npm" "install" "--ignore-scripts"
==> default: npm ERR! node v0.10.37
==> default: npm ERR! npm v2.14.5
==> default: npm ERR! path /home/vagrant/.npm/nodegit/0.4.1/package.tgz.2974a6d18ef76bbd174c29cda9c35c1a
==> default: npm ERR! code EACCES
==> default: npm ERR! errno 3
==> default:
==> default: npm ERR! Error: EACCES, open '/home/vagrant/.npm/nodegit/0.4.1/package.tgz.2974a6d18ef76bbd174c29cda9c35c1a'
==> default: npm ERR! { [Error: EACCES, open '/home/vagrant/.npm/nodegit/0.4.1/package.tgz.2974a6d18ef76bbd174c29cda9c35c1a']
==> default: npm ERR! errno: 3,
==> default: npm ERR! code: 'EACCES',
==> default: npm ERR! path: '/home/vagrant/.npm/nodegit/0.4.1/package.tgz.2974a6d18ef76bbd174c29cda9c35c1a' }
==> default: npm ERR!
==> default: npm ERR! Please try running this command again as root/Administrator.
==> default:
==> default: npm ERR! Please include the following file with any support request:
==> default: npm ERR! /usr/lib/node_modules/git-hours/node_modules/nodegit/npm-debug.log
==> default: ] killed: false, code: 3, signal: null }
==> default: undefined
==> default: /usr/bin/git-hours -> /usr/lib/node_modules/git-hours/src/index.js
==> default: [email protected] /usr/lib/node_modules/git-hours
==> default: ├── [email protected]
==> default: ├── [email protected]
==> default: ├── [email protected]
==> default: ├── [email protected] ([email protected])
==> default: └── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])

Clarifications on differences from Clockout

@kimmobrunfeldt I saw on the clockout repo that you based this tool on that one. I was wondering why you chose not to incorporate "smart" estimation and instead decided to use a simple threshold method.

Also, should we consider adding the clock out and clock in feature? Or I suppose it might be best to do that in a separate project.

At any rate, I am interested in extending the functionality of these tools so we can have more powerful analysis of our work activity.

Segmentation fault and/or wrong NODE_MODULE_VERSION on Windows

Hello!

Running on Window 8.1 + npm 6.3.0 + node 8.9.4
and getting these errors.

Installed lasted version using npm install -g git-hours nodegit

+ [email protected]
+ [email protected]

C:\aaa\Devel>git hours
C:\Users\aaa\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit\dist\nodegit.js:15
    throw ex;
    ^

Error: The module '\\?\C:\Users\aaa\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit\build\Release\nodegit.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 47. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (module.js:672:18)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\aaa\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit\dist\nodegit.js:11:12)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\aaa\AppData\Roaming\npm\node_modules\git-hours\src\index.js:4:11)
    at Module._compile (module.js:643:30)

C:\usr>git hours
C:\Users\aaa\AppData\Roaming\npm\git-hours: line 14: 11076 Segmentation fault      node "$basedir/node_modules/git-hours/src/index.js" "$@"

Does not install with Node 18.x

npm install -g git-hours
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '^14.x' },
npm WARN EBADENGINE   current: { node: 'v18.15.0', npm: '9.2.0' }
npm WARN EBADENGINE }
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     ' **HIDDEN**\\AppData\\Roaming\\npm\\node_modules\\git-hours',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir ' **HIDDEN**\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit\vendor\libgit2\tests\resources\typechanges\.gitted\modules'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: ' **HIDDEN**\\AppData\\Roaming\\npm\\node_modules\\git-hours\\node_modules\\nodegit\\vendor\\libgit2\\tests\\resources\\typechanges\\.gitted\\modules'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     ' **HIDDEN**\\AppData\\Roaming\\npm\\node_modules\\git-hours',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir ' **HIDDEN**\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit\vendor\libgit2\tests\resources\typechanges'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: ' **HIDDEN**\\AppData\\Roaming\\npm\\node_modules\\git-hours\\node_modules\\nodegit\\vendor\\libgit2\\tests\\resources\\typechanges'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     ' **HIDDEN**\\AppData\\Roaming\\npm\\node_modules\\git-hours\\node_modules\\nodegit',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir ' **HIDDEN**\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit\vendor\libgit2\tests\resources\submod2\.gitted\modules\sm_unchanged\logs'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: ' **HIDDEN**\\AppData\\Roaming\\npm\\node_modules\\git-hours\\node_modules\\nodegit\\vendor\\libgit2\\tests\\resources\\submod2\\.gitted\\modules\\sm_unchanged\\logs'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     ' **HIDDEN**\\AppData\\Roaming\\npm\\node_modules\\git-hours\\node_modules',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir ' **HIDDEN**\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit\vendor\libgit2\tests\resources\push_src\.gitted\modules'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: ' **HIDDEN**\\AppData\\Roaming\\npm\\node_modules\\git-hours\\node_modules\\nodegit\\vendor\\libgit2\\tests\\resources\\push_src\\.gitted\\modules'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path  **HIDDEN**\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node lifecycleScripts/preinstall && node lifecycleScripts/install
npm ERR! [nodegit] Running pre-install script
npm ERR! [nodegit] Running install script
npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe  **HIDDEN**\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module= **HIDDEN**\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit\build\Release\nodegit.node --module_name=nodegit --module_path= **HIDDEN**\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit\build\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp
npm ERR! info it worked if it ends with ok
npm ERR! node-pre-gyp info
npm ERR! using [email protected]
npm ERR! node-pre-gyp info using [email protected] | win32 | x64
npm ERR! node-pre-gyp WARN Using request for node-pre-gyp https download
npm ERR! node-pre-gyp info
npm ERR! check checked for " **HIDDEN**\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit\build\Release\nodegit.node" (not found)
npm ERR! node-pre-gyp
npm ERR! http GET https://axonodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v0.27.0-node-v108-win32-x64.tar.gz
npm ERR! node-pre-gyp http 404 https://axonodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v0.27.0-node-v108-win32-x64.tar.gz
npm ERR! node-pre-gyp WARN Tried to download(404): https://axonodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v0.27.0-node-v108-win32-x64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v108 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp http 404 status code downloading tarball https://axonodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v0.27.0-node-v108-win32-x64.tar.gz
npm ERR! gyp
npm ERR! info it worked if it ends with ok
npm ERR! gyp info using
npm ERR! [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp
npm ERR! info
npm ERR! ok
npm ERR!
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using
npm ERR! [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp
npm ERR! info find Python using Python version 3.10.11 found at " **HIDDEN**\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe"
npm ERR! gyp ERR!
npm ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS checking VS2022 (17.1.32328.378) found at:
npm ERR! gyp ERR! find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! gyp
npm ERR! ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS
npm ERR! not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp
npm ERR! ERR! find VS **************************************************************
npm ERR! gyp ERR!
npm ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp
npm ERR! ERR! find VS For more information consult the documentation at:
npm ERR! gyp
npm ERR! ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp
npm ERR! ERR! find VS **************************************************************
npm ERR! gyp
npm ERR! ERR! find VS
npm ERR! gyp
npm ERR! ERR! configure error
npm ERR! gyp
npm ERR! ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR!
npm ERR! stack     at VisualStudioFinder.fail ( **HIDDEN**\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! gyp ERR!
npm ERR! stack     at  **HIDDEN**\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! gyp ERR!
npm ERR! stack     at VisualStudioFinder.findVisualStudio2013 ( **HIDDEN**\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:369:14)
npm ERR! gyp ERR! stack
npm ERR! at  **HIDDEN**\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! gyp ERR! stack     at  **HIDDEN**\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:390:16
npm ERR! gyp ERR! stack     at  **HIDDEN**\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack     at  **HIDDEN**\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:427:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
npm ERR! gyp ERR! System Windows_NT 10.0.26016
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" " **HIDDEN**\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module= **HIDDEN**\\AppData\\Roaming\\npm\\node_modules\\git-hours\\node_modules\\nodegit\\build\\Release\\nodegit.node" "--module_name=nodegit" "--module_path= **HIDDEN**\\AppData\\Roaming\\npm\\node_modules\\git-hours\\node_modules\\nodegit\\build\\Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
npm ERR! gyp ERR! cwd  **HIDDEN**\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit
npm ERR! gyp ERR! node -v v18.15.0
npm ERR! gyp
npm ERR! ERR! node-gyp -v v9.3.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR!
npm ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe  **HIDDEN**\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module= **HIDDEN**\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit\build\Release\nodegit.node --module_name=nodegit --module_path= **HIDDEN**\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit\build\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> ( **HIDDEN**\AppData\Roaming\npm\node_modules\git-hours\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.26016
npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" " **HIDDEN**\\AppData\\Roaming\\npm\\node_modules\\git-hours\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp
npm ERR! ERR! cwd  **HIDDEN**\AppData\Roaming\npm\node_modules\git-hours\node_modules\nodegit
npm ERR! node-pre-gyp ERR!
npm ERR! node -v v18.15.0
npm ERR! node-pre-gyp ERR!
npm ERR! node-pre-gyp -v v0.13.0
npm ERR! node-pre-gyp ERR! not ok
npm ERR! [nodegit] ERROR - Could not finish install
npm ERR! [nodegit] ERROR - finished with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR!      **HIDDEN**\AppData\Local\npm-cache\_logs\2023-12-29T04_08_05_068Z-debug-0.log

Doesn't work in detached HEAD state

It seems that this utility does not work when the repository is in detached HEAD state.

Running:

git checkout @~0
git hours

Results in:

Error: Reference 'refs/remotes/(HEAD/HEAD' not found
    at Error (native)

This is the reason why Travis CI builds fail with Uncaught SyntaxError: Unexpected end of input, which you reported in travis-ci/travis-ci#2493 and this can be confirmed by printing out stderror in any of the tests (the above error is displayed).

403 tar.gz

403 status code downloading tarball https://nodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v0.13.2-node-v51-darwin-x64.tar.gz

with a browser, I get:

<Error>
<script/>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>B07936DF9D117468</RequestId>
<HostId>
wbKl516JO34MDKT4VgxSkm+xjMErxW2PAeXar+WIsYrakX66/gxvleGnnkQhB5gxUfe4v5g5xWY=
</HostId>
</Error>

feature request: add option to base first-commit-add as the difference between first commit for a day and a set start time.

Feature request:

Add option to calculate the first-commit-add value as the difference between first commit for a day and a supplied set start time.

so that:

if start of day is 9:00 AM localtime
and first commit is at 9:00 AM (for that day)
then use 0 as the first commit add time.

if start of day is 9:00 AM localtime
and first commit is at 11:30 AM (for that day)
then use 2.5 hours as the first commit add time.

npm install failed on MacOS HighSierra 10.13.3

$ npm install -g git-hours
[1]  + 44543 suspended (signal)  npm install -g git-hoursModule [email protected] checking
/usr/local/bin/git-hours -> /usr/local/lib/node_modules/git-hours/src/index.js

> [email protected] install /usr/local/lib/node_modules/git-hours/node_modules/nodegit
> node lifecycleScripts/install

[nodegit] Fetching binary from S3.
[nodegit] Failed to install prebuilt binary:
{ Error: Command failed: "/usr/local/lib/node_modules/git-hours/node_modules/nodegit/node_modules/.bin/node-pre-gyp" install --fallback-to-build=false
node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ '/usr/local/Cellar/node/9.11.1/bin/node',
node-pre-gyp verb cli   '/usr/local/lib/node_modules/git-hours/node_modules/nodegit/node_modules/.bin/node-pre-gyp',
node-pre-gyp verb cli   'install',
node-pre-gyp verb cli   '--fallback-to-build=false' ]
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | x64
node-pre-gyp verb command install []
node-pre-gyp info check checked for "/usr/local/lib/node_modules/git-hours/node_modules/nodegit/build/Release/nodegit.node" (not found)
node-pre-gyp http GET https://nodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v0.13.2-node-v59-darwin-x64.tar.gz
node-pre-gyp http 403 https://nodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v0.13.2-node-v59-darwin-x64.tar.gz
node-pre-gyp ERR! install error 
node-pre-gyp ERR! stack Error: 403 status code downloading tarball https://nodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v0.13.2-node-v59-darwin-x64.tar.gz
node-pre-gyp ERR! stack     at Request.<anonymous> (/usr/local/lib/node_modules/git-hours/node_modules/nodegit/node_modules/node-pre-gyp/lib/install.js:101:37)
node-pre-gyp ERR! stack     at Request.emit (events.js:185:15)
node-pre-gyp ERR! stack     at Request.onRequestResponse (/usr/local/lib/node_modules/git-hours/node_modules/request/request.js:1068:10)
node-pre-gyp ERR! stack     at ClientRequest.emit (events.js:180:13)
node-pre-gyp ERR! stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:540:21)
node-pre-gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:117:17)
node-pre-gyp ERR! stack     at TLSSocket.socketOnData (_http_client.js:445:20)
node-pre-gyp ERR! stack     at TLSSocket.emit (events.js:180:13)
node-pre-gyp ERR! stack     at addChunk (_stream_readable.js:274:12)
node-pre-gyp ERR! stack     at readableAddChunk (_stream_readable.js:261:11)
node-pre-gyp ERR! System Darwin 17.4.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/9.11.1/bin/node" "/usr/local/lib/node_modules/git-hours/node_modules/nodegit/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build=false"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/git-hours/node_modules/nodegit
node-pre-gyp ERR! node -v v9.11.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.28
node-pre-gyp ERR! not ok 

    at ChildProcess.exithandler (child_process.js:273:12)
    at ChildProcess.emit (events.js:180:13)
    at maybeClose (internal/child_process.js:936:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: '"/usr/local/lib/node_modules/git-hours/node_modules/nodegit/node_modules/.bin/node-pre-gyp" install --fallback-to-build=false' }
[nodegit] Building manually. (You'll be here a while.)
[nodegit] Regenerating and configuring code

$ git-hours
internal/modules/cjs/loader.js:550
    throw err;
    ^

Error: Cannot find module '../build/Debug/nodegit.node'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
    at Function.Module._load (internal/modules/cjs/loader.js:475:25)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/git-hours/node_modules/nodegit/dist/nodegit.js:18:12)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/git-hours/src/index.js:4:11)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)

System Information

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.13.3
BuildVersion:	17D102

$ node -v
v9.11.1

take into account squashed commits

not sure exactly how to do this. would be nice if this took into account commits that were squashed. some examples are:

  • branches that were merge --squash
  • commits that were squashed prior to commit

Calculate for specific user

Is it possible to calculate the hours for each specific commit author? This is pretty useful when you end up with a shared branch that has multiple contributors.

Feature-Request: Track lines modified

Depending on how much people commit at once, we get vastly different results for roughly the same amount of work. (One massive commit a day vs. lots of regular, tiny commits)
It would be nice if the tool could also track the number of lines that were modified (deletions, insertions, modifications) as this might be more transparent in some instances.

Errors finding modules after install

I first installed Vagrant and VirtualBox

installed Vagrant on macOS 10.14.6
installed VirtualBox on macOS 10.14.6

Then I installed git-hours:

https://github.com/kimmobrunfeldt/git-hours
cd git-hours
vagrant up && vagrant ssh

I then needed to install git inside the ssh session. Then I attempted to access my git repo

git clone https://github.com/appsird/iAmp-xxxx.git
user:
pw:
cd iAmp-xxxx
git hours

I received a missing module error - and many others on Google search had this same error for different reasons. Is there a means to run this application without dependencies for a VM OS and other pieces. Can I run directly in macOS, which is Debian instead?

vagrant@vagrant-ubuntu-trusty-64:~/iAmp-iOS-13$ git hours
module.js:338
    throw err;
          ^
Error: Cannot find module '../build/Debug/nodegit.node'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/lib/node_modules/git-hours/node_modules/nodegit/dist/nodegit.js:18:12)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/lib/node_modules/git-hours/src/index.js:4:11)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
vagrant@vagrant-ubuntu-trusty-64:~/iAmp-iOS-13$ 

So, I spent 3 hours trying to vagrant up

....then, finally, I install my repo, and type 'git hours' at the prompt expecting magic.
I get this

vagrant@git-hours:/XXXXXX$ git hours
git: 'hours' is not a git command. See 'git --help'.
vagrant@git-hours:
/XXXXXX$

Any idea at all?

git-hours cannot be launched from npx

Env

Software Version
node v10.16.0
npm 6.12.0
OS Archlinux

Suggestions

  1. As mentioned in the readme, it is tricky to work with nodegit, could we not depends on it? e.g. just via exec git log then parse the stdout directly
  2. Could we rewrite it to be standlone npm executable? Instead of hooking onto git alias, i.e. git-hours instead of git hours

Installed but "git: 'hours' is not a git command"

I tried installing this helper. From what I can tell both git-hours:

$ npm list -g | grep git-hours
├─┬ [email protected]

and nodegit:

$ npm list -g | grep nodegit
│ └─┬ [email protected]
│     └─┬ [email protected]
└─┬ [email protected]
    └─┬ [email protected]

seem installed. However, when I run $ git hours in a git repository root I get this message:

$ git hours
git: 'hours' is not a git command. See 'git --help'.

My npm version is 5.6.0, my node is 9.5.0.

Which node version is supported?

I am trying to install git-hours - could you maybe reference which node versions are supported? I am currently using v16.11.1.

Proper installation instructions?

Neither npm, docker or vagrant routes work as expected when following the readme.

Was anyone able to get this to work?

My two cents: This should be mentioned in the readme so more devs time is not wasted :/

Take diff size into account when estimating first commit work in each session

For the first commit of each "coding session", we cannot tell how much time was spent on it based on the timestamps alone. Currently, the algorithm simply uses a constant to estimate the work for those commits. I believe better estimates can be easily made.

Proposed algorithm:

  • Group commits into commit sessions, separating where time between commits > 2h (same as current algorithm)
  • Estimate average time to edit a line of code:
    • let known_work be the set of commits with known hours of work (i.e., all but the first commit in each session)
    • average time to edit a line of code = total lines edited in known_work / total time spent in known_work
  • Estimate total time spent:
    • For the first commit in each session, multiply the number of lines changed in that commit by the average time to edit a line of code
    • For other commits, assume the entire duration since the last commit was spent working (same as current algorithm)

Other considerations and alternatives:

  • Instead of time per line, we could use time per character or other metric
  • Instead of estimating hours of work based on time per line, we could assume that the time spent on the first commit in a session would be similar to the time spent on other commits.
  • For first commits, the estimated time may be capped by the duration since last commit
  • Current algorithms assume there is 1 author if I understand correctly. Would be nice to compute time per-author. Not only would this be a more detailed metric, but it would also be more accurate, as 2 people committing at the same time shouldn't be considered a single session.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.