All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 # An example of how to add a new revision control system type to mr.
2 # git fake bare repositories have a detached workspace. One potential
3 # application is storing dotfiles in git, keeping them checked out in
4 # ones $HOME, but checked into different git repositories. This file adds
5 # support for them, separate from the normal git support.
7 # To make mr use this file, add a line like this inside the [DEFAULT]
8 # section of your ~/.mrconfig
9 #include = cat /usr/share/mr/git-fake-bare
11 # And an example repo using it would look something like:
13 #checkout = git_fake_bare_checkout git://... .dotfiles <worktree, eg. ..>
16 # git doesn't have an easy way to check out such a repo, so
18 git_fake_bare_checkout() {
21 local worktree; worktree="$3"
22 git clone --no-checkout "$url" "$repo"
28 GIT_DIR="$PWD" git read-tree HEAD
29 GIT_DIR="$PWD" git checkout-index -a --prefix="$worktree" || true
30 GIT_DIR="$PWD" git config core.worktree "$worktree"
34 worktree="$(git config --get core.worktree)" || true
35 if [ -z "$worktree" ]; then
36 error "git worktree is not set"
38 worktree="${worktree%%/}/"
39 if [ ! -d "$worktree" ]; then
40 error "git worktree $worktree does not exist"
46 test -d "$MR_REPO"/refs/heads && test -d "$MR_REPO"/refs/tags &&
47 test -d "$MR_REPO"/objects && test -f "$MR_REPO"/config &&
48 test `GIT_DIR="$MR_REPO" git config --get core.worktree`
50 git_fake_bare_update =
52 branch="$(GIT_DIR="$MR_REPO" git symbolic-ref HEAD | sed -e 's,.*/,,')"
53 [ -z "$args" ] && args="-t origin $branch"
54 GIT_DIR="$MR_REPO" git pull $args
56 git_fake_bare_status = GIT_DIR="$MR_REPO" git status -s "$@" || true
58 git_fake_bare_commit =
59 cd "$(git_get_worktree)"
60 GIT_DIR="$MR_REPO" git commit -a "$@"
61 GIT_DIR="$MR_REPO" git push --all
64 GIT_DIR="$MR_REPO" git push --all
66 git_fake_bare_record =
67 cd "$(git_get_worktree)"
68 GIT_DIR="$MR_REPO" git commit -a "$@"
71 cd "$(git_get_worktree)"
72 GIT_DIR="$MR_REPO" git diff "$@"
74 git_fake_bare_log = GIT_DIR="$MR_REPO" git log "$@"
76 git_fake_bare_register =
77 url="$(LC_ALL=C GIT_CONFIG=config git config --get remote.origin.url)" || true
78 if [ -z "$url" ]; then
79 error "cannot determine git url"
81 worktree="$(git_get_worktree)"
82 echo "Registering git url: $url in $MR_CONFIG (with worktree $worktree)"
83 mr -c "$MR_CONFIG" config "`pwd`" \
84 checkout="git_fake_bare_checkout '$url' '$MR_REPO' '$worktree'"
86 # vim:sw=8:sts=0:ts=8:noet