info "Merging $name base with $branch..."
if ! git merge "$branch"; then
- info "Please commit merge resolution and call: tg create"
+ info "Please commit merge resolution and call: $tg create"
info "It is also safe to abort this operation using:"
info "git reset --hard some_branch"
info "(You are on a detached HEAD now.)"
info "Topic branch $name set up. Please fill .topmsg now and make initial commit."
-info "To abort: git rm -f .top* && git checkout ${deps%% *} && tg delete $name"
+info "To abort: git rm -f .top* && git checkout ${deps%% *} && $tg delete $name"
echo "Exporting $_dep"
mkdir -p "$(dirname "$filename")"
- tg patch "$_dep" >"$filename"
+ $tg patch "$_dep" >"$filename"
echo "$_dep.diff -p1" >>"$output/series"
}
echo "Base: $base_rev"
branch_contains "$name" "$base_rev" ||
- echo "* Base is newer than head! Please run \`tg update\`."
+ echo "* Base is newer than head! Please run \`$tg update\`."
if has_remote "$name"; then
echo "Remote Mate: $base_remote/$name"
echo '-- '
echo "tg: ($base_rev..) $name (depends on: $(git cat-file blob "$name:.topdeps" | paste -s -d' '))"
branch_contains "$name" "$base_rev" ||
- echo "tg: The patch is out-of-date wrt. the base! Run \`tg update\`."
+ echo "tg: The patch is out-of-date wrt. the base! Run \`$tg update\`."
(
export TG_RECURSIVE="[$dep] $TG_RECURSIVE"
export PS1="[$dep] $PS1"
- while ! tg update; do
+ while ! $tg update; do
# The merge got stuck! Let the user fix it up.
info "You are in a subshell. If you abort the merge,"
info "use \`exit 1\` to abort the recursive update altogether."
info "Updating base with $dep changes..."
if ! git merge "$dep"; then
if [ -z "$TG_RECURSIVE" ]; then
- resume='`tg update` again'
+ resume='`$tg update` again'
else # subshell
resume='exit'
fi
if [ -z "$TG_RECURSIVE" ]; then
info "Please commit merge resolution. No need to do anything else"
info "You can abort this operation using \`git reset --hard\` now"
- info "and retry this merge later using \`tg update\`."
+ info "and retry this merge later using \`$tg update\`."
else # subshell
info "Please commit merge resolution and call exit."
info "You can abort this operation using \`git reset --hard\`."
# setup_hook NAME
setup_hook()
{
- hook_call="\"\$(tg --hooks-path)\"/$1 \"\$@\""
+ hook_call="\"\$($tg --hooks-path)\"/$1 \"\$@\""
if [ -f "$git_dir/hooks/$1" ] &&
fgrep -q "$hook_call" "$git_dir/hooks/$1"; then
# Another job well done!
git_dir="$(git rev-parse --git-dir)"
root_dir="$(git rev-parse --show-cdup)"; root_dir="${root_dir:-.}"
base_remote="$(git config topgit.remote 2>/dev/null)" || :
+tg="tg"
# make sure merging the .top* files will always behave sanely
setup_ours
setup_hook "pre-commit"
if [ "$1" = "-r" ]; then
shift; base_remote="$1"; shift
+ tg="$tg -r $base_remote"
fi
cmd="$1"