Skip to content

Commit 34fa631

Browse files
committed
commit graph: formatting fixes
1 parent 7d9ebdc commit 34fa631

File tree

2 files changed

+21
-23
lines changed

2 files changed

+21
-23
lines changed

include/git2/sys/commit_graph.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ typedef struct {
127127
} git_commit_graph_writer_options;
128128

129129
#define GIT_COMMIT_GRAPH_WRITER_OPTIONS_VERSION 1
130-
#define GIT_COMMIT_GRAPH_WRITER_OPTIONS_INIT \
131-
{ \
132-
GIT_COMMIT_GRAPH_WRITER_OPTIONS_VERSION, \
130+
#define GIT_COMMIT_GRAPH_WRITER_OPTIONS_INIT { \
131+
GIT_COMMIT_GRAPH_WRITER_OPTIONS_VERSION \
133132
}
134133

135134
/**

src/commit_graph.c

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -915,8 +915,11 @@ static int write_offset(off64_t offset, commit_graph_write_cb write_cb, void *cb
915915
return 0;
916916
}
917917

918-
static int
919-
write_chunk_header(int chunk_id, off64_t offset, commit_graph_write_cb write_cb, void *cb_data)
918+
static int write_chunk_header(
919+
int chunk_id,
920+
off64_t offset,
921+
commit_graph_write_cb write_cb,
922+
void *cb_data)
920923
{
921924
uint32_t word = htonl(chunk_id);
922925
int error = write_cb((const char *)&word, sizeof(word), cb_data);
@@ -954,8 +957,10 @@ static void packed_commit_free_dup(void *packed_commit)
954957
packed_commit_free(packed_commit);
955958
}
956959

957-
static int
958-
commit_graph_write(git_commit_graph_writer *w, commit_graph_write_cb write_cb, void *cb_data)
960+
static int commit_graph_write(
961+
git_commit_graph_writer *w,
962+
commit_graph_write_cb write_cb,
963+
void *cb_data)
959964
{
960965
int error = 0;
961966
size_t i;
@@ -996,18 +1001,17 @@ commit_graph_write(git_commit_graph_writer *w, commit_graph_write_cb write_cb, v
9961001
/* Fill the OID Fanout table. */
9971002
oid_fanout_count = 0;
9981003
for (i = 0; i < 256; i++) {
999-
while (oid_fanout_count < git_vector_length(&w->commits)
1000-
&& ((struct packed_commit *)git_vector_get(&w->commits, oid_fanout_count))
1001-
->sha1.id[0]
1002-
<= i)
1004+
while (oid_fanout_count < git_vector_length(&w->commits) &&
1005+
(packed_commit = (struct packed_commit *)git_vector_get(&w->commits, oid_fanout_count)) &&
1006+
packed_commit->sha1.id[0] <= i)
10031007
++oid_fanout_count;
10041008
oid_fanout[i] = htonl(oid_fanout_count);
10051009
}
10061010

10071011
/* Fill the OID Lookup table. */
10081012
git_vector_foreach (&w->commits, i, packed_commit) {
1009-
error = git_buf_put(
1010-
&oid_lookup, (const char *)&packed_commit->sha1, sizeof(git_oid));
1013+
error = git_buf_put(&oid_lookup,
1014+
(const char *)&packed_commit->sha1, sizeof(git_oid));
10111015
if (error < 0)
10121016
goto cleanup;
10131017
}
@@ -1021,8 +1025,7 @@ commit_graph_write(git_commit_graph_writer *w, commit_graph_write_cb write_cb, v
10211025
size_t *packed_index;
10221026
unsigned int parentcount = (unsigned int)git_array_size(packed_commit->parents);
10231027

1024-
error = git_buf_put(
1025-
&commit_data,
1028+
error = git_buf_put(&commit_data,
10261029
(const char *)&packed_commit->tree_oid,
10271030
sizeof(git_oid));
10281031
if (error < 0)
@@ -1054,14 +1057,10 @@ commit_graph_write(git_commit_graph_writer *w, commit_graph_write_cb write_cb, v
10541057
unsigned int parent_i;
10551058
for (parent_i = 1; parent_i < parentcount; ++parent_i) {
10561059
packed_index = git_array_get(
1057-
packed_commit->parent_indices, parent_i);
1058-
word = htonl(
1059-
(uint32_t)(*packed_index
1060-
| (parent_i + 1 == parentcount
1061-
? 0x80000000u
1062-
: 0)));
1063-
error = git_buf_put(
1064-
&extra_edge_list,
1060+
packed_commit->parent_indices, parent_i);
1061+
word = htonl((uint32_t)(*packed_index | (parent_i + 1 == parentcount ? 0x80000000u : 0)));
1062+
1063+
error = git_buf_put(&extra_edge_list,
10651064
(const char *)&word,
10661065
sizeof(word));
10671066
if (error < 0)

0 commit comments

Comments
 (0)