1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-02-12 05:49:47 +08:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Gautam krishna R
17e96bf91e
fix(changelog): use longer hashes for commits (#12096) 2023-12-20 21:10:32 +01:00
Oleg Grigoriev
2a15741656
fix(rake-fast): make .rake_tasks write atomic (#12108) 2023-12-20 20:52:27 +01:00
2 changed files with 14 additions and 10 deletions

View File

@ -43,14 +43,17 @@ _tasks_changed () {
} }
_rake_generate () { _rake_generate () {
echo "version:$_rake_tasks_version" > .rake_tasks local rake_tasks_content="version:$_rake_tasks_version\n"
rake_tasks_content+=$(rake --silent --tasks --all \
rake --silent --tasks --all \
| sed "s/^rake //" | sed "s/\:/\\\:/g" \ | sed "s/^rake //" | sed "s/\:/\\\:/g" \
| sed "s/\[[^]]*\]//g" \ | sed "s/\[[^]]*\]//g" \
| sed "s/ *# /\:/" \ | sed "s/ *# /\:/" \
| sed "s/\:$//" \ | sed "s/\:$//")
>> .rake_tasks
local rake_tasks_file="$(mktemp -t .rake_tasks.XXXXXX)"
echo $rake_tasks_content > $rake_tasks_file
mv $rake_tasks_file .rake_tasks
} }
_rake () { _rake () {

View File

@ -292,16 +292,17 @@ function display-release {
function fmt:hash { function fmt:hash {
#* Uses $hash from outer scope #* Uses $hash from outer scope
local hash="${1:-$hash}" local hash="${1:-$hash}"
local short_hash="${hash:0:7}" # 7 characters sha, top level sha is 12 characters
case "$output" in case "$output" in
raw) printf '%s' "$hash" ;; raw) printf '%s' "$short_hash" ;;
text) text)
local text="\e[33m$hash\e[0m"; # red local text="\e[33m$short_hash\e[0m"; # red
if supports_hyperlinks; then if supports_hyperlinks; then
printf "\e]8;;%s\a%s\e]8;;\a" "https://github.com/ohmyzsh/ohmyzsh/commit/$hash" $text; printf "\e]8;;%s\a%s\e]8;;\a" "https://github.com/ohmyzsh/ohmyzsh/commit/$hash" $text;
else else
echo $text; echo $text;
fi ;; 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 esac
} }
@ -512,13 +513,13 @@ function main {
# Git log options # Git log options
# -z: commits are delimited by null bytes # -z: commits are delimited by null bytes
# --format: [7-char hash]<field sep>[ref names]<field sep>[subject]<field sep>[body] # --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 # --no-merges: merge commits are omitted
# --first-parent: commits from merged branches are omitted # --first-parent: commits from merged branches are omitted
local SEP="0mZmAgIcSeP" local SEP="0mZmAgIcSeP"
local -a raw_commits local -a raw_commits
raw_commits=(${(0)"$(command git -c log.showSignature=false log -z \ 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)"}) --no-merges --first-parent $range)"})
local raw_commit local raw_commit