git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] Only show log entries for new revisions in hooks--update

From
APAndy Parkins <andyparkins@gmail.com>
Date
Feb 13, 2007, 14:24 UTC
Message-ID
<200702131424.06983.andyparkins@gmail.com>

If you were issuing emails for two branches, and one merged the other, you would get the same log messages appearing in two separate emails.

e.g. A working repository, where the last push to central was done at
     the revision marked "B", after which two branches were developed
     further.
  * -- B -- 1 -- 1 -- M (branch1)
        \           /
         2 -- 2 -- 2 (branch2)

Now imagine that branch2 is pushed to the email-generating repository; an email containing all the "2" revisions would be sent. Now, let's say branch1 is pushed, the old update hook would run

 git-rev-list $newrev ^$baserev

Where $newrev would be "M" and $baserev would be "B". This list includes all the "2" revisions as well as all the "1" revisions.

This patch addresses this problem by using
 git-rev-parse --not --all | git-rev-list --stdin $newrev ^$baserev

To inhibit the display of all revisions that are already in the repository.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 templates/hooks--update |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/templates/hooks--update b/templates/hooks--update
index e8c536f..7e8258a 100644
--- a/templates/hooks--update
+++ b/templates/hooks--update
@@ -190,7 +190,7 @@ case "$refname_type" in
 			fi
 			echo ""
 			echo $LOGBEGIN
-			git-rev-list --pretty $newrev ^$baserev
+			git-rev-parse --not --all | git-rev-list --stdin --pretty $newrev ^$baserev
 			echo $LOGEND
 			echo ""
 			echo "Diffstat:"
-- 
1.5.0.rc4.364.g85b1
Next: Junio C Hamano
Message 1 of 3 in “Only show log entries for new revisions in hooks--update”
  1. 2/3 Only show log entries for new revisions in hooks--updateAndy Parkins, Feb 13, 2007
  2. Junio C HamanoFeb 13, 2007
  3. Andy ParkinsFeb 13, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.