Skip to contentSkip to conversation

Commit template

PATCH Sean 3 participants 11 messages Jun 15, 2016

lore
Share & tools
lore

Sean

author
#0 lore raw

Hi Petr,

This adds the ability to have a per repository commit template. Create a .git/commit.form file containg "CG: " and other lines and it will be used in place of the regular top 3 lines. This is kind of handy so that you can include your signed-off-by: with your email etc.

 cg-commit |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

Sean

P.s. Can't inline patches with this mailer.

cg-commit: needs update
Index: cg-commit
===================================================================

cg-commit (mode:100755) +8 -3
@@ -67,9 +67,14 @@
 
 LOGMSG=$(mktemp -t gitci.XXXXXX)
 LOGMSG2=$(mktemp -t gitci2.XXXXXX)
-echo CG: ---------------------------------------------------------- >>$LOGMSG
-echo CG: Lines beggining with CG: will be automatically removed     >>$LOGMSG
-echo CG:                                                            >>$LOGMSG
+if [ -e .git/commit.form ]; then
+	cat .git/commit.form >>$LOGMSG
+else
+	{
+	echo "CG: ----------------------------------------------------------"
+	echo "CG: Lines beggining with CG: will be automatically removed"
+	echo "CG:"; } >>$LOGMSG
+fi
 if [ ! "$ignorecache" ]; then
 	if [ ! "${commitfiles[*]}" ]; then
 		echo 'Nothing to commit.' >&2
#1 lore raw

Hi Sean,

Quoted 4 lines

This adds the ability to have a per repository commit template. Create a .git/commit.form file containg "CG: " and other lines and it will be used in place of the regular top 3 lines. This is kind of handy so that you can include your signed-off-by: with your email etc.

I think it is a bad idea to take the CG: into it. Let them be created by the cg-commit script, because it knows what to do.

The question now is when we should provide that form. For me it only makes sense if it is not a merge and if no commit message is provided via command line.

Regards

Marcel

author
#2 lore raw
Quoted 9 lines · Marcel Holtmann

Hi Sean,

Quoted 6 lines

This adds the ability to have a per repository commit template. Create a
.git/commit.form file containg "CG: " and other lines and it will be used
in place of the regular top 3 lines. This is kind of handy so that you can include your signed-off-by: with your email etc.

Quoted 6 lines

I think it is a bad idea to take the CG: into it. Let them be created by the cg-commit script, because it knows what to do.

The question now is when we should provide that form. For me it only makes sense if it is not a merge and if no commit message is provided via command line.

Marcel,

Yeah, it was just a quick hack. You're not forced to put any CG: lines in
the commit template of course, but it will handle it if you do. Even
with the patch, cg-commit will add addtional CG: lines containing a list of modified files etc..

Sean

#3 lore raw

Hi Sean,

Quoted 10 lines
Quoted 10 lines
Quoted 6 lines

This adds the ability to have a per repository commit template. Create a
.git/commit.form file containg "CG: " and other lines and it will be used
in place of the regular top 3 lines. This is kind of handy so that you can include your signed-off-by: with your email etc.

I think it is a bad idea to take the CG: into it. Let them be created by the cg-commit script, because it knows what to do.

Quoted 8 lines
Quoted 3 lines

The question now is when we should provide that form. For me it only makes sense if it is not a merge and if no commit message is provided via command line.

Yeah, it was just a quick hack. You're not forced to put any CG: lines in
the commit template of course, but it will handle it if you do. Even
with the patch, cg-commit will add addtional CG: lines containing a list of modified files etc..

if you don't put any CG: lines in the commit template you screw up the look of the modified files list. So I propose to leave all the CG: lines additions as they are in cg-commit and only add the template in front of it.

Regards

Marcel

author
#4 lore raw

On Sun, May 8, 2005 3:30 pm, Marcel Holtmann said:

Hey Marcel,

Quoted 4 lines

if you don't put any CG: lines in the commit template you screw up the look of the modified files list. So I propose to leave all the CG: lines additions as they are in cg-commit and only add the template in front of it.

