From: Thomas Rast Date: Sat, 14 Feb 2009 20:23:21 GMT Subject: [PATCH v2 1/5] notes: only clean up message file when editing Message-ID: <4655551d70d8829a7a15219aef384deb4e63371a.1234642638.git.trast@student.ethz.ch> In-Reply-To: <200902142056.42198.trast@student.ethz.ch> We clean up the notes file when exiting. However, actions other than 'edit' have nothing to do with the file, so they should not remove it when done. Signed-off-by: Thomas Rast Acked-by: Johannes Schindelin --- Same as v1. git-notes.sh | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/git-notes.sh b/git-notes.sh index 9cbad02..246df65 100755 --- a/git-notes.sh +++ b/git-notes.sh @@ -14,13 +14,13 @@ test -z "$GIT_NOTES_REF" && GIT_NOTES_REF="refs/notes/commits" COMMIT=$(git rev-parse --verify --default HEAD "$@") || die "Invalid commit: $@" -MESSAGE="$GIT_DIR"/new-notes-$COMMIT -trap ' - test -f "$MESSAGE" && rm "$MESSAGE" -' 0 - case "$ACTION" in edit) + MESSAGE="$GIT_DIR"/new-notes-$COMMIT + trap ' + test -f "$MESSAGE" && rm "$MESSAGE" + ' 0 + GIT_NOTES_REF= git log -1 $COMMIT | sed "s/^/#/" > "$MESSAGE" GIT_INDEX_FILE="$MESSAGE".idx -- 1.6.2.rc0.296.ge2122