Merge branch 'master' into next

* master:
  t3101: modernise style
  vcs-svn: Fix some printf format compiler warnings
  compat/nedmalloc: don't force NDEBUG on the rest of git
This commit is contained in:
Junio C Hamano
2010-09-12 14:05:29 -07:00
5 changed files with 80 additions and 68 deletions

View File

@@ -1470,7 +1470,7 @@ ifdef NO_REGEX
endif
ifdef USE_NED_ALLOCATOR
COMPAT_CFLAGS += -DUSE_NED_ALLOCATOR -DOVERRIDE_STRDUP -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR -Icompat/nedmalloc
COMPAT_CFLAGS += -Icompat/nedmalloc
COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
endif
@@ -1916,6 +1916,11 @@ ifdef NO_REGEX
compat/regex/regex.o: EXTRA_CPPFLAGS = -DGAWK -DNO_MBSUPPORT
endif
ifdef USE_NED_ALLOCATOR
compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
-DNDEBUG -DOVERRIDE_STRDUP -DREPLACE_SYSTEM_ALLOCATOR
endif
git-%$X: %.o $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)

View File

@@ -160,6 +160,10 @@ extern char *gitbasename(char *);
#define PRIx32 "x"
#endif
#ifndef PRIo32
#define PRIo32 "o"
#endif
#ifndef PATH_SEP
#define PATH_SEP ':'
#endif

View File

@@ -21,33 +21,32 @@ entries. Also test odd filename and missing entries handling.
'
. ./test-lib.sh
test_expect_success \
'setup' \
'echo 111 >1.txt &&
echo 222 >2.txt &&
mkdir path0 path0/a path0/a/b path0/a/b/c &&
echo 111 >path0/a/b/c/1.txt &&
mkdir path1 path1/b path1/b/c &&
echo 111 >path1/b/c/1.txt &&
mkdir path2 &&
echo 111 >path2/1.txt &&
mkdir path3 &&
echo 111 >path3/1.txt &&
echo 222 >path3/2.txt &&
find *.txt path* \( -type f -o -type l \) -print |
xargs git update-index --add &&
tree=`git write-tree` &&
echo $tree'
test_expect_success 'setup' '
echo 111 >1.txt &&
echo 222 >2.txt &&
mkdir path0 path0/a path0/a/b path0/a/b/c &&
echo 111 >path0/a/b/c/1.txt &&
mkdir path1 path1/b path1/b/c &&
echo 111 >path1/b/c/1.txt &&
mkdir path2 &&
echo 111 >path2/1.txt &&
mkdir path3 &&
echo 111 >path3/1.txt &&
echo 222 >path3/2.txt &&
find *.txt path* \( -type f -o -type l \) -print |
xargs git update-index --add &&
tree=`git write-tree` &&
echo $tree
'
test_output () {
sed -e "s/ $_x40 / X /" <current >check
test_cmp expected check
sed -e "s/ $_x40 / X /" <current >check &&
test_cmp expected check
}
test_expect_success \
'ls-tree plain' \
'git ls-tree $tree >current &&
cat >expected <<\EOF &&
test_expect_success 'ls-tree plain' '
git ls-tree $tree >current &&
cat >expected <<\EOF &&
100644 blob X 1.txt
100644 blob X 2.txt
040000 tree X path0
@@ -55,13 +54,13 @@ test_expect_success \
040000 tree X path2
040000 tree X path3
EOF
test_output'
test_output
'
# Recursive does not show tree nodes anymore...
test_expect_success \
'ls-tree recursive' \
'git ls-tree -r $tree >current &&
cat >expected <<\EOF &&
test_expect_success 'ls-tree recursive' '
git ls-tree -r $tree >current &&
cat >expected <<\EOF &&
100644 blob X 1.txt
100644 blob X 2.txt
100644 blob X path0/a/b/c/1.txt
@@ -70,68 +69,71 @@ test_expect_success \
100644 blob X path3/1.txt
100644 blob X path3/2.txt
EOF
test_output'
test_output
'
test_expect_success \
'ls-tree filter 1.txt' \
'git ls-tree $tree 1.txt >current &&
cat >expected <<\EOF &&
test_expect_success 'ls-tree filter 1.txt' '
git ls-tree $tree 1.txt >current &&
cat >expected <<\EOF &&
100644 blob X 1.txt
EOF
test_output'
test_output
'
test_expect_success \
'ls-tree filter path1/b/c/1.txt' \
'git ls-tree $tree path1/b/c/1.txt >current &&
cat >expected <<\EOF &&
test_expect_success 'ls-tree filter path1/b/c/1.txt' '
git ls-tree $tree path1/b/c/1.txt >current &&
cat >expected <<\EOF &&
100644 blob X path1/b/c/1.txt
EOF
test_output'
test_output
'
test_expect_success \
'ls-tree filter all 1.txt files' \
'git ls-tree $tree 1.txt path0/a/b/c/1.txt path1/b/c/1.txt path2/1.txt path3/1.txt >current &&
cat >expected <<\EOF &&
test_expect_success 'ls-tree filter all 1.txt files' '
git ls-tree $tree 1.txt path0/a/b/c/1.txt \
path1/b/c/1.txt path2/1.txt path3/1.txt >current &&
cat >expected <<\EOF &&
100644 blob X 1.txt
100644 blob X path0/a/b/c/1.txt
100644 blob X path1/b/c/1.txt
100644 blob X path2/1.txt
100644 blob X path3/1.txt
EOF
test_output'
test_output
'
# I am not so sure about this one after ls-tree doing pathspec match.
# Having both path0/a and path0/a/b/c makes path0/a redundant, and
# it behaves as if path0/a/b/c, path1/b/c, path2 and path3 are specified.
test_expect_success \
'ls-tree filter directories' \
'git ls-tree $tree path3 path2 path0/a/b/c path1/b/c path0/a >current &&
cat >expected <<\EOF &&
test_expect_success 'ls-tree filter directories' '
git ls-tree $tree path3 path2 path0/a/b/c path1/b/c path0/a >current &&
cat >expected <<\EOF &&
040000 tree X path0/a/b/c
040000 tree X path1/b/c
040000 tree X path2
040000 tree X path3
EOF
test_output'
test_output
'
# Again, duplicates are filtered away so this is equivalent to
# having 1.txt and path3
test_expect_success \
'ls-tree filter odd names' \
'git ls-tree $tree 1.txt ./1.txt .//1.txt path3/1.txt path3/./1.txt path3 path3// >current &&
cat >expected <<\EOF &&
test_expect_success 'ls-tree filter odd names' '
git ls-tree $tree 1.txt ./1.txt .//1.txt \
path3/1.txt path3/./1.txt path3 path3// >current &&
cat >expected <<\EOF &&
100644 blob X 1.txt
100644 blob X path3/1.txt
100644 blob X path3/2.txt
EOF
test_output'
test_output
'
test_expect_success \
'ls-tree filter missing files and extra slashes' \
'git ls-tree $tree 1.txt/ abc.txt path3//23.txt path3/2.txt/// >current &&
cat >expected <<\EOF &&
EOF
test_output'
test_expect_success 'ls-tree filter missing files and extra slashes' '
git ls-tree $tree 1.txt/ abc.txt \
path3//23.txt path3/2.txt/// >current &&
>expected &&
test_output
'
test_expect_success 'ls-tree filter is leading path match' '
git ls-tree $tree pa path3/a >current &&
@@ -198,7 +200,7 @@ EOF
'
test_expect_success 'ls-tree --name-only' '
git ls-tree --name-only $tree >current
git ls-tree --name-only $tree >current &&
cat >expected <<\EOF &&
1.txt
2.txt
@@ -211,7 +213,7 @@ EOF
'
test_expect_success 'ls-tree --name-only -r' '
git ls-tree --name-only -r $tree >current
git ls-tree --name-only -r $tree >current &&
cat >expected <<\EOF &&
1.txt
2.txt

