~egtann/cup

3da256d34dabb5d95013277e61bdd1f4c7633db0 — Evan Tann 3 months ago 1195f77
fix mv directory bug

Directories were sometimes nested into themselves with `cp -R`. Now
they're copied to the correct location.
1 files changed, 10 insertions(+), 7 deletions(-)

M cup.go
M cup.go => cup.go +10 -7
@@ 244,7 244,12 @@ func run() error {
		if opts.Remote == "" && isDefaultRemote {
			skipCopy = true
		}
		if opts.Remote == "" || !filepath.IsAbs(opts.Remote) {
		mvRemote := man.Default.Remote
		if opts.Remote != "" {
			mvRemote = filepath.Join(man.Default.Remote,
				filepath.Base(opts.Remote))
		}
		if !filepath.IsAbs(opts.Remote) {
			remoteFile := file
			if opts.Remote != "" {
				remoteFile = opts.Remote


@@ 261,7 266,7 @@ func run() error {
			fileShort := filepath.Join(man.name,
				filepath.Base(file))
			line := fmt.Sprintf("%s %q %q", man.Default.Mv,
				fileShort, opts.Remote)
				fileShort, mvRemote)
			addLine(*verbose, &script, line, man.Default.SSH)
		}



@@ 271,11 276,9 @@ func run() error {
			addLine(*verbose, &script, line, man.Default.SSH)
		}

		if opts.Own != "" {
			line := fmt.Sprintf("%s %s %q", man.Default.Chown,
				opts.Own, opts.Remote)
			addLine(*verbose, &script, line, man.Default.SSH)
		}
		line := fmt.Sprintf("%s %s %q", man.Default.Chown, opts.Own,
			opts.Remote)
		addLine(*verbose, &script, line, man.Default.SSH)
	}

	var lines []string