Code

[PATCH] Buglets fix in the new two scripts
[git.git] / commit.c
index 3f2235ecf87b63bc5d16342ebcf7f8faf098530a..abbf155da938cf675696e812b4083c8a773ffab0 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -1,8 +1,6 @@
 #include "tag.h"
 #include "commit.h"
 #include "cache.h"
-#include <string.h>
-#include <limits.h>
 
 const char *commit_type = "commit";
 
@@ -105,6 +103,10 @@ int parse_commit(struct commit *item)
                             sha1_to_hex(item->object.sha1));
        }
        ret = parse_commit_buffer(item, buffer, size);
+       if (!ret) {
+               item->buffer = buffer;
+               return 0;
+       }
        free(buffer);
        return ret;
 }