Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use $Id$ as the ident attribute keyword rather than $ident$ to be con…

…sistent with other VCSs

$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>
  • Loading branch information...
commit af9b54bb2cb0e15780bf3e820b5f1ce399deb2c4 1 parent 3545193
Andy Parkins andyparkins authored Junio C Hamano committed
2  Documentation/RelNotes-1.5.2.txt
@@ -26,7 +26,7 @@ Updates since v1.5.1
26 26 considered a binary or text (the former would be treated by
27 27 'git diff' not to produce textual output; the latter can go
28 28 through the line endings conversion process in repositories
29   - with core.autocrlf set), expand and unexpand '$ident$' keyword
  29 + with core.autocrlf set), expand and unexpand '$Id$' keyword
30 30 with blob object name, specify a custom 3-way merge driver,
31 31 and specify a custom diff driver. You can also apply
32 32 arbitrary filter to contents on check-in/check-out codepath
6 Documentation/gitattributes.txt
@@ -138,11 +138,11 @@ upon checkout.
138 138 ^^^^^^^
139 139
140 140 When the attribute `ident` is set to a path, git replaces
141   -`$ident$` in the blob object with `$ident:`, followed by
  141 +`$Id$` in the blob object with `$Id:`, followed by
142 142 40-character hexadecimal blob object name, followed by a dollar
143 143 sign `$` upon checkout. Any byte sequence that begins with
144   -`$ident:` and ends with `$` in the worktree file is replaced
145   -with `$ident$` upon check-in.
  144 +`$Id:` and ends with `$` in the worktree file is replaced
  145 +with `$Id$` upon check-in.
146 146
147 147
148 148 Interaction between checkin/checkout attributes
44 convert.c
@@ -412,7 +412,7 @@ static void setup_convert_check(struct git_attr_check *check)
412 412 static int count_ident(const char *cp, unsigned long size)
413 413 {
414 414 /*
415   - * "$ident: 0000000000000000000000000000000000000000 $" <=> "$ident$"
  415 + * "$Id: 0000000000000000000000000000000000000000 $" <=> "$Id$"
416 416 */
417 417 int cnt = 0;
418 418 char ch;
@@ -422,20 +422,20 @@ static int count_ident(const char *cp, unsigned long size)
422 422 size--;
423 423 if (ch != '$')
424 424 continue;
425   - if (size < 6)
  425 + if (size < 3)
426 426 break;
427   - if (memcmp("ident", cp, 5))
  427 + if (memcmp("Id", cp, 2))
428 428 continue;
429   - ch = cp[5];
430   - cp += 6;
431   - size -= 6;
  429 + ch = cp[2];
  430 + cp += 3;
  431 + size -= 3;
432 432 if (ch == '$')
433   - cnt++; /* $ident$ */
  433 + cnt++; /* $Id$ */
434 434 if (ch != ':')
435 435 continue;
436 436
437 437 /*
438   - * "$ident: ... "; scan up to the closing dollar sign and discard.
  438 + * "$Id: ... "; scan up to the closing dollar sign and discard.
439 439 */
440 440 while (size) {
441 441 ch = *cp++;
@@ -466,10 +466,10 @@ static char *ident_to_git(const char *path, const char *src, unsigned long *size
466 466 for (dst = buf; size; size--) {
467 467 char ch = *src++;
468 468 *dst++ = ch;
469   - if ((ch == '$') && (6 <= size) &&
470   - !memcmp("ident:", src, 6)) {
471   - unsigned long rem = size - 6;
472   - const char *cp = src + 6;
  469 + if ((ch == '$') && (3 <= size) &&
  470 + !memcmp("Id:", src, 3)) {
  471 + unsigned long rem = size - 3;
  472 + const char *cp = src + 3;
473 473 do {
474 474 ch = *cp++;
475 475 if (ch == '$')
@@ -478,8 +478,8 @@ static char *ident_to_git(const char *path, const char *src, unsigned long *size
478 478 } while (rem);
479 479 if (!rem)
480 480 continue;
481   - memcpy(dst, "ident$", 6);
482   - dst += 6;
  481 + memcpy(dst, "Id$", 3);
  482 + dst += 3;
483 483 size -= (cp - src);
484 484 src = cp;
485 485 }
@@ -511,13 +511,13 @@ static char *ident_to_worktree(const char *path, const char *src, unsigned long
511 511 const char *cp;
512 512 char ch = *src++;
513 513 *dst++ = ch;
514   - if ((ch != '$') || (size < 6) || memcmp("ident", src, 5))
  514 + if ((ch != '$') || (size < 3) || memcmp("Id", src, 2))
515 515 continue;
516 516
517   - if (src[5] == ':') {
  517 + if (src[2] == ':') {
518 518 /* discard up to but not including the closing $ */
519   - unsigned long rem = size - 6;
520   - cp = src + 6;
  519 + unsigned long rem = size - 3;
  520 + cp = src + 3;
521 521 do {
522 522 ch = *cp++;
523 523 if (ch == '$')
@@ -527,13 +527,13 @@ static char *ident_to_worktree(const char *path, const char *src, unsigned long
527 527 if (!rem)
528 528 continue;
529 529 size -= (cp - src);
530   - } else if (src[5] == '$')
531   - cp = src + 5;
  530 + } else if (src[2] == '$')
  531 + cp = src + 2;
532 532 else
533 533 continue;
534 534
535   - memcpy(dst, "ident: ", 7);
536   - dst += 7;
  535 + memcpy(dst, "Id: ", 4);
  536 + dst += 4;
537 537 memcpy(dst, sha1_to_hex(sha1), 40);
538 538 dst += 40;
539 539 *dst++ = ' ';
4 t/t0021-conversion.sh
@@ -21,7 +21,7 @@ test_expect_success setup '
21 21 {
22 22 echo a b c d e f g h i j k l m
23 23 echo n o p q r s t u v w x y z
24   - echo '\''$ident$'\''
  24 + echo '\''$Id$'\''
25 25 } >test &&
26 26 cat test >test.t &&
27 27 cat test >test.o &&
@@ -31,7 +31,7 @@ test_expect_success setup '
31 31 git checkout -- test test.t test.i
32 32 '
33 33
34   -script='s/^\$ident: \([0-9a-f]*\) \$/\1/p'
  34 +script='s/^\$Id: \([0-9a-f]*\) \$/\1/p'
35 35
36 36 test_expect_success check '
37 37

0 comments on commit af9b54b

Please sign in to comment.
Something went wrong with that request. Please try again.