Skip to content

gitserver: Only support name/.git paths

Warren Gifford requested to merge core/gitserver-remove-old-style-paths into master

Created by: keegancsmith

@sourcegraph/core-services This doesn't update all the tests that break outside of the gitserver tests (mostly tests that use our gittest package that makes incorrect assumptions). I wanted feedback on if this approach is good before updating them.

Originally gitserver cloned bare repos to ReposDir/name. However, this didn't allow any child repos like ReposDir/name/subname (which some customers on gitolite have). So we migrated all repos to be stored at ReposDir/name/.git. To prevent disruption we supported reading repositories at both the old style and new style. The old style should not exist anymore (the migration is so old, we have removed it). We didn't remove the backwards compatibility support due to fear of breaking something. This commit removes that support.

To remove the support we introduce a tiny type GitDir, and all functions which operate on git directories now take a GitDir instead of a string. This made it possible to audit all the call sites and how they interpreted the directory. Now GitDir will always point to a .git, which simplifies many assumptions going forward.

Fixes https://github.com/sourcegraph/sourcegraph/issues/2496

Merge request reports

Loading