mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-28 10:19:56 -06:00
Updates to error handling for unset configs. (#1444)
Co-authored-by: Lawrence Cook <lawrencescook@gmail.com>
This commit is contained in:
@@ -64,11 +64,11 @@ func NewCommitMetaWithUserTS(name, email, desc string, userTS time.Time) (*Commi
|
||||
d := strings.TrimSpace(desc)
|
||||
|
||||
if n == "" {
|
||||
return nil, errors.New("Aborting commit due to empty committer name.")
|
||||
return nil, errors.New("Aborting commit due to empty committer name. Is your config set?")
|
||||
}
|
||||
|
||||
if e == "" {
|
||||
return nil, errors.New("Aborting commit due to empty committer email.")
|
||||
return nil, errors.New("Aborting commit due to empty committer email. Is your config set?")
|
||||
}
|
||||
|
||||
if d == "" {
|
||||
|
||||
@@ -164,3 +164,26 @@ teardown() {
|
||||
regex='John Doe <john@doe.com>'
|
||||
[[ "$output" =~ "$regex" ]] || false
|
||||
}
|
||||
|
||||
@test "config: COMMIT correctly errors when user.name or user.email is unset." {
|
||||
dolt config --global --add user.name "bats tester"
|
||||
dolt config --global --add user.email "joshn@doe.com"
|
||||
|
||||
dolt init
|
||||
dolt sql -q "
|
||||
CREATE TABLE test (
|
||||
pk int primary key
|
||||
)"
|
||||
|
||||
dolt config --global --unset user.name
|
||||
dolt config --global --unset user.email
|
||||
|
||||
run dolt sql -q "SET @@dolt_repo_$$_head = COMMIT('-a', '-m', 'updated stuff')"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Aborting commit due to empty committer name. Is your config set" ]] || false
|
||||
|
||||
dolt config --global --add user.name "bats tester"
|
||||
run dolt sql -q "SET @@dolt_repo_$$_head = COMMIT('-a', '-m', 'updated stuff')"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Aborting commit due to empty committer email. Is your config set" ]] || false
|
||||
}
|
||||
Reference in New Issue
Block a user