Bug 12835 - Allow --link-dest to link to an optionally unexisting directory
Summary: Allow --link-dest to link to an optionally unexisting directory
Status: NEW
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.1.3
Hardware: All All
: P5 enhancement (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-12 10:07 UTC by Julien Palard
Modified: 2017-06-12 10:07 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 Julien Palard 2017-06-12 10:07:17 UTC
Found myself trying to hardlink between versions, but as I may rsync to a new server I may not having an old version to point to, so I had to use:

  rsync -rl --link-dest=$(ssh prod "cd /var/www; readlink -e current || echo .") static index.html prod:/var/www/$CI_COMMIT_SHA/
  ssh prod "ln -nfs $CI_COMMIT_SHA" current 

Which is ugly.

I'd prefer something like:

  rsync -rl --link-dest=current static index.html prod:/var/www/$CI_COMMIT_SHA/
  ssh prod "ln -nfs $CI_COMMIT_SHA" current

But warning / erroring on missing --link-dest sound legitimate, and we may not want to change this. If not, why not introduce a --link-dest-if-exists? Or a --ignore-missing-link-dest (in combination with the normal --link-dest)?