/git-fast-export
/git-fast-import
/git-fetch
-/git-fetch--tool
/git-fetch-pack
/git-filter-branch
/git-fmt-merge-msg
/git-reflog
/git-relink
/git-remote
-/git-remote-curl
/git-remote-http
/git-remote-https
/git-remote-ftp
/test-line-buffer
/test-match-trees
/test-mktemp
- /test-obj-pool
/test-parse-options
/test-path-utils
/test-run-command
/test-sha1
/test-sigchain
- /test-string-pool
/test-subprocess
/test-svn-fe
- /test-treap
/common-cmds.h
*.tar.gz
*.dsc
# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
# d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
#
-# Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
-# do not support the 'size specifiers' introduced by C99, namely ll, hh,
-# j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
-# some C compilers supported these specifiers prior to C99 as an extension.
-#
# Define NO_STRCASESTR if you don't have strcasestr.
#
# Define NO_MEMMEM if you don't have memmem.
#
# Define NO_REGEX if you have no or inferior regex support in your C library.
#
+# Define GETTEXT_POISON if you are debugging the choice of strings marked
+# for translation. In a GETTEXT_POISON build, you can turn all strings marked
+# for translation into gibberish by setting the GIT_GETTEXT_POISON variable
+# (to any value) in your environment.
+#
# Define JSMIN to point to JavaScript minifier that functions as
# a filter to have gitweb.js minified.
#
RPMBUILD = rpmbuild
TCL_PATH = tclsh
TCLTK_PATH = wish
+XGETTEXT = xgettext
PTHREAD_LIBS = -lpthread
PTHREAD_CFLAGS =
GCOV = gcov
TEST_PROGRAMS_NEED_X += test-genrandom
TEST_PROGRAMS_NEED_X += test-line-buffer
TEST_PROGRAMS_NEED_X += test-match-trees
- TEST_PROGRAMS_NEED_X += test-obj-pool
TEST_PROGRAMS_NEED_X += test-parse-options
TEST_PROGRAMS_NEED_X += test-path-utils
TEST_PROGRAMS_NEED_X += test-run-command
TEST_PROGRAMS_NEED_X += test-sha1
TEST_PROGRAMS_NEED_X += test-sigchain
- TEST_PROGRAMS_NEED_X += test-string-pool
TEST_PROGRAMS_NEED_X += test-subprocess
TEST_PROGRAMS_NEED_X += test-svn-fe
- TEST_PROGRAMS_NEED_X += test-treap
TEST_PROGRAMS_NEED_X += test-index-version
TEST_PROGRAMS_NEED_X += test-mktemp
LIB_H += dir.h
LIB_H += exec_cmd.h
LIB_H += fsck.h
+LIB_H += gettext.h
LIB_H += git-compat-util.h
LIB_H += graph.h
LIB_H += grep.h
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
NO_STRLCPY = YesPlease
- NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
GIT_TEST_CMP = cmp
endif
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
NO_STRLCPY = YesPlease
- NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
GIT_TEST_CMP = cmp
endif
ifeq ($(uname_R),5.8)
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
- NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
GIT_TEST_CMP = cmp
endif
ifeq ($(uname_R),5.9)
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
- NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
GIT_TEST_CMP = cmp
endif
NO_UNSETENV = YesPlease
NO_HSTRERROR = YesPlease
NO_SYS_SELECT_H = YesPlease
+ NO_FNMATCH_CASEFOLD = YesPlease
SNPRINTF_RETURNS_BOGUS = YesPlease
NO_NSEC = YesPlease
ifeq ($(uname_R),B.11.00)
NO_MEMMEM = YesPlease
# NEEDS_LIBICONV = YesPlease
NO_ICONV = YesPlease
- NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
NO_STRTOULL = YesPlease
NO_MKDTEMP = YesPlease
NO_MEMMEM = YesPlease
NEEDS_LIBICONV = YesPlease
OLD_ICONV = YesPlease
- NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
NO_MKDTEMP = YesPlease
NO_MKSTEMPS = YesPlease
ifdef NO_NSEC
BASIC_CFLAGS += -DNO_NSEC
endif
-ifdef NO_C99_FORMAT
- BASIC_CFLAGS += -DNO_C99_FORMAT
-endif
ifdef SNPRINTF_RETURNS_BOGUS
COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
COMPAT_OBJS += compat/snprintf.o
ifdef NO_SYMLINK_HEAD
BASIC_CFLAGS += -DNO_SYMLINK_HEAD
endif
+ifdef GETTEXT_POISON
+ LIB_OBJS += gettext.o
+ BASIC_CFLAGS += -DGETTEXT_POISON
+endif
ifdef NO_STRCASESTR
COMPAT_CFLAGS += -DNO_STRCASESTR
COMPAT_OBJS += compat/strcasestr.o
QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
QUIET_GEN = @echo ' ' GEN $@;
QUIET_LNCP = @echo ' ' LN/CP $@;
+ QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
QUIET_GCOV = @echo ' ' GCOV $@;
QUIET_SUBDIR0 = +@subdir=
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
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/string_pool.o vcs-svn/line_buffer.o \
- vcs-svn/repo_tree.o vcs-svn/fast_export.o vcs-svn/svndump.o
- VCSSVN_TEST_OBJS = test-obj-pool.o test-string-pool.o \
- test-line-buffer.o test-treap.o
+ VCSSVN_OBJS = vcs-svn/line_buffer.o vcs-svn/repo_tree.o \
+ vcs-svn/fast_export.o vcs-svn/svndump.o
+ VCSSVN_TEST_OBJS = test-line-buffer.o
OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS) $(VCSSVN_OBJS)
dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
$(VCSSVN_OBJS) $(VCSSVN_TEST_OBJS): $(LIB_H) \
- vcs-svn/obj_pool.h vcs-svn/trp.h vcs-svn/string_pool.h \
vcs-svn/line_buffer.h vcs-svn/repo_tree.h vcs-svn/fast_export.h \
vcs-svn/svndump.h
pdf:
$(MAKE) -C Documentation pdf
+XGETTEXT_FLAGS = \
+ --force-po \
+ --add-comments \
+ --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
+ --from-code=UTF-8
+XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
+ --keyword=_ --keyword=N_ --keyword="Q_:1,2"
+LOCALIZED_C := $(C_OBJ:o=c)
+
+po/git.pot: $(LOCALIZED_C)
+ $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C) && \
+ mv $@+ $@
+
+pot: po/git.pot
+
$(ETAGS_TARGET): FORCE
$(RM) $(ETAGS_TARGET)
$(FIND) . -name '*.[hcS]' -print | xargs etags -a -o $(ETAGS_TARGET)
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
@echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@
endif
+ @echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@
### Detect Tck/Tk interpreter path changes
ifndef NO_TCLTK
test-parse-options$X: parse-options.o
- test-string-pool$X: vcs-svn/lib.a
-
test-svn-fe$X: vcs-svn/lib.a
.PRECIOUS: $(TEST_OBJS)
check: common-cmds.h
if sparse; \
then \
- for i in *.c; \
+ for i in $(patsubst %.o, %.c, $(GIT_OBJS)); \
do \
sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
done; \
distclean: clean
$(RM) configure
+ $(RM) po/git.pot
clean:
$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
*/
#include "git-compat-util.h"
+ #include "strbuf.h"
+ #include "quote.h"
#include "fast_export.h"
#include "line_buffer.h"
#include "repo_tree.h"
- #include "string_pool.h"
#include "strbuf.h"
#define MAX_GITSVN_LINE_LEN 4096
buffer_reset(&report_buffer);
}
- void fast_export_delete(uint32_t depth, const uint32_t *path)
+ void fast_export_delete(const char *path)
{
- printf("D \"");
- pool_print_seq_q(depth, path, '/', stdout);
- printf("\"\n");
+ putchar('D');
+ putchar(' ');
+ quote_c_style(path, NULL, stdout, 0);
+ putchar('\n');
}
- static void fast_export_truncate(uint32_t depth, const uint32_t *path, uint32_t mode)
+ static void fast_export_truncate(const char *path, uint32_t mode)
{
- fast_export_modify(depth, path, mode, "inline");
+ fast_export_modify(path, mode, "inline");
printf("data 0\n\n");
}
- void fast_export_modify(uint32_t depth, const uint32_t *path, uint32_t mode,
- const char *dataref)
+ void fast_export_modify(const char *path, uint32_t mode, const char *dataref)
{
/* Mode must be 100644, 100755, 120000, or 160000. */
if (!dataref) {
- fast_export_truncate(depth, path, mode);
+ fast_export_truncate(path, mode);
return;
}
- printf("M %06"PRIo32" %s \"", mode, dataref);
- pool_print_seq_q(depth, path, '/', stdout);
- printf("\"\n");
+ printf("M %06"PRIo32" %s ", mode, dataref);
+ quote_c_style(path, NULL, stdout, 0);
+ putchar('\n');
}
static char gitsvnline[MAX_GITSVN_LINE_LEN];
-void fast_export_begin_commit(uint32_t revision, const char *author, char *log,
+void fast_export_begin_commit(uint32_t revision, const char *author,
+ const struct strbuf *log,
const char *uuid, const char *url,
unsigned long timestamp)
{
+ static const struct strbuf empty = STRBUF_INIT;
if (!log)
- log = "";
+ log = ∅
if (*uuid && *url) {
snprintf(gitsvnline, MAX_GITSVN_LINE_LEN,
"\n\ngit-svn-id: %s@%"PRIu32" %s\n",
*author ? author : "nobody",
*author ? author : "nobody",
*uuid ? uuid : "local", timestamp);
- printf("data %"PRIu32"\n%s%s\n",
- (uint32_t) (strlen(log) + strlen(gitsvnline)),
- log, gitsvnline);
+ printf("data %"PRIuMAX"\n",
+ (uintmax_t) (log->len + strlen(gitsvnline)));
+ fwrite(log->buf, log->len, 1, stdout);
+ printf("%s\n", gitsvnline);
if (!first_commit_done) {
if (revision > 1)
printf("from :%"PRIu32"\n", revision - 1);
printf("progress Imported commit %"PRIu32".\n\n", revision);
}
- static void ls_from_rev(uint32_t rev, uint32_t depth, const uint32_t *path)
+ static void ls_from_rev(uint32_t rev, const char *path)
{
/* ls :5 path/to/old/file */
- printf("ls :%"PRIu32" \"", rev);
- pool_print_seq_q(depth, path, '/', stdout);
- printf("\"\n");
+ printf("ls :%"PRIu32" ", rev);
+ quote_c_style(path, NULL, stdout, 0);
+ putchar('\n');
fflush(stdout);
}
- static void ls_from_active_commit(uint32_t depth, const uint32_t *path)
+ static void ls_from_active_commit(const char *path)
{
/* ls "path/to/file" */
printf("ls \"");
- pool_print_seq_q(depth, path, '/', stdout);
+ quote_c_style(path, NULL, stdout, 1);
printf("\"\n");
fflush(stdout);
}
return 0;
}
- int fast_export_ls_rev(uint32_t rev, uint32_t depth, const uint32_t *path,
+ int fast_export_ls_rev(uint32_t rev, const char *path,
uint32_t *mode, struct strbuf *dataref)
{
- ls_from_rev(rev, depth, path);
+ ls_from_rev(rev, path);
return parse_ls_response(get_response_line(), mode, dataref);
}
- int fast_export_ls(uint32_t depth, const uint32_t *path,
- uint32_t *mode, struct strbuf *dataref)
+ int fast_export_ls(const char *path, uint32_t *mode, struct strbuf *dataref)
{
- ls_from_active_commit(depth, path);
+ ls_from_active_commit(path);
return parse_ls_response(get_response_line(), mode, dataref);
}
void fast_export_deinit(void);
void fast_export_reset(void);
- void fast_export_delete(uint32_t depth, const uint32_t *path);
- void fast_export_modify(uint32_t depth, const uint32_t *path,
- uint32_t mode, const char *dataref);
+ void fast_export_delete(const char *path);
+ void fast_export_modify(const char *path, uint32_t mode, const char *dataref);
-void fast_export_begin_commit(uint32_t revision, const char *author, char *log,
- const char *uuid, const char *url,
- unsigned long timestamp);
+void fast_export_begin_commit(uint32_t revision, const char *author,
+ const struct strbuf *log, const char *uuid,
+ const char *url, unsigned long timestamp);
void fast_export_end_commit(uint32_t revision);
void fast_export_data(uint32_t mode, uint32_t len, struct line_buffer *input);
/* If there is no such file at that rev, returns -1, errno == ENOENT. */
- int fast_export_ls_rev(uint32_t rev, uint32_t depth, const uint32_t *path,
+ int fast_export_ls_rev(uint32_t rev, const char *path,
uint32_t *mode_out, struct strbuf *dataref_out);
- int fast_export_ls(uint32_t depth, const uint32_t *path,
+ int fast_export_ls(const char *path,
uint32_t *mode_out, struct strbuf *dataref_out);
#endif
#include "repo_tree.h"
#include "fast_export.h"
- const char *repo_read_path(const uint32_t *path, uint32_t *mode_out)
-const char *repo_read_path(const char *path)
++const char *repo_read_path(const char *path, uint32_t *mode_out)
{
int err;
- uint32_t dummy;
static struct strbuf buf = STRBUF_INIT;
strbuf_reset(&buf);
- err = fast_export_ls(REPO_MAX_PATH_DEPTH, path, mode_out, &buf);
- err = fast_export_ls(path, &dummy, &buf);
++ err = fast_export_ls(path, mode_out, &buf);
if (err) {
if (errno != ENOENT)
die_errno("BUG: unexpected fast_export_ls error");
+ /* Treat missing paths as directories. */
+ *mode_out = REPO_MODE_DIR;
return NULL;
}
return buf.buf;
}
- void repo_copy(uint32_t revision, const uint32_t *src, const uint32_t *dst)
-uint32_t repo_read_mode(const char *path)
-{
- int err;
- uint32_t result;
- static struct strbuf dummy = STRBUF_INIT;
-
- strbuf_reset(&dummy);
- err = fast_export_ls(path, &result, &dummy);
- if (err) {
- if (errno != ENOENT)
- die_errno("BUG: unexpected fast_export_ls error");
- /* Treat missing paths as directories. */
- return REPO_MODE_DIR;
- }
- return result;
-}
-
+ void repo_copy(uint32_t revision, const char *src, const char *dst)
{
int err;
uint32_t mode;
static struct strbuf data = STRBUF_INIT;
strbuf_reset(&data);
- err = fast_export_ls_rev(revision, REPO_MAX_PATH_DEPTH, src, &mode, &data);
+ err = fast_export_ls_rev(revision, src, &mode, &data);
if (err) {
if (errno != ENOENT)
die_errno("BUG: unexpected fast_export_ls_rev error");
- fast_export_delete(REPO_MAX_PATH_DEPTH, dst);
+ fast_export_delete(dst);
return;
}
- fast_export_modify(REPO_MAX_PATH_DEPTH, dst, mode, data.buf);
+ fast_export_modify(dst, mode, data.buf);
}
- void repo_delete(uint32_t *path)
+ void repo_delete(const char *path)
{
- fast_export_delete(REPO_MAX_PATH_DEPTH, path);
+ fast_export_delete(path);
}
#ifndef REPO_TREE_H_
#define REPO_TREE_H_
-#include "git-compat-util.h"
+struct strbuf;
#define REPO_MODE_DIR 0040000
#define REPO_MODE_BLB 0100644
#define REPO_MODE_EXE 0100755
#define REPO_MODE_LNK 0120000
- #define REPO_MAX_PATH_LEN 4096
- #define REPO_MAX_PATH_DEPTH 1000
-
uint32_t next_blob_mark(void);
- void repo_copy(uint32_t revision, const uint32_t *src, const uint32_t *dst);
- void repo_add(uint32_t *path, uint32_t mode, uint32_t blob_mark);
- const char *repo_read_path(const uint32_t *path, uint32_t *mode_out);
- void repo_delete(uint32_t *path);
+ void repo_copy(uint32_t revision, const char *src, const char *dst);
+ void repo_add(const char *path, uint32_t mode, uint32_t blob_mark);
-const char *repo_read_path(const char *path);
-uint32_t repo_read_mode(const char *path);
++const char *repo_read_path(const char *path, uint32_t *mode_out);
+ void repo_delete(const char *path);
void repo_commit(uint32_t revision, const char *author,
- char *log, const char *uuid, const char *url,
+ const struct strbuf *log, const char *uuid, const char *url,
long unsigned timestamp);
void repo_diff(uint32_t r1, uint32_t r2);
void repo_init(void);
#include "repo_tree.h"
#include "fast_export.h"
#include "line_buffer.h"
- #include "string_pool.h"
#include "strbuf.h"
-#define REPORT_FILENO 3
-
/*
* Compare start of string to literal of equal length;
* must be guarded by length test.
*/
#define constcmp(s, ref) memcmp(s, ref, sizeof(ref) - 1)
+#define REPORT_FILENO 3
+
#define NODEACT_REPLACE 4
#define NODEACT_DELETE 3
#define NODEACT_ADD 2
static struct {
uint32_t action, propLength, textLength, srcRev, type;
- uint32_t src[REPO_MAX_PATH_DEPTH], dst[REPO_MAX_PATH_DEPTH];
+ struct strbuf src, dst;
uint32_t text_delta, prop_delta;
} node_ctx;
node_ctx.action = NODEACT_UNKNOWN;
node_ctx.propLength = LENGTH_UNKNOWN;
node_ctx.textLength = LENGTH_UNKNOWN;
- node_ctx.src[0] = ~0;
+ strbuf_reset(&node_ctx.src);
node_ctx.srcRev = 0;
- pool_tok_seq(REPO_MAX_PATH_DEPTH, node_ctx.dst, "/", fname);
+ strbuf_reset(&node_ctx.dst);
+ if (fname)
+ strbuf_addstr(&node_ctx.dst, fname);
node_ctx.text_delta = 0;
node_ctx.prop_delta = 0;
}
}
static void handle_property(const struct strbuf *key_buf,
- const char *val, uint32_t len,
+ struct strbuf *val,
uint32_t *type_set)
{
const char *key = key_buf->buf;
break;
if (!val)
die("invalid dump: unsets svn:log");
- strbuf_reset(&rev_ctx.log);
- strbuf_add(&rev_ctx.log, val, len);
+ strbuf_swap(&rev_ctx.log, val);
break;
case sizeof("svn:author"):
if (constcmp(key, "svn:author"))
break;
- strbuf_reset(&rev_ctx.author);
- if (val)
- strbuf_add(&rev_ctx.author, val, len);
+ if (!val)
+ strbuf_reset(&rev_ctx.author);
+ else
+ strbuf_swap(&rev_ctx.author, val);
break;
case sizeof("svn:date"):
if (constcmp(key, "svn:date"))
break;
if (!val)
die("invalid dump: unsets svn:date");
- if (parse_date_basic(val, &rev_ctx.timestamp, NULL))
- warning("invalid timestamp: %s", val);
+ if (parse_date_basic(val->buf, &rev_ctx.timestamp, NULL))
+ warning("invalid timestamp: %s", val->buf);
break;
case sizeof("svn:executable"):
case sizeof("svn:special"):
static void read_props(void)
{
static struct strbuf key = STRBUF_INIT;
+ static struct strbuf val = STRBUF_INIT;
const char *t;
/*
* NEEDSWORK: to support simple mode changes like
uint32_t type_set = 0;
while ((t = buffer_read_line(&input)) && strcmp(t, "PROPS-END")) {
uint32_t len;
- const char *val;
const char type = t[0];
int ch;
if (!type || t[1] != ' ')
die("invalid property line: %s\n", t);
len = atoi(&t[2]);
- val = buffer_read_string(&input, len);
- if (!val || strlen(val) != len)
+ strbuf_reset(&val);
+ buffer_read_binary(&input, &val, len);
+ if (val.len < len)
die_short_read();
/* Discard trailing newline. */
if (ch == EOF)
die_short_read();
if (ch != '\n')
- die("invalid dump: expected newline after %s", val);
+ die("invalid dump: expected newline after %s", val.buf);
switch (type) {
case 'K':
+ strbuf_swap(&key, &val);
+ continue;
case 'D':
- strbuf_reset(&key);
- if (val)
- strbuf_add(&key, val, len);
- if (type == 'K')
- continue;
- assert(type == 'D');
- val = NULL;
- len = 0;
- /* fall through */
+ handle_property(&val, NULL, &type_set);
+ continue;
case 'V':
- handle_property(&key, val, len, &type_set);
+ handle_property(&key, &val, &type_set);
strbuf_reset(&key);
continue;
default:
if (have_text || have_props || node_ctx.srcRev)
die("invalid dump: deletion node has "
"copyfrom info, text, or properties");
- repo_delete(node_ctx.dst);
- return repo_delete(node_ctx.dst.buf);
++ repo_delete(node_ctx.dst.buf);
+ return;
}
if (node_ctx.action == NODEACT_REPLACE) {
- repo_delete(node_ctx.dst);
+ repo_delete(node_ctx.dst.buf);
node_ctx.action = NODEACT_ADD;
}
if (node_ctx.srcRev) {
- repo_copy(node_ctx.srcRev, node_ctx.src, node_ctx.dst);
+ repo_copy(node_ctx.srcRev, node_ctx.src.buf, node_ctx.dst.buf);
if (node_ctx.action == NODEACT_ADD)
node_ctx.action = NODEACT_CHANGE;
}
/*
* Find old content (old_data) and decide on the new mode.
*/
- if (node_ctx.action == NODEACT_CHANGE && !~*node_ctx.dst) {
+ if (node_ctx.action == NODEACT_CHANGE && !*node_ctx.dst.buf) {
if (type != REPO_MODE_DIR)
die("invalid dump: root of tree is not a regular file");
old_data = NULL;
} else if (node_ctx.action == NODEACT_CHANGE) {
uint32_t mode;
- old_data = repo_read_path(node_ctx.dst, &mode);
- old_data = repo_read_path(node_ctx.dst.buf);
- mode = repo_read_mode(node_ctx.dst.buf);
++ old_data = repo_read_path(node_ctx.dst.buf, &mode);
if (mode == REPO_MODE_DIR && type != REPO_MODE_DIR)
die("invalid dump: cannot modify a directory into a file");
if (mode != REPO_MODE_DIR && type == REPO_MODE_DIR)
/* For the fast_export_* functions, NULL means empty. */
old_data = NULL;
if (!have_text) {
- fast_export_modify(REPO_MAX_PATH_DEPTH, node_ctx.dst,
- node_ctx.type, old_data);
+ fast_export_modify(node_ctx.dst.buf, node_ctx.type, old_data);
return;
}
- fast_export_modify(REPO_MAX_PATH_DEPTH, node_ctx.dst,
- node_ctx.type, "inline");
+ fast_export_modify(node_ctx.dst.buf, node_ctx.type, "inline");
fast_export_data(node_ctx.type, node_ctx.textLength, &input);
}
if (!rev_ctx.revision) /* revision 0 gets no git commit. */
return;
fast_export_begin_commit(rev_ctx.revision, rev_ctx.author.buf,
- rev_ctx.log.buf, dump_ctx.uuid.buf, dump_ctx.url.buf,
+ &rev_ctx.log, dump_ctx.uuid.buf, dump_ctx.url.buf,
rev_ctx.timestamp);
}
reset_dump_ctx(url);
while ((t = buffer_read_line(&input))) {
- val = strstr(t, ": ");
+ val = strchr(t, ':');
if (!val)
continue;
- val += 2;
+ val++;
+ if (*val != ' ')
+ continue;
+ val++;
/* strlen(key) + 1 */
switch (val - t - 1) {
case sizeof("Node-copyfrom-path"):
if (constcmp(t, "Node-copyfrom-path"))
continue;
- pool_tok_seq(REPO_MAX_PATH_DEPTH, node_ctx.src, "/", val);
+ strbuf_reset(&node_ctx.src);
+ strbuf_addstr(&node_ctx.src, val);
break;
case sizeof("Node-copyfrom-rev"):
if (constcmp(t, "Node-copyfrom-rev"))
strbuf_init(&dump_ctx.url, 4096);
strbuf_init(&rev_ctx.log, 4096);
strbuf_init(&rev_ctx.author, 4096);
+ strbuf_init(&node_ctx.src, 4096);
+ strbuf_init(&node_ctx.dst, 4096);
reset_dump_ctx(NULL);
reset_rev_ctx(0);
reset_node_ctx(NULL);
reset_rev_ctx(0);
reset_node_ctx(NULL);
strbuf_release(&rev_ctx.log);
+ strbuf_release(&node_ctx.src);
+ strbuf_release(&node_ctx.dst);
if (buffer_deinit(&input))
fprintf(stderr, "Input error\n");
if (ferror(stdout))