Skip to content

Commit

Permalink
cmd/root: skip remote discuvery for initSkipped commands
Browse files Browse the repository at this point in the history
Some commands basically skips the lab.Init() code, meaning that they
don't intend to actually interact with the git repository. With that, we
can also skip the remote discovery code to avoid misleading errors
about missing remote for commands that skipped the init code.

Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
  • Loading branch information
bmeneg committed Feb 10, 2022
1 parent 8ab707a commit 6a18256
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func Execute(initSkipped bool) {
// Try to gather remote information if running inside a git tree/repo.
// Otherwise, skip it, since the info won't be used at all, also avoiding
// misleading error/warning messages about missing remote.
if git.InsideGitRepo() {
if !initSkipped && git.InsideGitRepo() {
defaultRemote = guessDefaultRemote()
if defaultRemote == "" {
log.Infoln("No default remote found")
Expand Down

0 comments on commit 6a18256

Please sign in to comment.