]> asedeno.scripts.mit.edu Git - git.git/commitdiff
Use $Id$ as the ident attribute keyword rather than $ident$ to be consistent with...
authorAndy Parkins <andyparkins@gmail.com>
Mon, 14 May 2007 13:37:25 +0000 (14:37 +0100)
committerJunio C Hamano <junkio@cox.net>
Tue, 15 May 2007 02:03:32 +0000 (19:03 -0700)
$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>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/RelNotes-1.5.2.txt
Documentation/gitattributes.txt
convert.c
t/t0021-conversion.sh

index d1c2cac4fcacf09104a8b239b1598a77c443f81b..7dbdb26988b9832fed04ebce9dfbd0bdf091d5dc 100644 (file)
@@ -26,7 +26,7 @@ Updates since v1.5.1
   considered a binary or text (the former would be treated by
   'git diff' not to produce textual output; the latter can go
   through the line endings conversion process in repositories
-  with core.autocrlf set), expand and unexpand '$ident$' keyword
+  with core.autocrlf set), expand and unexpand '$Id$' keyword
   with blob object name, specify a custom 3-way merge driver,
   and specify a custom diff driver.  You can also apply
   arbitrary filter to contents on check-in/check-out codepath
index 87723105d1aeeab3cc9918ffc80503f4291e749c..d3ac9c718147042a89db90a87d75fee34e778e5a 100644 (file)
@@ -138,11 +138,11 @@ upon checkout.
 ^^^^^^^
 
 When the attribute `ident` is set to a path, git replaces
-`$ident$` in the blob object with `$ident:`, followed by
+`$Id$` in the blob object with `$Id:`, followed by
 40-character hexadecimal blob object name, followed by a dollar
 sign `$` upon checkout.  Any byte sequence that begins with
-`$ident:` and ends with `$` in the worktree file is replaced
-with `$ident$` upon check-in.
+`$Id:` and ends with `$` in the worktree file is replaced
+with `$Id$` upon check-in.
 
 
 Interaction between checkin/checkout attributes
index 9ee31b0ee0949e1d45ac70b463efbb0d47132b32..12abdaf2a5ce6ffd1a186b8201fb0a8d3b8d11f1 100644 (file)
--- 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;
@@ -422,20 +422,20 @@ static int count_ident(const char *cp, unsigned long size)
                size--;
                if (ch != '$')
                        continue;
-               if (size < 6)
+               if (size < 3)
                        break;
-               if (memcmp("ident", cp, 5))
+               if (memcmp("Id", cp, 2))
                        continue;
-               ch = cp[5];
-               cp += 6;
-               size -= 6;
+               ch = cp[2];
+               cp += 3;
+               size -= 3;
                if (ch == '$')
-                       cnt++; /* $ident$ */
+                       cnt++; /* $Id$ */
                if (ch != ':')
                        continue;
 
                /*
-                * "$ident: ... "; scan up to the closing dollar sign and discard.
+                * "$Id: ... "; scan up to the closing dollar sign and discard.
                 */
                while (size) {
                        ch = *cp++;
@@ -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), 40);
                dst += 40;
                *dst++ = ' ';
index bab9ecc34e0304e855e7f4aa131f89c0300bc3e2..6c26fd829d8d9a08cb6cadfa013e0beae9b08dff 100755 (executable)
@@ -21,7 +21,7 @@ test_expect_success setup '
        {
            echo a b c d e f g h i j k l m
            echo n o p q r s t u v w x y z
-           echo '\''$ident$'\''
+           echo '\''$Id$'\''
        } >test &&
        cat test >test.t &&
        cat test >test.o &&
@@ -31,7 +31,7 @@ test_expect_success setup '
        git checkout -- test test.t test.i
 '
 
-script='s/^\$ident: \([0-9a-f]*\) \$/\1/p'
+script='s/^\$Id: \([0-9a-f]*\) \$/\1/p'
 
 test_expect_success check '