home/git: add all-commits script

This commit is contained in:
2025-12-14 01:06:36 +09:00
parent 186a0c901b
commit 058a43fcba
2 changed files with 20 additions and 0 deletions

View File

@@ -357,6 +357,11 @@ lib.mkIf cfg.enable {
runtimeInputs = with pkgs; [ cfg.package gnused gnugrep gawk uutils-coreutils-noprefix ]; runtimeInputs = with pkgs; [ cfg.package gnused gnugrep gawk uutils-coreutils-noprefix ];
text = lib.fileContents ./scripts/git-author-lines.sh; text = lib.fileContents ./scripts/git-author-lines.sh;
}) })
(pkgs.writeShellApplication {
name = "git-all-commits";
runtimeInputs = with pkgs; [ cfg.package gnugrep gawk findutils uutils-coreutils-noprefix ];
text = lib.fileContents ./scripts/git-all-commits.sh;
})
((pkgs.writers.writePython3Bin "git-post-pr" { ((pkgs.writers.writePython3Bin "git-post-pr" {
libraries = with pkgs.python3Packages; [ libraries = with pkgs.python3Packages; [
tkinter tkinter

View File

@@ -0,0 +1,15 @@
GIT_ROOT="$(git rev-parse --show-toplevel)"
find "$GIT_ROOT/.git/objects" -type f | \
while read -r file; do
if echo "$file" | grep -Eq '\.idx$'; then
git show-index < "$file" | awk '{print $2}'
elif echo "$file" | grep -Eq '[0-9a-f]{38}$'; then
echo "$(basename "$(dirname "$file")")$(basename "$file")"
fi
done | \
while read -r hash; do
if [ "$(git cat-file -t "$hash")" = commit ]; then
echo "$hash"
fi
done