Yes, but you're free to make it look however you like. Here's a sample:

CG: -[DO NOT COMMIT!]------------------------------------------- CG:
CG: Hey! You don't want to commit here, use a cloned repository! CG:

and another:

CG: -[USB CHANGES REPO!]---------------------------------------- CG:
CG: Commit only USB changes here!
CG:

CG:
CG:

The trailing CG: lines ensure that those added by cg-commit look okay. It's not perfect, but it's a nice feature.

Sean

#5 lore raw

Hi Sean,

Quoted 20 lines
Quoted 4 lines

if you don't put any CG: lines in the commit template you screw up the look of the modified files list. So I propose to leave all the CG: lines additions as they are in cg-commit and only add the template in front of it.

Yes, but you're free to make it look however you like. Here's a sample:

CG: -[DO NOT COMMIT!]------------------------------------------- CG:
CG: Hey! You don't want to commit here, use a cloned repository! CG:

and another:

CG: -[USB CHANGES REPO!]---------------------------------------- CG:
CG: Commit only USB changes here!
CG:

Quoted 6 lines

CG:
CG:

The trailing CG: lines ensure that those added by cg-commit look okay. It's not perfect, but it's a nice feature.

my argument is; not to mess up with the CG: lines created by cg-commit. If you wanna insert a warning then you can of course add additional CG:
lines to the commit template.

Regards

Marcel

author
#6 lore raw
Quoted 3 lines · Marcel Holtmann

my argument is; not to mess up with the CG: lines created by cg-commit. If you wanna insert a warning then you can of course add additional CG:
lines to the commit template.

Marcel,

Well, i'd argue that anyone making their own commit should be responsible for making it look however they like. Maybe they want to only use only 60 character wide lines and are tired of seeing the notice about CG: being
ignored. Gives the power user a tad more flexibility. But I really
don't care much either way.

Sean

#7 lore raw

Dear diary, on Sun, May 08, 2005 at 10:06:31PM CEST, I got a letter where Sean <[email protected]> told me that...

Quoted 6 lines · Marcel Holtmann
Quoted 4 lines

my argument is; not to mess up with the CG: lines created by cg-commit. If you wanna insert a warning then you can of course add additional CG:
lines to the commit template.

Quoted 7 lines

Marcel,

Well, i'd argue that anyone making their own commit should be responsible for making it look however they like. Maybe they want to only use only 60 character wide lines and are tired of seeing the notice about CG: being
ignored. Gives the power user a tad more flexibility. But I really
don't care much either way.

I'm with Sean on this one - implemented (with current cg-commit, and I used .git/commit-template file instead), committed, pushed out.

Sean, could you please sign off the patches you send to the mailing list in the future?

Thanks,

Signature · 3 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
#8 lore raw

Hi Petr,

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

my argument is; not to mess up with the CG: lines created by cg-commit. If you wanna insert a warning then you can of course add additional CG:
lines to the commit template.

Quoted 8 lines
Quoted 5 lines

Well, i'd argue that anyone making their own commit should be responsible for making it look however they like. Maybe they want to only use only 60 character wide lines and are tired of seeing the notice about CG: being
ignored. Gives the power user a tad more flexibility. But I really
don't care much either way.

I'm with Sean on this one - implemented (with current cg-commit, and I used .git/commit-template file instead), committed, pushed out.

then please do a "touch .git/commit-template" and call cg-commit. Now you will see what I mean. It is too easy to screw up.

Why not leave the list of modified files in the hand of the cg-commit and people that wanna extra text inside their commit-template add something like:

CG: ---
CG: This is my testing tree, don't commit

This will look much prettier and gives people the same possibilities to change everything. If you wanna make the modified files list into a full configurable template, then I think you must introduce place holders.

Also an option to suppress the list of modified files is possible.

Regards

Marcel

#9 lore raw

Dear diary, on Sun, May 08, 2005 at 10:36:57PM CEST, I got a letter where Marcel Holtmann <[email protected]> told me that...

Quoted 12 lines

