git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] ident attribute related patches (resend w/ testsuite)
@ 2010-03-15 15:30 Henrik Grubbström (Grubba)
  2010-03-15 15:30 ` [PATCH 1/4] convert: Safer handling of $Id$ contraction Henrik Grubbström (Grubba)
  0 siblings, 1 reply; 11+ messages in thread
From: Henrik Grubbström (Grubba) @ 2010-03-15 15:30 UTC (permalink / raw)
  To: git; +Cc: Henrik Grubbström  

These are some patches that are needed to get the support for the
'ident' attribute to a useable state.

Since last time, some issues that caused the the existing testsuite to
fail have been fixed, and the testsuite has been extended to test the
issues fixed by the patches.

Henrik Grubbström (Grubba) (4):
  convert: Safer handling of $Id$ contraction.
  convert: Keep foreign $Id$ on checkout.
  convert: Inhibit contraction of foreign $Id$ during stats.
  convert: Added core.refilteronadd feature.

 Documentation/config.txt |    6 ++++
 builtin/apply.c          |    2 +-
 builtin/blame.c          |    2 +-
 cache.h                  |    9 +++++-
 combine-diff.c           |    2 +-
 config.c                 |    5 +++
 convert.c                |   53 ++++++++++++++++++++++++++++++----
 diff.c                   |    2 +-
 environment.c            |    1 +
 sha1_file.c              |   60 +++++++++++++++++++++++++++++++++++++-
 t/t0021-conversion.sh    |   72 ++++++++++++++++++++++++++++++++++++++++++----
 11 files changed, 196 insertions(+), 18 deletions(-)

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH 1/4] convert: Safer handling of $Id$ contraction.
@ 2010-03-01 16:16 Henrik Grubbström
  2010-03-01 16:16 ` [PATCH 2/4] convert: Keep foreign $Id$ on checkout Henrik Grubbström
  0 siblings, 1 reply; 11+ messages in thread
From: Henrik Grubbström @ 2010-03-01 16:16 UTC (permalink / raw)
  To: git; +Cc: Henrik Grubbström  

From: Henrik Grubbström (Grubba) <grubba@grubba.org>

The code to contract $Id:xxxxx$ strings could eat an arbitrary amount
of source text if the terminating $ was lost. It now refuses to
contract $Id:xxxxx$ strings spanning multiple lines.

Signed-off-by: Henrik Grubbström <grubba@grubba.org>
---
 convert.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/convert.c b/convert.c
index 4f8fcb7..91207ab 100644
--- a/convert.c
+++ b/convert.c
@@ -425,6 +425,7 @@ static int count_ident(const char *cp, unsigned long size)
 				cnt++;
 				break;
 			}
+			if (ch == '\n') break;
 		}
 	}
 	return cnt;
@@ -433,7 +434,7 @@ static int count_ident(const char *cp, unsigned long size)
 static int ident_to_git(const char *path, const char *src, size_t len,
                         struct strbuf *buf, int ident)
 {
-	char *dst, *dollar;
+	char *dst, *dollar, *nl;
 
 	if (!ident || !count_ident(src, len))
 		return 0;
@@ -455,6 +456,12 @@ static int ident_to_git(const char *path, const char *src, size_t len,
 			dollar = memchr(src + 3, '$', len - 3);
 			if (!dollar)
 				break;
+			nl = memchr(src + 3, '\n', len - 3);
+			if (nl && nl < dollar) {
+				/* Line break before the next dollar. */
+				continue;
+			}
+
 			memcpy(dst, "Id$", 3);
 			dst += 3;
 			len -= dollar + 1 - src;
@@ -470,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, *nl;
 	int cnt;
 
 	if (!ident)
@@ -514,6 +521,12 @@ static int ident_to_worktree(const char *path, const char *src, size_t len,
 				break;
 			}
 
+			nl = memchr(src + 3, '\n', len - 3);
+			if (nl && nl < dollar) {
+				/* Line break before the next dollar. */
+				continue;
+			}
+
 			len -= dollar + 1 - src;
 			src  = dollar + 1;
 		} else {
-- 
1.6.4.122.g6ffd7

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-03-15 18:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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)
2010-03-15 15:30     ` [PATCH 3/4] convert: Inhibit contraction of foreign $Id$ during stats Henrik Grubbström (Grubba)
2010-03-15 15:30       ` [PATCH 4/4] convert: Added core.refilteronadd feature Henrik Grubbström (Grubba)
2010-03-15 15:42       ` [PATCH 3/4] convert: Inhibit contraction of foreign $Id$ during stats Bert Wesarg
2010-03-15 18:32         ` Henrik Grubbström
2010-03-15 15:39   ` [PATCH 1/4] convert: Safer handling of $Id$ contraction Bert Wesarg
2010-03-15 18:21     ` Henrik Grubbström
2010-03-15 18:16   ` René Scharfe
  -- strict thread matches above, loose matches on Subject: below --
2010-03-01 16:16 Henrik Grubbström
2010-03-01 16:16 ` [PATCH 2/4] convert: Keep foreign $Id$ on checkout Henrik Grubbström
2010-03-01 16:16   ` [PATCH 3/4] convert: Inhibit contraction of foreign $Id$ during stats Henrik Grubbström

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).