4 # This script is intended to help with sharing a recorded resolution cache for
5 # use with git's rerere. It assumes that the cache is available in an orphaned
6 # branch of a remote repository.
8 # Run the following command to initialize the repository with a cache:
10 # $ rr-cache init [branch]
12 # Where branch is the name of the (remote) branch that contains the cache. If
13 # omitted, origin/rr-cache will be used by default. The init command creates a
14 # local branch named rr-cache and clones it into the .git/rr-cache directory.
16 # Commands other than init are passed unmodified to git and are run on the new
17 # repository created in the .git/rr-cache subdirectory.
22 if test -d .git/rr-cache; then
23 echo "error: directory .git/rr-cache already exists"
36 if test "$remote" != "$ref" -o "$branch" != "$ref"; then
37 echo "initializing rr-cache using remote branch $remote/$branch"
38 git branch rr-cache "$remote/$branch"
41 echo "initializing rr-cache using local branch $branch"
44 git clone -b $branch . .git/rr-cache
48 git --git-dir=.git/rr-cache/.git --work-tree=.git/rr-cache "$@"