Skip to content

Commit

Permalink
Add requested changes in mv.go
Browse files Browse the repository at this point in the history
  • Loading branch information
vaithak committed Oct 26, 2018
1 parent e2a9c27 commit 4bb9b04
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
26 changes: 12 additions & 14 deletions cmd/mv.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,20 @@ func mv(cmd *cobra.Command, args []string) error {
argumentFile := re.FindString(argument)
lastCharDest := destination[len(destination)-1:]

var err error
var arg *files.RelocationArg

if lastCharDest == "/" {
arg, err := makeRelocationArg(argument, destination + argumentFile)
if err != nil {
relocationError := fmt.Errorf("Error validating move for %s to %s: %v", argument, destination, err)
mvErrors = append(mvErrors, relocationError)
} else {
relocationArgs = append(relocationArgs, arg)
}
arg, err = makeRelocationArg(argument, destination + argumentFile)
} else {
arg, err = makeRelocationArg(argument, destination)
}

if err != nil {
relocationError := fmt.Errorf("Error validating move for %s to %s: %v", argument, destination, err)
mvErrors = append(mvErrors, relocationError)
} else {
arg, err := makeRelocationArg(argument, destination)
if err != nil {
relocationError := fmt.Errorf("Error validating move for %s to %s: %v", argument, destination, err)
mvErrors = append(mvErrors, relocationError)
} else {
relocationArgs = append(relocationArgs, arg)
}
relocationArgs = append(relocationArgs, arg)
}
}

Expand Down
5 changes: 4 additions & 1 deletion contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ ${dbxcli} cp ${d}/dbxcli ${d}/dbxcli-new
echo "Testing revs"
rev=$(${dbxcli} revs ${d}/dbxcli)

echo "Testing updated mv"
echo "Testing mv"
${dbxcli} mv ${d}/dbxcli ${d}/dbxcli-old

echo "Testing mv"
${dbxcli} mv ${d}/dbxcli ${d}/dbxcli-old/

echo "Testing restore"
Expand Down

0 comments on commit 4bb9b04

Please sign in to comment.