summaryrefslogtreecommitdiff
path: root/test/tools/git
AgeCommit message (Collapse)Author
2025-06-26Fix flaky blame-in-diff test and "edit -fifo" in BufCloseFifoJohannes Altmanninger
This test uses ui_out and ui_in to coordinate events. This is brittle[1] because ui_out behavior depends on timing. Since this test doesn't really care about intermediate UI state, express the sequence using BufCloseFifo instead. This hits another issue: inside git blame-jump's BufCloseFifo, we run git blame, which runs another "edit -fifo .. *git*". A special aspect of fifo buffers is that any existing *git* buffer will be reused instead of being recreated[2]. After BufCloseFifo, the fifo watcher destructor will reset the fifo flag, even if BufCloseFifo has recreated the fifo buffer. This breaks invariants and causes the next fifo watcher destructor do fail its assertion. Let's not reset fifo flags in this case. This should be safe because it's the very last thing the fifo watcher does, so it's okay if another one is active now. Alternatively we could reject this kind of recursion, or implement it in a different way (using ScopedSetBool for the flags). Reported-by: Nico Sonack <nsonack@herrhotzenplotz.de> [1]: https://lists.sr.ht/~mawww/kakoune/%3C20241210100417.1150697-1-aclopte@gmail.com%3E [2]: This removes the need to use delete-buffer which also ensures that the buffer remains visible in any client it's already shown.
2025-02-10Format blamed commit timestamps using the original time zoneJohannes Altmanninger
Surprisingly, these two commands show different commit times: git blame README.asciidoc kak -e 'git blame' README.asciidoc This is because git shows times as of the original time zone (of the author/committer). Our blame integration uses the current local time. - blame-jump displays the date in the status line of a git-show buffer This date may be inconsistent with the buffer's "Date:" header, so this seems surprising. Fix that. This fixes a test in some time zones. - Unlike "git blame", our ":git blame" does not display time zone info by default. So, the conversion to localtime might make sense. I don't really have an opinion on this. Change it too I guess, since the current behavior might not have been intended. Fixes #5285
2024-11-11Remove noisy output from testsJohannes Altmanninger
"ui_out -until-grep" invocations used to redirect the output from grep, usually to /dev/null. Looks like the intention of 60fcc3443 (Change ui_out -until-grep to check for equality the next argument, 2024-11-02) was that grep no longer needs to print output, since we can assert instead which is mildly better. Unfortunately there are two places where -until-grep might not be powerful enough, which is why we capture the output and check it in the test script. For one of them we can use -until-grep with a small change. Not yet sure about the other one. Let's try to use eval instead, so we can silence the output. I realize -until-eval is not great (the nested quoting is ugly) but I guess it's better than the status quo. Alternatively, we could print output only if the [expected] argument is not given, and add >/dev/null to the other invocations.
2024-05-12Fix another case where git tests were hangingMaxime Coste
2024-05-10Fix tests that were failing on alpineMaxime Coste
Ensure perl exists for git blame tests, replace timing sensitive `ui_out -ignore ...` with `ui_out -until '...'`
2024-02-18Another try to fix blame-jump-message test flakynessMaxime Coste
2024-02-18Fix flaky blame-jump-message testJohannes Altmanninger
This test fails occasionally[1] because the order of events and the number of events varies across runs. We should always call draw_status exactly 3 times: [*git*][fifo] [*git*] Commit subject etc. [*git*] Let's check it this way. This seems to work; this time I took the time to run it a couple hundred times and in Cirrus CI. [1] https://builds.sr.ht/~mawww/job/1151239
2024-02-18rc tools git: fix initial position of blame of deleted lineJohannes Altmanninger
When running git blame in a "git show" buffer, we annotate the youngest version of the file that has the line referenced by the diff line at cursor. In case the cursor is on an added or context line, we simply show the version from the surrounding commit. When the cursor is on a deleted line, we show the parent commit, which still has the deleted line. However there is a bug: we use the line number in the new version of the file. Fix that.
2024-02-13rc git.kak: fix blame-jump for commits with special charactersJohannes Altmanninger
Commit 53d9b9b67 (Escaping tweak in git.kak, 2024-02-06) broke blame-jump when the commit subject contains a single quote. (Also on unbalanced "{" which is a rare edge case but we already have it in our Git history.) git.kak assumes that filenames don't contain ' or unbalanced {, but we can't really make that assumption about people's names or commit subjects. Unfortunately the escaping here is very messy. We need to pass arbitrary text to callbacks; maybe we should have closures that can capture private temporary registers.