Hi Petr,

Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

my argument is; not to mess up with the CG: lines created by cg-commit. If you wanna insert a warning then you can of course add additional CG:
lines to the commit template.

Well, i'd argue that anyone making their own commit should be responsible for making it look however they like. Maybe they want to only use only 60 character wide lines and are tired of seeing the notice about CG: being
ignored. Gives the power user a tad more flexibility. But I really
don't care much either way.

Quoted 5 lines
Quoted 2 lines

I'm with Sean on this one - implemented (with current cg-commit, and I used .git/commit-template file instead), committed, pushed out.

then please do a "touch .git/commit-template" and call cg-commit. Now you will see what I mean. It is too easy to screw up.

So don't touch .git/commit-template. It's not like it stops working, you just don't get the top stuff. Which you probably wanted, why would you touch .git/commit-template otherwise?

Quoted 9 lines

Why not leave the list of modified files in the hand of the cg-commit and people that wanna extra text inside their commit-template add something like:

CG: ---
CG: This is my testing tree, don't commit

This will look much prettier and gives people the same possibilities to change everything.

But you have extra stuff both before and after the list of modified files.

Quoted 2 lines

If you wanna make the modified files list into a full configurable template, then I think you must introduce place holders.

That's what I was thinking about, actually - @@MODIFIED@@ and such, and it replaces _all_ the CG: stuff. Just decided that I have better things to do now personally.

Signature · 3 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
#10 lore raw

Hi Petr,

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 9 lines
Quoted 3 lines

my argument is; not to mess up with the CG: lines created by cg-commit. If you wanna insert a warning then you can of course add additional CG:
lines to the commit template.

Well, i'd argue that anyone making their own commit should be responsible for making it look however they like. Maybe they want to only use only 60 character wide lines and are tired of seeing the notice about CG: being
ignored. Gives the power user a tad more flexibility. But I really
don't care much either way.

I'm with Sean on this one - implemented (with current cg-commit, and I used .git/commit-template file instead), committed, pushed out.

Quoted 6 lines
Quoted 2 lines

then please do a "touch .git/commit-template" and call cg-commit. Now you will see what I mean. It is too easy to screw up.

So don't touch .git/commit-template. It's not like it stops working, you just don't get the top stuff. Which you probably wanted, why would you touch .git/commit-template otherwise?

maybe I am the only one who sees a problem here and thinks that it is a mis-design. Let me try one last time to explain it. We speak here about end users of Cogito, right? They don't know what is inside the scripts and how they work. So you tell them that they can create a commit template that will be presented at every commit time. So lets do it.

---snip---
[PATCH]

---snip---

I would create a file like this and save it as .git/commit-template, because I don't really know about the CG: lines and actually I don't really care, because they get deleted anyway. Stupid as I am, I am expecting now something like this:

---snip---
[PATCH]

CG: -----------------------------------------------------------------------
CG: Lines beginning with the CG: prefix are removed automatically CG:
CG: Modified files:
CG: Makefile
CG: ----------------------------------------------------------------------- ---snip---

But instead I am getting this:

---snip---

[PATCH]

CG:
CG: Modified files:
CG: Makefile
CG: ----------------------------------------------------------------------- ---snip---

As an end user, what would you say?

Quoted 4 lines
Quoted 4 lines

Why not leave the list of modified files in the hand of the cg-commit and people that wanna extra text inside their commit-template add something like:

Quoted 8 lines
Quoted 5 lines

CG: ---
CG: This is my testing tree, don't commit

This will look much prettier and gives people the same possibilities to change everything.

But you have extra stuff both before and after the list of modified files.

Adding extra CG: lines in a commit template is only good for reminding you of something, right? Why else would you add them?

Quoted 6 lines
Quoted 2 lines

If you wanna make the modified files list into a full configurable template, then I think you must introduce place holders.

That's what I was thinking about, actually - @@MODIFIED@@ and such, and it replaces _all_ the CG: stuff. Just decided that I have better things to do now personally.

I understand that :)

Regards

Marcel