]> git.madduck.net Git - code/myrepos.git/blob - lib/git-subtree

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:

moved TODO to website
[code/myrepos.git] / lib / git-subtree
1 # Add support for Avery Pennarun's git-subtree
2 #
3 # To make mr use this file, add a line like this inside the [DEFAULT]
4 # section of your ~/.mrconfig
5 #include = cat /usr/share/mr/git-subtree
6 #
7 # Example:
8 #
9 # [repo]
10 # checkout = git clone git.example.org:repo.git
11 #
12 # [repo/lib]
13 # git_subtree_test = true
14 # checkout = git subtree add --prefix=lib git.example.org:lib.git master
15 # update = git_subtree_update --prefix=lib git.example.org:lib.git master
16 # push = git_subtree_push --prefix=lib git.example.org:lib.git master
17
18 lib =
19         git_get_toplevel() {
20                 local toplevel
21                 toplevel="$(git rev-parse --show-toplevel)" || true
22                 if [ -z "$toplevel" ]; then
23                         error "git toplevel is not set"
24                 fi
25                 toplevel="${toplevel%%/}/"
26                 if [ ! -d "$toplevel" ]; then
27                         error "git toplevel $toplevel does not exist"
28                 fi
29                 echo "$toplevel"
30         }
31         git_subtree_update() {
32                 cd "$(git_get_toplevel)"
33                 git subtree pull "$@"
34         }
35         git_subtree_push() {
36                 cd "$(git_get_toplevel)"
37                 git subtree push "$@"
38         }
39
40 git_subtree_status = git status -s "$@" . || true
41 git_subtree_commit = git add . && git commit "$@" && git_subtree_push
42 git_subtree_record = git add . && git commit "$@"
43 git_subtree_diff = git diff .
44 git_subtree_log = git log .