Skip to contentSkip to conversation

cg-commit: show and enable editing of changes with --review

PROBE Jonas Fonseca 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Show changes being commited as a patch appended to the commit message buffer. If the original patch is different from the patch extracted from the commit message file the original patch will be reverted and the edited patch applied before completing the commit.

Due to limitations with cg-patch this can only be used when commiting from the project root directory. The error handling if the either the original patch or the edited patch does not apply is not optimal, since cg-patch will not report errors properly.

---
commit 5031c74c4716793784314f836f4ceb6bcfa6698a
tree d01b7a66054352a89c637d58c7ab6454a26ba700
parent dd872816a04f6462686e282b00d3e1523e3ecf4c
author Jonas Fonseca <[email protected]> Wed, 30 Nov 2005 00:41:06 +0100 committer Jonas Fonseca <[email protected]> Wed, 30 Nov 2005 00:41:06 +0100

 TODO      |    4 ----
 cg-commit |   63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 61 insertions(+), 6 deletions(-)
TODO +0 -4
index 777c728..cffa753 100644
@@ -79,10 +79,6 @@ cg-*patch should be pre-1.0.)
 		  whitespace errors and stuff; hooks are good for this too,
 		  but I think it's good to have internal support for the
 		  basic stuff.
-	-- post 1.0 --
-	* Patch-altering cg-commit
-		You can already alter the list of files to be committed,
-		let's optionally show the patch and let you alter it, too.
 
 * cg-push over HTTP
 
cg-commit +61 -2

119 lines not on this page · raw message

Signature · 1 line
Jonas Fonseca
#1 lore raw
Quoted 9 lines · Jonas Fonseca

Show changes being commited as a patch appended to the commit message buffer. If the original patch is different from the patch extracted from the commit message file the original patch will be reverted and the edited patch applied before completing the commit.

Due to limitations with cg-patch this can only be used when commiting from the project root directory. The error handling if the either the original patch or the edited patch does not apply is not optimal, since cg-patch will not report errors properly.

I do not do Porcelains, I am not a Cogito user, and I generally do not like encouraging people who are playing an individual developer role to commit something that has never existed in their working tree (hence by definition never been tested), but...

cg-commit else · line 454

Quoted 8 lines
cg-commit +8 -0
+		echo "Updating changes to edited patch"
+		# FIXME: Can only be run from the top level
+		# FIXME: Is very 'fragile' error handling. We should probably
+		# save the original patch in a local file for recovery?
+		if ! cg-patch -R < $PATCH; then
+			backup=$(mktemp commit-backup.XXXXXX)
+			cp $PATCH $backup
+			error_msg="unable to revert original patch, backup saved to $backup"

I suspect at least you should be able to use checkout-index for the first one instead of cg-patch.

#2 lore raw

Junio C Hamano <[email protected]> wrote Tue, Nov 29, 2005:

Quoted 7 lines
Quoted 5 lines · Jonas Fonseca

Show changes being commited as a patch appended to the commit message buffer. If the original patch is different from the patch extracted from the commit message file the original patch will be reverted and the edited patch applied before completing the commit.

Quoted 6 lines
Quoted 4 lines

Due to limitations with cg-patch this can only be used when commiting from the project root directory. The error handling if the either the original patch or the edited patch does not apply is not optimal, since cg-patch will not report errors properly.

I do not do Porcelains,

I am curious since you have also used this phrase in the past: didn't you do your own jit porcelain once and are you saying that git does not ship with it's own porcelain?

Quoted 5 lines

I am not a Cogito user, and I generally
do not like encouraging people who are playing an individual developer role to commit something that has never existed in their working tree (hence by definition never been tested), but...

I see your point. I mostly intend to use it for fixing small typos in comments and documentation. It can help to cure some "post-commit stress". Also I hope you will agree that it is always a good idea to review your changes one more time although I agree it might be a little silly.

Quoted 11 lines

cg-commit else · line 454

Quoted 8 lines
cg-commit +8 -0
+		echo "Updating changes to edited patch"
+		# FIXME: Can only be run from the top level
+		# FIXME: Is very 'fragile' error handling. We should probably
+		# save the original patch in a local file for recovery?
+		if ! cg-patch -R < $PATCH; then
+			backup=$(mktemp commit-backup.XXXXXX)
+			cp $PATCH $backup
+			error_msg="unable to revert original patch, backup saved to $backup"

I suspect at least you should be able to use checkout-index for the first one instead of cg-patch.

Oh, great, thanks. I guess I should work some more on the git docs to get to know these kind of things.

Signature · 1 line
Jonas Fonseca