kevmoo / git

A dart wrapper around the git command line binary

Home Page:https://pub.dev/packages/git

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support bare repositories with different worktrees

dalewking opened this issue · comments

I need the ability to work with a bare repo with multiple work trees. So what I would like to be able to see is:

  • The ability to pass a path to the actual git directory like "/some/directory/.git" or in the case of true bare repository a path like "/some/directory/myProject.git" and get a GitDir._raw of that path without a work tree. All that requires is changing
    if (returnedPath == '.git') {

to

    if (returnedPath == '.git' || returnedPath = '.') {
  • To better support working trees you might want to think about changing the --git-dir argument to --git-common-dir
  • The ability to take a GitDir and create a version with another working tree. You can verify that working tree arg passed points to the actual git dir using --git-common-dir

PRs welcome! Please include tests!