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

[PATCH] Use $Id$ as the ident attribute keyword rather than $ident$ to be consistent with other VCSs

From
APAndy Parkins <andyparkins@gmail.com>
Date
May 14, 2007, 13:37 UTC
Message-ID
<200705141437.25528.andyparkins@gmail.com>
In-Reply-To
<200705141429.58412.andyparkins@gmail.com>

$Id$ is present already in SVN and CVS; it would mean that people converting their existing repositories won't have to make any changes to the source files should they want to make use of the ident attribute.

Given that it's a feature that's meant to calm those very people, it seems obtuse to make them edit every file just to make use of it.

I think that bzr uses $Id$; Mercurial has examples hooks for $Id$; monotone has $Id$ on its wishlist. I can't think of a good reason not to stick with the de-facto standard and call ours $Id$ instead of $ident$.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
Patch, should anyone agree with the idea.
 convert.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/convert.c b/convert.c
index 79dfbcf..23257aa 100644
--- a/convert.c
+++ b/convert.c
@@ -412,7 +412,7 @@ static void setup_convert_check(struct git_attr_check *check)
 static int count_ident(const char *cp, unsigned long size)
 {
 	/*
-	 * "$ident: 0000000000000000000000000000000000000000 $" <=> "$ident$"
+	 * "$Id: 0000000000000000000000000000000000000000 $" <=> "$Id$"
 	 */
 	int cnt = 0;
 	char ch;
@@ -466,10 +466,10 @@ static char *ident_to_git(const char *path, const char *src, unsigned long *size
 	for (dst = buf; size; size--) {
 		char ch = *src++;
 		*dst++ = ch;
-		if ((ch == '$') && (6 <= size) &&
-		    !memcmp("ident:", src, 6)) {
-			unsigned long rem = size - 6;
-			const char *cp = src + 6;
+		if ((ch == '$') && (3 <= size) &&
+		    !memcmp("Id:", src, 3)) {
+			unsigned long rem = size - 3;
+			const char *cp = src + 3;
 			do {
 				ch = *cp++;
 				if (ch == '$')
@@ -478,8 +478,8 @@ static char *ident_to_git(const char *path, const char *src, unsigned long *size
 			} while (rem);
 			if (!rem)
 				continue;
-			memcpy(dst, "ident$", 6);
-			dst += 6;
+			memcpy(dst, "Id$", 3);
+			dst += 3;
 			size -= (cp - src);
 			src = cp;
 		}
@@ -511,13 +511,13 @@ static char *ident_to_worktree(const char *path, const char *src, unsigned long
 		const char *cp;
 		char ch = *src++;
 		*dst++ = ch;
-		if ((ch != '$') || (size < 6) || memcmp("ident", src, 5))
+		if ((ch != '$') || (size < 3) || memcmp("Id", src, 2))
 			continue;
 
-		if (src[5] == ':') {
+		if (src[2] == ':') {
 			/* discard up to but not including the closing $ */
-			unsigned long rem = size - 6;
-			cp = src + 6;
+			unsigned long rem = size - 3;
+			cp = src + 3;
 			do {
 				ch = *cp++;
 				if (ch == '$')
@@ -527,13 +527,13 @@ static char *ident_to_worktree(const char *path, const char *src, unsigned long
 			if (!rem)
 				continue;
 			size -= (cp - src);
-		} else if (src[5] == '$')
-			cp = src + 5;
+		} else if (src[2] == '$')
+			cp = src + 2;
 		else
 			continue;
 
-		memcpy(dst, "ident: ", 7);
-		dst += 7;
+		memcpy(dst, "Id: ", 4);
+		dst += 4;
 		memcpy(dst, sha1_to_hex(sha1), ident);
 		dst += ident;
 		*dst++ = ' ';
-- 
1.5.2.rc3.27.g43d151-dirty
Previous: Andy ParkinsNext: Johannes Sixt
Message 3 of 14 in “Allow the ident attribute to include a length specifier”
  1. Allow the ident attribute to include a length specifierAndy Parkins, May 14, 2007
  2. Andy ParkinsMay 14, 2007
  3. Use $Id$ as the ident attribute keyword rather than $ident$ to be consistent with other VCSsAndy Parkins, May 14, 2007
  4. Johannes SixtMay 14, 2007
  5. Andy ParkinsMay 14, 2007
  6. Junio C HamanoMay 14, 2007
  7. Andy ParkinsMay 14, 2007
  8. Junio C HamanoMay 15, 2007
  9. Junio C HamanoMay 15, 2007
  10. Andy ParkinsMay 15, 2007
  11. Junio C HamanoMay 15, 2007
  12. Andy ParkinsMay 15, 2007
  13. Andy ParkinsMay 17, 2007
  14. Junio C HamanoMay 17, 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.