releng r937 - trunk/tools



Author: herzi
Date: Sat Feb  2 00:22:47 2008
New Revision: 937
URL: http://svn.gnome.org/viewvc/releng?rev=937&view=rev

Log:
2008-02-02  Sven Herzberg  <herzi gnome-de org>

	* prepare-ChangeLog.pl: after chatting with rob we realized that we
	should not diff against the index. The solution right now is this:
	Diff the index against the last revision; if this doesn't reveal
	changes, diff the tree against the last revision. This way
	"git add file && prepare..." will end up containing only the files
	already added to the index



Modified:
   trunk/tools/ChangeLog
   trunk/tools/prepare-ChangeLog.pl

Modified: trunk/tools/prepare-ChangeLog.pl
==============================================================================
--- trunk/tools/prepare-ChangeLog.pl	(original)
+++ trunk/tools/prepare-ChangeLog.pl	Sat Feb  2 00:22:47 2008
@@ -112,15 +112,26 @@
   {
     my ($tmphandle,$tmpname) = tempfile (UNLINK => 1);
     print STDERR "  Running git diff to find changes.\n";
+    my @args = ("git-diff", "--cached", "--quiet");
+    my $reference = ""; # our reference for diffing; HEAD or --cached
+    system (@args);
+    if ($? >> 8)
+      {
+	$cached = "--cached";
+      }
+    else
+      {
+	$cached = "HEAD";
+      }
     print $tmphandle <<EOF;
 #!/bin/bash
 echo "Index: \$1"
 echo "==================================================================="
-diff -b \$1 \$2 || true
+diff -b \$2 \$5 || true
 EOF
     close $tmphandle or die "Failed closing the script file: $OS_ERROR.\n";
     chmod (0700, $tmpname);
-    open DIFF, "GIT_EXTERNAL_DIFF='$tmpname' git diff |" or die "The git diff failed: $OS_ERROR.\n";
+    open DIFF, "GIT_EXTERNAL_DIFF='$tmpname' git diff $cached |" or die "The git diff failed: $OS_ERROR.\n";
   }
 
 while (<DIFF>)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]