aboutsummaryrefslogtreecommitdiff
path: root/convert.c
diff options
context:
space:
mode:
authorHenrik Grubbström <grubba@grubba.org>2010-04-06 14:46:38 +0200
committerJunio C Hamano <gitster@pobox.com>2010-04-10 21:45:01 -0700
commit07814d90095b65b4594efd47c69f9f171ef162d4 (patch)
tree618a1200cebaab300e36a069df05f03c7de1624e /convert.c
parenta9f3049f6c152d4e6c26b15f7eeb08660aaadca3 (diff)
downloadgit-07814d90095b65b4594efd47c69f9f171ef162d4.tar.gz
git-07814d90095b65b4594efd47c69f9f171ef162d4.tar.xz
convert: Keep foreign $Id$ on checkout.
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>
Diffstat (limited to 'convert.c')
-rw-r--r--convert.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/convert.c b/convert.c
index 239fa0ab9..5a0b7fbca 100644
--- a/convert.c
+++ b/convert.c
@@ -477,7 +477,7 @@ static int ident_to_worktree(const char *path, const char *src, size_t len,
struct strbuf *buf, int ident)
{
unsigned char sha1[20];
- char *to_free = NULL, *dollar;
+ char *to_free = NULL, *dollar, *spc;
int cnt;
if (!ident)
@@ -513,7 +513,10 @@ static int ident_to_worktree(const char *path, const char *src, size_t len,
} 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) {
@@ -526,6 +529,15 @@ static int ident_to_worktree(const char *path, const char *src, size_t len,
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 {