Skip to content

Commit 50754c7

Browse files
committed
Update README.md
Moved the rest to wiki.
1 parent bb83a5d commit 50754c7

File tree

1 file changed

+20
-122
lines changed

1 file changed

+20
-122
lines changed

README.md

Lines changed: 20 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -19,136 +19,34 @@ Alternatively, you can run it directly:
1919
python git_sym.py -h
2020
```
2121

22-
## Examples
23-
These examples explain the basics:
24-
25-
* <https://github.com/cdunn2001/git-sym-test/wiki/Examples>
26-
27-
## Running
28-
You can test it right here. The `links` directory has some examples.
29-
```
30-
$ ls -l links/foo
31-
lrwxr-xr-x 1 cdunn2001 staff 15 Jun 10 09:44 links/foo -> ../.git_sym/foo
32-
```
33-
For this example, a file called `foo` needs to exist in your home directory,
34-
because that is where our makefile looks for it:
35-
```
36-
$ cat git_sym.makefile
37-
foo:
38-
cp -f ~/foo $@
39-
40-
$ touch ~/foo
41-
```
42-
Then, just run `git-sym update`:
43-
```
44-
git-sym update links/foo
45-
# or
46-
# python git_sym.py update links/foo
47-
cat links/foo
48-
```
49-
50-
## How it works
51-
* Instead of a large file, create a symlink to `.git_sym/unique_filename`.
52-
```
53-
ln -sf .git_sym/unique_filename my_filename
54-
```
55-
* Add a rule to `git_sym.makefile` which can retrieve `unique_filename`.
56-
```
57-
unique_filename:
58-
wget http://mysite.com/unique_filename
59-
```
60-
* Then, `git-sym update` will automatically retrieve the file and fill in the symbolic links.
22+
## Basic usage
23+
### For repo users
6124
```
6225
git-sym update
6326
```
64-
65-
## Breaking the link
66-
To break it, remove the file from the cache and from its
67-
origin.
27+
### For repo owners
6828
```
69-
rm -f ~/git_sym_cache/foo ~/foo .git_sym
29+
git-sym add my_big_file.gif
30+
git commit -m 'git-sym added'
31+
ls -l my_big_file.gif
7032
```
71-
Then, this should fail:
33+
Or more explicitly, and with a rule for retrieval:
7234
```
35+
ln -sf .git_sym/my_big_data.v123.db my_big_data.db
36+
git add my_big_data.db
37+
git commit
38+
cat <<EOF >> git_sym.makefile
39+
my_big_data.v123.db:
40+
wget http://www.somewhere.com/my_big_data.v123.db
41+
EOF
7342
git-sym update
7443
```
7544

76-
## Adding your own large-files.
77-
```
78-
git-sym add large1 large2 large3
79-
git commit -m 'adding links'
80-
git-sym show
81-
```
82-
**git-sym** will choose unique filenames based on checksums. But `git-sym add` is strictly for convenience.
83-
You are free to use your own filenames. Anything symlinked via `GIT_ROOT/.git_sym` will be update-able.
84-
85-
Next, you might want to make those files available to other.
86-
You can then move those files out of GIT_SYM_CACHE_DIR and into Amazon S3, or an ftp site, or wherever.
87-
Just add rules to your `git_sym.makefile`.
88-
89-
## Other useful commands
90-
```
91-
git-sym show -h
92-
git-sym missing -h
93-
git-sym -h
94-
```
95-
96-
# Details
97-
## Typical usage
98-
You will store relative symlinks in your repo. They will point to a unique filename inside `ROOT/.git_sym/`, where ROOT is `../../` etc.
99-
100-
`git-sym update` will search your repo for symlinks (unless you specify them on the command-line). For each, it will execute `ROOT/git_sym.makefile` in your `GIT_SYM_CACHE_DIR` (`~/git_sym_cache` by default). The makefile targets will be the basenames of the symlinks.
101-
102-
If all those files are properly retrieved, then symlinks will be created with the same filenames inside `.git/git_sym`. `ROOT/.git_sym` will point at that. And all other symlinks will point *thru* `ROOT/.git_sym`. Thus, there are three (3) levels of indirection.
103-
104-
## Makefile
105-
Someday, we will offer a plugin architecture. But for now, using a makefile is really very simple. Just create a rule for each unique filename. (You *are* using unique filenames, right?) You can run `wget`, `curl`, `ftp`, `rcp`, `rsync`, `aws-s3-get`, or whatever you want. The retrieval mechanism is decoupled from caching.
106-
107-
You should try to ensure that you have a rule for every current symlink. Old rules for symlinks no longer in your repo are fine; they are simply ignored.
108-
109-
To test your rules:
110-
```
111-
export GIT_SYM_CACHE_DIR=~/mytest
112-
git-sym missing # should report something
113-
git-sym update
114-
git-sym missing
115-
```
116-
117-
## Other notes
118-
### Cache
119-
**git-sym** sets the mode to read-only for the cached files. These files should never change. You might want to name them after their own checksums. `git-sym add` can help you with that.
120-
### Submodules
121-
If your module can be used as a *submodule*, we cannot point at `.git/git_sym/` directly because for submodules `.git/` is not inside the tree. (The relative symlinks are constant, so they need to work no matter where `.git/` sits.) That is why we have *three* levels of indirection, in case your were wondering. (This is also why **git-annex** *fails* for submodules.)
122-
123-
This is also why we write `ROOT/.git_sym`; it might be a different directory than `.git`.
124-
125-
For submodule support, you will also need this:
126-
```
127-
git config --global alias.gsexec '!exec '
128-
```
129-
We use that to learn the actual location of the `.git/` directory. If it fails, we try current directory, and if `.git` is not a directory there, we attempt to find it in `../.git/modules/REPO`, where REPO is the root directory. (This can fail in many ways. The alias never fails.)
130-
131-
Again, we expect you to forget that, so we add that alias to your local repo for you. Believe us: It's a Good Thing.
132-
133-
### git-sym-test
134-
This module provides a way to test **git-sym**. It is not required.
135-
However, it is listed as a git-submodule here for conveniently
136-
testing submodule support.
137-
```
138-
git submodule update --init
139-
```
140-
141-
### .gitignore
142-
Since the intermediate symlink is also in the repo, but points to a changing target, it needs to be listed in `.gitignore`. (That anticipates both accidental `git add` and `git clean`.) We expect you to forget that important rule, so **git-sym** will detect its absence and add it to `.git/info/exclude` instead. No worries.
143-
144-
### Complicated symlinks?
145-
We require a flat directory structure within `.git/git_sym`. If you need more files than your filesystem
146-
can handle, you're Doing It Wrong. Git will slow down anyway.
45+
## Examples
46+
These examples explain the basics:
14747

148-
However, we support symlinked *directories*, which can then be an entire tree in GIT_SYM_CACHE_DIR. That should
149-
satisfy all reasonable use-cases.
48+
* <https://github.com/cdunn2001/git-sym-test/wiki/Examples>
15049

151-
# TODO
152-
* git-sym fix -- also fix broken links from moved cache, and missing links in GIT_SYM_DIR
153-
* Try `.gitattributes` instead of `.gitignore`, to avoid problems with `git clean`.
154-
* Add `git-submodule` support, to run `git-sym update` automatically.
50+
If you prefer words to shell code:
51+
* <https://github.com/cdunn2001/git-sym/wiki/Details>
52+
* <https://github.com/cdunn2001/git-sym/wiki/Examples>

0 commit comments

Comments
 (0)