-
-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow dolt init
on dolt repo with just config.json
#8838
base: main
Are you sure you want to change the base?
Conversation
@coffeegoddd DOLT
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double check the logic in that condition I commented on, and then this looks good to go. Could be worth adding a test where a .dolt
dir does have a TimDirName
directory in it to make sure that case is working as expected.
run dolt config --add user.name foo | ||
[ "$status" -eq 0 ] | ||
run dolt config --add user.email [email protected] | ||
[ "$status" -eq 0 ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(minor) if you just want to ensure that the commend exits with a success status (without checking any output), you can omit run
and you'll get that automatically. Not a big deal, but saves a couple lines.
run dolt config --add user.name foo | |
[ "$status" -eq 0 ] | |
run dolt config --add user.email [email protected] | |
[ "$status" -eq 0 ] | |
dolt config --add user.name foo | |
dolt config --add user.email [email protected] |
@@ -499,7 +499,7 @@ func (dEnv *DoltEnv) createDirectories(dir string) (string, error) { | |||
} | |||
|
|||
if len(entries) == 1 { | |||
if !entries[0].IsDir() || entries[0].Name() != TmpDirName { | |||
if (!entries[0].IsDir() && entries[0].Name() != TmpDirName) && (!entries[0].IsDir() && entries[0].Name() != configFile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic doesn't seem correct to me 🤔 Looking at the original logic... seems like we were originally allowing only a directory named TmpDirName
, but this new logic wouldn't allow that anymore.
I think you actually want something like this:
if (!entries[0].IsDir() && entries[0].Name() != TmpDirName) && (!entries[0].IsDir() && entries[0].Name() != configFile) { | |
entry := entries[0] | |
if (entry.IsDir && entry.Name() != TmpDirName) || (!entry.IsDir() && entry.Name() != configFile) { |
This PR changes
dolt init
to allow the dolt repo to still be created when there are no global users, but there are local users in.dolt/config.json
.In order to get to that state you must do
related: #8835