2 # TopGit - A different patch queue manager
3 # (c) Petr Baudis <pasky@suse.cz> 2008
17 [ -z "$head_from" ] || die
"-i and -w are mutually exclusive"
20 echo "Usage: tg [...] patch [-i | -w] [<name>]" >&2
23 [ -z "$name" ] || die
"name already specified ($name)"
28 head="$(git symbolic-ref HEAD)"
29 head="${head#refs/heads/}"
33 base_rev
="$(git rev-parse --short --verify "refs
/top-bases
/$name" 2>/dev/null)" ||
34 die
"not a TopGit-controlled branch"
36 if [ -n "$head_from" ] && [ "$name" != "$head" ]; then
37 die
"$head_from makes only sense for the current branch"
43 # We now collect the rest of the code in this file into a block
44 # so we can redirect the output to the pager.
47 # put out the commit message
48 # and put an empty line out, if the last one in the message was not an empty line
49 # and put out "---" if the commit message does not have one yet
50 cat_file
"$name:.topmsg" $head_from |
69 b_tree
=$
(pretty_tree
"$name" -b)
70 t_tree
=$
(pretty_tree
"$name" $head_from)
72 if [ $b_tree = $t_tree ]; then
75 git diff-tree
-p --stat $b_tree $t_tree
79 echo "tg: ($base_rev..) $name (depends on: $(cat_file "$name:.topdeps
" $head_from | paste -s -d ' ' -))"
80 branch_contains
"$name" "$base_rev" ||
81 echo "tg: The patch is out-of-date wrt. the base! Run \`$tg update\`."
84 # ... and then we pipe all the output through the pager