chiark / gitweb /
tg export (collapse): implement skipping empty patches
[topgit.git] / tg-export.sh
index afb6f95ce288fa95825d09a3da87c96366c1f532..95aa346ef014af079c40ff8b397d5bee7e1ffa01 100644 (file)
@@ -91,9 +91,13 @@ collapsed_commit()
                        $(for p in $parent; do echo -p $p; done))"
        fi
 
-       (printf '%s\n\n' "$SUBJECT"; cat "$playground/^msg") |
-       git stripspace |
-       git commit-tree "$(pretty_tree "$name")" -p "$parent"
+       if branch_empty "$name"; then
+               echo "$parent";
+       else
+               (printf '%s\n\n' "$SUBJECT"; cat "$playground/^msg") |
+               git stripspace |
+               git commit-tree "$(pretty_tree "$name")" -p "$parent"
+       fi;
 
        echo "$name" >>"$playground/^ticker"
 }