MCPcopy Create free account
hub / github.com/git/git / finalize_hashfile

Function finalize_hashfile

csum-file.c:65–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65int finalize_hashfile(struct hashfile *f, unsigned char *result,
66 enum fsync_component component, unsigned int flags)
67{
68 int fd;
69
70 hashflush(f);
71
72 if (f->skip_hash)
73 hashclr(f->buffer, f->algop);
74 else
75 git_hash_final(f->buffer, &f->ctx);
76
77 if (result)
78 hashcpy(result, f->buffer, f->algop);
79 if (flags & CSUM_HASH_IN_STREAM)
80 flush(f, f->buffer, f->algop->rawsz);
81 if (flags & CSUM_FSYNC)
82 fsync_component_or_die(component, f->fd, f->name);
83 if (flags & CSUM_CLOSE) {
84 if (close(f->fd))
85 die_errno("%s: sha1 file error on close", f->name);
86 fd = 0;
87 } else
88 fd = f->fd;
89 if (0 <= f->check_fd) {
90 char discard;
91 int cnt = read_in_full(f->check_fd, &discard, 1);
92 if (cnt < 0)
93 die_errno("%s: error when reading the tail of sha1 file",
94 f->name);
95 if (cnt)
96 die("%s: sha1 file has trailing garbage", f->name);
97 if (close(f->check_fd))
98 die_errno("%s: sha1 file error on close", f->name);
99 }
100 free_hashfile(f);
101 return fd;
102}
103
104void discard_hashfile(struct hashfile *f)
105{

Callers 13

write_commit_graph_fileFunction · 0.85
write_midx_internalFunction · 0.85
write_idx_fileFunction · 0.85
write_rev_file_orderFunction · 0.85
write_mtimes_fileFunction · 0.85
do_write_indexFunction · 0.85
bitmap_writer_finishFunction · 0.85
cmd__pack_deltasFunction · 0.85
finalizeMethod · 0.85
conclude_packFunction · 0.85
end_packfileFunction · 0.85

Calls 10

hashflushFunction · 0.85
hashclrFunction · 0.85
git_hash_finalFunction · 0.85
hashcpyFunction · 0.85
fsync_component_or_dieFunction · 0.85
die_errnoFunction · 0.85
read_in_fullFunction · 0.85
free_hashfileFunction · 0.85
flushFunction · 0.70
dieFunction · 0.70

Tested by 1

cmd__pack_deltasFunction · 0.68