Add per-repository --git-dir option

Sebastian Neuser 3 years ago updated by Marc Strapetz 3 years ago 4

Sometimes developers want/need to move the git repository (aka. .git directory) out of the working directory. The CLI provides an option --git-dir=/foo/bar which allows one to specify a custom .git directory location. As far as I understand, this can not be done with SmartGit.

It would be really cool if we could configure this on a per-repository basis.

Possibly. I am talking about `man git | grep -A2 '    --git-dir='`:

    Set the path to the repository. This can also be controlled by setting the GIT_DIR environment variable. It can be an absolute path or relative path to current working directory.

One way to implement this could indeed be a .git file at the repository TLD containing:

gitdir: ../foo/bar

Not specific commands actually. If SmartGit already supports .git files, all you have to do is create a nice GUI that

  • moves the .git folder to the intended destination
  • creates the .git file (if not already present) and
  • configures the gitdir setting in the .git file.

Maybe a new tab in the [Repository > Settings] dialog?

Today we configured the repository in question. While generally everything seems to work, it appears to be quite slow.

Also SmartGit displays the following warning:

The repository has an error-prone admin area configuration.

For the repository the .git-admin directory is located at C:\GIT\foobar.git.
If the repository is not located on the same drive as the admin area, this will cause troubles for Refreshing.

Could you please elaborate on "troubles for Refreshing"?