Bug 5665 - need option to hard link from source tree to dest tree
Summary: need option to hard link from source tree to dest tree
Status: RESOLVED WONTFIX
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.0.4
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-04 00:23 UTC by Dave Yost
Modified: 2008-10-02 14:01 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Yost 2008-08-04 00:23:16 UTC
This is something I do a lot, and I've been using an older tool to do this. Rsync should do it, too.

mkdir a b
touch a/file1 a/file2
rsync -a --new-option a b

would create
 b/a/file1
 b/a/file2
as shared links to their counterparts in a/
Comment 1 Matt McCutchen 2008-08-04 07:36:19 UTC
Just pass a --link-dest option for the source dir.
Comment 2 Dave Yost 2008-08-04 09:29:22 UTC
OK, but

1. an option specifically for this is warranted.
2. the new option would operate quite differently from using link_dest, as below

--clone hard links the destination to the source. If necessary, each existing destination file is removed first. It is an error to use this option unless src and dest are on the same volume.
Comment 3 Matt McCutchen 2008-08-04 09:38:25 UTC
(In reply to comment #2)
> 1. an option specifically for this is warranted.

Why?

> 2. the new option would operate quite differently from using link_dest, as
> below
> 
> --clone hard links the destination to the source. If necessary, each existing
> destination file is removed first.

The --recheck-basis-dirs option of bug 5644 would make --link-dest work that way.

> It is an error to use this option unless src
> and dest are on the same volume.

Is it really important for rsync to issue an error in this case?
Comment 4 Wayne Davison 2008-10-02 14:01:23 UTC
I personally don't see the need for this as a special option.