Re: [PATCH] Use $Id$ as the ident attribute keyword rather than $ident$ to be consistent with other VCSs
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:10
Andy Parkins [off-list ref] writes:
On Monday 2007, May 14, Junio C Hamano wrote:quoted
Obviously I do not care much about this feature and I have not look at Andy's patch too deeply yet, but in any case I think the inverse conversion needs to be modified to match it, if it hasn't been done so.I believe I did the inverse conversion as well.
I think this on top of your patch would be the minimum necessary for v1.5.2. Documentation/RelNotes-1.5.2.txt | 2 +- Documentation/gitattributes.txt | 6 +++--- convert.c | 14 +++++++------- t/t0021-conversion.sh | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/Documentation/RelNotes-1.5.2.txt b/Documentation/RelNotes-1.5.2.txt
index d1c2cac..7dbdb26 100644
--- a/Documentation/RelNotes-1.5.2.txt
+++ b/Documentation/RelNotes-1.5.2.txt@@ -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
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index 8772310..d3ac9c7 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt@@ -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
diff --git a/convert.c b/convert.c
index c46ab1b..12abdaf 100644
--- a/convert.c
+++ b/convert.c@@ -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++;
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index bab9ecc..6c26fd8 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh@@ -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 '