mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-07-27 06:18:23 +00:00
init: Add --use-local-gitdirs for standard Git layouts
Introduce --use-local-gitdirs to bypass repo's symlink-based layouts in favor of standard local .git directories. Bug: 513329573 Bug: 508146070 Change-Id: I53d1602e61be0b86964529bcbea3dc801471f9c9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/569001 Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Dan Willemsen <dwillemsen@google.com>
This commit is contained in:
committed by
gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
2d54384a5e
commit
b8531133de
+18
-8
@@ -1055,6 +1055,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
|
||||
def UseGitWorktrees(self):
|
||||
return self.manifestProject.use_worktree
|
||||
|
||||
@property
|
||||
def UseLocalGitDirs(self):
|
||||
return self.manifestProject.use_local_gitdirs
|
||||
|
||||
@property
|
||||
def IsArchive(self):
|
||||
return self.manifestProject.archive
|
||||
@@ -2042,15 +2046,21 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
|
||||
else:
|
||||
namepath = f"{name}.git"
|
||||
worktree = os.path.join(self.topdir, path).replace("\\", "/")
|
||||
gitdir = os.path.join(self.subdir, "projects", "%s.git" % path)
|
||||
# We allow people to mix git worktrees & non-git worktrees for now.
|
||||
# This allows for in situ migration of repo clients.
|
||||
if os.path.exists(gitdir) or not self.UseGitWorktrees:
|
||||
objdir = os.path.join(self.repodir, "project-objects", namepath)
|
||||
else:
|
||||
use_git_worktrees = True
|
||||
gitdir = os.path.join(self.repodir, "worktrees", namepath)
|
||||
if self.UseLocalGitDirs:
|
||||
gitdir = os.path.join(worktree, ".git")
|
||||
objdir = gitdir
|
||||
else:
|
||||
gitdir = os.path.join(self.subdir, "projects", "%s.git" % path)
|
||||
# We allow people to mix git worktrees & non-git worktrees for
|
||||
# now. This allows for in situ migration of repo clients.
|
||||
if os.path.exists(gitdir) or not self.UseGitWorktrees:
|
||||
objdir = os.path.join(
|
||||
self.repodir, "project-objects", namepath
|
||||
)
|
||||
else:
|
||||
use_git_worktrees = True
|
||||
gitdir = os.path.join(self.repodir, "worktrees", namepath)
|
||||
objdir = gitdir
|
||||
return relpath, worktree, gitdir, objdir, use_git_worktrees
|
||||
|
||||
def GetProjectsWithName(self, name, all_manifests=False):
|
||||
|
||||
Reference in New Issue
Block a user