Skip to content

Commit

Permalink
Flags: discourage the use of absolute in-repo paths for bazel options (
Browse files Browse the repository at this point in the history
…#75)

Document that the user should use the relative form for paths passed to bazel options via `--bazel-opts` and `--bazel-startup-opts`.

Target-determinator may query target information in git worktrees, which live in different directories. When this is the case, passing an absolute path in a bazel option, like `--bazel-startup-opts=--bazelrc=/my/repo.git/mybazelrc`, results in unexpected behaviors if the `mybazelrc` changed between the "before" and "after" commit.
  • Loading branch information
sitaktif authored Oct 4, 2023
1 parent cfae1f3 commit c1521bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ func RegisterCommonFlags() *CommonFlags {
flag.StringVar(commonFlags.WorkingDirectory, "working-directory", ".", "Working directory to query.")
flag.StringVar(commonFlags.BazelPath, "bazel", "bazel",
"Bazel binary (basename on $PATH, or absolute or relative path) to run.")
flag.Var(commonFlags.BazelStartupOpts, "bazel-startup-opts", "Startup options to pass to Bazel.")
flag.Var(commonFlags.BazelOpts, "bazel-opts", "Options to pass to Bazel. Assumed to apply to build and cquery.")
flag.Var(commonFlags.BazelStartupOpts, "bazel-startup-opts", "Startup options to pass to Bazel. Options such as '--bazelrc' should use relative paths for files under the repository to avoid issues (TD may check out the repository in a temporary directory).")
flag.Var(commonFlags.BazelOpts, "bazel-opts", "Options to pass to Bazel. Assumed to apply to build and cquery. Options should use relative paths for repository files (see --bazel-startup-opts).")
flag.Var(&commonFlags.EnforceCleanRepo, "enforce-clean",
fmt.Sprintf("Pass --enforce-clean=%v to fail if the repository is unclean, or --enforce-clean=%v to allow ignored untracked files (the default).",
EnforceClean.String(), AllowIgnored.String()))
Expand Down

0 comments on commit c1521bb

Please sign in to comment.