Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add T option #14

Merged
merged 1 commit into from
Dec 31, 2015
Merged

Conversation

kenjiszk
Copy link
Contributor

Add T option to cp

In the target directory existing case, cp command doesn't work as expected.

$ mkdir -p source/assets
$ mkdir -p target/assets
$ touch source/assets/sample.txt
$ cp -r source/assets target/assets
$ tree target
target
`-- assets
    `-- assets
        `-- sample.txt

2 directories, 1 file

then, add T option, it works.

$ rm -fr target/assets/assets 
$ cp -Tr source/assets target/assets
$ tree target
target
`-- assets
    `-- sample.txt

1 directory, 1 file

It also works when target directory is not exists.

$ mkdir -p source/assets
$ mkdir target
$ touch source/assets/sample.txt
$ cp -Tr source/assets target/assets
$ tree target 
target
`-- assets
    `-- sample.txt

1 directory, 1 file

@rhomeister
Copy link
Contributor

I'm not familiar with the -T option. man cp says treat DEST as a normal file. Is this really what we want?

@kenjiszk
Copy link
Contributor Author

kenjiszk commented Dec 3, 2015

Yes, if cp treats DEST as a directory, copy result becomes target/assets/assets/sample.txt

See also
https://www.gnu.org/software/coreutils/manual/html_node/Target-directory.html

rhomeister added a commit that referenced this pull request Dec 31, 2015
@rhomeister rhomeister merged commit 9fde06b into capistrano-plugins:master Dec 31, 2015
@rhomeister rhomeister mentioned this pull request Dec 31, 2015
@rhomeister
Copy link
Contributor

@kenjiszk, @elik-ru disagrees with this solution (see #16). Could you please provide arguments why this commit should remain? If not, I will revert this PR.

@kenjiszk
Copy link
Contributor Author

kenjiszk commented Jan 7, 2016

@rhomeister
Please revert this PR. I think big issue is this( @elik-ru thank you for comment ).
-T key exists only in Linux, not in FreeBSD, MacOS and may be some other systems

I will think about another solution better than 'add T'.

@rhomeister rhomeister mentioned this pull request Jan 13, 2016
@rhomeister
Copy link
Contributor

OK, thanks for your input. I've reverted the PR.

@silva96
Copy link

silva96 commented Sep 30, 2016

I back this, is the only way this gem can work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants