chiark / gitweb /
Merge branch 'fixes/ensure-worktree' into refs/top-bases/i/basis-merge
[topgit.git] / tg-export.sh
index 6d82d55751bd41159f04f20f55b753baaec94c44..486ec94ba00f97e831848648ecb6c37272d5e823 100644 (file)
@@ -57,21 +57,11 @@ if [ -z "$branches" ]; then
 fi
 
 
-playground="$(mktemp -d -t tg-export.XXXXXX)"
-trap 'rm -rf "$playground"' EXIT
+playground="$(get_temp tg-export -d)"
 
 
 ## Collapse driver
 
-# pretty_tree NAME
-# Output tree ID of a cleaned-up tree without tg's artifacts.
-pretty_tree()
-{
-       git ls-tree --full-tree "$1" \
-       | awk -F '      ' '$2 !~ /^.top/' \
-       | git mktree
-}
-
 create_tg_commit()
 {
        name="$1"
@@ -112,7 +102,7 @@ collapsed_commit()
                        echo "TopGit-driven merge of branches:"
                        echo
                        cut -f 2 "$playground/$name^parents"
-               } | git commit-tree "$(pretty_tree "refs/top-bases/$name")" \
+               } | git commit-tree "$(pretty_tree "$name" -b)" \
                        $(for p in $parent; do echo -p $p; done))"
        fi
 
@@ -227,7 +217,7 @@ linearize()
        else
                retmerge=0;
 
-               git merge-recursive "$(pretty_tree "refs/top-bases/$_dep")" -- HEAD "$(pretty_tree "refs/heads/$_dep")" || retmerge="$?";
+               git merge-recursive "$(pretty_tree "$_dep" -b)" -- HEAD "$(pretty_tree "refs/heads/$_dep")" || retmerge="$?";
 
                if test "x$retmerge" != "x0"; then
                        git rerere;