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.
8 local timestamp; timestamp=$(date +'%s %z')
9 git hash-object -t commit -w --stdin <<-_commit_data
10 tree $(_get_empty_treeref)
11 author TopGit <> $timestamp
13 x-topgit-data-node yes
17 This commit is used internally by TopGit. Please just ignore it.
24 _append_parentref_to_HEAD()
26 local parent; parent="$1"
27 local ref; ref=$(git cat-file commit HEAD |
28 sed -e "/^parent/aparent ${parent}" |
29 git hash-object -t commit -w --stdin)
30 git update-ref HEAD $ref
33 _remove_parentref_from_HEAD()
35 local parent; parent="$1"
36 local ref; ref=$(git cat-file commit HEAD |
37 grep -v "^parent ${parent}" |
38 git hash-object -t commit -w --stdin)
39 git update-ref HEAD $ref
42 # returns 0 if $1 is a valid TopGit pcommit
45 local pcommit; pcommit="$1"
46 git cat-file commit $pcommit | grep -q '^x-topgit-data-node yes$'
49 # returns the ref of the pcommit attached to $1
50 # returns 1 when none is found
53 local commit; commit="$1"
54 local parentnr; parentnr=1
57 ref=$(tg_ds_resolve_commit "${commit}^${parentnr}") || break
58 _is_pcommit "$ref" && printf "$ref\n" && return 0
59 parentnr=$(($parentnr + 1))
64 # expects data on stdin and adds to HEAD
67 local author; author=$(git cat-file commit HEAD | sed -rne 's,^author ,,p')
68 _append_parentref_to_HEAD $(_make_pcommit "$author")
71 # removes data from HEAD
74 local pcommit; pcommit=$(_find_pcommit HEAD) || return # no error
75 _remove_parentref_from_HEAD $pcommit
78 # lists data on a given commit
81 local commit; commit="${1:-HEAD}"
82 ref=$(tg_ds_resolve_commit $commit) || die "tg_ds_list_data: invalid commit: $commit"
83 local pcommit; pcommit=$(_find_pcommit $commit) || return 1
84 git cat-file commit $pcommit | sed -e '0,/^TopGit data follow:$/d'