# Commit template

11 messages from 2005-05-08 to 2005-05-08. Participants: Sean, Marcel Holtmann, Petr Baudis.
Thread: https://gitlist.dev/t/536

## Sean, 2005-05-08 19:07

Subject: Commit template
Message-ID: <1965.10.10.10.24.1115579256.squirrel@linux1>
URL: https://gitlist.dev/e/1965.10.10.10.24.1115579256.squirrel%40linux1

```
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, 2005-05-08 19:16

Subject: Re: Commit template
Message-ID: <1115579764.8949.15.camel@pegasus>
URL: https://gitlist.dev/e/1115579764.8949.15.camel%40pegasus
In-Reply-To: <1965.10.10.10.24.1115579256.squirrel@linux1>

```
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, 2005-05-08 19:20

Subject: Re: Commit template
Message-ID: <2003.10.10.10.24.1115580031.squirrel@linux1>
URL: https://gitlist.dev/e/2003.10.10.10.24.1115580031.squirrel%40linux1
In-Reply-To: <1115579764.8949.15.camel@pegasus>

```
On Sun, May 8, 2005 3:16 pm, Marcel Holtmann said:
> 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, 2005-05-08 19:30

Subject: Re: Commit template
Message-ID: <1115580630.8949.27.camel@pegasus>
URL: https://gitlist.dev/e/1115580630.8949.27.camel%40pegasus
In-Reply-To: <2003.10.10.10.24.1115580031.squirrel@linux1>

```
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.
>
> 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, 2005-05-08 19:57

Subject: Re: Commit template
Message-ID: <2095.10.10.10.24.1115582244.squirrel@linux1>
URL: https://gitlist.dev/e/2095.10.10.10.24.1115582244.squirrel%40linux1
In-Reply-To: <1115580630.8949.27.camel@pegasus>

```
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, 2005-05-08 20:03

Subject: Re: Commit template
Message-ID: <1115582601.8949.31.camel@pegasus>
URL: https://gitlist.dev/e/1115582601.8949.31.camel%40pegasus
In-Reply-To: <2095.10.10.10.24.1115582244.squirrel@linux1>

```
Hi Sean,

> > 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, 2005-05-08 20:06

Subject: Re: Commit template
Message-ID: <2159.10.10.10.24.1115582791.squirrel@linux1>
URL: https://gitlist.dev/e/2159.10.10.10.24.1115582791.squirrel%40linux1
In-Reply-To: <1115582601.8949.31.camel@pegasus>

```
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, 2005-05-08 20:17

Subject: Re: Commit template
Message-ID: <20050508201723.GH9495@pasky.ji.cz>
URL: https://gitlist.dev/e/20050508201723.GH9495%40pasky.ji.cz
In-Reply-To: <2159.10.10.10.24.1115582791.squirrel@linux1>

```
Dear diary, on Sun, May 08, 2005 at 10:06:31PM CEST, I got a letter
where Sean <seanlkml@sympatico.ca> told me that...
> 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, 2005-05-08 20:36

Subject: Re: Commit template
Message-ID: <1115584617.8949.51.camel@pegasus>
URL: https://gitlist.dev/e/1115584617.8949.51.camel%40pegasus
In-Reply-To: <20050508201723.GH9495@pasky.ji.cz>

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

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, 2005-05-08 20:40

Subject: Re: Commit template
Message-ID: <20050508204043.GJ9495@pasky.ji.cz>
URL: https://gitlist.dev/e/20050508204043.GJ9495%40pasky.ji.cz
In-Reply-To: <1115584617.8949.51.camel@pegasus>

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

> 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, 2005-05-08 21:09

Subject: Re: Commit template
Message-ID: <1115586556.8949.65.camel@pegasus>
URL: https://gitlist.dev/e/1115586556.8949.65.camel%40pegasus
In-Reply-To: <20050508204043.GJ9495@pasky.ji.cz>

```
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?

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?

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

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



```
