Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2019-03-29 13:58:50 +0300
committerPatrick Steinhardt <ps@pks.im>2019-05-02 11:22:12 +0300
commitc79f9daefaeba1fa211870b63a4c75611cc98a96 (patch)
treecdcb18e4f819b77d7838d3cab8503e583d915cc3
parent1df7d27addb1135bbd189257ebe39dff033d2118 (diff)
patch_parse: improve formatting
-rw-r--r--src/patch_parse.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 647929fd5..3e78d8ca7 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -921,21 +921,15 @@ static int check_filenames(git_patch_parsed *patch)
return git_parse_err("missing old path");
/* Ensure (non-renamed) paths match */
- if (check_header_names(
- patch->header_old_path, patch->old_path, "old", added) < 0 ||
- check_header_names(
- patch->header_new_path, patch->new_path, "new", deleted) < 0)
+ if (check_header_names(patch->header_old_path, patch->old_path, "old", added) < 0 ||
+ check_header_names(patch->header_new_path, patch->new_path, "new", deleted) < 0)
return -1;
- prefixed_old = (!added && patch->old_path) ? patch->old_path :
- patch->header_old_path;
- prefixed_new = (!deleted && patch->new_path) ? patch->new_path :
- patch->header_new_path;
+ prefixed_old = (!added && patch->old_path) ? patch->old_path : patch->header_old_path;
+ prefixed_new = (!deleted && patch->new_path) ? patch->new_path : patch->header_new_path;
- if (check_prefix(
- &patch->old_prefix, &old_prefixlen, patch, prefixed_old) < 0 ||
- check_prefix(
- &patch->new_prefix, &new_prefixlen, patch, prefixed_new) < 0)
+ if (check_prefix(&patch->old_prefix, &old_prefixlen, patch, prefixed_old) < 0 ||
+ check_prefix(&patch->new_prefix, &new_prefixlen, patch, prefixed_new) < 0)
return -1;
/* Prefer the rename filenames as they are unambiguous and unprefixed */
@@ -950,7 +944,7 @@ static int check_filenames(git_patch_parsed *patch)
patch->base.delta->new_file.path = prefixed_new + new_prefixlen;
if (!patch->base.delta->old_file.path &&
- !patch->base.delta->new_file.path)
+ !patch->base.delta->new_file.path)
return git_parse_err("git diff header lacks old / new paths");
return 0;
@@ -964,14 +958,14 @@ static int check_patch(git_patch_parsed *patch)
return -1;
if (delta->old_file.path &&
- delta->status != GIT_DELTA_DELETED &&
- !delta->new_file.mode)
+ delta->status != GIT_DELTA_DELETED &&
+ !delta->new_file.mode)
delta->new_file.mode = delta->old_file.mode;
if (delta->status == GIT_DELTA_MODIFIED &&
- !(delta->flags & GIT_DIFF_FLAG_BINARY) &&
- delta->new_file.mode == delta->old_file.mode &&
- git_array_size(patch->base.hunks) == 0)
+ !(delta->flags & GIT_DIFF_FLAG_BINARY) &&
+ delta->new_file.mode == delta->old_file.mode &&
+ git_array_size(patch->base.hunks) == 0)
return git_parse_err("patch with no hunks");
if (delta->status == GIT_DELTA_ADDED) {