Skip to content

0.6.2

Choose a tag to compare

@github-actions github-actions released this 08 Aug 03:18
· 10 commits to main since this release

Update notes 0.6.2

Requires a Termux runner update (v11 → v12). Open the companion app and tap Update runner, or re-run the install command from the plugin settings. Nothing needs re-pairing.

Staging one hunk at a time

The diff pane now has buttons on every hunk. Which ones depend on what the pane is showing: the staged side of a file offers Unstage hunk, the unstaged side offers Stage hunk and Discard hunk, and a diff from history offers neither, since there is nothing there to stage.

Staging a hunk leaves the file alone, so a file with two edits and one of them staged appears in both groups of the git panel: the staged edit under Staged changes, the other under Changes. That is git's own behaviour, and it is what makes a commit of half your work possible.

Select lines beside those buttons switches to picking: checkboxes appear in the line-number column, and the buttons become Stage selected and Unstage selected. Unpicked lines are left exactly as they are, including unpicked removals — a distinction that is easy to get wrong and would otherwise delete lines you did not choose.

Discard is the only one that removes work rather than moving it, and the only one that asks first.

Opening another file leaves picking mode, because the ticks are positions in the diff that was on screen and mean nothing in the next one. Settings → Keep line selection when opening another file turns that off if you would rather stay in the mode; the ticks are dropped either way.

Restoring one block now lands staged

Restore this block in the file history still refuses when the surrounding text has drifted, but the restored block now goes straight into the index. Other edits in the same file stay unstaged, because the plugin stages that block specifically rather than the whole path.

The button itself has moved into the hunk's own header row and looks like the buttons in the diff pane, because it is the same kind of control. It used to sit in a row of its own, aligned to the far right of a table as wide as the longest line of code, which on a phone put it off the edge of the screen.

A diff limit you control

Settings → Diff size limit, default 100 KB, per device. A large diff is expensive to draw: every line costs about a dozen elements, so this is a property of the phone rather than of the vault.

The runner keeps whole hunks within the limit and never a partial one, so what arrives is always a valid patch and every hunk button on it works. When something was left out, the pane says so — "Showing 12 of 40 hunks" — and offers to fetch the whole diff for that one diff, after telling you how many lines that is. The setting is not touched, and the next diff starts from it again.

Diffs render without any third-party code

The diff panes no longer use diff2html. They parse the unified diff and build the view directly, which removed the plugin's last runtime dependency and 92 KB of bundle. Nothing in the plugin executes generated code any more, and the file Obsidian loads contains only this repository's own source.

Reading a diff

Every hunk says which lines of the file it is, next to the buttons that act on it, and a rule separates one hunk from the next across the whole pane, line numbers included. Two hunks used to run together and read as one continuous stretch of the file.

Settings → Compare changed lines by chooses what gets highlighted inside a line that changed. Words is the default and suits prose: "brown" becoming "red" is one word replaced, where the old character comparison rendered it as <del>b</del>r<del>own</del> because the two share an "r". Characters suits a path, an identifier or a number, where one letter is the whole edit. The choice applies to the diff pane, the file history and the conflict pane.

Line numbers past 99 no longer touch each other. 832 beside 887 used to render as 832887, which reads as one six-digit number.

In picking mode the checkboxes now form a straight column at the left edge, instead of shifting sideways with the width of the numbers next to them.

File at commit is shown like a diff, with numbered lines and wrapping, instead of one block of unnumbered text.

The diff, conflict and history panes have room to scroll past the last line. Android's gesture bar and Obsidian's floating toolbar used to sit on top of it.

Conflicts

The two sides of a block are now compared line by line, and what differs is highlighted the same way it is in a diff. The pane has always said that local and remote disagree without saying about what, which on a block of prose is the only question worth answering.

The side labels read Local (HEAD) and Remote (branch), with a long branch name or a commit hash abbreviated. The buttons are Keep Local and Keep Remote. The branch used to be in the button, which made it as wide as the branch name and, on a phone, wide enough to cover the text beside it.

Blocks are separated by the same air the diff pane gives its hunks.

Termux: which vaults are still paired

The installer now ends by listing every profile on the device: how many there are, which one belongs to the vault you just installed for, and, for each, the folder it points at, with a note when that folder is gone or is no longer a git repository.

A vault that was deleted or moved leaves its profile behind by design, so the number of profiles can quietly exceed the number of vaults on the phone. Nothing ever said so. The installer deletes nothing — a profile holds that vault's token — but it now tells you which file to remove if you want to.

Fixes

  • A note line starting with -- or ++ disappeared from its diff. Removing -- signature produces the diff line --- signature, which the parser read as a file header. Adding ++ list had the same problem.
  • Every diff had a phantom blank line at the bottom, with a line number of its own.
  • A diff of a merge commit showed nothing at all.
  • The history panel's refresh button never animated, and each refresh left another timer running behind the scenes until the panel was closed. The same leak affected the file-history and diff panes.
  • A failed discard all, reset, create repository or clone left the panel showing a state that no longer existed.
  • Diff truncation was locale-dependent. The old limit counted characters in one environment and bytes in another, and could cut a multi-byte character in half, leaving a broken glyph on the last visible line.
  • The Select lines button could not be reached unless line wrapping was on. It was pushed to the far end of the hunk's controls, and without wrapping, "the far end" is past the right edge of a diff wider than the screen.
  • The reduced-motion block of the stylesheet was malformed and is now written correctly.

Internals

Runner v12 adds apply-patch (one patch, to the index or the working tree, forward or reversed) and a hunk-aligned budget for diff-file reporting hunksShown, hunksTotal, diffBytesTotal and diffBytesLimit. 492 unit tests, 454 e2e checks against real repositories, including all three patch directions and every refusal: a second path in the patch, a protected path, a traversal path, and a patch that no longer applies.

The character comparison is a second pass over the stretches the word comparison already found, not a separate comparison of the whole line. A line-wide character comparison costs O(n·m) and would give up on any paragraph longer than a few hundred characters, reporting it as wholly changed.

The project is GPL-3.0-only and always was: the LICENSE file has held the GPLv3 text since the first commit. package.json, the README and parts of the documentation said MIT, which was wrong and is corrected. The MIT notice that travels with diff2html's stylesheet stays where it is.

Full Changelog: 0.6.1...0.6.2