# New ref generates 8MB mail message

3 messages from 2006-01-18 to 2006-01-19. Participants: Matthew Wilcox, Linus Torvalds, Andreas Ericsson.
Thread: https://gitlist.dev/t/3095

## Matthew Wilcox, 2006-01-18 14:09

Subject: New ref generates 8MB mail message
Message-ID: <20060118140907.GV19769@parisc-linux.org>
URL: https://gitlist.dev/e/20060118140907.GV19769%40parisc-linux.org

```

There's a bit of an unfortunate mistake in the default mail script
that causes making a new ref for Linus' kernel tree to generate an 8MB
mail message.

Based on the idea that a new branch is probably a branch off master, and
if it isn't, then at least sending a log vs master is better than a log
vs the beginning of time, I propose this patch:

diff --git a/templates/hooks--update b/templates/hooks--update
index 6db555f..609b4fe 100644
--- a/templates/hooks--update
+++ b/templates/hooks--update
@@ -13,7 +13,7 @@ recipient="commit-list@example.com"
 if expr "$2" : '0*$' >/dev/null
 then
 	echo "Created a new ref, with the following commits:"
-	git-rev-list --pretty "$3"
+	git-rev-list --pretty "$3" ^master
 else
 	base=$(git-merge-base "$2" "$3")
 	case "$base" in

```

## Linus Torvalds, 2006-01-18 16:12

Subject: Re: New ref generates 8MB mail message
Message-ID: <Pine.LNX.4.64.0601180810330.3240@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0601180810330.3240%40g5.osdl.org
In-Reply-To: <20060118140907.GV19769@parisc-linux.org>

```


On Wed, 18 Jan 2006, Matthew Wilcox wrote:
> 
> Based on the idea that a new branch is probably a branch off master, and
> if it isn't, then at least sending a log vs master is better than a log
> vs the beginning of time, I propose this patch:

Actually, since the update hook _should_ be called before the ref has 
actually been updated, it's probably much better to instead of this:

> -	git-rev-list --pretty "$3"
> +	git-rev-list --pretty "$3" ^master

do something like this:

	git-rev-list --pretty "$3" $(git-rev-parse --not --all)

which basically says: show any commits that are in the new ref, but are 
not in _any_ other ref.

Untested, of course.

		Linus

```

## Andreas Ericsson, 2006-01-19 12:35

Subject: Re: New ref generates 8MB mail message
Message-ID: <43CF8791.6050705@op5.se>
URL: https://gitlist.dev/e/43CF8791.6050705%40op5.se
In-Reply-To: <Pine.LNX.4.64.0601180810330.3240@g5.osdl.org>

```
Linus Torvalds wrote:
> 
> On Wed, 18 Jan 2006, Matthew Wilcox wrote:
> 
>>Based on the idea that a new branch is probably a branch off master, and
>>if it isn't, then at least sending a log vs master is better than a log
>>vs the beginning of time, I propose this patch:
> 
> 
> Actually, since the update hook _should_ be called before the ref has 
> actually been updated, it's probably much better to instead of this:
> 
> 
>>-	git-rev-list --pretty "$3"
>>+	git-rev-list --pretty "$3" ^master
> 
> 
> do something like this:
> 
> 	git-rev-list --pretty "$3" $(git-rev-parse --not --all)
> 
> which basically says: show any commits that are in the new ref, but are 
> not in _any_ other ref.
> 
> Untested, of course.
> 

Tested. It works fine and is, surprisingly, insanely fast.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

```
