Last active
October 12, 2023 12:17
-
-
Save CyberShadow/556c61d6f6f3335fc7691405f69a8bb8 to your computer and use it in GitHub Desktop.
find-commit-with-longest-message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env dub | |
/+ dub.sdl: | |
dependency "ae" version="==0.0.3236" | |
+/ | |
module find_commit_with_longest_message; | |
import std.algorithm.iteration; | |
import std.range.primitives; | |
import std.stdio; | |
import ae.sys.git; | |
void main() | |
{ | |
auto repo = Git("."); | |
auto history = repo.getHistory(); | |
auto commitWithLongestMessage = history.commits.values.fold!((a, b) => a.message.joiner.walkLength > b.message.joiner.walkLength ? a : b); | |
writeln(commitWithLongestMessage.oid); | |
commitWithLongestMessage.message.each!writeln(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment