Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-26 06:26:28 +0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-26 06:26:28 +0400
commitbd1e17e245153fdc75feaaf5e556b922d98ca699 (patch)
tree5ad114ffcf9ccb0220a1a59f7d747a4b88ffa394
parenta6f68d4767835d5720cff61785b93eaf99376241 (diff)
Make "parse_object()" also fill in commit message buffer data.
And teach fsck to free it to save memory.
-rw-r--r--commit.h2
-rw-r--r--fsck-cache.c2
-rw-r--r--object.c4
3 files changed, 7 insertions, 1 deletions
diff --git a/commit.h b/commit.h
index 0bb8779ca7..f7a2cb88bd 100644
--- a/commit.h
+++ b/commit.h
@@ -14,7 +14,7 @@ struct commit {
unsigned long date;
struct commit_list *parents;
struct tree *tree;
- const char *buffer;
+ char *buffer;
};
extern const char *commit_type;
diff --git a/fsck-cache.c b/fsck-cache.c
index 6ac122b71c..4050c17eb0 100644
--- a/fsck-cache.c
+++ b/fsck-cache.c
@@ -203,6 +203,8 @@ static int fsck_tree(struct tree *item)
static int fsck_commit(struct commit *commit)
{
+ free(commit->buffer);
+ commit->buffer = NULL;
if (!commit->tree)
return -1;
if (!commit->parents && show_root)
diff --git a/object.c b/object.c
index d093e17d24..5e72a78784 100644
--- a/object.c
+++ b/object.c
@@ -129,6 +129,10 @@ struct object *parse_object(unsigned char *sha1)
} else if (!strcmp(type, "commit")) {
struct commit *commit = lookup_commit(sha1);
parse_commit_buffer(commit, buffer, size);
+ if (!commit->buffer) {
+ commit->buffer = buffer;
+ buffer = NULL;
+ }
obj = &commit->object;
} else if (!strcmp(type, "tag")) {
struct tag *tag = lookup_tag(sha1);