summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a9f3049)
raw | patch | inline | side by side (parent: a9f3049)
author | Henrik Grubbström <grubba@grubba.org> | |
Tue, 6 Apr 2010 12:46:38 +0000 (14:46 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 11 Apr 2010 04:45:01 +0000 (21:45 -0700) |
If there are foreign $Id$ keywords in the repository, they are most
likely there for a reason. Let's keep them on checkout (which is also
what the documentation indicates). Foreign $Id$ keywords are now
recognized by there being multiple space separated fields in $Id:xxxxx$.
Signed-off-by: Henrik Grubbström <grubba@grubba.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
likely there for a reason. Let's keep them on checkout (which is also
what the documentation indicates). Foreign $Id$ keywords are now
recognized by there being multiple space separated fields in $Id:xxxxx$.
Signed-off-by: Henrik Grubbström <grubba@grubba.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
convert.c | patch | blob | history | |
t/t0021-conversion.sh | patch | blob | history |
diff --git a/convert.c b/convert.c
index 239fa0ab959c938ce2e3cd5c5a0888c00631dc7c..5a0b7fbca4cc4999df6ddd05e5387afb3a0774b2 100644 (file)
--- a/convert.c
+++ b/convert.c
struct strbuf *buf, int ident)
{
unsigned char sha1[20];
- char *to_free = NULL, *dollar;
+ char *to_free = NULL, *dollar, *spc;
int cnt;
if (!ident)
} else if (src[2] == ':') {
/*
* It's possible that an expanded Id has crept its way into the
- * repository, we cope with that by stripping the expansion out
+ * repository, we cope with that by stripping the expansion out.
+ * This is probably not a good idea, since it will cause changes
+ * on checkout, which won't go away by stash, but let's keep it
+ * for git-style ids.
*/
dollar = memchr(src + 3, '$', len - 3);
if (!dollar) {
continue;
}
+ spc = memchr(src + 4, ' ', dollar - src - 4);
+ if (spc && spc < dollar-1) {
+ /* There are spaces in unexpected places.
+ * This is probably an id from some other
+ * versioning system. Keep it for now.
+ */
+ continue;
+ }
+
len -= dollar + 1 - src;
src = dollar + 1;
} else {
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 29438c59b98a9265760738af0d95a59c70cd5edf..828e35baf72d94908ad1f30dbd2e1aa6f9376e69 100755 (executable)
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
echo "\$Id: NoTerminatingSymbol"
- echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
+ echo "\$Id: Foreign Commit With Spaces \$"
echo "\$Id: NoTerminatingSymbolAtEOF"
} > expected-output &&