Subject: Re: Find out on which branch a commit was originally made) (was ANNOUNCE git-what-branch)

From: Artur Skawina <[email-masked]>
Date: Fri, 24 Sep 2010 03:33:20 +0200

> There's still a bug in there somewhere; 

JIC someone actually wants to use that script -- you'll need this:

--- git-show-merge-path	2010-09-23 20:13:59.000000000 +0000
+++ git-show-merge-path	2010-09-24 01:09:10.000000000 +0000
@@ -90,21 +89,21 @@
         	desc[id] = 1;
 	 if (sizeof(commits[id]["parent"])>1)
             if (!desc[commits[id]["parent"][0]]) {
-	       mapping reached = ([]);
-	       if (commits[id]["Branch"])
-	          reached = commits[id]["Branch"]&branchnames;
 	       int comtime = (int)commits[id]["committer"][-2];
                write("%.12s %-56.56s %.12s\n", id, 
 	              squeeze_subject(commits[id][""][1]),
 		      cal->Second(comtime)->format_time_xshort() );
-               if (sizeof(reached)>0) {
-	          branchnames -= reached;
-                  write("# Merged into %s\n", 
-		          String.implode_nicely(indices(reached)) );
-		  if (sizeof(branchnames)==0)
-		     exit(0);
-	       }
 	    }
+	 if (mapping reached = commits[id]["Branch"]) {
+	    reached = reached&branchnames;
+            if (sizeof(reached)>0) {
+               branchnames -= reached;
+               write("# Merged into %s\n",
+		       String.implode_nicely(indices(reached)) );
+	       if (sizeof(branchnames)==0)
+		  exit(0);
+	    }
+	 }
       }
       m_delete(commits, id);
    }