aboutsummaryrefslogtreecommitdiff
path: root/doc/todo/link_file_to_remote_repo_feature.mdwn
blob: d6b41e8059836f7072fb9686248dc8c30db75dd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
I have two repos, using SHA1 backend and both using git.
The first one is a laptop, the second one is a usb drive.

When I drop a file on the laptop repo, the file is not available on that repo until I run *git annex get*
But when the usb drive is plugged in the file is actually available.

How about adding a feature to link some/all files to the remote repo?

e.g. 
We have *railscasts/196-nested-model-form-part-1.mp4* file added to git, and only available on the usb drive:

      $ git annex whereis 196-nested-model-form-part-1.mp4 
         whereis 196-nested-model-form-part-1.mp4 (1 copy) 
  	   a7b7d7a4-2a8a-11e1-aebc-d3c589296e81 -- origin (Portable usb drive)

I can see the link with:

    $ cd railscasts
    $ ls -ls 196*
    8 lrwxr-xr-x  1 framallo  staff  193 Dec 20 05:49 196-nested-model-form-part-1.mp4 -> ../.git/annex/objects/Wz/6P/SHA256-s16898930--43679c67cd968243f58f8f7fb30690b5f3f067574e318d609a01613a2a14351e/SHA256-s16898930--43679c67cd968243f58f8f7fb30690b5f3f067574e318d609a01613a2a14351e

I save this in a variable just to make the example more clear:

    ID=".git/annex/objects/Wz/6P/SHA256-s16898930--43679c67cd968243f58f8f7fb30690b5f3f067574e318d609a01613a2a14351e/SHA256-s16898930--43679c67cd968243f58f8f7fb30690b5f3f067574e318d609a01613a2a14351e"

The file doesn't exist on the local repo:

    $ ls ../$ID
    ls: ../$ID: No such file or directory

however I can create a link to access that file on the remote repo.
First I create a needed dir:

    $ mkdir ../.git/annex/objects/Wz/6P/SHA256-s16898930--43679c67cd968243f58f8f7fb30690b5f3f067574e318d609a01613a2a14351e/

Then I link to the remote file:

    $ ln -s /mnt/usb_drive/repo_folder/$ID ../$ID

now I can open the file in the laptop repo.


I think it could be easy to implement. Maybe It's a naive approach, but looks apealing.
Checking if it's a real file or a link shouldn't impact on performance.
The limitation is that it would work only with remote repos on local dirs

Also allows you to have one directory structure like AFS or other distributed FS. If the file is not local I go to the remote server. 
Which is great for apps like Picasa, Itunes, and friends that depends on the file location.

> This is a duplicate of [[union_mounting]]. So closing it: [[done]]. 
> 
> It's a good idea, but making sure git-annex correctly handles these links in all cases is a subtle problem that has not yet been tackled. --[[Joey]]