Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ Name | Type | Description
<span style="white-space: nowrap;">`--noansi`</span> | *boolean* | Don't use ANSI output for messages
<span style="white-space: nowrap;">`--nocleanup`</span> | *boolean* | Cleanup the output directories. This includes the workdir, scratch clones of Git repos, etc. By default is set to false and directories will be cleaned prior to the execution. If set to true, the previous run output will not be cleaned up. Keep in mind that running in this mode will lead to an ever increasing disk usage.
<span style="white-space: nowrap;">`--output-limit`</span> | *int* | Limit the output in the console to a number of records. Each subcommand might use this flag differently. Defaults to 0, which shows all the output.
<span style="white-space: nowrap;">`--output-root`</span> | *string* | The root directory where to generate output files. If not set, ~/copybara/out is used by default. Use with care, Copybara might remove files inside this root if necessary.
<span style="white-space: nowrap;">`--output-root`</span> | *string* | The root directory where to generate output files. If not set, ~/.local/share/copybara is used by default. Use with care, Copybara might remove files inside this root if necessary.
<span style="white-space: nowrap;">`--squash`</span> | *boolean* | Override workflow's mode with 'SQUASH'. This is useful mainly for workflows that use 'ITERATIVE' mode, when we want to run a single export with 'SQUASH', maybe to fix an issue. Always use --dry-run before, to test your changes locally.
<span style="white-space: nowrap;">`--validate-starlark`</span> | *string* | Starlark should be validated prior to execution, but this might break legacy configs. Options are LOOSE, STRICT
<span style="white-space: nowrap;">`-v, --verbose`</span> | *boolean* | Verbose output.
Expand Down
19 changes: 12 additions & 7 deletions java/com/google/copybara/GeneralOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,20 @@ public <T> T ioRepoTask(String description, Callable<T> callable)
* Returns a {@link DirFactory} capable of creating directories in a self contained location in
* the filesystem.
*
* <p>By default, the directories are created under {@code $HOME/copybara}, but it can be
* overridden with the flag --output-root.
* <p>By default, the directories are created under {@code $XDG_DATA_HOME/copybara} (falling back
* to {@code $HOME/.local/share/copybara}), but it can be overridden with the flag
* --output-root.
*/
public DirFactory getDirFactory() {
if (getOutputRoot() != null) {
return new DirFactory(getOutputRoot());
} else {
String home = checkNotNull(environment.get("HOME"), "$HOME environment var is not set");
return new DirFactory(fileSystem.getPath(home).resolve("copybara"));
String errMessage = "Neither $HOME nor $XDG_DATA_HOME environment vars are set";
String outputRoot = environment.get("XDG_DATA_HOME") != null
? environment.get("XDG_DATA_HOME")
: checkNotNull(environment.get("HOME"), errMessage) + "/.local/share";

return new DirFactory(fileSystem.getPath(outputRoot, "copybara"));
}
}

Expand Down Expand Up @@ -362,9 +367,9 @@ public CommandRunner newCommandRunner(Command cmd) {
@Parameter(
names = OUTPUT_ROOT_FLAG,
description =
"The root directory where to generate output files. If not set, ~/copybara/out is used "
+ "by default. Use with care, Copybara might remove files inside this root if "
+ "necessary.")
"The root directory where to generate output files. If not set, ~/.local/share/copybara "
+ "is used by default. Use with care, Copybara might remove files inside this root "
+ "if necessary.")
String outputRoot = null;

@Parameter(
Expand Down