Fix some formatting inconsistency
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
diff --git a/src/diff.c b/src/diff.c
index cea3fdb..a154e67 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -327,8 +327,7 @@ static git_diff_list *diff_list_alloc(
/* Use case-insensitive compare if either iterator has
* the ignore_case bit set */
if (!git_iterator_ignore_case(old_iter) &&
- !git_iterator_ignore_case(new_iter))
- {
+ !git_iterator_ignore_case(new_iter)) {
diff->opts.flags &= ~GIT_DIFF_DELTAS_ARE_ICASE;
diff->strcomp = git__strcmp;
@@ -777,8 +776,7 @@ static int handle_unmatched_new_item(
/* if not already inside an ignored dir, check if this is ignored */
if (delta_type != GIT_DELTA_IGNORED &&
- git_iterator_current_is_ignored(info->new_iter))
- {
+ git_iterator_current_is_ignored(info->new_iter)) {
delta_type = GIT_DELTA_IGNORED;
git_buf_sets(&info->ignore_prefix, nitem->path);
}
diff --git a/src/diff_output.c b/src/diff_output.c
index 4ce01bc..64ff6b5 100644
--- a/src/diff_output.c
+++ b/src/diff_output.c
@@ -101,8 +101,8 @@ static bool diff_delta_is_binary_forced(
/* make sure files are conceivably mmap-able */
if ((git_off_t)((size_t)delta->old_file.size) != delta->old_file.size ||
- (git_off_t)((size_t)delta->new_file.size) != delta->new_file.size)
- {
+ (git_off_t)((size_t)delta->new_file.size) != delta->new_file.size) {
+
delta->old_file.flags |= GIT_DIFF_FLAG_BINARY;
delta->new_file.flags |= GIT_DIFF_FLAG_BINARY;
delta->flags |= GIT_DIFF_FLAG_BINARY;
@@ -232,8 +232,7 @@ static int get_blob_content(
if (git_oid_iszero(&file->oid))
return 0;
- if (file->mode == GIT_FILEMODE_COMMIT)
- {
+ if (file->mode == GIT_FILEMODE_COMMIT) {
char oidstr[GIT_OID_HEXSZ+1];
git_buf content = GIT_BUF_INIT;
@@ -299,8 +298,8 @@ static int get_workdir_sm_content(
char oidstr[GIT_OID_HEXSZ+1];
if ((error = git_submodule_lookup(&sm, ctxt->repo, file->path)) < 0 ||
- (error = git_submodule_status(&sm_status, sm)) < 0)
- {
+ (error = git_submodule_status(&sm_status, sm)) < 0) {
+
/* GIT_EEXISTS means a "submodule" that has not been git added */
if (error == GIT_EEXISTS)
error = 0;
@@ -312,8 +311,8 @@ static int get_workdir_sm_content(
const git_oid* sm_head;
if ((sm_head = git_submodule_wd_id(sm)) != NULL ||
- (sm_head = git_submodule_head_id(sm)) != NULL)
- {
+ (sm_head = git_submodule_head_id(sm)) != NULL) {
+
git_oid_cpy(&file->oid, sm_head);
file->flags |= GIT_DIFF_FLAG_VALID_OID;
}
@@ -660,8 +659,8 @@ static int diff_patch_load(
*/
if (check_if_unmodified &&
delta->old_file.mode == delta->new_file.mode &&
- !git_oid__cmp(&delta->old_file.oid, &delta->new_file.oid))
- {
+ !git_oid__cmp(&delta->old_file.oid, &delta->new_file.oid)) {
+
delta->status = GIT_DELTA_UNMODIFIED;
if ((ctxt->opts->flags & GIT_DIFF_INCLUDE_UNMODIFIED) == 0)
@@ -1049,6 +1048,12 @@ char git_diff_status_char(git_delta_t status)
return code;
}
+static int callback_error(void)
+{
+ giterr_clear();
+ return GIT_EUSER;
+}
+
static int print_compact(
const git_diff_delta *delta, float progress, void *data)
{
@@ -1083,10 +1088,7 @@ static int print_compact(
if (pi->print_cb(delta, NULL, GIT_DIFF_LINE_FILE_HDR,
git_buf_cstr(pi->buf), git_buf_len(pi->buf), pi->payload))
- {
- giterr_clear();
- return GIT_EUSER;
- }
+ return callback_error();
return 0;
}
@@ -1200,10 +1202,7 @@ static int print_patch_file(
if (pi->print_cb(delta, NULL, GIT_DIFF_LINE_FILE_HDR,
git_buf_cstr(pi->buf), git_buf_len(pi->buf), pi->payload))
- {
- giterr_clear();
- return GIT_EUSER;
- }
+ return callback_error();
if ((delta->flags & GIT_DIFF_FLAG_BINARY) == 0)
return 0;
@@ -1217,10 +1216,7 @@ static int print_patch_file(
if (pi->print_cb(delta, NULL, GIT_DIFF_LINE_BINARY,
git_buf_cstr(pi->buf), git_buf_len(pi->buf), pi->payload))
- {
- giterr_clear();
- return GIT_EUSER;
- }
+ return callback_error();
return 0;
}
@@ -1243,10 +1239,7 @@ static int print_patch_hunk(
if (pi->print_cb(d, r, GIT_DIFF_LINE_HUNK_HDR,
git_buf_cstr(pi->buf), git_buf_len(pi->buf), pi->payload))
- {
- giterr_clear();
- return GIT_EUSER;
- }
+ return callback_error();
return 0;
}
@@ -1278,10 +1271,7 @@ static int print_patch_line(
if (pi->print_cb(delta, range, line_origin,
git_buf_cstr(pi->buf), git_buf_len(pi->buf), pi->payload))
- {
- giterr_clear();
- return GIT_EUSER;
- }
+ return callback_error();
return 0;
}