View File

@@ -25,7 +25,7 @@ void fast_export_modify(uint32_t depth, uint32_t *path, uint32_t mode,
uint32_t mark)
{
/* Mode must be 100644, 100755, 120000, or 160000. */
printf("M %06o :%d ", mode, mark);
printf("M %06"PRIo32" :%"PRIu32" ", mode, mark);
pool_print_seq(depth, path, '/', stdout);
putchar('\n');
}
@@ -38,7 +38,8 @@ void fast_export_commit(uint32_t revision, uint32_t author, char *log,
if (!log)
log = "";
if (~uuid && ~url) {
snprintf(gitsvnline, MAX_GITSVN_LINE_LEN, "\n\ngit-svn-id: %s@%d %s\n",
snprintf(gitsvnline, MAX_GITSVN_LINE_LEN,
"\n\ngit-svn-id: %s@%"PRIu32" %s\n",
pool_fetch(url), revision, pool_fetch(uuid));
} else {
*gitsvnline = '\0';
@@ -59,7 +60,7 @@ void fast_export_commit(uint32_t revision, uint32_t author, char *log,
repo_diff(revision - 1, revision);
fputc('\n', stdout);
printf("progress Imported commit %d.\n\n", revision);
printf("progress Imported commit %"PRIu32".\n\n", revision);
}
void fast_export_blob(uint32_t mode, uint32_t mark, uint32_t len)
@@ -69,7 +70,7 @@ void fast_export_blob(uint32_t mode, uint32_t mark, uint32_t len)
buffer_skip_bytes(5);
len -= 5;
}
printf("blob\nmark :%d\ndata %d\n", mark, len);
printf("blob\nmark :%"PRIu32"\ndata %"PRIu32"\n", mark, len);
buffer_copy_bytes(len);
fputc('\n', stdout);
}

View File

@@ -257,7 +257,7 @@ void svndump_read(const char *url)
handle_node();
active_ctx = REV_CTX;
} else {
fprintf(stderr, "Unexpected content length header: %d\n", len);
fprintf(stderr, "Unexpected content length header: %"PRIu32"\n", len);
buffer_skip_bytes(len);
}
}