Andy Parkins [off-list ref] writes:
I had to jump through quite a few hoops to get the expanded $Id$ into a
repository (originally it was because I used an older version of git in
one place, and a newer one in another).
I'll see what I can do to make a test case though.
Wouldn't it be sufficient to:
(1) prepare a file with "$Id$", use ident in .gitattributes,
check it in and commit;
(2) remove it from the working tree, check it out with
"checkout -f";
(3) temorarily move away .gitattributes, modify the file, and
check it in;
(4) move .gitattributes back into its place, and commit.
On Saturday 2007, May 26, Junio C Hamano wrote:
Wouldn't it be sufficient to:
(1) prepare a file with "$Id$", use ident in .gitattributes,
check it in and commit;
(2) remove it from the working tree, check it out with
"checkout -f";
(3) temorarily move away .gitattributes, modify the file, and
check it in;
(4) move .gitattributes back into its place, and commit.
I'm glad to have you confirm that. I wasn't sure if git would do
something clever and reading the .gitattributes from the same commit as
the file for which is being checked out.
If the above would work, then even simpler:
(1) Commit a file with $Id: blah blah blah $ in it.
(2) Add a .gitattributes with ident
(3) Check out.
Patch to follow.
Andy
--
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
This test case would have caught the bug fixed by revision
c23290d5.
It puts various forms of $Id$ into a file in the repository,
without allowing git to collapse them to uniformity. Then enables the
$Id$ expansion on checkout, and checks that what is checked out has
coped with the various forms.
Signed-off-by: Andy Parkins <redacted>
---
t/t0021-conversion.sh | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 6c26fd8..a839f4e 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -45,4 +45,40 @@ test_expect_success check '
test "z$id" = "z$embedded"
'
+# If an expanded ident ever gets into the repository, we want to make sure that
+# it is collapsed before being expanded again on checkout
+test_expect_success expanded_in_repo '
+ {
+ echo "File with expanded keywords"
+ echo "\$Id\$"
+ echo "\$Id:\$"
+ echo "\$Id: 0000000000000000000000000000000000000000 \$"
+ echo "\$Id: NoSpaceAtEnd\$"
+ echo "\$Id:NoSpaceAtFront \$"
+ echo "\$Id:NoSpaceAtEitherEnd\$"
+ echo "\$Id: NoTerminatingSymbol"
+ } > expanded-keywords &&
+
+ {
+ echo "File with expanded keywords"
+ echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
+ echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
+ echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
+ echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
+ echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
+ echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
+ echo "\$Id: NoTerminatingSymbol"
+ } > expected-output &&
+
+ git add expanded-keywords &&
+ git commit -m "File with keywords expanded" &&
+
+ echo "expanded-keywords ident" >> .gitattributes &&
+
+ rm -f expanded-keywords &&
+ git checkout -- expanded-keywords &&
+ cat expanded-keywords &&
+ cmp expanded-keywords expected-output
+'
+
test_done--
1.5.2.86.g99b5-dirty