threads / discuss / 536

Commit template

Subject: Commit template

## tl;dr

11 messages between May 8, 2005 and May 8, 2005.

replies: 10people: 3as markdown or json

Sean· May 8, 2005, 19:07 UTC · lore
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
===================================================================
--- b2ce852fd77209e112e0b53866ca7004e9b0879f/cg-commit  (mode:100755)
+++ uncommitted/cg-commit  (mode:100755)
@@ -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
Marcel Holtmann· May 8, 2005, 19:16 UTC · re: Sean · lore

Re: Commit template

Hi Sean,
> 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
Sean· May 8, 2005, 19:20 UTC · re: Marcel Holtmann · lore

Re: Commit template

On Sun, May 8, 2005 3:16 pm, Marcel Holtmann said:
Show 15 quoted lines
> Hi Sean,
>
>> 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.
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
Marcel Holtmann· May 8, 2005, 19:30 UTC · re: Sean · lore

Re: Commit template

Hi Sean,
Show 18 quoted 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.
>
> 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
Sean· May 8, 2005, 19:57 UTC · re: Marcel Holtmann · lore

Re: Commit template

On Sun, May 8, 2005 3:30 pm, Marcel Holtmann said:
Hey Marcel,
> 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:
Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
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
Marcel Holtmann· May 8, 2005, 20:03 UTC · re: Sean · lore

Re: Commit template

Hi Sean,
Show 26 quoted 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:
> 
> Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
> 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
Sean· May 8, 2005, 20:06 UTC · re: Marcel Holtmann · lore

Re: Commit template

On Sun, May 8, 2005 4:03 pm, Marcel Holtmann said:
> 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
Petr Baudis· May 8, 2005, 20:17 UTC · re: Sean · lore

Re: Commit template

Dear diary, on Sun, May 08, 2005 at 10:06:31PM CEST, I got a letter where Sean <seanlkml@sympatico.ca> told me that...

Show 13 quoted lines
> On Sun, May 8, 2005 4:03 pm, Marcel Holtmann said:
> 
> > 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.

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,
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Marcel Holtmann· May 8, 2005, 20:36 UTC · re: Petr Baudis · lore

Re: Commit template

Hi Petr,
Show 12 quoted 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.

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
Petr Baudis· May 8, 2005, 20:40 UTC · re: Marcel Holtmann · lore

Re: Commit template

Dear diary, on Sun, May 08, 2005 at 10:36:57PM CEST, I got a letter where Marcel Holtmann <marcel@holtmann.org> told me that...

Show 17 quoted lines
> Hi Petr,
> 
> > > > 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.
> 
> 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?

Show 9 quoted 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.

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

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Marcel Holtmann· May 8, 2005, 21:09 UTC · re: Petr Baudis · lore

Re: Commit template

Hi Petr,
Show 19 quoted 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.
> > 
> > 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]

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---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]

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
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]
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
CG:
CG: Modified files:
CG:    Makefile
CG: -----------------------------------------------------------------------
---snip---
As an end user, what would you say?
Show 12 quoted 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.

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

Show 6 quoted 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

← back to recent threads