Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

405 clang format revisit rules to make the job easier to follow #1815

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ UseTab: Always
TabWidth: 8
IndentWidth: 8
ContinuationIndentWidth: 8
ColumnLimit: 80

# While we recommend keeping column limit to 80, we don't want to
# enforce it as we generally are more lenient with this rule and
# prefer to prioritize readability.
ColumnLimit: 0

# C Language specifics
Language: Cpp
Expand All @@ -39,10 +43,9 @@ AlignConsecutiveDeclarations: false
# int cccccccc;
AlignEscapedNewlines: Left

# Align operands of binary and ternary expressions
# int aaa = bbbbbbbbbbb +
# cccccc;
AlignOperands: true
# Don't enforce alignment after linebreaks and instead
# rely on the ContinuationIndentWidth value.
AlignOperands: false

# Don't align trailing comments
# int a; // Comment a
Expand Down
1 change: 1 addition & 0 deletions block-sha1/sha1.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx);
#define platform_SHA1_Init blk_SHA1_Init
#define platform_SHA1_Update blk_SHA1_Update
#define platform_SHA1_Final blk_SHA1_Final
#define platform_SHA1_Test blk_SHA1_Test
#endif
1 change: 1 addition & 0 deletions ci/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ case "$jobname" in
ClangFormat)
sudo apt-get -q update
sudo apt-get -q -y install clang-format
clang-format -version
;;
StaticAnalysis)
sudo apt-get -q update
Expand Down
7 changes: 3 additions & 4 deletions loose.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#define USE_THE_REPOSITORY_VARIABLE

#include "git-compat-util.h"
#include "hash.h"
#include "path.h"
#include "object-store.h"
#include "hex.h"
#include "repository.h"
#include "wrapper.h"
#include "gettext.h"
#include "loose.h"
Expand Down Expand Up @@ -142,8 +141,8 @@ int repo_write_loose_object_map(struct repository *repo)

for (; iter != kh_end(map); iter++) {
if (kh_exist(map, iter)) {
if (oideq(&kh_key(map, iter), the_hash_algo->empty_tree) ||
oideq(&kh_key(map, iter), the_hash_algo->empty_blob))
if (oideq(&kh_key(map, iter), repo->hash_algo->empty_tree) ||
oideq(&kh_key(map, iter), repo->hash_algo->empty_blob))
continue;
strbuf_addf(&buf, "%s %s\n", oid_to_hex(&kh_key(map, iter)), oid_to_hex(kh_value(map, iter)));
if (write_in_full(fd, buf.buf, buf.len) < 0)
Expand Down
Loading