git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH Cogito] Use cg-commit -E to invoke editor and always commit
@ 2005-05-09  0:25 Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2005-05-09  0:25 UTC (permalink / raw)
  To: Petr Baudis; +Cc: GIT Mailing List

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

Hi Petr,

the attached patch introduces the -E parameter to cg-commit and then
uses it in cg-init. If you use -E instead of -e the editor is invoked
and it will do the commit even it the default commit messages has not
been changed.

Regards

Marcel


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1618 bytes --]

cg-commit: needs update
cg-init: needs update
Index: cg-commit
===================================================================
--- 00b94eea5b99d5dd1d1bbe9c9ca3502d11aec581/cg-commit  (mode:100755)
+++ uncommitted/cg-commit  (mode:100755)
@@ -13,6 +13,8 @@
 # appended to a single commit message, each as separate paragraph.
 # -e forces the editor to be brought up even when -m parameters were
 # passed to cg-commit.
+# -E forces the editor to be brought up and it will do the commit
+# even if the default commit message is not changed.
 
 . ${COGITO_LIB}cg-Xlib
 
@@ -21,6 +23,7 @@
 
 forceeditor=
 ignorecache=
+commitalways=
 msgs=()
 while [ "$1" ]; do
 	case "$1" in
@@ -32,6 +35,11 @@
 		forceeditor=1
 		shift
 		;;
+	-E)
+		forceeditor=1
+		commitalways=1
+		shift
+		;;
 	-m*)
 		msgs=("${msgs[@]}" "${1#-m}")
 		shift
@@ -126,10 +134,10 @@
 if tty -s; then
 	if ! [ "$msgs" ] || [ "$forceeditor" ]; then
 		${EDITOR:-vi} $LOGMSG2
-	fi
-	if ! [ "$msgs" ] && ! [ $LOGMSG2 -nt $LOGMSG ]; then
-		rm $LOGMSG $LOGMSG2
-		die 'Commit message not modified, commit aborted'
+		if ! [ "$commitalways" ] && ! [ $LOGMSG2 -nt $LOGMSG ]; then
+			rm $LOGMSG $LOGMSG2
+			die 'Commit message not modified, commit aborted'
+		fi
 	fi
 else
 	cat >>$LOGMSG2
Index: cg-init
===================================================================
--- 00b94eea5b99d5dd1d1bbe9c9ca3502d11aec581/cg-init  (mode:100755)
+++ uncommitted/cg-init  (mode:100755)
@@ -32,6 +32,6 @@
 else
 	git-read-tree # Seed the dircache
 	find * | xargs cg-add
-	cg-commit -C -m"Initial commit" -e
+	cg-commit -C -m"Initial commit" -E
 fi
 exit 0

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

* [PATCH Cogito] Use cg-commit -E to invoke editor and always commit
@ 2005-05-12 20:43 Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2005-05-12 20:43 UTC (permalink / raw)
  To: Petr Baudis; +Cc: GIT Mailing List

[-- Attachment #1: Type: text/plain, Size: 306 bytes --]

Hi Petr,

the attached patch introduces the -E parameter to cg-commit and then
uses it in cg-init. If you use -E instead of -e the editor is invoked
and it will do the commit even it the default commit messages has not
been changed.

Regards

Marcel


Signed-off-by: Marcel Holtmann <marcel@holtmann.org>


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1572 bytes --]

Index: cg-commit
===================================================================
--- 00b94eea5b99d5dd1d1bbe9c9ca3502d11aec581/cg-commit  (mode:100755)
+++ uncommitted/cg-commit  (mode:100755)
@@ -13,6 +13,8 @@
 # appended to a single commit message, each as separate paragraph.
 # -e forces the editor to be brought up even when -m parameters were
 # passed to cg-commit.
+# -E forces the editor to be brought up and it will do the commit
+# even if the default commit message is not changed.
 
 . ${COGITO_LIB}cg-Xlib
 
@@ -21,6 +23,7 @@
 
 forceeditor=
 ignorecache=
+commitalways=
 msgs=()
 while [ "$1" ]; do
 	case "$1" in
@@ -32,6 +35,11 @@
 		forceeditor=1
 		shift
 		;;
+	-E)
+		forceeditor=1
+		commitalways=1
+		shift
+		;;
 	-m*)
 		msgs=("${msgs[@]}" "${1#-m}")
 		shift
@@ -126,10 +134,10 @@
 if tty -s; then
 	if ! [ "$msgs" ] || [ "$forceeditor" ]; then
 		${EDITOR:-vi} $LOGMSG2
-	fi
-	if ! [ "$msgs" ] && ! [ $LOGMSG2 -nt $LOGMSG ]; then
-		rm $LOGMSG $LOGMSG2
-		die 'Commit message not modified, commit aborted'
+		if ! [ "$commitalways" ] && ! [ $LOGMSG2 -nt $LOGMSG ]; then
+			rm $LOGMSG $LOGMSG2
+			die 'Commit message not modified, commit aborted'
+		fi
 	fi
 else
 	cat >>$LOGMSG2
Index: cg-init
===================================================================
--- 00b94eea5b99d5dd1d1bbe9c9ca3502d11aec581/cg-init  (mode:100755)
+++ uncommitted/cg-init  (mode:100755)
@@ -32,6 +32,6 @@
 else
 	git-read-tree # Seed the dircache
 	find * | xargs cg-add
-	cg-commit -C -m"Initial commit" -e
+	cg-commit -C -m"Initial commit" -E
 fi
 exit 0

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

end of thread, other threads:[~2005-05-12 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-12 20:43 [PATCH Cogito] Use cg-commit -E to invoke editor and always commit Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2005-05-09  0:25 Marcel Holtmann

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).