mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-08 02:36:27 -05:00
Addressing PR Feedback
Renamed a variable to be more clear, and updated documentation for the --use-db flag.
This commit is contained in:
+1
-1
@@ -633,7 +633,7 @@ func buildGlobalArgs() *argparser.ArgParser {
|
||||
ap.SupportsString(commands.CfgDirFlag, "", "directory", "Defines a directory that contains configuration files for dolt. Defaults to `$data-dir/.doltcfg`. Will only be created if there is a change to configuration settings.")
|
||||
ap.SupportsString(commands.PrivsFilePathFlag, "", "privilege file", "Path to a file to load and store users and grants. Defaults to `$doltcfg-dir/privileges.db`. Will only be created if there is a change to privileges.")
|
||||
ap.SupportsString(commands.BranchCtrlPathFlag, "", "branch control file", "Path to a file to load and store branch control permissions. Defaults to `$doltcfg-dir/branch_control.db`. Will only be created if there is a change to branch control permissions.")
|
||||
ap.SupportsString(commands.UseDbFlag, "", "database", "The name of the database to use when executing SQL queries. Defaults to the first database alphabetically.")
|
||||
ap.SupportsString(commands.UseDbFlag, "", "database", "The name of the database to use when executing SQL queries. Defaults the database of the root directory, if it exists, and the first alphabetically if not.")
|
||||
|
||||
return ap
|
||||
}
|
||||
|
||||
+9
-9
@@ -69,31 +69,31 @@ func MultiEnvForSingleEnv(ctx context.Context, env *DoltEnv) (*MultiRepoEnv, err
|
||||
func MultiEnvForDirectory(
|
||||
ctx context.Context,
|
||||
config config.ReadWriteConfig,
|
||||
fs filesys.Filesys, // fs which is the root of the multi-env. This is essentially the --data-dir flag or cwd.
|
||||
dataDirFS filesys.Filesys,
|
||||
version string,
|
||||
ignoreLockFile bool,
|
||||
dEnv *DoltEnv,
|
||||
) (*MultiRepoEnv, error) {
|
||||
// Load current fs and put into mr env
|
||||
// Load current dataDirFS and put into mr env
|
||||
var dbName string = "dolt"
|
||||
var newDEnv *DoltEnv = dEnv
|
||||
|
||||
// InMemFS is used only for testing.
|
||||
// All other FS Types should get a newly created Envronment which will serve as the primary env in the MultiRepoEnv
|
||||
if _, ok := fs.(*filesys.InMemFS); !ok {
|
||||
path, err := fs.Abs("")
|
||||
// All other FS Types should get a newly created Environment which will serve as the primary env in the MultiRepoEnv
|
||||
if _, ok := dataDirFS.(*filesys.InMemFS); !ok {
|
||||
path, err := dataDirFS.Abs("")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
envName := getRepoRootDir(path, string(os.PathSeparator))
|
||||
dbName = dirToDBName(envName)
|
||||
|
||||
newDEnv = Load(ctx, GetCurrentUserHomeDir, fs, doltdb.LocalDirDoltDB, version)
|
||||
newDEnv = Load(ctx, GetCurrentUserHomeDir, dataDirFS, doltdb.LocalDirDoltDB, version)
|
||||
}
|
||||
|
||||
mrEnv := &MultiRepoEnv{
|
||||
envs: make([]NamedEnv, 0),
|
||||
fs: fs,
|
||||
fs: dataDirFS,
|
||||
cfg: config,
|
||||
dialProvider: NewGRPCDialProviderFromDoltEnv(newDEnv),
|
||||
ignoreLockFile: ignoreLockFile,
|
||||
@@ -105,14 +105,14 @@ func MultiEnvForDirectory(
|
||||
}
|
||||
|
||||
// If there are other directories in the directory, try to load them as additional databases
|
||||
fs.Iter(".", false, func(path string, size int64, isDir bool) (stop bool) {
|
||||
dataDirFS.Iter(".", false, func(path string, size int64, isDir bool) (stop bool) {
|
||||
if !isDir {
|
||||
return false
|
||||
}
|
||||
|
||||
dir := filepath.Base(path)
|
||||
|
||||
newFs, err := fs.WithWorkingDir(dir)
|
||||
newFs, err := dataDirFS.WithWorkingDir(dir)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user