17e96bf91ee0bc3dc27fa65b0ea7b10d3b971f9d
- Author
- Gautam krishna R <rgautamkrishna@gmail.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
fix(changelog): use longer hashes for commits (#12096)
Diff
1diff --git a/tools/changelog.sh b/tools/changelog.sh
2index 6d768963e1a95c43630afc996b87df88edbed584..3ad8fe786e6d1ac4e87a11891d9f0aa60b413ef3 100755
3--- a/tools/changelog.sh
4+++ b/tools/changelog.sh
5@@ -292,16 +292,17 @@ function display-release {
6 function fmt:hash {
7 #* Uses $hash from outer scope
8 local hash="${1:-$hash}"
9+ local short_hash="${hash:0:7}" # 7 characters sha, top level sha is 12 characters
10 case "$output" in
11- raw) printf '%s' "$hash" ;;
12+ raw) printf '%s' "$short_hash" ;;
13 text)
14- local text="\e[33m$hash\e[0m"; # red
15+ local text="\e[33m$short_hash\e[0m"; # red
16 if supports_hyperlinks; then
17 printf "\e]8;;%s\a%s\e]8;;\a" "https://github.com/ohmyzsh/ohmyzsh/commit/$hash" $text;
18 else
19 echo $text;
20 fi ;;
21- md) printf '[`%s`](https://github.com/ohmyzsh/ohmyzsh/commit/%s)' "$hash" "$hash" ;;
22+ md) printf '[`%s`](https://github.com/ohmyzsh/ohmyzsh/commit/%s)' "$short_hash" "$hash" ;;
23 esac
24 }
25
26@@ -512,13 +513,13 @@ function main {
27 # Git log options
28 # -z: commits are delimited by null bytes
29 # --format: [7-char hash]<field sep>[ref names]<field sep>[subject]<field sep>[body]
30- # --abbrev=7: force commit hashes to be 7 characters long
31+ # --abbrev=7: force commit hashes to be 12 characters long
32 # --no-merges: merge commits are omitted
33 # --first-parent: commits from merged branches are omitted
34 local SEP="0mZmAgIcSeP"
35 local -a raw_commits
36 raw_commits=(${(0)"$(command git -c log.showSignature=false log -z \
37- --format="%h${SEP}%D${SEP}%s${SEP}%b" --abbrev=7 \
38+ --format="%h${SEP}%D${SEP}%s${SEP}%b" --abbrev=12 \
39 --no-merges --first-parent $range)"})
40
41 local raw_commit