Skip to content

Apply --rotate to SVG output - #168

Merged
peso merged 1 commit into
git-bahn:masterfrom
TheeCoderAhmed:fix/rotate-svg
Nov 4, 2026
Merged

peso merged 1 commit into
git-bahn:masterfrom
TheeCoderAhmed:fix/rotate-svg

Conversation

@TheeCoderAhmed

Copy link
Copy Markdown
Contributor

--rotate (the old --reverse) has no effect on --svg output. print_unicode checks reverse_commit_order, but print_svg never reads it, so the SVG always has the newest commit on top.

print_svg now mirrors the rows when the flag is set:

  • Summaries and branch labels are placed at the mirrored row.
  • Each commit's group of dots and lines gets a matrix(1 0 0 -1 0 H) transform that mirrors it around the same rows.
  • The --debug branch lines use the mirrored row as well.

Output without --rotate is unchanged, and svg_keeps_newest_commit_on_top_by_default checks the order and that no transform is added.

Fixes #134

What I ran, on macOS with rustc 1.98.1:

  • cargo test --locked passes. The two new tests in src/print/svg.rs build a two-commit repo in the temp directory.
  • svg_rotate_puts_oldest_commit_on_top fails without the change.
  • cargo fmt --check passes, and cargo clippy --locked --all-targets reports no warnings.

I did not run the binary or open the SVG in a viewer, so the picture itself is unchecked. The tests only cover a linear history, so a graph with merges has not been exercised with --rotate.

@peso
peso merged commit 41fc4b0 into git-bahn:master Nov 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--reverse has no effect on --svg

2 participants