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

[PATCH/RFC] Add git-changelog-script to show the changes between two commits

From
RARyan Anderson <ryan@michonline.com>
Date
Jul 21, 2005, 06:31 UTC
Message-ID
<20050721063143.GO20369@mythryan2.michonline.com>
I'll start by saying that, well, I'm pretty sure this patch is wrong.

I was trying to look at the changes between two commits, sanely, but failed to find a tool or example in the tree that hinted at how to do this.

After poking around at git-whatchanged trying to figure out what it is trying to do - I gave up and wrote something that *seems* to work correctly for the simple test cases I pulled together. I just don't trust it.

My thinking here is that, when doing a release of a package such as git or Linux, the releaser could do something like:

	git changelog $LAST_RELEASED_COMMIT HEAD | git-shortlog |\
		mail -s "Linux 2.7.0 finally open" linux-kernel
Where LAST_RELEASED is recorded somewhere or pulled from an internal
changelog with something like:
	grep "Released commit-id:" changelog | awk -F: '{print $2}'" |\
		head -1
Signed-off-by: Ryan Anderson <ryan@michonline.com>
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,8 @@ SCRIPTS=git git-apply-patch-script git-m
 	git-reset-script git-add-script git-checkout-script git-clone-script \
 	gitk git-cherry git-rebase-script git-relink-script git-repack-script \
 	git-format-patch-script git-sh-setup-script git-push-script \
-	git-branch-script git-parse-remote
+	git-branch-script git-parse-remote \
+	git-changelog-script git-revdiff-script
 
 PROG=   git-update-cache git-diff-files git-init-db git-write-tree \
 	git-read-tree git-commit-tree git-cat-file git-fsck-cache \
diff --git a/git-changelog-script b/git-changelog-script
new file mode 100755
--- /dev/null
+++ b/git-changelog-script
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+git-revdiff-script $@ | git-diff-tree --stdin --pretty -r | LESS="$LESS -S" ${PAGER:-less}
diff --git a/git-revdiff-script b/git-revdiff-script
new file mode 100755
--- /dev/null
+++ b/git-revdiff-script
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+my ($start,$end) = @ARGV;
+
+open(R,"-|","git-rev-list",$start)
+	or die "Failed to pipe from git-rev-list: " . $!;
+
+my $rev;
+while ($rev = <R>) {
+	chomp $rev;
+	print $rev,"\n";
+	last if $end eq $rev;
+}
+
+close(R);
-- 
Ryan Anderson
  sometimes Pug Majere
Next: Ryan Anderson
Message 1 of 3 in “Add git-changelog-script to show the changes between two commits”
  1. Add git-changelog-script to show the changes between two commitsRyan Anderson, Jul 21, 2005
  2. Ryan AndersonJul 21, 2005
  3. Linus TorvaldsJul 21, 2005

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.