projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] Add the merge test Linus called "test script from hell".
[git.git]
/
tree.c
diff --git
a/tree.c
b/tree.c
index
d9777bf
..
ca800a8
100644
(file)
--- a/
tree.c
+++ b/
tree.c
@@
-18,7
+18,7
@@
static int read_one_entry(unsigned char *sha1, const char *base, int baselen, co
memcpy(ce->name, base, baselen);
memcpy(ce->name + baselen, pathname, len+1);
memcpy(ce->sha1, sha1, 20);
memcpy(ce->name, base, baselen);
memcpy(ce->name + baselen, pathname, len+1);
memcpy(ce->sha1, sha1, 20);
- return add_cache_entry(ce,
1
);
+ return add_cache_entry(ce,
ADD_CACHE_OK_TO_ADD
);
}
static int read_tree_recursive(void *buffer, unsigned long size,
}
static int read_tree_recursive(void *buffer, unsigned long size,
@@
-39,14
+39,17
@@
static int read_tree_recursive(void *buffer, unsigned long size,
if (S_ISDIR(mode)) {
int retval;
int pathlen = strlen(path);
if (S_ISDIR(mode)) {
int retval;
int pathlen = strlen(path);
- char *newbase
= xmalloc(baselen + 1 + pathlen)
;
+ char *newbase;
void *eltbuf;
char elttype[20];
unsigned long eltsize;
eltbuf = read_sha1_file(sha1, elttype, &eltsize);
void *eltbuf;
char elttype[20];
unsigned long eltsize;
eltbuf = read_sha1_file(sha1, elttype, &eltsize);
- if (!eltbuf || strcmp(elttype, "tree"))
+ if (!eltbuf || strcmp(elttype, "tree")) {
+ if (eltbuf) free(eltbuf);
return -1;
return -1;
+ }
+ newbase = xmalloc(baselen + 1 + pathlen);
memcpy(newbase, base, baselen);
memcpy(newbase + baselen, path, pathlen);
newbase[baselen + pathlen] = '/';
memcpy(newbase, base, baselen);
memcpy(newbase + baselen, path, pathlen);
newbase[baselen + pathlen] = '/';