1
0
Fork 0
mirror of https://git.ludikovsky.name/git/fugitive.git synced 2024-09-28 22:25:27 +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_subject=`git log -1 --format="%s"`
commit_slug=`git log -1 --format="%f"` commit_slug=`git log -1 --format="%f"`
commit_body() { commit_body() {
tmp="/tmp/fugitive-$$.$RANDOM" tmp=`tempfile -p "fugitive"`
git log -1 --format="%b" > "$tmp" git log -1 --format="%b" > "$tmp"
(sleep 5 && rm -f "$tmp") & # this message will self-destruct in 5s (sleep 5 && rm -f "$tmp") & # this message will self-destruct in 5s
echo "$tmp" echo "$tmp"
@ -36,7 +36,7 @@ article_get_title() {
head -1 "$1" head -1 "$1"
} }
article_get_content() { article_get_content() {
tmp="/tmp/fugitive-$$.$RANDOM" tmp=`tempfile -p "fugitive"`
tail -n+2 "$1" > "$tmp" tail -n+2 "$1" > "$tmp"
(sleep 5 && rm -f "$tmp") & # this message will self-destruct in 5s (sleep 5 && rm -f "$tmp") & # this message will self-destruct in 5s
echo "$tmp" echo "$tmp"
@ -46,7 +46,7 @@ replace_var_by_string() {
sed "s/<\!--$1-->/$2/" sed "s/<\!--$1-->/$2/"
} }
replace_var_by_file() { replace_var_by_file() {
sed "/<\!--$1-->/ { \ sed "/<\!--$1-->/ {
r $2 r $2
d }" d }"
} }
@ -80,4 +80,3 @@ for f in $added_files $modified_files; do
echo "done." echo "done."
fi fi
done done