From af2ae5b533dc20aea4d36f478df771b929b93863 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Sat, 31 Oct 2020 10:26:27 -0700 Subject: [PATCH] Make the --root flag required, no default BREAKING CHANGE The default of $HOME has caused problems for people playing with git-sync, so this change makes it a required argument. --- README.md | 2 +- cmd/git-sync/main.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1970d20..8c4de3b 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ docker run -d \ | GIT_SYNC_REV | `--rev` | the git revision (tag or hash) to check out | "HEAD" | | GIT_SYNC_DEPTH | `--depth` | use a shallow clone with a history truncated to the specified number of commits | 0 | | GIT_SYNC_SUBMODULES | `--submodules` | git submodule behavior: one of 'recursive', 'shallow', or 'off' | recursive | -| GIT_SYNC_ROOT | `--root` | the root directory for git-sync operations, under which --dest will be created | "$HOME/git" | +| GIT_SYNC_ROOT | `--root` | the root directory for git-sync operations, under which --dest will be created | "" | | GIT_SYNC_DEST | `--dest` | the name of (a symlink to) a directory in which to check-out files under --root (defaults to the leaf dir of --repo) | "" | | GIT_SYNC_PERIOD | `--period` | how long to wait between syncs, must be >= 10ms | "10s" | | GIT_SYNC_SYNC_TIMEOUT | `--sync-timeout` | the total time allowed for one complete sync, must be >= 10ms | "120s" | diff --git a/cmd/git-sync/main.go b/cmd/git-sync/main.go index 84a943e..7ceff3b 100644 --- a/cmd/git-sync/main.go +++ b/cmd/git-sync/main.go @@ -62,7 +62,7 @@ var flDepth = pflag.Int("depth", envInt("GIT_SYNC_DEPTH", 0), var flSubmodules = pflag.String("submodules", envString("GIT_SYNC_SUBMODULES", "recursive"), "git submodule behavior: one of 'recursive', 'shallow', or 'off'") -var flRoot = pflag.String("root", envString("GIT_SYNC_ROOT", envString("HOME", "")+"/git"), +var flRoot = pflag.String("root", envString("GIT_SYNC_ROOT", ""), "the root directory for git-sync operations, under which --dest will be created") var flDest = pflag.String("dest", envString("GIT_SYNC_DEST", ""), "the name of (a symlink to) a directory in which to check-out files under --root (defaults to the leaf dir of --repo)") @@ -1136,7 +1136,7 @@ OPTIONS --root , $GIT_SYNC_ROOT The root directory for git-sync operations, under which --dest will - be created. (default: $HOME/git) + be created. This flag is required. --ssh, $GIT_SYNC_SSH Use SSH for git authentication and operations.