diff --git a/README.md b/README.md index 7d59ef4..f894bf5 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ docker run -d \ | GIT_SYNC_BRANCH | `--branch` | the git branch to check out | "master" | | 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` | submodule clone option. One of recursive, shallow (does not use --recursive flag), or off (no submodule cloning) | recursive | +| 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_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_WAIT | `--wait` | the number of seconds between syncs | 0 | diff --git a/cmd/git-sync/main.go b/cmd/git-sync/main.go index 3d29303..ac6bd36 100644 --- a/cmd/git-sync/main.go +++ b/cmd/git-sync/main.go @@ -55,7 +55,7 @@ var flRev = flag.String("rev", envString("GIT_SYNC_REV", "HEAD"), var flDepth = flag.Int("depth", envInt("GIT_SYNC_DEPTH", 0), "use a shallow clone with a history truncated to the specified number of commits") var flSubmodules = flag.String("submodules", envString("GIT_SYNC_SUBMODULES", "recursive"), - "Configure submodule behavior - options are 'recursive', 'shallow' and 'off'.") + "git submodule behavior: one of 'recursive', 'shallow', or 'off'") var flRoot = flag.String("root", envString("GIT_SYNC_ROOT", envString("HOME", "")+"/git"), "the root directory for git-sync operations, under which --dest will be created") @@ -135,9 +135,9 @@ var ( const initTimeout = time.Second * 30 const ( - SubmoduleModeRecursive = "recursive" - SubmoduleModeOff = "off" - SubmoduleModeShallow = "shallow" + submodulesRecursive = "recursive" + submodulesShallow = "shallow" + submodulesOff = "off" ) func init() { @@ -259,9 +259,9 @@ func main() { } switch *flSubmodules { - case SubmoduleModeRecursive, SubmoduleModeShallow, SubmoduleModeOff: + case submodulesRecursive, submodulesShallow, submodulesOff: default: - fmt.Fprintf(os.Stderr, "ERROR: --submodules must be one of %s, %s or %s, but recieved %s", SubmoduleModeRecursive, SubmoduleModeOff, SubmoduleModeShallow, *flSubmodules) + fmt.Fprintf(os.Stderr, "ERROR: --submodules must be one of %q, %q, or %q", submodulesRecursive, submodulesShallow, submodulesOff) os.Exit(1) } @@ -540,10 +540,10 @@ func addWorktreeAndSwap(ctx context.Context, gitRoot, dest, branch, rev string, // Update submodules // NOTE: this works for repo with or without submodules. - if submoduleMode != SubmoduleModeOff { + if submoduleMode != submodulesOff { log.V(0).Info("updating submodules") submodulesArgs := []string{"submodule", "update", "--init"} - if submoduleMode == SubmoduleModeRecursive { + if submoduleMode == submodulesRecursive { submodulesArgs = append(submodulesArgs, "--recursive") } if depth != 0 {