From 488d54d4eea1e0bae5c6056ae628b783d4f716c0 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 19 Aug 2022 06:47:35 -0400 Subject: [PATCH] init: show a notice when reinitializing Make it clear to users when we're reinitializing an existing checkout in case they weren't expecting it. Bug: https://crbug.com/gerrit/12396 Change-Id: I22e89ae041a8e7b147c9d06a82f1302dd5807ae0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/343535 Reviewed-by: LaMont Jones Tested-by: Mike Frysinger --- subcmds/init.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subcmds/init.py b/subcmds/init.py index bcccae06..803f39a6 100644 --- a/subcmds/init.py +++ b/subcmds/init.py @@ -315,6 +315,13 @@ to update the working directory files. # Older versions of git supported worktree, but had dangerous gc bugs. git_require((2, 15, 0), fail=True, msg='git gc worktree corruption') + # Provide a short notice that we're reinitializing an existing checkout. + # Sometimes developers might not realize that they're in one, or that + # repo doesn't do nested checkouts. + existing_checkout = self.manifest.manifestProject.Exists + if not opt.quiet and existing_checkout: + print('repo: reusing existing repo client checkout in', self.manifest.topdir) + self._SyncManifest(opt) if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror: