git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Minor cleanup and bugfixing in git-notes.sh
@ 2009-05-15  0:12 Johan Herland
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Herland @ 2009-05-15  0:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin

The following changes are made:
- Rename $MESSAGE to $MSG_FILE which better describes its purpose
- Make sure not only $MSG_FILE is removed upopn completion, but also
  $GIT_INDEX_FILE
- Remove stray "GIT_NOTES_REF=" in front of "git log ..." command

Signed-off-by: Johan Herland <johan@herland.net>
---
 git-notes.sh |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/git-notes.sh b/git-notes.sh
index 6ec33c9..7c3b8b9 100755
--- a/git-notes.sh
+++ b/git-notes.sh
@@ -20,15 +20,16 @@ edit)
 		die "Refusing to edit notes in $GIT_NOTES_REF (outside of refs/notes/)"
 	fi
 
-	MESSAGE="$GIT_DIR"/new-notes-$COMMIT
+	MSG_FILE="$GIT_DIR/new-notes-$COMMIT"
+	GIT_INDEX_FILE="MSG_FILE.idx"
+	export GIT_INDEX_FILE
+
 	trap '
-		test -f "$MESSAGE" && rm "$MESSAGE"
+		test -f "$MSG_FILE" && rm "$MSG_FILE"
+		test -f "$GIT_INDEX_FILE" && rm "$GIT_INDEX_FILE"
 	' 0
 
-	GIT_NOTES_REF= git log -1 $COMMIT | sed "s/^/#/" > "$MESSAGE"
-
-	GIT_INDEX_FILE="$MESSAGE".idx
-	export GIT_INDEX_FILE
+	git log -1 $COMMIT | sed "s/^/#/" > "$MSG_FILE"
 
 	CURRENT_HEAD=$(git show-ref "$GIT_NOTES_REF" | cut -f 1 -d ' ')
 	if [ -z "$CURRENT_HEAD" ]; then
@@ -36,16 +37,16 @@ edit)
 	else
 		PARENT="-p $CURRENT_HEAD"
 		git read-tree "$GIT_NOTES_REF" || die "Could not read index"
-		git cat-file blob :$COMMIT >> "$MESSAGE" 2> /dev/null
+		git cat-file blob :$COMMIT >> "$MSG_FILE" 2> /dev/null
 	fi
 
 	core_editor="$(git config core.editor)"
-	${GIT_EDITOR:-${core_editor:-${VISUAL:-${EDITOR:-vi}}}} "$MESSAGE"
+	${GIT_EDITOR:-${core_editor:-${VISUAL:-${EDITOR:-vi}}}} "$MSG_FILE"
 
-	grep -v ^# < "$MESSAGE" | git stripspace > "$MESSAGE".processed
-	mv "$MESSAGE".processed "$MESSAGE"
-	if [ -s "$MESSAGE" ]; then
-		BLOB=$(git hash-object -w "$MESSAGE") ||
+	grep -v ^# < "$MSG_FILE" | git stripspace > "$MSG_FILE".processed
+	mv "$MSG_FILE".processed "$MSG_FILE"
+	if [ -s "$MSG_FILE" ]; then
+		BLOB=$(git hash-object -w "$MSG_FILE") ||
 			die "Could not write into object database"
 		git update-index --add --cacheinfo 0644 $BLOB $COMMIT ||
 			die "Could not write index"
-- 
1.6.3.rc0.1.gf800




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] Minor cleanup and bugfixing in git-notes.sh
  2009-04-21  0:49   ` Johannes Schindelin
@ 2009-04-21  0:51     ` Johan Herland
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Herland @ 2009-04-21  0:51 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git

On Tuesday 21 April 2009, Johannes Schindelin wrote:
> On Tue, 21 Apr 2009, Johan Herland wrote:
> > The following changes are made:
> > - Rename $MESSAGE to $MSG_FILE which better describes its purpose
> > - Make sure not only $MSG_FILE is removed upopn completion, but also
> >   $GIT_INDEX_FILE
> > - Remove stray "GIT_NOTES_REF=" in front of "git log ..." command
>
> Valid points.  Mind if I squash this into the commit adding git-notes.sh?

No problem


Have fun! :)

