Skip to content

Commit f2af9f5

Browse files
derrickstoleegitster
authored andcommitted
csum-file: rename hashclose() to finalize_hashfile()
The hashclose() method behaves very differently depending on the flags parameter. In particular, the file descriptor is not always closed. Perform a simple rename of "hashclose()" to "finalize_hashfile()" in preparation for functional changes. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 2ee13a7 commit f2af9f5

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

builtin/index-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha
12691269
nr_objects - nr_objects_initial);
12701270
stop_progress_msg(&progress, msg.buf);
12711271
strbuf_release(&msg);
1272-
hashclose(f, tail_hash, 0);
1272+
finalize_hashfile(f, tail_hash, 0);
12731273
hashcpy(read_hash, pack_hash);
12741274
fixup_pack_header_footer(output_fd, pack_hash,
12751275
curr_pack, nr_objects,

builtin/pack-objects.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -837,11 +837,11 @@ static void write_pack_file(void)
837837
* If so, rewrite it like in fast-import
838838
*/
839839
if (pack_to_stdout) {
840-
hashclose(f, oid.hash, CSUM_CLOSE);
840+
finalize_hashfile(f, oid.hash, CSUM_CLOSE);
841841
} else if (nr_written == nr_remaining) {
842-
hashclose(f, oid.hash, CSUM_FSYNC);
842+
finalize_hashfile(f, oid.hash, CSUM_FSYNC);
843843
} else {
844-
int fd = hashclose(f, oid.hash, 0);
844+
int fd = finalize_hashfile(f, oid.hash, 0);
845845
fixup_pack_header_footer(fd, oid.hash, pack_tmp_name,
846846
nr_written, oid.hash, offset);
847847
close(fd);

bulk-checkin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)
3535
unlink(state->pack_tmp_name);
3636
goto clear_exit;
3737
} else if (state->nr_written == 1) {
38-
hashclose(state->f, oid.hash, CSUM_FSYNC);
38+
finalize_hashfile(state->f, oid.hash, CSUM_FSYNC);
3939
} else {
40-
int fd = hashclose(state->f, oid.hash, 0);
40+
int fd = finalize_hashfile(state->f, oid.hash, 0);
4141
fixup_pack_header_footer(fd, oid.hash, state->pack_tmp_name,
4242
state->nr_written, oid.hash,
4343
state->offset);

csum-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void hashflush(struct hashfile *f)
5353
}
5454
}
5555

56-
int hashclose(struct hashfile *f, unsigned char *result, unsigned int flags)
56+
int finalize_hashfile(struct hashfile *f, unsigned char *result, unsigned int flags)
5757
{
5858
int fd;
5959

csum-file.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ struct hashfile_checkpoint {
2626
extern void hashfile_checkpoint(struct hashfile *, struct hashfile_checkpoint *);
2727
extern int hashfile_truncate(struct hashfile *, struct hashfile_checkpoint *);
2828

29-
/* hashclose flags */
29+
/* finalize_hashfile flags */
3030
#define CSUM_CLOSE 1
3131
#define CSUM_FSYNC 2
3232

3333
extern struct hashfile *hashfd(int fd, const char *name);
3434
extern struct hashfile *hashfd_check(const char *name);
3535
extern struct hashfile *hashfd_throughput(int fd, const char *name, struct progress *tp);
36-
extern int hashclose(struct hashfile *, unsigned char *, unsigned int);
36+
extern int finalize_hashfile(struct hashfile *, unsigned char *, unsigned int);
3737
extern void hashwrite(struct hashfile *, const void *, unsigned int);
3838
extern void hashflush(struct hashfile *f);
3939
extern void crc32_begin(struct hashfile *);

fast-import.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ static void end_packfile(void)
10161016
struct tag *t;
10171017

10181018
close_pack_windows(pack_data);
1019-
hashclose(pack_file, cur_pack_oid.hash, 0);
1019+
finalize_hashfile(pack_file, cur_pack_oid.hash, 0);
10201020
fixup_pack_header_footer(pack_data->pack_fd, pack_data->sha1,
10211021
pack_data->pack_name, object_count,
10221022
cur_pack_oid.hash, pack_size);

pack-bitmap-write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ void bitmap_writer_finish(struct pack_idx_entry **index,
535535
if (options & BITMAP_OPT_HASH_CACHE)
536536
write_hash_cache(f, index, index_nr);
537537

538-
hashclose(f, NULL, CSUM_FSYNC);
538+
finalize_hashfile(f, NULL, CSUM_FSYNC);
539539

540540
if (adjust_shared_perm(tmp_file.buf))
541541
die_errno("unable to make temporary bitmap file readable");

pack-write.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
170170
}
171171

172172
hashwrite(f, sha1, the_hash_algo->rawsz);
173-
hashclose(f, NULL, ((opts->flags & WRITE_IDX_VERIFY)
174-
? CSUM_CLOSE : CSUM_FSYNC));
173+
finalize_hashfile(f, NULL, ((opts->flags & WRITE_IDX_VERIFY)
174+
? CSUM_CLOSE : CSUM_FSYNC));
175175
return index_name;
176176
}
177177

0 commit comments

Comments
 (0)