git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [RFD] Add repoid identifier to commit
@ 2005-05-11 21:38 Thomas Gleixner
  2005-05-11 22:00 ` Sean
  2005-05-11 23:14 ` H. Peter Anvin
  0 siblings, 2 replies; 74+ messages in thread
From: Thomas Gleixner @ 2005-05-11 21:38 UTC (permalink / raw)
  To: git

This is an initial attempt to enable history tracking for multiple
repositories in a consistent state. At the moment this can only be done
by heuristic guessing on the parent dates and the committer names. 
This fails for example with Dave Millers net-2.6 and sparc-2.6 trees, as
in both cases the committer name is the same. It fails also completely
in cases where the system clock of the committer is wrong and the merge
is a head forward. The old bk repository contains entries from 1999 and
2027, which will happen also with git over the time. 

To identify a repository commit-tree tries to read an environment
variable "GIT_REPOSITORY_ID" and has a fallback to the current working
directory. The environment variable keeps the door open for managed
repository id's, but the current working directory is certainly a quite
helpful information to solve the origin decision for history tracking.

Adding a line after the committer should not break any existing tools
AFAICS.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

--- a/commit-tree.c
+++ b/commit-tree.c
@@ -110,6 +110,7 @@ int main(int argc, char **argv)
 	char *gecos, *realgecos, *commitgecos;
 	char *email, *commitemail, realemail[1000];
 	char date[20], realdate[20];
+	char *repoid, repoidbuf[MAXPATHLEN];
 	char *audate;
 	char comment[1000];
 	struct passwd *pw;
@@ -154,6 +155,14 @@ int main(int argc, char **argv)
 	if (audate)
 		parse_date(audate, date, sizeof(date));
 
+	repoid = getenv("GIT_REPOSITORY_ID");
+	if (!repoid)
+		repoid = getcwd(repoidbuf, MAXPATHLEN);
+	else {
+		if (strlen(repoid) == 0)
+			die("GIT_REPOSITORY_ID is empty. Fix it !");
+	}
+
 	remove_special(gecos); remove_special(realgecos); remove_special(commitgecos);
 	remove_special(email); remove_special(realemail); remove_special(commitemail);
 
@@ -170,7 +179,8 @@ int main(int argc, char **argv)
 
 	/* Person/date information */
 	add_buffer(&buffer, &size, "author %s <%s> %s\n", gecos, email, date);
-	add_buffer(&buffer, &size, "committer %s <%s> %s\n\n", commitgecos, commitemail, realdate);
+	add_buffer(&buffer, &size, "committer %s <%s> %s\n", commitgecos, commitemail, realdate);
+	add_buffer(&buffer, &size, "repoid %s\n\n", repoid);
 
 	/* And add the comment */
 	while (fgets(comment, sizeof(comment), stdin) != NULL)



^ permalink raw reply	[flat|nested] 74+ messages in thread

end of thread, other threads:[~2005-05-14  5:02 UTC | newest]

Thread overview: 74+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-11 21:38 [PATCH] [RFD] Add repoid identifier to commit Thomas Gleixner
2005-05-11 22:00 ` Sean
2005-05-11 22:05   ` Thomas Gleixner
2005-05-11 22:24     ` Sean
2005-05-11 22:30       ` Thomas Gleixner
2005-05-11 22:36         ` Sean
2005-05-11 22:48           ` Thomas Gleixner
2005-05-11 23:01             ` Sean
2005-05-11 23:33               ` Thomas Gleixner
2005-05-11 23:44                 ` Sean
2005-05-12  0:30                   ` Thomas Gleixner
2005-05-12  0:45                     ` Sean
2005-05-12  0:56                       ` Thomas Gleixner
2005-05-12  0:58                         ` Sean
2005-05-12 10:07                           ` David Woodhouse
2005-05-12 10:18                             ` Sean
2005-05-12 10:42                               ` Thomas Gleixner
2005-05-12 10:43                               ` David Woodhouse
2005-05-12 10:58                                 ` Sean
2005-05-12 10:39                             ` Sean
2005-05-11 23:14 ` H. Peter Anvin
2005-05-11 23:38   ` Thomas Gleixner
2005-05-11 23:40     ` H. Peter Anvin
2005-05-11 23:45       ` Sean
2005-05-12  0:04         ` H. Peter Anvin
2005-05-12  0:20           ` Sean
2005-05-12  0:33       ` Thomas Gleixner
2005-05-12  1:46         ` Junio C Hamano
2005-05-12  7:57           ` Thomas Gleixner
2005-05-12  9:32             ` Sean
2005-05-12  9:39               ` Thomas Gleixner
2005-05-12  9:46                 ` Sean
2005-05-12 11:18                   ` Thomas Gleixner
2005-05-12 11:24                     ` Sean
2005-05-12 11:43                       ` Thomas Gleixner
2005-05-12 11:48                         ` Sean
2005-05-12 12:16                           ` Thomas Gleixner
2005-05-12 12:16                             ` Sean
2005-05-12 12:34                               ` Thomas Gleixner
2005-05-12 12:35                                 ` Sean
2005-05-12 12:17                             ` Sean
2005-05-12 12:29                           ` David Woodhouse
2005-05-12 12:32                             ` Sean
2005-05-12 13:29                         ` Jan Harkes
2005-05-12 15:44                           ` Jon Seymour
2005-05-12 15:48                             ` Jon Seymour
2005-05-12 15:50                               ` Jon Seymour
2005-05-12 16:20                                 ` Jan Harkes
2005-05-12 17:09                                   ` Jon Seymour
2005-05-12 17:12                                     ` Jon Seymour
2005-05-12 17:35             ` Junio C Hamano
2005-05-12 18:18               ` Sean
2005-05-12 19:24                 ` Junio C Hamano
2005-05-12 19:35                   ` Sean
2005-05-12 20:47               ` Thomas Gleixner
2005-05-12 21:09                 ` Sean
2005-05-12 21:21                   ` Thomas Gleixner
2005-05-12 21:32                     ` Sean
2005-05-12 21:44                       ` Junio C Hamano
2005-05-12 22:06                       ` Thomas Gleixner
2005-05-12 22:24                         ` Sean
2005-05-12  0:41     ` Dmitry Torokhov
2005-05-12  0:44       ` Thomas Gleixner
2005-05-12  1:09         ` H. Peter Anvin
2005-05-12  1:13           ` H. Peter Anvin
2005-05-12  3:30             ` Joel Becker
2005-05-12  9:17             ` Thomas Gleixner
2005-05-13  1:37   ` [PATCH] [RFD] Add repoid identifier to commit [its a workspace id, isn't it?] Jon Seymour
2005-05-13  8:36     ` Thomas Gleixner
2005-05-13 22:25     ` Petr Baudis
2005-05-13 22:26       ` H. Peter Anvin
2005-05-13 23:39         ` Petr Baudis
2005-05-13 23:49       ` Jon Seymour
2005-05-14  5:02         ` Jon Seymour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).