summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGautam krishna R <rgautamkrishna@gmail.com>2023-12-21 01:40:32 +0530
committerGitHub <noreply@github.com>2023-12-20 21:10:32 +0100
commit17e96bf91ee0bc3dc27fa65b0ea7b10d3b971f9d (patch)
treec693f926314c30c75b891443af01c3b690ca88b2
parent2a1574165691495d21b3f243f50e1b655b361d9b (diff)
downloadzsh-17e96bf91ee0bc3dc27fa65b0ea7b10d3b971f9d.tar.gz
zsh-17e96bf91ee0bc3dc27fa65b0ea7b10d3b971f9d.tar.bz2
zsh-17e96bf91ee0bc3dc27fa65b0ea7b10d3b971f9d.zip
fix(changelog): use longer hashes for commits (#12096)
-rwxr-xr-xtools/changelog.sh11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/changelog.sh b/tools/changelog.sh
index 6d768963e..3ad8fe786 100755
--- a/tools/changelog.sh
+++ b/tools/changelog.sh
@@ -292,16 +292,17 @@ function display-release {
function fmt:hash {
#* Uses $hash from outer scope
local hash="${1:-$hash}"
+ local short_hash="${hash:0:7}" # 7 characters sha, top level sha is 12 characters
case "$output" in
- raw) printf '%s' "$hash" ;;
+ raw) printf '%s' "$short_hash" ;;
text)
- local text="\e[33m$hash\e[0m"; # red
+ local text="\e[33m$short_hash\e[0m"; # red
if supports_hyperlinks; then
printf "\e]8;;%s\a%s\e]8;;\a" "https://github.com/ohmyzsh/ohmyzsh/commit/$hash" $text;
else
echo $text;
fi ;;
- md) printf '[`%s`](https://github.com/ohmyzsh/ohmyzsh/commit/%s)' "$hash" "$hash" ;;
+ md) printf '[`%s`](https://github.com/ohmyzsh/ohmyzsh/commit/%s)' "$short_hash" "$hash" ;;
esac
}
@@ -512,13 +513,13 @@ function main {
# Git log options
# -z: commits are delimited by null bytes
# --format: [7-char hash]<field sep>[ref names]<field sep>[subject]<field sep>[body]
- # --abbrev=7: force commit hashes to be 7 characters long
+ # --abbrev=7: force commit hashes to be 12 characters long
# --no-merges: merge commits are omitted
# --first-parent: commits from merged branches are omitted
local SEP="0mZmAgIcSeP"
local -a raw_commits
raw_commits=(${(0)"$(command git -c log.showSignature=false log -z \
- --format="%h${SEP}%D${SEP}%s${SEP}%b" --abbrev=7 \
+ --format="%h${SEP}%D${SEP}%s${SEP}%b" --abbrev=12 \
--no-merges --first-parent $range)"})
local raw_commit