mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-06 00:39:40 -06:00
reset hard fixes (#706)
This commit is contained in:
@@ -223,10 +223,8 @@ SQL
|
||||
dolt reset --hard
|
||||
run dolt status
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "On branch master" ]] || false
|
||||
[[ "$output" =~ "Untracked files" ]] || false
|
||||
[[ "$output" =~ ([[:space:]]*new table:[[:space:]]*test) ]] || false
|
||||
[[ ! "$output" =~ "LICENSE.md" ]] || false
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "nothing to commit, working tree clean" ]] || false
|
||||
run cat LICENSE.md
|
||||
[ "$output" = "license-text" ]
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ SQL
|
||||
run dolt status
|
||||
[[ ! "$output" =~ "test1" ]] || false
|
||||
[[ ! "$output" =~ "test2" ]] || false
|
||||
[[ "$output" =~ file.*test3 ]] || false
|
||||
[[ ! "$output" =~ file.*test3 ]] || false
|
||||
[[ "$output" =~ file.*test4 ]] || false
|
||||
}
|
||||
|
||||
@@ -180,7 +180,6 @@ SQL
|
||||
dolt add test1 test2
|
||||
dolt reset --hard
|
||||
run dolt status
|
||||
skip "dolt reset --hard does not delete tracked new tables"
|
||||
[[ ! "$output" =~ table.*test1 ]] || false
|
||||
[[ ! "$output" =~ table.*test2 ]] || false
|
||||
[[ "$output" =~ "nothing to commit" ]] || false
|
||||
|
||||
@@ -98,7 +98,7 @@ func (cmd ResetCmd) Exec(ctx context.Context, commandStr string, args []string,
|
||||
if apr.ContainsAll(HardResetParam, SoftResetParam) {
|
||||
verr = errhand.BuildDError("error: --%s and --%s are mutually exclusive options.", HardResetParam, SoftResetParam).Build()
|
||||
} else if apr.Contains(HardResetParam) {
|
||||
verr = resetHard(ctx, dEnv, apr, workingRoot, headRoot)
|
||||
verr = resetHard(ctx, dEnv, apr, workingRoot, stagedRoot, headRoot)
|
||||
} else {
|
||||
verr = resetSoft(ctx, dEnv, apr, stagedRoot, headRoot)
|
||||
}
|
||||
@@ -107,7 +107,7 @@ func (cmd ResetCmd) Exec(ctx context.Context, commandStr string, args []string,
|
||||
return HandleVErrAndExitCode(verr, usage)
|
||||
}
|
||||
|
||||
func resetHard(ctx context.Context, dEnv *env.DoltEnv, apr *argparser.ArgParseResults, workingRoot, headRoot *doltdb.RootValue) errhand.VerboseError {
|
||||
func resetHard(ctx context.Context, dEnv *env.DoltEnv, apr *argparser.ArgParseResults, workingRoot, stagedRoot, headRoot *doltdb.RootValue) errhand.VerboseError {
|
||||
if apr.NArg() != 0 {
|
||||
return errhand.BuildDError("--%s does not support additional params", HardResetParam).SetPrintUsage().Build()
|
||||
}
|
||||
@@ -128,7 +128,7 @@ func resetHard(ctx context.Context, dEnv *env.DoltEnv, apr *argparser.ArgParseRe
|
||||
}
|
||||
}
|
||||
|
||||
headTblNames, err := headRoot.GetTableNames(ctx)
|
||||
headTblNames, err := stagedRoot.GetTableNames(ctx)
|
||||
|
||||
if err != nil {
|
||||
return errhand.BuildDError("error: failed to read tables from head").AddCause(err).Build()
|
||||
|
||||
Reference in New Issue
Block a user