From 346895a69bb6b3d724b9b7dcbf4dfb4098c4c587 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Sat, 27 Dec 2025 15:33:43 +0100 Subject: organize --- blames.awk | 21 --------------------- find-base-commits.sh | 40 ---------------------------------------- libexec/blames.awk | 21 +++++++++++++++++++++ libexec/find-base-commits.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 61 deletions(-) delete mode 100644 blames.awk delete mode 100755 find-base-commits.sh create mode 100755 libexec/blames.awk create mode 100755 libexec/find-base-commits.sh diff --git a/blames.awk b/blames.awk deleted file mode 100644 index ff817f1..0000000 --- a/blames.awk +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env gawk - -BEGIN { - file=""; - ranges=""; -} - -match($0, /^\+\+\+ b\/(.+)$/, matched) { - if(ranges!="") print(ranges, "--", file); - file=matched[1]; - ranges=""; -} - -match($0, /^@@ -([0-9]+),([0-9]+) /, matched) && file!="" { - if(matched[2]!="0") - ranges = ranges " -L " matched[1] ",+" matched[2]; -} - -END { - if(ranges!="") print(ranges, "--", file); -} diff --git a/find-base-commits.sh b/find-base-commits.sh deleted file mode 100755 index 3e16227..0000000 --- a/find-base-commits.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -extend_bases () { - shas="$1" - new="$2" - for sha in $shas ; do - [ "$sha" = "$new" ] && continue - ${DELI_GIT_IS_ANCESTOR_CMD:-git merge-base --is-ancestor} "$sha" "$new" - res=$? - case $res in - 0) ;; - 1) echo "$sha" ;; - *) echo "$0: ancestor finding failed" >&2 - exit 1 ;; - esac - done - old=no - for sha in $shas ; do - [ "$sha" = "$new" ] && continue - ${DELI_GIT_IS_ANCESTOR_CMD:-git merge-base --is-ancestor} "$new" "$sha" - res=$? - case $res in - 0) old=yes ; break ;; - 1) ;; - *) echo "$0: ancestor finding failed" >&2 - exit 1 ;; - esac - done - [ $old = no ] && echo "$new" -} - -bases="" - -while read sha ; do - bases=$( extend_bases "$bases" "$sha" ) -done - -for sha in $bases ; do - echo "$sha" -done diff --git a/libexec/blames.awk b/libexec/blames.awk new file mode 100755 index 0000000..ff817f1 --- /dev/null +++ b/libexec/blames.awk @@ -0,0 +1,21 @@ +#!/usr/bin/env gawk + +BEGIN { + file=""; + ranges=""; +} + +match($0, /^\+\+\+ b\/(.+)$/, matched) { + if(ranges!="") print(ranges, "--", file); + file=matched[1]; + ranges=""; +} + +match($0, /^@@ -([0-9]+),([0-9]+) /, matched) && file!="" { + if(matched[2]!="0") + ranges = ranges " -L " matched[1] ",+" matched[2]; +} + +END { + if(ranges!="") print(ranges, "--", file); +} diff --git a/libexec/find-base-commits.sh b/libexec/find-base-commits.sh new file mode 100755 index 0000000..3e16227 --- /dev/null +++ b/libexec/find-base-commits.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +extend_bases () { + shas="$1" + new="$2" + for sha in $shas ; do + [ "$sha" = "$new" ] && continue + ${DELI_GIT_IS_ANCESTOR_CMD:-git merge-base --is-ancestor} "$sha" "$new" + res=$? + case $res in + 0) ;; + 1) echo "$sha" ;; + *) echo "$0: ancestor finding failed" >&2 + exit 1 ;; + esac + done + old=no + for sha in $shas ; do + [ "$sha" = "$new" ] && continue + ${DELI_GIT_IS_ANCESTOR_CMD:-git merge-base --is-ancestor} "$new" "$sha" + res=$? + case $res in + 0) old=yes ; break ;; + 1) ;; + *) echo "$0: ancestor finding failed" >&2 + exit 1 ;; + esac + done + [ $old = no ] && echo "$new" +} + +bases="" + +while read sha ; do + bases=$( extend_bases "$bases" "$sha" ) +done + +for sha in $bases ; do + echo "$sha" +done -- cgit v1.2.3