Git development
 help / color / mirror / Atom feed
* [PATCH 1/5] date: Expose the time_to_tm function
From: Ramkumar Ramachandra @ 2011-01-19  5:44 UTC (permalink / raw)
  To: Git List; +Cc: Jonathan Nieder, David Barr, Sverre Rabbelier
In-Reply-To: <1295415899-1192-1-git-send-email-artagnon@gmail.com>

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 cache.h |    1 +
 date.c  |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/cache.h b/cache.h
index d83d68c..95fea31 100644
--- a/cache.h
+++ b/cache.h
@@ -816,6 +816,7 @@ enum date_mode {
 	DATE_RAW
 };
 
+struct tm *time_to_tm(unsigned long time, int tz);
 const char *show_date(unsigned long time, int timezone, enum date_mode mode);
 const char *show_date_relative(unsigned long time, int tz,
 			       const struct timeval *now,
diff --git a/date.c b/date.c
index 00f9eb5..e601a50 100644
--- a/date.c
+++ b/date.c
@@ -54,7 +54,7 @@ static time_t gm_time_t(unsigned long time, int tz)
  * thing, which means that tz -0100 is passed in as the integer -100,
  * even though it means "sixty minutes off"
  */
-static struct tm *time_to_tm(unsigned long time, int tz)
+struct tm *time_to_tm(unsigned long time, int tz)
 {
 	time_t t = gm_time_t(time, tz);
 	return gmtime(&t);
-- 
1.7.4.rc1.7.g2cf08.dirty

^ permalink raw reply related

* [PATCH 2/5] vcs-svn: Start working on the dumpfile producer
From: Ramkumar Ramachandra @ 2011-01-19  5:44 UTC (permalink / raw)
  To: Git List; +Cc: Jonathan Nieder, David Barr, Sverre Rabbelier
In-Reply-To: <1295415899-1192-1-git-send-email-artagnon@gmail.com>

Start off with some broad design sketches. Compile succeeds, but
parser is incorrect. Include a Makefile rule to build it into
vcs-svn/lib.a.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Makefile              |    2 +-
 vcs-svn/dump_export.c |   73 ++++++++++++
 vcs-svn/svnload.c     |  294 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 368 insertions(+), 1 deletions(-)
 create mode 100644 vcs-svn/dump_export.c
 create mode 100644 vcs-svn/svnload.c

diff --git a/Makefile b/Makefile
index 1345c38..40f6691 100644
--- a/Makefile
+++ b/Makefile
@@ -1834,7 +1834,7 @@ ifndef NO_CURL
 endif
 XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
 	xdiff/xmerge.o xdiff/xpatience.o
-VCSSVN_OBJS = vcs-svn/line_buffer.o \
+VCSSVN_OBJS = vcs-svn/line_buffer.o vcs-svn/svnload.o vcs-svn/dump_export.o \
 	vcs-svn/repo_tree.o vcs-svn/fast_export.o vcs-svn/sliding_window.o \
 	vcs-svn/svndiff.o vcs-svn/svndump.o
 VCSSVN_TEST_OBJS = test-obj-pool.o \
diff --git a/vcs-svn/dump_export.c b/vcs-svn/dump_export.c
new file mode 100644
index 0000000..04ede06
--- /dev/null
+++ b/vcs-svn/dump_export.c
@@ -0,0 +1,73 @@
+/*
+ * Licensed under a two-clause BSD-style license.
+ * See LICENSE for details.
+ */
+
+#include "git-compat-util.h"
+#include "strbuf.h"
+#include "line_buffer.h"
+#include "dump_export.h"
+
+void dump_export_begin_rev(int revision, const char *revprops,
+			int prop_len) {
+	printf("Revision-number: %d\n", revision);
+	printf("Prop-content-length: %d\n", prop_len);
+	printf("Content-length: %d\n\n", prop_len);
+	printf("%s\n", revprops);
+}
+
+void dump_export_node(const char *path, enum node_kind kind,
+		enum node_action action, unsigned long text_len,
+		unsigned long copyfrom_rev, const char *copyfrom_path) {
+	printf("Node-path: %s\n", path);
+	printf("Node-kind: ");
+	switch (action) {
+	case NODE_KIND_NORMAL:
+		printf("file\n");
+		break;
+	case NODE_KIND_EXECUTABLE:
+		printf("file\n");
+		break;
+	case NODE_KIND_SYMLINK:
+		printf("file\n");
+		break;
+	case NODE_KIND_GITLINK:
+		printf("file\n");
+		break;
+	case NODE_KIND_SUBDIR:
+		die("Unsupported: subdirectory");
+	default:
+		break;
+	}
+	printf("Node-action: ");
+	switch (action) {
+	case NODE_ACTION_CHANGE:
+		printf("change\n");
+		break;
+	case NODE_ACTION_ADD:
+		printf("add\n");
+		break;
+	case NODE_ACTION_REPLACE:
+		printf("replace\n");
+		break;
+	case NODE_ACTION_DELETE:
+		printf("delete\n");
+		break;
+	default:
+		break;
+	}
+	if (copyfrom_rev != SVN_INVALID_REV) {
+		printf("Node-copyfrom-rev: %lu\n", copyfrom_rev);
+		printf("Node-copyfrom-path: %s\n", copyfrom_path);
+	}
+	printf("Prop-delta: false\n");
+	printf("Prop-content-length: 10\n"); /* Constant 10 for "PROPS-END" */
+	printf("Text-delta: false\n");
+	printf("Text-content-length: %lu\n", text_len);
+	printf("Content-length: %lu\n\n", text_len + 10);
+	printf("PROPS-END\n\n");
+}
+
+void dump_export_text(struct line_buffer *data, off_t len) {
+	buffer_copy_bytes(data, len);
+}
diff --git a/vcs-svn/svnload.c b/vcs-svn/svnload.c
new file mode 100644
index 0000000..7043ae7
--- /dev/null
+++ b/vcs-svn/svnload.c
@@ -0,0 +1,294 @@
+/*
+ * Produce a dumpfile v3 from a fast-import stream.
+ * Load the dump into the SVN repository with:
+ * svnrdump load <URL> <dumpfile
+ *
+ * Licensed under a two-clause BSD-style license.
+ * See LICENSE for details.
+ */
+
+#include "cache.h"
+#include "git-compat-util.h"
+#include "line_buffer.h"
+#include "dump_export.h"
+#include "strbuf.h"
+
+#define SVN_DATE_FORMAT "%Y-%m-%dT%H:%M:%S.000000Z"
+#define SVN_DATE_LEN 28
+#define LENGTH_UNKNOWN (~0)
+
+static struct line_buffer input = LINE_BUFFER_INIT;
+static struct strbuf blobs[100];
+	
+static struct {
+	unsigned long prop_len, text_len, copyfrom_rev, mark;
+	int text_delta, prop_delta; /* Boolean */
+	enum node_action action;
+	enum node_kind kind;
+	struct strbuf copyfrom_path, path;
+} node_ctx;
+
+static struct {
+	int rev, text_len;
+	struct strbuf props, log;
+	struct strbuf svn_author, author, committer;
+	struct strbuf author_date, committer_date;
+	struct strbuf author_email, committer_email;
+} rev_ctx;
+
+static enum {
+	UNKNOWN_CTX,
+	COMMIT_CTX,
+	BLOB_CTX
+} active_ctx;
+
+static void reset_rev_ctx(int revision)
+{
+	rev_ctx.rev = revision;
+	strbuf_reset(&rev_ctx.props);
+	strbuf_reset(&rev_ctx.log);
+	strbuf_reset(&rev_ctx.svn_author);
+	strbuf_reset(&rev_ctx.author);
+	strbuf_reset(&rev_ctx.committer);
+	strbuf_reset(&rev_ctx.author_date);
+	strbuf_reset(&rev_ctx.committer_date);
+	strbuf_reset(&rev_ctx.author_email);
+	strbuf_reset(&rev_ctx.committer_email);
+}
+
+static void reset_node_ctx(void)
+{
+	node_ctx.prop_len = LENGTH_UNKNOWN;
+	node_ctx.text_len = LENGTH_UNKNOWN;
+	node_ctx.mark = 0;
+	node_ctx.copyfrom_rev = 0;
+	node_ctx.text_delta = -1;
+	node_ctx.prop_delta = -1;
+	strbuf_reset(&node_ctx.copyfrom_path);
+	strbuf_reset(&node_ctx.path);
+}
+
+static void populate_props(struct strbuf *props, const char *author,
+			const char *log, const char *date) {
+	strbuf_reset(props);	
+	strbuf_addf(props, "K\nsvn:author\nV\n%s\n", author);
+	strbuf_addf(props, "K\nsvn:log\nV\n%s", log);
+	strbuf_addf(props, "K\nsvn:date\nV\n%s\n", date);
+	strbuf_add(props, "PROPS-END\n", 10);
+}
+
+static void parse_author_line(char *val, struct strbuf *name,
+			struct strbuf *email, struct strbuf *date) {
+	char *t, *tz_off;
+	char time_buf[SVN_DATE_LEN];
+	const struct tm *tm_time;
+
+	/* Simon Hausmann <shausman@trolltech.com> 1170199019 +0100 */
+	strbuf_reset(name);
+	strbuf_reset(email);
+	strbuf_reset(date);
+	tz_off = strrchr(val, ' ');
+	*tz_off++ = '\0';
+	t = strrchr(val, ' ');
+	*(t - 1) = '\0'; /* Ignore '>' from email */
+	t ++;
+	tm_time = time_to_tm(strtoul(t, NULL, 10), atoi(tz_off));
+	strftime(time_buf, SVN_DATE_LEN, SVN_DATE_FORMAT, tm_time);
+	strbuf_add(date, time_buf, SVN_DATE_LEN);
+	t = strchr(val, '<');
+	*(t - 1) = '\0'; /* Ignore ' <' from email */
+	t ++;
+	strbuf_add(email, t, strlen(t));
+	strbuf_add(name, val, strlen(val));
+}
+
+void svnload_read(void) {
+	char *t, *val;
+	int mode_incr;
+	struct strbuf *to_dump;
+
+	while ((t = buffer_read_line(&input))) {
+		val = strchr(t, ' ');
+		if (!val) {
+			if (!memcmp(t, "blob", 4))
+				active_ctx = BLOB_CTX;
+			else if (!memcmp(t, "deleteall", 9))
+				;
+			continue;
+		}
+		*val++ = '\0';
+
+		/* strlen(key) */
+		switch (val - t - 1) {
+		case 1:
+			if (!memcmp(t, "D", 1)) {
+				node_ctx.action = NODE_ACTION_DELETE;
+			}
+			else if (!memcmp(t, "C", 1)) {
+				node_ctx.action = NODE_ACTION_ADD;
+			}
+			else if (!memcmp(t, "R", 1)) {
+				node_ctx.action = NODE_ACTION_REPLACE;
+			}
+			else if (!memcmp(t, "M", 1)) {
+				node_ctx.action = NODE_ACTION_CHANGE;
+				mode_incr = 7;
+				if (!memcmp(val, "100644", 6))
+					node_ctx.kind = NODE_KIND_NORMAL;
+				else if (!memcmp(val, "100755", 6))
+					node_ctx.kind = NODE_KIND_EXECUTABLE;
+				else if (!memcmp(val, "120000", 6))
+					node_ctx.kind = NODE_KIND_SYMLINK;
+				else if (!memcmp(val, "160000", 6))
+					node_ctx.kind = NODE_KIND_GITLINK;
+				else if (!memcmp(val, "040000", 6))
+					node_ctx.kind = NODE_KIND_SUBDIR;
+				else {
+					if (!memcmp(val, "755", 3))
+						node_ctx.kind = NODE_KIND_EXECUTABLE;
+					else if(!memcmp(val, "644", 3))
+						node_ctx.kind = NODE_KIND_NORMAL;
+					else
+						die("Unrecognized mode: %s", val);
+					mode_incr = 4;
+				}
+				val += mode_incr;
+				t = strchr(val, ' ');
+				*t++ = '\0';
+				strbuf_reset(&node_ctx.path);
+				strbuf_add(&node_ctx.path, t, strlen(t));
+				if (!memcmp(val + 1, "inline", 6))
+					die("Unsupported dataref: inline");
+				else if (*val == ':')
+					to_dump = &blobs[strtoul(val + 1, NULL, 10)];
+				else
+					die("Unsupported dataref: sha1");
+				dump_export_node(node_ctx.path.buf, node_ctx.kind,
+						node_ctx.action, to_dump->len,
+						0, NULL);
+				printf("%s", to_dump->buf);
+			}
+			break;
+		case 3:
+			if (!memcmp(t, "tag", 3))
+				continue;
+			break;
+		case 4:
+			if (!memcmp(t, "mark", 4))
+				switch(active_ctx) {
+				case COMMIT_CTX:
+					/* What do we do with commit marks? */
+					continue;
+				case BLOB_CTX:
+					node_ctx.mark = strtoul(val + 1, NULL, 10);
+					break;
+				default:
+					break;
+				}
+			else if (!memcmp(t, "from", 4))
+				continue;
+			else if (!memcmp(t, "data", 4)) {
+				switch (active_ctx) {
+				case COMMIT_CTX:
+					strbuf_reset(&rev_ctx.log);
+					buffer_read_binary(&input,
+							&rev_ctx.log,
+							strtoul(val, NULL, 10));
+					populate_props(&rev_ctx.props,
+						rev_ctx.svn_author.buf,
+						rev_ctx.log.buf,
+						rev_ctx.author_date.buf);
+					dump_export_begin_rev(rev_ctx.rev,
+							rev_ctx.props.buf,
+							rev_ctx.props.len);
+					break;
+				case BLOB_CTX:
+					node_ctx.text_len = strtoul(val, NULL, 10);
+					buffer_read_binary(&input,
+							&blobs[node_ctx.mark],
+							node_ctx.text_len);
+					break;
+				default:
+					break;
+				}
+			}
+			break;
+		case 5:
+			if (!memcmp(t, "reset", 5))
+				continue;
+			if (!memcmp(t, "merge", 5))
+				continue;
+			break;
+		case 6:
+			if (!memcmp(t, "author", 6)) {
+				parse_author_line(val, &rev_ctx.author,
+						&rev_ctx.author_email,
+						&rev_ctx.author_date);
+				/* Build svn_author */
+				t = strchr(rev_ctx.author_email.buf, '@');
+				strbuf_reset(&rev_ctx.svn_author);
+				strbuf_add(&rev_ctx.svn_author,
+					rev_ctx.author_email.buf,
+					t - rev_ctx.author_email.buf);
+
+			}
+			else if (!memcmp(t, "commit", 6)) {
+				rev_ctx.rev ++;
+				active_ctx = COMMIT_CTX;
+			}
+			break;
+		case 9:
+			if (!memcmp(t, "committer", 9))
+				parse_author_line(val, &rev_ctx.committer,
+						&rev_ctx.committer_email,
+						&rev_ctx.committer_date);
+			break;
+		default:
+			break;
+		}
+	}
+}
+
+int svnload_init(const char *filename)
+{
+	int i;
+	if (buffer_init(&input, filename))
+		return error("cannot open %s: %s", filename, strerror(errno));
+	active_ctx = UNKNOWN_CTX;
+	strbuf_init(&rev_ctx.props, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.log, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.author, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.committer, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.author_date, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.committer_date, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.author_email, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&rev_ctx.committer_email, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&node_ctx.path, MAX_GITSVN_LINE_LEN);
+	strbuf_init(&node_ctx.copyfrom_path, MAX_GITSVN_LINE_LEN);
+	for (i = 0; i < 100; i ++)
+		strbuf_init(&blobs[i], 10000);
+	return 0;
+}
+
+void svnload_deinit(void)
+{
+	int i;
+	reset_rev_ctx(0);
+	reset_node_ctx();
+	strbuf_release(&rev_ctx.props);
+	strbuf_release(&rev_ctx.log);
+	strbuf_release(&rev_ctx.author);
+	strbuf_release(&rev_ctx.committer);
+	strbuf_release(&rev_ctx.author_date);
+	strbuf_release(&rev_ctx.committer_date);
+	strbuf_release(&rev_ctx.author_email);
+	strbuf_release(&rev_ctx.committer_email);
+	strbuf_release(&node_ctx.path);
+	strbuf_release(&node_ctx.copyfrom_path);
+	for (i = 0; i < 100; i ++)
+		strbuf_release(&blobs[i]);
+	if (buffer_deinit(&input))
+		fprintf(stderr, "Input error\n");
+	if (ferror(stdout))
+		fprintf(stderr, "Output error\n");
+}
-- 
1.7.4.rc1.7.g2cf08.dirty

^ permalink raw reply related

* [PATCH 3/5] Build an svn-fi target in contrib/svn-fe
From: Ramkumar Ramachandra @ 2011-01-19  5:44 UTC (permalink / raw)
  To: Git List; +Cc: Jonathan Nieder, David Barr, Sverre Rabbelier
In-Reply-To: <1295415899-1192-1-git-send-email-artagnon@gmail.com>

Build an svn-fi target for testing the dumpfile producer in vcs-svn/.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 contrib/svn-fe/Makefile   |   23 +++++++++++++++++++++--
 contrib/svn-fe/svn-fi.c   |   16 ++++++++++++++++
 contrib/svn-fe/svn-fi.txt |   28 ++++++++++++++++++++++++++++
 3 files changed, 65 insertions(+), 2 deletions(-)
 create mode 100644 contrib/svn-fe/svn-fi.c
 create mode 100644 contrib/svn-fe/svn-fi.txt

diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
index 360d8da..555a8ff 100644
--- a/contrib/svn-fe/Makefile
+++ b/contrib/svn-fe/Makefile
@@ -37,7 +37,7 @@ svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(GIT_LIB)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ svn-fe.o \
 		$(ALL_LDFLAGS) $(LIBS)
 
-svn-fe.o: svn-fe.c ../../vcs-svn/svndump.h
+svn-fe.o: svn-fe.c ../../vcs-svn/svnload.h
 	$(QUIET_CC)$(CC) -I../../vcs-svn -o $*.o -c $(ALL_CFLAGS) $<
 
 svn-fe.html: svn-fe.txt
@@ -51,6 +51,24 @@ svn-fe.1: svn-fe.txt
 		../contrib/svn-fe/$@
 	$(MV) ../../Documentation/svn-fe.1 .
 
+svn-fi$X: svn-fi.o $(VCSSVN_LIB) $(GIT_LIB)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ svn-fi.o \
+		$(ALL_LDFLAGS) $(LIBS)
+
+svn-fi.o: svn-fi.c ../../vcs-svn/svnload.h
+	$(QUIET_CC)$(CC) -I../../vcs-svn -o $*.o -c $(ALL_CFLAGS) $<
+
+svn-fi.html: svn-fi.txt
+	$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
+		MAN_TXT=../contrib/svn-fe/svn-fi.txt \
+		../contrib/svn-fe/$@
+
+svn-fi.1: svn-fi.txt
+	$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
+		MAN_TXT=../contrib/svn-fe/svn-fi.txt \
+		../contrib/svn-fe/$@
+	$(MV) ../../Documentation/svn-fi.1 .
+
 ../../vcs-svn/lib.a: FORCE
 	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) vcs-svn/lib.a
 
@@ -58,6 +76,7 @@ svn-fe.1: svn-fe.txt
 	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
 
 clean:
-	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
+	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1 \
+	svn-fi$X svn-fi.o svn-fi.html svn-fi.xml svn-fi.1
 
 .PHONY: all clean FORCE
diff --git a/contrib/svn-fe/svn-fi.c b/contrib/svn-fe/svn-fi.c
new file mode 100644
index 0000000..81347b0
--- /dev/null
+++ b/contrib/svn-fe/svn-fi.c
@@ -0,0 +1,16 @@
+/*
+ * This file is in the public domain.
+ * You may freely use, modify, distribute, and relicense it.
+ */
+
+#include <stdlib.h>
+#include "svnload.h"
+
+int main(int argc, char **argv)
+{
+	if (svnload_init(NULL))
+		return 1;
+	svnload_read();
+	svnload_deinit();
+	return 0;
+}
diff --git a/contrib/svn-fe/svn-fi.txt b/contrib/svn-fe/svn-fi.txt
new file mode 100644
index 0000000..996a175
--- /dev/null
+++ b/contrib/svn-fe/svn-fi.txt
@@ -0,0 +1,28 @@
+svn-fe(1)
+=========
+
+NAME
+----
+svn-fi - convert fast-import stream to an SVN "dumpfile"
+
+SYNOPSIS
+--------
+[verse]
+svn-fi
+
+DESCRIPTION
+-----------
+
+Converts a git-fast-import(1) stream into a Subversion dumpfile.
+
+INPUT FORMAT
+-------------
+The fast-import format is documented by the git-fast-import(1)
+manual page.
+
+OUTPUT FORMAT
+------------
+Subversion's repository dump format is documented in full in
+`notes/dump-load-format.txt` from the Subversion source tree.
+Files in this format can be generated using the 'svnadmin dump' or
+'svk admin dump' command.
-- 
1.7.4.rc1.7.g2cf08.dirty

^ permalink raw reply related

* [PATCH 4/5] fast-export: Introduce --inline-blobs
From: Ramkumar Ramachandra @ 2011-01-19  5:44 UTC (permalink / raw)
  To: Git List; +Cc: Jonathan Nieder, David Barr, Sverre Rabbelier
In-Reply-To: <1295415899-1192-1-git-send-email-artagnon@gmail.com>

Introduce a new command-line option --inline-blobs that always inlines
blobs instead of referring to them via marks or their original SHA-1
hash.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Documentation/git-fast-export.txt |    5 +++++
 builtin/fast-export.c             |   23 +++++++++++++++++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-fast-export.txt b/Documentation/git-fast-export.txt
index e05b686..cd48b4b 100644
--- a/Documentation/git-fast-export.txt
+++ b/Documentation/git-fast-export.txt
@@ -90,6 +90,11 @@ marks the same across runs.
 	resulting stream can only be used by a repository which
 	already contains the necessary objects.
 
+--inline-blobs::
+	Inline all blobs, instead of referring to them via marks or
+	their original SHA-1 hash.  This is useful to parsers, as they
+	don't need to persist blobs.
+
 --full-tree::
 	This option will cause fast-export to issue a "deleteall"
 	directive for each commit followed by a full list of all files
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index c8fd46b..202a3b9 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -27,6 +27,7 @@ static enum { ABORT, VERBATIM, WARN, STRIP } signed_tag_mode = ABORT;
 static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ABORT;
 static int fake_missing_tagger;
 static int no_data;
+static int inline_blobs;
 static int full_tree;
 
 static int parse_opt_signed_tag_mode(const struct option *opt,
@@ -118,7 +119,7 @@ static void handle_object(const unsigned char *sha1)
 	char *buf;
 	struct object *object;
 
-	if (no_data)
+	if (no_data || inline_blobs)
 		return;
 
 	if (is_null_sha1(sha1))
@@ -218,7 +219,23 @@ static void show_filemodify(struct diff_queue_struct *q,
 			if (no_data || S_ISGITLINK(spec->mode))
 				printf("M %06o %s %s\n", spec->mode,
 				       sha1_to_hex(spec->sha1), spec->path);
-			else {
+			else if (inline_blobs) {
+				unsigned long size;
+				enum object_type type;
+				char *buf;
+
+				buf = read_sha1_file(spec->sha1, &type, &size);
+				if (!buf)
+					die ("Could not read blob %s",
+						sha1_to_hex(spec->sha1));
+				printf("M %06o inline %s\n", spec->mode, spec->path);
+				printf("data %lu\n", size);
+				if (size && fwrite(buf, size, 1, stdout) != 1)
+					die_errno ("Could not write blob '%s'",
+						sha1_to_hex(spec->sha1));
+				printf("\n");
+
+			} else {
 				struct object *object = lookup_object(spec->sha1);
 				printf("M %06o :%d %s\n", spec->mode,
 				       get_object_mark(object), spec->path);
@@ -627,6 +644,8 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
 			     "Fake a tagger when tags lack one"),
 		OPT_BOOLEAN(0, "full-tree", &full_tree,
 			     "Output full tree for each commit"),
+		OPT_BOOLEAN(0, "inline-blobs", &inline_blobs,
+			     "Output all blobs inline"),
 		{ OPTION_NEGBIT, 0, "data", &no_data, NULL,
 			"Skip output of blob data",
 			PARSE_OPT_NOARG | PARSE_OPT_NEGHELP, NULL, 1 },
-- 
1.7.4.rc1.7.g2cf08.dirty

^ permalink raw reply related

* [PATCH 5/5] vcs-svn: Add dir_cache for svnload
From: Ramkumar Ramachandra @ 2011-01-19  5:44 UTC (permalink / raw)
  To: Git List; +Cc: Jonathan Nieder, David Barr, Sverre Rabbelier
In-Reply-To: <1295415899-1192-1-git-send-email-artagnon@gmail.com>

The logic for creating directories recursively is now
implemented. Unfortunately, dir_cache is currently implemented
inefficiently using string_list- should probably use a treap or trie
in future.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Makefile              |    2 +-
 vcs-svn/dir_cache.c   |   40 +++++++++++++++
 vcs-svn/dir_cache.h   |   12 +++++
 vcs-svn/dump_export.c |  104 ++++++++++++++++++++++++++++++++-------
 vcs-svn/dump_export.h |   33 ++++++++++++
 vcs-svn/svnload.c     |  130 +++++++++++++++++++++++--------------------------
 vcs-svn/svnload.h     |   10 ++++
 7 files changed, 243 insertions(+), 88 deletions(-)
 create mode 100644 vcs-svn/dir_cache.c
 create mode 100644 vcs-svn/dir_cache.h
 create mode 100644 vcs-svn/dump_export.h
 create mode 100644 vcs-svn/svnload.h

diff --git a/Makefile b/Makefile
index 40f6691..d9c2442 100644
--- a/Makefile
+++ b/Makefile
@@ -1836,7 +1836,7 @@ XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
 	xdiff/xmerge.o xdiff/xpatience.o
 VCSSVN_OBJS = vcs-svn/line_buffer.o vcs-svn/svnload.o vcs-svn/dump_export.o \
 	vcs-svn/repo_tree.o vcs-svn/fast_export.o vcs-svn/sliding_window.o \
-	vcs-svn/svndiff.o vcs-svn/svndump.o
+	vcs-svn/svndiff.o vcs-svn/svndump.o vcs-svn/dir_cache.o
 VCSSVN_TEST_OBJS = test-obj-pool.o \
 	test-line-buffer.o test-treap.o test-svn-fe.o
 OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS) $(VCSSVN_OBJS)
diff --git a/vcs-svn/dir_cache.c b/vcs-svn/dir_cache.c
new file mode 100644
index 0000000..9a608ce
--- /dev/null
+++ b/vcs-svn/dir_cache.c
@@ -0,0 +1,40 @@
+/*
+ * Licensed under a two-clause BSD-style license.
+ * See LICENSE for details.
+ */
+
+#include "git-compat-util.h"
+#include "string-list.h"
+#include "line_buffer.h"
+#include "dump_export.h"
+
+static struct string_list dirents = STRING_LIST_INIT_DUP;
+static struct string_list_item *dir = NULL;
+
+void dir_cache_add(const char *path, enum node_kind kind) {
+	dir = string_list_insert(&dirents, path);
+	dir->util = malloc(sizeof(enum node_kind));
+	*((enum node_kind *)(dir->util)) = kind;
+}
+
+void dir_cache_remove(const char *path) {
+	dir = string_list_lookup(&dirents, path);
+	if (dir)
+		*((enum node_kind *)(dir->util)) = NODE_KIND_UNKNOWN;
+}
+
+enum node_kind dir_cache_lookup(const char *path) {
+	dir = string_list_lookup(&dirents, path);
+	if (dir)
+		return *((enum node_kind *)(dir->util));
+	else
+		return NODE_KIND_UNKNOWN;
+}
+
+void dir_cache_init() {
+	return;
+}
+
+void dir_cache_deinit() {
+	string_list_clear(&dirents, 1);
+}
diff --git a/vcs-svn/dir_cache.h b/vcs-svn/dir_cache.h
new file mode 100644
index 0000000..43c3797
--- /dev/null
+++ b/vcs-svn/dir_cache.h
@@ -0,0 +1,12 @@
+#ifndef DIR_CACHE_H_
+#define DIR_CACHE_H_
+
+#include "dump_export.h"
+
+void dir_cache_add(const char *path, enum node_kind kind);
+void dir_cache_remove(const char *path);
+enum node_kind dir_cache_lookup(const char *path);
+void dir_cache_init();
+void dir_cache_deinit();
+
+#endif
diff --git a/vcs-svn/dump_export.c b/vcs-svn/dump_export.c
index 04ede06..6f2a9d7 100644
--- a/vcs-svn/dump_export.c
+++ b/vcs-svn/dump_export.c
@@ -7,6 +7,9 @@
 #include "strbuf.h"
 #include "line_buffer.h"
 #include "dump_export.h"
+#include "dir_cache.h"
+
+static struct strbuf props;
 
 void dump_export_begin_rev(int revision, const char *revprops,
 			int prop_len) {
@@ -19,39 +22,47 @@ void dump_export_begin_rev(int revision, const char *revprops,
 void dump_export_node(const char *path, enum node_kind kind,
 		enum node_action action, unsigned long text_len,
 		unsigned long copyfrom_rev, const char *copyfrom_path) {
+	int dump_props = 1; /* Boolean */
+	strbuf_reset(&props);
 	printf("Node-path: %s\n", path);
-	printf("Node-kind: ");
-	switch (action) {
+	switch (kind) {
 	case NODE_KIND_NORMAL:
-		printf("file\n");
+		printf("Node-kind: file\n");
 		break;
 	case NODE_KIND_EXECUTABLE:
-		printf("file\n");
+		printf("Node-kind: file\n");
+		strbuf_addf(&props, "K\nsvn:executable\nV\n1\n");
 		break;
 	case NODE_KIND_SYMLINK:
-		printf("file\n");
+		printf("Node-kind: file\n");
+		strbuf_addf(&props, "K\nsvn:special\nV\n1\n");
 		break;
 	case NODE_KIND_GITLINK:
-		printf("file\n");
+		printf("Node-kind: file\n");
+		break;
+	case NODE_KIND_DIR:
+		printf("Node-kind: dir\n");
 		break;
 	case NODE_KIND_SUBDIR:
 		die("Unsupported: subdirectory");
 	default:
-		break;
+		break; /* When a node is being removed, nothing is printed */
 	}
-	printf("Node-action: ");
+	strbuf_add(&props, "PROPS-END\n", 10);
+
 	switch (action) {
 	case NODE_ACTION_CHANGE:
-		printf("change\n");
+		printf("Node-action: change\n");
 		break;
 	case NODE_ACTION_ADD:
-		printf("add\n");
+		printf("Node-action: add\n");
 		break;
 	case NODE_ACTION_REPLACE:
-		printf("replace\n");
+		printf("Node-action: replace\n");
 		break;
 	case NODE_ACTION_DELETE:
-		printf("delete\n");
+		printf("Node-action: delete\n");
+		dump_props = 0;
 		break;
 	default:
 		break;
@@ -60,14 +71,71 @@ void dump_export_node(const char *path, enum node_kind kind,
 		printf("Node-copyfrom-rev: %lu\n", copyfrom_rev);
 		printf("Node-copyfrom-path: %s\n", copyfrom_path);
 	}
-	printf("Prop-delta: false\n");
-	printf("Prop-content-length: 10\n"); /* Constant 10 for "PROPS-END" */
-	printf("Text-delta: false\n");
-	printf("Text-content-length: %lu\n", text_len);
-	printf("Content-length: %lu\n\n", text_len + 10);
-	printf("PROPS-END\n\n");
+	if (dump_props) {
+		printf("Prop-delta: false\n");
+		printf("Prop-content-length: %lu\n", props.len);
+	}
+	if (text_len) {
+		printf("Text-delta: false\n");		
+		printf("Text-content-length: %lu\n", text_len);
+	}
+	if (text_len || dump_props) {
+		printf("Content-length: %lu\n\n", text_len + props.len);
+		printf("%s", props.buf);
+	}
+	if (!text_len)
+		printf("\n");
+}
+
+void dump_export_node_r(const char *path, enum node_kind kind,
+			enum node_action action, unsigned long text_len,
+			unsigned long copyfrom_rev, const char *copyfrom_path) {
+	char *start, *t;
+	start = (char *) path;
+
+	while((t = strchr(start, '/'))) {
+			*t = '\0';
+			if (dir_cache_lookup(path) == NODE_KIND_UNKNOWN) {
+				dir_cache_add(path, NODE_KIND_NORMAL);
+				dump_export_node(path, NODE_KIND_DIR,
+						NODE_ACTION_ADD, 0,
+						SVN_INVALID_REV, NULL);
+			}
+			*t = '/';   /* Change it back */
+			start = t + 1;
+	}
+	switch (dir_cache_lookup(path)) {
+	case NODE_KIND_UNKNOWN:
+		action = NODE_ACTION_ADD;
+		break;
+	case NODE_KIND_SYMLINK:
+		dir_cache_remove(path);
+		dump_export_node(path, NODE_KIND_UNKNOWN,
+				NODE_ACTION_DELETE,
+				0, SVN_INVALID_REV, NULL);
+		break;
+	case NODE_KIND_DIR:
+		die("File was previously a directory?");
+		break;
+	case NODE_KIND_SUBDIR:
+		die("Subdirectories unsupported");
+		break;
+	default:
+		action = NODE_ACTION_CHANGE;
+		break;
+	}
+	dir_cache_add(path, kind);
+	dump_export_node(path, kind, action, text_len, copyfrom_rev, copyfrom_path);
 }
 
 void dump_export_text(struct line_buffer *data, off_t len) {
 	buffer_copy_bytes(data, len);
 }
+
+void dump_export_init() {
+	strbuf_init(&props, MAX_GITSVN_LINE_LEN);
+}
+
+void dump_export_deinit() {
+	strbuf_release(&props);
+}
diff --git a/vcs-svn/dump_export.h b/vcs-svn/dump_export.h
new file mode 100644
index 0000000..e9f51a3
--- /dev/null
+++ b/vcs-svn/dump_export.h
@@ -0,0 +1,33 @@
+#ifndef DUMP_EXPORT_H_
+#define DUMP_EXPORT_H_
+
+#define MAX_GITSVN_LINE_LEN 4096
+#define SVN_INVALID_REV 0
+
+enum node_action {
+	NODE_ACTION_UNKNOWN,
+	NODE_ACTION_CHANGE,
+	NODE_ACTION_ADD,
+	NODE_ACTION_DELETE,
+	NODE_ACTION_REPLACE
+};
+
+enum node_kind {
+	NODE_KIND_UNKNOWN,       /* Missing node */
+	NODE_KIND_NORMAL,
+	NODE_KIND_EXECUTABLE,
+	NODE_KIND_SYMLINK,
+	NODE_KIND_GITLINK,
+	NODE_KIND_DIR,           /* SVN-specific */
+	NODE_KIND_SUBDIR
+};
+
+void dump_export_begin_rev(int revision, const char *revprops, int prop_len);
+void dump_export_text(struct line_buffer *data, off_t len);
+void dump_export_node_r(const char *path, enum node_kind kind,
+			enum node_action action, unsigned long text_len,
+			unsigned long copyfrom_rev, const char *copyfrom_path);
+void dump_export_init();
+void dump_export_deinit();
+
+#endif
diff --git a/vcs-svn/svnload.c b/vcs-svn/svnload.c
index 7043ae7..19c4689 100644
--- a/vcs-svn/svnload.c
+++ b/vcs-svn/svnload.c
@@ -11,17 +11,16 @@
 #include "git-compat-util.h"
 #include "line_buffer.h"
 #include "dump_export.h"
-#include "strbuf.h"
+#include "dir_cache.h"
 
 #define SVN_DATE_FORMAT "%Y-%m-%dT%H:%M:%S.000000Z"
 #define SVN_DATE_LEN 28
 #define LENGTH_UNKNOWN (~0)
 
 static struct line_buffer input = LINE_BUFFER_INIT;
-static struct strbuf blobs[100];
-	
+
 static struct {
-	unsigned long prop_len, text_len, copyfrom_rev, mark;
+	unsigned long prop_len, text_len, copyfrom_rev;
 	int text_delta, prop_delta; /* Boolean */
 	enum node_action action;
 	enum node_kind kind;
@@ -60,15 +59,14 @@ static void reset_node_ctx(void)
 {
 	node_ctx.prop_len = LENGTH_UNKNOWN;
 	node_ctx.text_len = LENGTH_UNKNOWN;
-	node_ctx.mark = 0;
-	node_ctx.copyfrom_rev = 0;
+	node_ctx.copyfrom_rev = SVN_INVALID_REV;
 	node_ctx.text_delta = -1;
 	node_ctx.prop_delta = -1;
 	strbuf_reset(&node_ctx.copyfrom_path);
 	strbuf_reset(&node_ctx.path);
 }
 
-static void populate_props(struct strbuf *props, const char *author,
+static void populate_revprops(struct strbuf *props, const char *author,
 			const char *log, const char *date) {
 	strbuf_reset(props);	
 	strbuf_addf(props, "K\nsvn:author\nV\n%s\n", author);
@@ -83,7 +81,7 @@ static void parse_author_line(char *val, struct strbuf *name,
 	char time_buf[SVN_DATE_LEN];
 	const struct tm *tm_time;
 
-	/* Simon Hausmann <shausman@trolltech.com> 1170199019 +0100 */
+	/* Author Name <author@email.com> 1170199019 +0530 */
 	strbuf_reset(name);
 	strbuf_reset(email);
 	strbuf_reset(date);
@@ -104,46 +102,42 @@ static void parse_author_line(char *val, struct strbuf *name,
 
 void svnload_read(void) {
 	char *t, *val;
-	int mode_incr;
-	struct strbuf *to_dump;
+	int len, mode_incr;
 
 	while ((t = buffer_read_line(&input))) {
 		val = strchr(t, ' ');
-		if (!val) {
-			if (!memcmp(t, "blob", 4))
-				active_ctx = BLOB_CTX;
-			else if (!memcmp(t, "deleteall", 9))
-				;
-			continue;
+		if (!val)
+			len = strlen(t);
+		else {
+			*val++ = '\0';
+			len = val - t - 1;
 		}
-		*val++ = '\0';
 
-		/* strlen(key) */
-		switch (val - t - 1) {
+		switch (len) {
 		case 1:
 			if (!memcmp(t, "D", 1)) {
 				node_ctx.action = NODE_ACTION_DELETE;
-			}
-			else if (!memcmp(t, "C", 1)) {
+			} else if (!memcmp(t, "C", 1)) {
 				node_ctx.action = NODE_ACTION_ADD;
-			}
-			else if (!memcmp(t, "R", 1)) {
+			} else if (!memcmp(t, "R", 1)) {
 				node_ctx.action = NODE_ACTION_REPLACE;
-			}
-			else if (!memcmp(t, "M", 1)) {
+			} else if (!memcmp(t, "M", 1)) {
 				node_ctx.action = NODE_ACTION_CHANGE;
-				mode_incr = 7;
-				if (!memcmp(val, "100644", 6))
-					node_ctx.kind = NODE_KIND_NORMAL;
-				else if (!memcmp(val, "100755", 6))
-					node_ctx.kind = NODE_KIND_EXECUTABLE;
-				else if (!memcmp(val, "120000", 6))
-					node_ctx.kind = NODE_KIND_SYMLINK;
-				else if (!memcmp(val, "160000", 6))
-					node_ctx.kind = NODE_KIND_GITLINK;
-				else if (!memcmp(val, "040000", 6))
-					node_ctx.kind = NODE_KIND_SUBDIR;
-				else {
+				if (strlen(val) >= 6) {
+					if (!memcmp(val, "100644", 6))
+						node_ctx.kind = NODE_KIND_NORMAL;
+					else if (!memcmp(val, "100755", 6))
+						node_ctx.kind = NODE_KIND_EXECUTABLE;
+					else if (!memcmp(val, "120000", 6))
+						node_ctx.kind = NODE_KIND_SYMLINK;
+					else if (!memcmp(val, "160000", 6))
+						node_ctx.kind = NODE_KIND_GITLINK;
+					else if (!memcmp(val, "040000", 6))
+						node_ctx.kind = NODE_KIND_SUBDIR;
+					else
+						die("Unrecognized mode: %s", val);
+					mode_incr = 7;
+				} else if (strlen(val) >= 3) {
 					if (!memcmp(val, "755", 3))
 						node_ctx.kind = NODE_KIND_EXECUTABLE;
 					else if(!memcmp(val, "644", 3))
@@ -151,40 +145,35 @@ void svnload_read(void) {
 					else
 						die("Unrecognized mode: %s", val);
 					mode_incr = 4;
-				}
+				} else
+					die ("Malformed filemodify: Missing mode");
 				val += mode_incr;
 				t = strchr(val, ' ');
+				if (!t)
+					die("Malformed filemodify: Missing dataref");
 				*t++ = '\0';
 				strbuf_reset(&node_ctx.path);
 				strbuf_add(&node_ctx.path, t, strlen(t));
-				if (!memcmp(val + 1, "inline", 6))
-					die("Unsupported dataref: inline");
+				if (!strncmp(val, "inline", 6))
+					active_ctx = BLOB_CTX;
 				else if (*val == ':')
-					to_dump = &blobs[strtoul(val + 1, NULL, 10)];
+					die("Unsupported dataref: marks");
 				else
 					die("Unsupported dataref: sha1");
-				dump_export_node(node_ctx.path.buf, node_ctx.kind,
-						node_ctx.action, to_dump->len,
-						0, NULL);
-				printf("%s", to_dump->buf);
 			}
 			break;
+		case 2:
+			if (!memcmp(t, "ls", 2))
+				die("ls not supported");
 		case 3:
 			if (!memcmp(t, "tag", 3))
 				continue;
 			break;
 		case 4:
-			if (!memcmp(t, "mark", 4))
-				switch(active_ctx) {
-				case COMMIT_CTX:
-					/* What do we do with commit marks? */
-					continue;
-				case BLOB_CTX:
-					node_ctx.mark = strtoul(val + 1, NULL, 10);
-					break;
-				default:
-					break;
-				}
+			if (!memcmp(t, "blob", 4))
+				die("Please inline blobs in the fast-import stream");
+			else if (!memcmp(t, "mark", 4))
+				continue;
 			else if (!memcmp(t, "from", 4))
 				continue;
 			else if (!memcmp(t, "data", 4)) {
@@ -194,7 +183,7 @@ void svnload_read(void) {
 					buffer_read_binary(&input,
 							&rev_ctx.log,
 							strtoul(val, NULL, 10));
-					populate_props(&rev_ctx.props,
+					populate_revprops(&rev_ctx.props,
 						rev_ctx.svn_author.buf,
 						rev_ctx.log.buf,
 						rev_ctx.author_date.buf);
@@ -204,9 +193,10 @@ void svnload_read(void) {
 					break;
 				case BLOB_CTX:
 					node_ctx.text_len = strtoul(val, NULL, 10);
-					buffer_read_binary(&input,
-							&blobs[node_ctx.mark],
-							node_ctx.text_len);
+					dump_export_node_r(node_ctx.path.buf, node_ctx.kind,
+							node_ctx.action, node_ctx.text_len,
+							SVN_INVALID_REV, NULL);
+					buffer_copy_bytes(&input, node_ctx.text_len);
 					break;
 				default:
 					break;
@@ -231,14 +221,18 @@ void svnload_read(void) {
 					rev_ctx.author_email.buf,
 					t - rev_ctx.author_email.buf);
 
-			}
-			else if (!memcmp(t, "commit", 6)) {
+			} else if (!memcmp(t, "commit", 6)) {
 				rev_ctx.rev ++;
 				active_ctx = COMMIT_CTX;
 			}
 			break;
+		case 8:
+			if (!memcmp(t, "cat-blob", 8))
+				die("cat-blob unsupported");
 		case 9:
-			if (!memcmp(t, "committer", 9))
+			if (!memcmp(t, "deleteall", 9))
+				continue;
+			else if (!memcmp(t, "committer", 9))
 				parse_author_line(val, &rev_ctx.committer,
 						&rev_ctx.committer_email,
 						&rev_ctx.committer_date);
@@ -251,7 +245,6 @@ void svnload_read(void) {
 
 int svnload_init(const char *filename)
 {
-	int i;
 	if (buffer_init(&input, filename))
 		return error("cannot open %s: %s", filename, strerror(errno));
 	active_ctx = UNKNOWN_CTX;
@@ -265,14 +258,13 @@ int svnload_init(const char *filename)
 	strbuf_init(&rev_ctx.committer_email, MAX_GITSVN_LINE_LEN);
 	strbuf_init(&node_ctx.path, MAX_GITSVN_LINE_LEN);
 	strbuf_init(&node_ctx.copyfrom_path, MAX_GITSVN_LINE_LEN);
-	for (i = 0; i < 100; i ++)
-		strbuf_init(&blobs[i], 10000);
+	dump_export_init();
+	dir_cache_init();
 	return 0;
 }
 
 void svnload_deinit(void)
 {
-	int i;
 	reset_rev_ctx(0);
 	reset_node_ctx();
 	strbuf_release(&rev_ctx.props);
@@ -285,8 +277,8 @@ void svnload_deinit(void)
 	strbuf_release(&rev_ctx.committer_email);
 	strbuf_release(&node_ctx.path);
 	strbuf_release(&node_ctx.copyfrom_path);
-	for (i = 0; i < 100; i ++)
-		strbuf_release(&blobs[i]);
+	dump_export_deinit();
+	dir_cache_deinit();
 	if (buffer_deinit(&input))
 		fprintf(stderr, "Input error\n");
 	if (ferror(stdout))
diff --git a/vcs-svn/svnload.h b/vcs-svn/svnload.h
new file mode 100644
index 0000000..0c8fe8b
--- /dev/null
+++ b/vcs-svn/svnload.h
@@ -0,0 +1,10 @@
+#ifndef SVNLOAD_H_
+#define SVNLOAD_H_
+
+#define SVN_INVALID_REV -1
+
+int svnload_init(const char *filename);
+void svnload_deinit(void);
+void svnload_read(void);
+
+#endif
-- 
1.7.4.rc1.7.g2cf08.dirty

^ permalink raw reply related

* Re: filter-branch --env-filter GIT_AUTHOR_DATE
From: Johannes Sixt @ 2011-01-19  7:01 UTC (permalink / raw)
  To: Tuncer Ayaz; +Cc: git
In-Reply-To: <AANLkTinx7cs6YTvSTTv-njHA+vk264u1EaJettSdBF9U@mail.gmail.com>

Am 1/18/2011 17:43, schrieb Tuncer Ayaz:
> To fix invalid timezone info in a repo I ran
> git filter-branch --env-filter '
>   GIT_AUTHOR_DATE=`echo ${GIT_AUTHOR_DATE}|sed s/+0000/-0800/`' HEAD
> 
> This fixed the invalid entries but the new timezone is -0700
> instead of -0800. Is this expected?

Parse error. You fixed it, but it is not fixed? So what?

What do you mean by "the new timezone is"? Do you mean "...is reported
as"? If so, reported by which tools?

> git version 1.7.4.rc2

I tried your command, but the timezone was changed in the expected way.

-- Hannes

^ permalink raw reply

* Locating Git Clone
From: flebber @ 2011-01-19  8:35 UTC (permalink / raw)
  To: git


I downloaded from git as I was following this walkthrough
http://www.grails.org/Installation.

So I issued the command 

    * git clone git://github.com/grails/grails-core.git

So that worked no problems, except I don't know where it cloned it to or how
I can move it. I had intended it to go to c:\grails.

Is there a way to find a locate something you have cloned?

Sayth
-- 
View this message in context: http://git.661346.n2.nabble.com/Locating-Git-Clone-tp5938712p5938712.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply

* Re: [PATCH 2/3] git-gui: spelling fixes in russian translation
From: Alexey Shumkin @ 2011-01-19  8:36 UTC (permalink / raw)
  To: git
In-Reply-To: <20110119000735.GA29212@dpotapov.dyndns.org>

Dmitry Potapov <dpotapov <at> gmail.com> writes:

> 
> On Tue, Jan 18, 2011 at 07:40:05AM +0000, Alexey Shumkin wrote:
> > change this
> > >  #, tcl-format
> > >  msgid "File %s seems to have unresolved conflicts, still stage?"
> > >  msgstr ""
> > +"Файл %s кажется содержит необработанные конфликты.
> > Продолжить подготовку к "
> >  "сохранению?"
> > to
> > +"Файл %s, кажется, содержит необработанные конфликты.
> > Продолжить подготовку к "
> >  "сохранению?"
> > 
> > "Кажется" - вводное слово, обособляется запятыми
> 
> In the above sentence, 'кажется' is not an introductory word, and thus
> no comma is required. For details, see #2 at
> http://ru.wiktionary.org/wiki/%D0%BA%D0%B0%D0%B6%D0%B5%D1%82%D1%81%D1%8F
> 
> However, such use of 'кажется' is more appropriate for colloquial speech
> than for documentation or even computer messages. Also, I have never seen
> 'unresolved conflicts' being translated as 'необработанные конфликты'.
> IMHO, the standard term is 'неразрешенные конфликты'. So my suggestion is:
> 
> Файл %s может содержать неразрешенные конфликты.
> 
> Dmitry
> 

As I understand exact meaning of phrase "File %s seems to have unresolved 
conflicts" (note *seems* word here) is a supposition. It is not
an equivalent of "may have" (but "may not have").
So, I agree sentence must rephrased but supposition must be retained.
Something like "Файл %s, похоже, содержит неразрешенные конфликты"
or "Файл %s, видимо, содержит неразрешенные конфликты"
or better "Предположительно файл %s содержит неразрешенные конфликты"
(stay official but supposing)

^ permalink raw reply

* Re: Locating Git Clone
From: Alexey Shumkin @ 2011-01-19  8:49 UTC (permalink / raw)
  To: git
In-Reply-To: <1295426139368-5938712.post@n2.nabble.com>

flebber <flebber.crue <at> gmail.com> writes:

> 
> 
> I downloaded from git as I was following this walkthrough
> http://www.grails.org/Installation.
> 
> So I issued the command 
> 
>     * git clone git://github.com/grails/grails-core.git
> 
> So that worked no problems, except I don't know where it cloned it to or how
> I can move it. I had intended it to go to c:\grails.
> 
> Is there a way to find a locate something you have cloned?
> 
> Sayth

'git clone URL [FOLDER]' clones repo to FOLDER if it is set
and to basename of URL to your current dir (say PWD) otherwise
I.e. PWD/grails-core (.git suffix is automatically removed) is this case

RTFM )) 

^ permalink raw reply

* Re: Locating Git Clone
From: flebber @ 2011-01-19  8:57 UTC (permalink / raw)
  To: git
In-Reply-To: <loom.20110119T094539-141@post.gmane.org>


So how can I determine which folder is set for git? Should I have declared
the folder to clone to in the orginal clone command?

I tried using --get-dir and the man.

renshaw@RENSHAWRESIDENC ~
$ --git-dir
sh.exe": --git-dir: command not found

renshaw@RENSHAWRESIDENC ~
$ --git-dir=GIT_DIR
sh.exe": --git-dir=GIT_DIR: command not found

renshaw@RENSHAWRESIDENC ~
$ help mv
sh.exe": help: no help topics match `mv'.  Try `help help'
fo mv'.

renshaw@RENSHAWRESIDENC ~
$ man -k mv
sh.exe": man: command not found

renshaw@RENSHAWRESIDENC ~
$ info mv
sh.exe": info: command not found

renshaw@RENSHAWRESIDENC ~
$ mv grails-1.3.6 c:\grails
mv: cannot stat `grails-1.3.6': No such file or directory
-- 
View this message in context: http://git.661346.n2.nabble.com/Locating-Git-Clone-tp5938712p5938759.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply

* Re: Locating Git Clone
From: Maaartin @ 2011-01-19  9:13 UTC (permalink / raw)
  To: git; +Cc: git
In-Reply-To: <1295427449605-5938759.post@n2.nabble.com>

On 11-01-19 09:57, flebber wrote:
>
> So how can I determine which folder is set for git? Should I have declared
> the folder to clone to in the orginal clone command?
>
> I tried using --get-dir and the man.
>
> renshaw@RENSHAWRESIDENC ~
> $ --git-dir
> sh.exe": --git-dir: command not found

Wrong, it's a git option, i.e., you'd use something like
git --git-dir some_git_command ...

But you do NOT need it at all. Don't use it, it's a bit advanced. Just
change into the right directory before using any git command.

> renshaw@RENSHAWRESIDENC ~
> $ --git-dir=GIT_DIR
> sh.exe": --git-dir=GIT_DIR: command not found
>
> renshaw@RENSHAWRESIDENC ~
> $ help mv
> sh.exe": help: no help topics match `mv'.  Try `help help'
> fo mv'.
>
> renshaw@RENSHAWRESIDENC ~
> $ man -k mv
> sh.exe": man: command not found
>
> renshaw@RENSHAWRESIDENC ~
> $ info mv
> sh.exe": info: command not found

Forget it,
http://www.google.com/search?q=man+mv
is what I use instead. It's fast enough for me.

> renshaw@RENSHAWRESIDENC ~
> $ mv grails-1.3.6 c:\grails
> mv: cannot stat `grails-1.3.6': No such file or directory

You did
git clone git://github.com/grails/grails-core.git
so I'd suppose you could move it using
mv grails-core c:/grails
Do not use "\" as it's an escape character, you'd need to double it. But
use anything you like for moving it.

^ permalink raw reply

* Re: [PATCH] gitk: spelling fixes in russian translation
From: Paul Mackerras @ 2011-01-19  9:33 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git, Serge Ziryukin, Dmitry Potapov, Alexander Gavrilov, Skip
In-Reply-To: <20110117212312.GA8506@blimp.localdomain>

On Mon, Jan 17, 2011 at 10:23:12PM +0100, Alex Riesen wrote:

> From: Skip <bsvskip@rambler.ru>
> 
> Signed-off-by: Skip <bsvskip@rambler.ru>
> Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
> ---
> 
> I applied the patch to the gitk-git in git main repository.
> I hope it still applies to your repository, Paul.

Yes, it was fine.

Thanks, applied.

^ permalink raw reply

* Re: [PATCH] gitk: Take only numeric version components when computing $git_version
From: Paul Mackerras @ 2011-01-19  9:35 UTC (permalink / raw)
  To: Anders Kaseorg; +Cc: Junio C Hamano, Mathias Lafeldt, git
In-Reply-To: <1294360953.21006.2.camel@fixed-disk>

On Thu, Jan 06, 2011 at 05:42:33PM -0700, Anders Kaseorg wrote:

> This fixes errors running with release candidate versions of Git:
>   Error in startup script: expected version number but got "1.7.4-rc0"

Thanks, applied.

Junio, you could do a pull from my gitk repository at your convenience.

Paul.

^ permalink raw reply

* Re: [PATCH 3/3] git-gui: update russian translation
From: Alex Riesen @ 2011-01-19  9:55 UTC (permalink / raw)
  To: Dmitry Potapov
  Cc: git, Shawn O. Pearce, Pat Thoyts, Serge Ziryukin,
	Alexander Gavrilov
In-Reply-To: <20110119001644.GB29212@dpotapov.dyndns.org>

2011/1/19 Dmitry Potapov <dpotapov@gmail.com>:
> On Mon, Jan 17, 2011 at 10:08:55PM +0100, Alex Riesen wrote:
>> -#: git-gui.sh:1367
>> +#: git-gui.sh:1454
>>  msgid "Calling prepare-commit-msg hook..."
>>  msgstr "Вызов программы поддержки репозитория prepare-commit-msg..."
>
> 'hook' is usually translated as 'программа перехвата'
>

Dunno. Does not sound right in this particular case.
Unless someone else speaks up for this translation, or
comes up with a better translation of the whole message,
I suggest we leave it as is.

^ permalink raw reply

* Re: git-config does not check validity of variable names
From: Libor Pechacek @ 2011-01-19 10:01 UTC (permalink / raw)
  To: Jeff King; +Cc: git
In-Reply-To: <20110111055922.GD10094@sigill.intra.peff.net>

Hi Jeff,

On Tue 11-01-11 00:59:22, Jeff King wrote:
> On Sat, Jan 08, 2011 at 03:46:44PM +0100, Libor Pechacek wrote:
> 
> > I've noticed that git-config accepts variable names in the form "a=b" for its
> > "get" operation.  That means "git config a=b" does not write anything to its
> > output and exists with status 1.
> > 
> > According to the man page only alphanumeric characters and - are allowed in
> > variable names.  Would it make sense to spit out an error message when the user
> > supplies an invalid variable name like the above?
> 
> Probably. The current behavior isn't all that terrible, in that it
> simply tries to look up the key, which of course doesn't exist (because
> it cannot syntactically), and does signal an error (with the exit code).
> So it is in some ways no worse than a typo like "git config
> color.dif.branch". And we probably don't want to start writing to stderr
> in such a case, as scripts assume they can call git config to find out
> whether the variable is defined without having to redirect stderr.

I fully agree that there should be no extra output if the user searches for an
undefined variable.  My idea is to warn the user when the variable name is
clearly invalid.

> That being said, I can see how the lack of a message could be confusing
> for a user who mistakenly thinks "git config color.diff.branch=red"
> should work. So I think a patch to make that better would get a
> favorable response.
> 
> Note, though, that what you wrote above is not strictly true. The
> manpage says variable names and section names must be alphanumeric. But
> subsection names can contain any character except newline. So it is
> valid syntactically to do:
> 
>   git config color.diff=red.branch
> 
> where the subsection contains the "=". Obviously this example is
> nonsense, and in practice most such "a=b" forms will end up not being
> syntactically valid (because the = will be part of the variable name,
> not the subsection).

That was new for me, so I had to learn the concept.  Thanks for thorough
explanation.

> But if you are going to write a patch, you need to
> make sure not to accidentally disallow:
> 
>   git config 'diff.my custom diff driver.command'

There is already a check in git_config_set_multivar to prevent the user from
creating variables with invalid names.  That can probably be separated and
reused in the "get value" path.  I'll have a look.


In the course of reading the code I've spotted another trouble related to
regexps.  Variable and section names are case insensitive, while subsection
names are case sensitive.  How can regexp matching be made "partially case
sensitive"?  That's a challenge.

The current approach is to lowercase everything in the pattern from the
beginning until the first dot and from the last dot till the end.  That has its
limitations as regular expressions can be fairly complex.

Just to illustrate the situation:
$ git config --get-regexp '(CORE|USER)\.'
user.email lpechacek@suse.cz
core.repositoryformatversion 0
core.filemode true

$ git config --get-regexp '(COR.|USER)\.'
core.repositoryformatversion 0
core.filemode true

Currently have no idea how to fix that apart from fixing the documentation. :) 

Libor
-- 
Libor Pechacek
SUSE L3 Team, Prague

^ permalink raw reply

* Re: [PATCH 2/3] git-gui: spelling fixes in russian translation
From: Alex Riesen @ 2011-01-19 10:04 UTC (permalink / raw)
  To: Alexey Shumkin; +Cc: git
In-Reply-To: <loom.20110119T090252-99@post.gmane.org>

On Wed, Jan 19, 2011 at 09:36, Alexey Shumkin <zapped@mail.ru> wrote:
> Dmitry Potapov <dpotapov <at> gmail.com> writes:
>>
>> In the above sentence, 'кажется' is not an introductory word, and thus
>> no comma is required. For details, see #2 at
>> http://ru.wiktionary.org/wiki/%D0%BA%D0%B0%D0%B6%D0%B5%D1%82%D1%81%D1%8F
>>
>> However, such use of 'кажется' is more appropriate for colloquial speech
>> than for documentation or even computer messages. Also, I have never seen
>> 'unresolved conflicts' being translated as 'необработанные конфликты'.
>> IMHO, the standard term is 'неразрешенные конфликты'. So my suggestion is:
>>
>> Файл %s может содержать неразрешенные конфликты.
>>

But this would be wrong. It is absolutely not the original
message tried to say. Any file can contain unresolved conflicts
(markers). The point is: this particular file very likely does.

> As I understand exact meaning of phrase "File %s seems to have unresolved
> conflicts" (note *seems* word here) is a supposition. It is not
> an equivalent of "may have" (but "may not have").
> So, I agree sentence must rephrased but supposition must be retained.
> Something like "Файл %s, похоже, содержит неразрешенные конфликты"

While I like this one, it is not much better semantically, than the
previous with punctuation corrected. So unless there are more votes
for it, I will not resend the translation.
Cannot forbid you from doing this, though (and personally would like
to see a name of another native russian speaker in the authors of
translations).

> or better "Предположительно файл %s содержит неразрешенные конфликты"
> (stay official but supposing)

"Supposedly file "...?

^ permalink raw reply

* Re: filter-branch --env-filter GIT_AUTHOR_DATE
From: Tuncer Ayaz @ 2011-01-19 10:08 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git
In-Reply-To: <4D368C49.3080105@viscovery.net>

On Wed, Jan 19, 2011 at 8:01 AM, Johannes Sixt wrote:
> Am 1/18/2011 17:43, schrieb Tuncer Ayaz:
>> To fix invalid timezone info in a repo I ran
>> git filter-branch --env-filter '
>>   GIT_AUTHOR_DATE=`echo ${GIT_AUTHOR_DATE}|sed s/+0000/-0800/`' HEAD
>>
>> This fixed the invalid entries but the new timezone is -0700
>> instead of -0800. Is this expected?
>
> Parse error. You fixed it, but it is not fixed? So what?

Fixed because it is not +0000 anymore. Surprised because the new
timezone is -0700 and not -0800.

> What do you mean by "the new timezone is"? Do you mean "...is reported
> as"? If so, reported by which tools?

git log
git cat-file $REV

>> git version 1.7.4.rc2
>
> I tried your command, but the timezone was changed in the expected way.

How did you check?

^ permalink raw reply

* Re: filter-branch --env-filter GIT_AUTHOR_DATE
From: Tuncer Ayaz @ 2011-01-19 10:12 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git
In-Reply-To: <AANLkTi=TAhYeWbyocag2myBXA2TfH7_r=hmam51YKbhm@mail.gmail.com>

On Wed, Jan 19, 2011 at 11:08 AM, Tuncer Ayaz wrote:
> git cat-file $REV

To be correct:
git cat-file -p $REV

^ permalink raw reply

* Re: core.whitespace space-in-indent feature request
From: Victor Engmark @ 2011-01-19  9:42 UTC (permalink / raw)
  To: git
In-Reply-To: <20205598.46894.1295382705010.JavaMail.trustmail@mail1.terreactive.ch>

On Jan 18, 2011, at 9:31 PM, Junio C Hamano wrote:

> Drew Northup <drew.northup@maine.edu> writes:
> 
>> On Fri, 2011-01-14 at 13:40 +0100, Victor Engmark wrote:
>>> Hi all,
>>> 
>>> I couldn't find this mentioned anywhere, but it would be useful for
>>> languages where you typically want only tab characters in indentation,
>>> like makefiles. Would be equivalent or similar to indent-with-non-tab
>>> and tabwidth=1.
>> 
>> Victor,
>> What would the point of this be? Git doesn't change the layout of the
>> code when storing it--that's up to the thing between the chair and the
>> keyboard.
> 
> True, but I think Victor wants to be able to ask "diff --check" to
> complain and diff --color to highlight when it sees a line that begins
> with a SP (or a HT then SP) by setting:
> 
> 	* whitespace=space-in-indent
> 
> or something in the attributes file.
> 
> As "equivalence" exists, not very much interested in coding it myself,
> though ;-)

That's it, but it turns out the settings don't work the way I expected:

$ git config --add core.whitespace 'indent-with-non-tab,tabwidth=1'
$ touch whitespace.txt
$ git add whitespace.txt
[Add the following to the file]
	HT
SP
	SP HT
	 HT SP
 2 SP
		2 HT
       8 SP
$ git diff --color

Only the "SP HT" and "8 SP" indentations are colored; I expected "SP" and "2 SP" to also be colored, and I would expect space-in-indent to also trigger on "HT SP".

Cheers,
-- 
Victor

^ permalink raw reply

* Re: Locating Git Clone
From: flebber @ 2011-01-19 10:28 UTC (permalink / raw)
  To: git
In-Reply-To: <1295426139368-5938712.post@n2.nabble.com>


Thanks for the help.

Didn't realise at all I could navigate like a unix shell. All solved thanks.

renshaw@RENSHAWRESIDENC ~
$ ls
Application Data  IETldCache      PrintHood     Start Menu  dwhelper
Aptana Rubles     Local Settings  PrivacIE      Templates   grails-core
Cookies           My Documents    Recent        UserData    ntuser.dat.LOG
Favorites         NTUSER.DAT      SendTo        _viminfo    ntuser.ini
IECompatCache     NetHood         Settings.bin  desktop     workspace

renshaw@RENSHAWRESIDENC ~
$ mv grails "c:/grails-core"
mv: cannot stat `grails': No such file or directory

renshaw@RENSHAWRESIDENC ~
$ mv grails grails-core
mv: cannot stat `grails': No such file or directory

renshaw@RENSHAWRESIDENC ~
$ mv grails-core "c:/grails"
-- 
View this message in context: http://git.661346.n2.nabble.com/Locating-Git-Clone-tp5938712p5939039.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply

* Re: filter-branch --env-filter GIT_AUTHOR_DATE
From: Johannes Sixt @ 2011-01-19 10:32 UTC (permalink / raw)
  To: Tuncer Ayaz; +Cc: git
In-Reply-To: <AANLkTi=TAhYeWbyocag2myBXA2TfH7_r=hmam51YKbhm@mail.gmail.com>

Am 1/19/2011 11:08, schrieb Tuncer Ayaz:
> On Wed, Jan 19, 2011 at 8:01 AM, Johannes Sixt wrote:
>> Am 1/18/2011 17:43, schrieb Tuncer Ayaz:
>>> To fix invalid timezone info in a repo I ran
>>> git filter-branch --env-filter '
>>>   GIT_AUTHOR_DATE=`echo ${GIT_AUTHOR_DATE}|sed s/+0000/-0800/`' HEAD
>>>
>>> This fixed the invalid entries but the new timezone is -0700
>>> instead of -0800. Is this expected?
>>
>> Parse error. You fixed it, but it is not fixed? So what?
> 
> Fixed because it is not +0000 anymore. Surprised because the new
> timezone is -0700 and not -0800.
> 
>> What do you mean by "the new timezone is"? Do you mean "...is reported
>> as"? If so, reported by which tools?
> 
> git log
> git cat-file $REV

$ git filter-branch -f --env-filter 'echo; echo "$GIT_AUTHOR_DATE"; GIT_AUTHOR_DATE=`echo ${GIT_AUTHOR_DATE}|sed s/+0100/-0800/`; echo "$GIT_AUTHOR_DATE"' -- -1
Rewrite 6fb5ec91707a4433628eae5d9d68153ca8b819fe (1/1)
1292311163 +0100
1292311163 -0800

Ref 'refs/heads/master' was rewritten
$ git cat-file commit HEAD
tree 43554f2216bbcfc96385db0641ae212409f26f21
parent 942f54790453970cfffbfedf29e47ac27b9ba995
author Johannes Sixt <j.sixt@viscovery.net> 1292311163 -0800
committer Johannes Sixt <j.sixt@viscovery.net> 1292311163 +0100

master

*Shrug*

-- Hannes

^ permalink raw reply

* Re: [PATCH 2/3] git-gui: spelling fixes in russian translation
From: Dmitry Potapov @ 2011-01-19 10:48 UTC (permalink / raw)
  To: Alexey Shumkin; +Cc: git, Alex Riesen
In-Reply-To: <loom.20110119T090252-99@post.gmane.org>

On Wed, Jan 19, 2011 at 08:36:32AM +0000, Alexey Shumkin wrote:
> So, I agree sentence must rephrased but supposition must be retained.
> Something like "Файл %s, похоже, содержит неразрешенные конфликты"

I like this one.

Thanks,
Dmitry

^ permalink raw reply

* Re: core.whitespace space-in-indent feature request
From: Victor Engmark @ 2011-01-19 10:53 UTC (permalink / raw)
  To: Victor Engmark; +Cc: git
In-Reply-To: <3798749.47565.1295432145824.JavaMail.trustmail@mail1.terreactive.ch>

On Jan 19, 2011, at 10:42 AM, Victor Engmark wrote:

> On Jan 18, 2011, at 9:31 PM, Junio C Hamano wrote:
> 
>> Drew Northup <drew.northup@maine.edu> writes:
>> 
>>> On Fri, 2011-01-14 at 13:40 +0100, Victor Engmark wrote:
>>>> Hi all,
>>>> 
>>>> I couldn't find this mentioned anywhere, but it would be useful for
>>>> languages where you typically want only tab characters in indentation,
>>>> like makefiles. Would be equivalent or similar to indent-with-non-tab
>>>> and tabwidth=1.
>>> 
>>> Victor,
>>> What would the point of this be? Git doesn't change the layout of the
>>> code when storing it--that's up to the thing between the chair and the
>>> keyboard.
>> 
>> True, but I think Victor wants to be able to ask "diff --check" to
>> complain and diff --color to highlight when it sees a line that begins
>> with a SP (or a HT then SP) by setting:
>> 
>> 	* whitespace=space-in-indent
>> 
>> or something in the attributes file.
>> 
>> As "equivalence" exists, not very much interested in coding it myself,
>> though ;-)
> 
> That's it, but it turns out the settings don't work the way I expected:
> 
> $ git config --add core.whitespace 'indent-with-non-tab,tabwidth=1'
> $ touch whitespace.txt
> $ git add whitespace.txt
> [Add the following to the file]
> 	HT
> SP
> 	SP HT
> 	 HT SP
> 2 SP
> 		2 HT
>       8 SP

Bloody OS X Mail - All those lines should of course be indented with the characters indicated at the end of the line.

Cheers,
-- 
Victor

^ permalink raw reply

* Re: core.whitespace space-in-indent feature request
From: Johannes Sixt @ 2011-01-19 11:09 UTC (permalink / raw)
  To: Victor Engmark; +Cc: git
In-Reply-To: <09F2551C-40E6-40DC-BE97-8DCFF3601C8C@terreactive.ch>

Am 1/19/2011 10:42, schrieb Victor Engmark:
> $ git config --add core.whitespace 'indent-with-non-tab,tabwidth=1'

tabwidth= is not in any released version of git, yet.

> Only the "SP HT" and "8 SP" indentations are colored; ...

This is no surprise, unless you are using a version that has commit
v1.7.4-rc0~52^2.

-- Hannes

^ permalink raw reply

* [PATCH/RFC 0/3] setup: stop ignoring GIT_WORK_TREE (when GIT_DIR is unset)
From: Jonathan Nieder @ 2011-01-19 12:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Nguyễn Thái Ngọc Duy, git
In-Reply-To: <7v1v4aknij.fsf@alter.siamese.dyndns.org>

Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:

>> +++ b/setup.c
>> @@ -419,6 +419,11 @@ static const char *setup_discovered_git_dir(const char *gitdir,
>>  		return NULL;
>>  	}
>>  
>> +	if (getenv(GIT_WORK_TREE_ENVIRONMENT)) {
>> +		warning("GIT_WORK_TREE without explicit GIT_DIR is deprecated");
>> +		return setup_explicit_git_dir(gitdir, cwd, offset, nongit_ok);
>> +	}
>> +
>
> My knee-jerk reaction is that calling this "deprecated" is probably
> confusing. git merely failed to notice misconfiguration

After staring at test results, I agree.  The rule, before nd/setup,
seems to be something like this:

 - if GIT_DIR is set, you're safe
 - if GIT_DIR is unset and .git is in the current directory,
   GIT_WORK_TREE will work by accident
 - otherwise, git errors out.

The patch below should be more robust.  It prints a warning:

	warning: pretending GIT_DIR was supplied alongside GIT_WORK_TREE

As the night winds on I am less sure that that warning is a good idea.
The .git discovery behavior seems relatively safe.  What is more
worrisome for the future of the use of GIT_WORK_TREE independent of
cwd is the interaction with pathspecs.

Jonathan Nieder (3):
  tests: cosmetic improvements to the repo-setup test
  tests: make the setup tests briefer
  setup: stop ignoring GIT_WORK_TREE and core.worktree

 setup.c               |   27 +-
 t/t1510-repo-setup.sh | 5166 +++++++------------------------------------------
 2 files changed, 729 insertions(+), 4464 deletions(-)

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox