[PATCH 2/4] convert: Keep foreign $Id$ on checkout.
- From
Henrik Grubbström <grubba@grubba.org>
- Date
- Mar 1, 2010, 16:16 UTC
- Message-ID
- <1267460218-1172-2-git-send-email-grubba@grubba.org>
- In-Reply-To
- <1267460218-1172-1-git-send-email-grubba@grubba.org>
From: Henrik Grubbström (Grubba) <grubba@grubba.org>
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> --- convert.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/convert.c b/convert.c index 91207ab..28aeea3 100644 --- a/convert.c +++ b/convert.c @@ -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) { @@ -527,6 +530,15 @@ static int ident_to_worktree(const char *path, const char *src, size_t len, continue; } + if ((src[3] != ' ') || + (memchr(src + 4, ' ', len - 4) != 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 {
-- 1.6.4.122.g6ffd7