1
0
Fork 0
mirror of https://git.ludikovsky.name/git/fugitive.git synced 2024-05-18 14:35:32 +02:00

using safe temp file

This commit is contained in:
p4bl0 2010-07-22 16:41:08 +02:00
parent 01adb9a64d
commit 09b5b7e3e3

View file

@ -26,7 +26,7 @@ commit_timestamp=`git log -1 --format="%at"`
commit_subject=`git log -1 --format="%s"`
commit_slug=`git log -1 --format="%f"`
commit_body() {
tmp="/tmp/fugitive-$$.$RANDOM"
tmp=`tempfile -p "fugitive"`
git log -1 --format="%b" > "$tmp"
(sleep 5 && rm -f "$tmp") & # this message will self-destruct in 5s
echo "$tmp"
@ -36,7 +36,7 @@ article_get_title() {
head -1 "$1"
}
article_get_content() {
tmp="/tmp/fugitive-$$.$RANDOM"
tmp=`tempfile -p "fugitive"`
tail -n+2 "$1" > "$tmp"
(sleep 5 && rm -f "$tmp") & # this message will self-destruct in 5s
echo "$tmp"
@ -46,7 +46,7 @@ replace_var_by_string() {
sed "s/<\!--$1-->/$2/"
}
replace_var_by_file() {
sed "/<\!--$1-->/ { \
sed "/<\!--$1-->/ {
r $2
d }"
}
@ -80,4 +80,3 @@ for f in $added_files $modified_files; do
echo "done."
fi
done