Skip to content

Commit

Permalink
Merge pull request git-lfs#4454 from chrisd8088/migrate-no-default-ov…
Browse files Browse the repository at this point in the history
…erride

Make migrate commands default to preserving uncommitted changes
  • Loading branch information
chrisd8088 authored Mar 29, 2021
2 parents b6fd35b + 6f6f856 commit d964bd0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
6 changes: 3 additions & 3 deletions commands/command_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func ensureWorkingCopyClean(in io.Reader, out io.Writer) {
answer := bufio.NewReader(in)
L:
for {
fmt.Fprintf(out, "migrate: override changes in your working copy? [Y/n] ")
fmt.Fprintf(out, "migrate: override changes in your working copy? All uncommitted changes will be lost! [y/N] ")
s, err := answer.ReadString('\n')
if err != nil {
if err == io.EOF {
Expand All @@ -342,10 +342,10 @@ func ensureWorkingCopyClean(in io.Reader, out io.Writer) {
}

switch strings.TrimSpace(s) {
case "n", "N":
case "n", "N", "":
proceed = false
break L
case "y", "Y", "":
case "y", "Y":
proceed = true
break L
}
Expand Down
17 changes: 17 additions & 0 deletions t/t-migrate-import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,23 @@ begin_test "migrate import (multiple remotes)"
)
end_test
begin_test "migrate import (dirty copy, default negative answer)"
(
set -e
setup_local_branch_with_dirty_copy
original_main="$(git rev-parse main)"
echo | git lfs migrate import --everything 2>&1 | tee migrate.log
grep "migrate: working copy must not be dirty" migrate.log
migrated_main="$(git rev-parse main)"
assert_ref_unmoved "main" "$original_main" "$migrated_main"
)
end_test
begin_test "migrate import (dirty copy, negative answer)"
(
set -e
Expand Down

0 comments on commit d964bd0

Please sign in to comment.