]> git.madduck.net Git - code/myrepos.git/blob - mrconfig.git-fake-bare

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

actions not split by rcs override those that are
[code/myrepos.git] / mrconfig.git-fake-bare
1 # An example of how to add a new revision control system type to mr.
2 # git fake bare repositories have a detached workspace. This file adds
3 # support for them, separate from the normal git support.
4
5 # To make mr use this file, add a line like this inside the [DEFAULT]
6 # section of your ~/.mrconfig
7 #include = cat /path/to/mrconfig.git-fake-bare
8
9 git_fake_bare_test = 
10         test -d "$MR_REPO"/refs/heads && test -d "$MR_REPO"/refs/tags &&
11         test -d "$MR_REPO"/objects && test -f "$MR_REPO"/config &&
12         test "$(GIT_CONFIG="$MR_REPO"/config git-config --get core.bare)" = false
13
14 git_fake_bare_update =
15         # all this is because of a bug in git-fetch, which requires GIT_DIR set
16         local git_dir_override; git_dir_override=.git
17         case "$(get_git_repo_type "$MR_REPO")" in
18                 fake-bare) git_dir_override="$MR_REPO";;
19         esac
20         args="$@"
21         [ -z "$args" ] && args="-t origin master"
22         eval GIT_DIR="$git_dir_override" git pull "$args"
23
24 git_fake_bare_status = git status "$@" || true
25
26 git_fake_bare_commit = error "commit does not work for fake bare git repositories (yet)."
27
28 git_fake_bare_diff = error "diff does not work for fake bare git repositories (yet)."
29
30 git_fake_bare_log = git log "$@"
31
32 git_fake_bare_register = 
33         url="$(LANG=C GIT_CONFIG=config git-config --get remote.origin.url)" || true
34         if [ -z "$url" ]; then
35                 error "cannot determine git url"
36         fi
37         worktree="$(git-config --get core.worktree)" || true
38         if [ -z "$worktree" ]; then
39                 error "git worktree is not set"
40         fi
41         worktree="${worktree%%/}/"
42         if [ ! -d "$worktree" ]; then
43                 error "git worktree $worktree does not exist"
44         fi
45         mr -c "$MR_CONFIG" config "`pwd`" \
46                 lib="GIT_WORK_TREE=$work_tree; export GIT_WORK_TREE"
47         echo "Registering git url: $url in $MR_CONFIG (with worktree $worktree)"
48         mr -c "$MR_CONFIG" config "`pwd`" \
49         checkout=" \
50         git clone --no-checkout $url $MR_REPO && \
51         cd $MR_REPO && \
52         git read-tree HEAD && \
53         git checkout-index -a --prefix='$work_tree' || true; \
54         git config core.worktree '$worktree' && \
55         mv .git/* . && \
56         rmdir .git"