Allow the test suite to pass in a directory whose name contains spaces
[gitweb.git] / patch-ids.c
index ce285c2e0c552ecf725c87052846d755507bd9db..92eba7a059e89873e2d94fd5ee37a92b887bde4c 100644 (file)
@@ -71,7 +71,7 @@ static int init_patch_id_entry(struct patch_id *patch,
                               struct commit *commit,
                               struct patch_ids *ids)
 {
-       unsigned char header_only_patch_id[GIT_SHA1_RAWSZ];
+       unsigned char header_only_patch_id[GIT_MAX_RAWSZ];
 
        patch->commit = commit;
        if (commit_patch_id(commit, &ids->diffopts, header_only_patch_id, 1))
@@ -99,11 +99,12 @@ struct patch_id *has_commit_patch_id(struct commit *commit,
 struct patch_id *add_commit_patch_id(struct commit *commit,
                                     struct patch_ids *ids)
 {
-       struct patch_id *key = xcalloc(1, sizeof(*key));
+       struct patch_id *key;
 
        if (!patch_id_defined(commit))
                return NULL;
 
+       key = xcalloc(1, sizeof(*key));
        if (init_patch_id_entry(key, commit, ids)) {
                free(key);
                return NULL;