git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Henrik Grubbström" <grubba@grubba.org>
To: git@vger.kernel.org
Cc: "Henrik Grubbström  " <grubba@grubba.org>
Subject: [PATCH 2/4] convert: Keep foreign $Id$ on checkout.
Date: Mon,  1 Mar 2010 17:16:56 +0100	[thread overview]
Message-ID: <1267460218-1172-2-git-send-email-grubba@grubba.org> (raw)
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

  reply	other threads:[~2010-03-01 16:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-01 16:16 [PATCH 1/4] convert: Safer handling of $Id$ contraction Henrik Grubbström
2010-03-01 16:16 ` Henrik Grubbström [this message]
2010-03-01 16:16   ` [PATCH 3/4] convert: Inhibit contraction of foreign $Id$ during stats Henrik Grubbström
2010-03-01 16:16     ` [PATCH 4/4] convert: Added core.refilteronadd feature Henrik Grubbström
2010-03-03  1:11   ` [PATCH 2/4] convert: Keep foreign $Id$ on checkout Junio C Hamano
2010-03-03 11:36     ` Henrik Grubbström
2010-03-03  1:10 ` [PATCH 1/4] convert: Safer handling of $Id$ contraction Junio C Hamano
2010-03-03 10:40   ` Henrik Grubbström
2010-03-09  9:22     ` Henrik Grubbström
  -- strict thread matches above, loose matches on Subject: below --
2010-03-15 15:30 [PATCH 0/4] ident attribute related patches (resend w/ testsuite) Henrik Grubbström (Grubba)
2010-03-15 15:30 ` [PATCH 1/4] convert: Safer handling of $Id$ contraction Henrik Grubbström (Grubba)
2010-03-15 15:30   ` [PATCH 2/4] convert: Keep foreign $Id$ on checkout Henrik Grubbström (Grubba)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1267460218-1172-2-git-send-email-grubba@grubba.org \
    --to=grubba@grubba.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).