rwjblue / git-repo-info

MIT License
112 stars 28 forks source link

Add support for linked worktrees #26

Closed hjdivad closed 8 years ago

hjdivad commented 8 years ago

Within a linked worktree (ie a worktree created via git worktree add) .git is a file that points to a worktree git dir (within the repo's .git). This directory contains HEAD and a file that contains the path to the repo's git dir.

findRepo now returns a POJO with two paths: the worktree git dir and the common git dir. For the base work tree, these paths will be the same. For a linked worktree, they will be different, eg

{
  worktreeGitDir: '<GIT_DIR>/worktrees/base',
  commonGitDir:   '<GIT_DIR>',
}

[Fix #25]

rwjblue commented 8 years ago

Thanks @hjdivad!

rwjblue commented 8 years ago

Published as v1.3.0

john-kurkowski commented 8 years ago

This is a breaking change, right? A public function used to return a string, now a POJO? Should this be v2.0.0?

EDIT: No public function changed here. My bad.

rwjblue commented 8 years ago

@john-kurkowski - Hmm, can you please open an issue describing where you are hitting breaking change here?

The change (unless I have completely misread before merge) is that require('git-repo-info')._findRepo has a different return value, but that leading underscore generally indicates private API and the documented usage is require('git-repo-info')() which has the same return value...

john-kurkowski commented 8 years ago

Oops, you're right. We were using the private method. Thank you for the quick response. Never mind!

hjdivad commented 8 years ago

Thanks for the fast merge @rwjblue! 🎉 🍻