...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] Minor cleanup and bugfixing in git-notes.sh
  2009-04-21  0:41 ` [PATCH 1/2] Minor cleanup and bugfixing in git-notes.sh Johan Herland
@ 2009-04-21  0:49   ` Johannes Schindelin
  2009-04-21  0:51     ` Johan Herland
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2009-04-21  0:49 UTC (permalink / raw)
  To: Johan Herland; +Cc: Junio C Hamano, git

Hi,

On Tue, 21 Apr 2009, Johan Herland wrote:

> The following changes are made:
> - Rename $MESSAGE to $MSG_FILE which better describes its purpose
> - Make sure not only $MSG_FILE is removed upopn completion, but also
>   $GIT_INDEX_FILE
> - Remove stray "GIT_NOTES_REF=" in front of "git log ..." command

Valid points.  Mind if I squash this into the commit adding git-notes.sh?

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] Minor cleanup and bugfixing in git-notes.sh
  2009-04-21  0:39 [PATCH 0/2] Add "-m" and "-F" options to "git notes edit" Johan Herland
@ 2009-04-21  0:41 ` Johan Herland
  2009-04-21  0:49   ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Herland @ 2009-04-21  0:41 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin

The following changes are made:
- Rename $MESSAGE to $MSG_FILE which better describes its purpose
- Make sure not only $MSG_FILE is removed upopn completion, but also
  $GIT_INDEX_FILE
- Remove stray "GIT_NOTES_REF=" in front of "git log ..." command

Signed-off-by: Johan Herland <johan@herland.net>
---
 git-notes.sh |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/git-notes.sh b/git-notes.sh
index 6ec33c9..7c3b8b9 100755
--- a/git-notes.sh
+++ b/git-notes.sh
@@ -20,15 +20,16 @@ edit)
 		die "Refusing to edit notes in $GIT_NOTES_REF (outside of refs/notes/)"
 	fi
 
-	MESSAGE="$GIT_DIR"/new-notes-$COMMIT
+	MSG_FILE="$GIT_DIR/new-notes-$COMMIT"
+	GIT_INDEX_FILE="MSG_FILE.idx"
+	export GIT_INDEX_FILE
+
 	trap '
-		test -f "$MESSAGE" && rm "$MESSAGE"
+		test -f "$MSG_FILE" && rm "$MSG_FILE"
+		test -f "$GIT_INDEX_FILE" && rm "$GIT_INDEX_FILE"
 	' 0
 
-	GIT_NOTES_REF= git log -1 $COMMIT | sed "s/^/#/" > "$MESSAGE"
-
-	GIT_INDEX_FILE="$MESSAGE".idx
-	export GIT_INDEX_FILE
+	git log -1 $COMMIT | sed "s/^/#/" > "$MSG_FILE"
 
 	CURRENT_HEAD=$(git show-ref "$GIT_NOTES_REF" | cut -f 1 -d ' ')
 	if [ -z "$CURRENT_HEAD" ]; then
@@ -36,16 +37,16 @@ edit)
 	else
 		PARENT="-p $CURRENT_HEAD"
 		git read-tree "$GIT_NOTES_REF" || die "Could not read index"
-		git cat-file blob :$COMMIT >> "$MESSAGE" 2> /dev/null
+		git cat-file blob :$COMMIT >> "$MSG_FILE" 2> /dev/null
 	fi
 
 	core_editor="$(git config core.editor)"
-	${GIT_EDITOR:-${core_editor:-${VISUAL:-${EDITOR:-vi}}}} "$MESSAGE"
+	${GIT_EDITOR:-${core_editor:-${VISUAL:-${EDITOR:-vi}}}} "$MSG_FILE"
 
-	grep -v ^# < "$MESSAGE" | git stripspace > "$MESSAGE".processed
-	mv "$MESSAGE".processed "$MESSAGE"
-	if [ -s "$MESSAGE" ]; then
-		BLOB=$(git hash-object -w "$MESSAGE") ||
+	grep -v ^# < "$MSG_FILE" | git stripspace > "$MSG_FILE".processed
+	mv "$MSG_FILE".processed "$MSG_FILE"
+	if [ -s "$MSG_FILE" ]; then
+		BLOB=$(git hash-object -w "$MSG_FILE") ||
 			die "Could not write into object database"
 		git update-index --add --cacheinfo 0644 $BLOB $COMMIT ||
 			die "Could not write index"
-- 
1.6.3.rc0.1.gf800

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-05-15  0:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-15  0:12 [PATCH 1/2] Minor cleanup and bugfixing in git-notes.sh Johan Herland
  -- strict thread matches above, loose matches on Subject: below --
2009-04-21  0:39 [PATCH 0/2] Add "-m" and "-F" options to "git notes edit" Johan Herland
2009-04-21  0:41 ` [PATCH 1/2] Minor cleanup and bugfixing in git-notes.sh Johan Herland
2009-04-21  0:49   ` Johannes Schindelin
2009-04-21  0:51     ` Johan Herland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).