Indent code with TABs

We indent with TABs and sometimes for fine alignment, TABs followed by spaces, but never all spaces (unless the indentation is less than 8 columns). Indenting with spaces slips through in some places. Fix them. Imported code and compat/ are left alone on purpose. The former should remain as close as upstream as possible. The latter pretty much has separate maintainers, it's up to them to decide. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Dec 6, 2018 at 16:42 UTC ec36c42a6301eca8a1a038001435bc8a7940e886
13 files changed +77 -77
archive-tar.c
+1 -1
@@ -142,7 +142,7 @@ static int stream_blocked(const struct object_id *oid)
142 * string and appends it to a struct strbuf.
143 */
144 static void strbuf_append_ext_header(struct strbuf *sb, const char *keyword,
145 - const char *value, unsigned int valuelen)
145 + const char *value, unsigned int valuelen)
146 {
147 int len, tmp;
148
archive.c
+2 -2
@@ -36,8 +36,8 @@ void init_archivers(void)
36 }
37
38 static void format_subst(const struct commit *commit,
39 - const char *src, size_t len,
40 - struct strbuf *buf)
39 + const char *src, size_t len,
40 + struct strbuf *buf)
41 {
42 char *to_free = NULL;
43 struct strbuf fmt = STRBUF_INIT;
builtin/add.c
+1 -1
@@ -176,7 +176,7 @@ static void refresh(int verbose, const struct pathspec *pathspec)
176 die(_("pathspec '%s' did not match any files"),
177 pathspec->items[i].match);
178 }
179 - free(seen);
179 + free(seen);
180 }
181
182 int run_add_interactive(const char *revision, const char *patch_mode,
builtin/gc.c
+1 -1
@@ -317,7 +317,7 @@ static void add_repack_all_option(struct string_list *keep_pack)
317
318 static void add_repack_incremental_option(void)
319 {
320 - argv_array_push(&repack, "--no-write-bitmap-index");
320 + argv_array_push(&repack, "--no-write-bitmap-index");
321 }
322
323 static int need_to_gc(void)
cache-tree.c
+1 -1
@@ -448,7 +448,7 @@ int cache_tree_update(struct index_state *istate, int flags)
448 }
449
450 static void write_one(struct strbuf *buffer, struct cache_tree *it,
451 - const char *path, int pathlen)
451 + const char *path, int pathlen)
452 {
453 int i;
454
convert.c
+3 -3
@@ -705,7 +705,7 @@ static int filter_buffer_or_fd(int in, int out, void *data)
705 }
706
707 static int apply_single_file_filter(const char *path, const char *src, size_t len, int fd,
708 - struct strbuf *dst, const char *cmd)
708 + struct strbuf *dst, const char *cmd)
709 {
710 /*
711 * Create a pipeline to have the command filter the buffer's
@@ -1091,7 +1091,7 @@ static int count_ident(const char *cp, unsigned long size)
1091 }
1092
1093 static int ident_to_git(const char *path, const char *src, size_t len,
1094 - struct strbuf *buf, int ident)
1094 + struct strbuf *buf, int ident)
1095 {
1096 char *dst, *dollar;
1097
@@ -1135,7 +1135,7 @@ static int ident_to_git(const char *path, const char *src, size_t len,
1135 }
1136
1137 static int ident_to_worktree(const char *path, const char *src, size_t len,
1138 - struct strbuf *buf, int ident)
1138 + struct strbuf *buf, int ident)
1139 {
1140 struct object_id oid;
1141 char *to_free = NULL, *dollar, *spc;
git-compat-util.h
+1 -1
@@ -721,7 +721,7 @@ extern const char *githstrerror(int herror);
721 #ifdef NO_MEMMEM
722 #define memmem gitmemmem
723 void *gitmemmem(const void *haystack, size_t haystacklen,
724 - const void *needle, size_t needlelen);
724 + const void *needle, size_t needlelen);
725 #endif
726
727 #ifdef OVERRIDE_STRDUP
parse-options.c
+1 -1
@@ -236,7 +236,7 @@ static int parse_short_opt(struct parse_opt_ctx_t *p, const struct option *optio
236 }
237
238 static int parse_long_opt(struct parse_opt_ctx_t *p, const char *arg,
239 - const struct option *options)
239 + const struct option *options)
240 {
241 const struct option *all_opts = options;
242 const char *arg_end = strchrnul(arg, '=');
parse-options.h
+3 -3
@@ -175,11 +175,11 @@ struct option {
175 * Returns the number of arguments left in argv[].
176 */
177 extern int parse_options(int argc, const char **argv, const char *prefix,
178 - const struct option *options,
179 - const char * const usagestr[], int flags);
178 + const struct option *options,
179 + const char * const usagestr[], int flags);
180
181 extern NORETURN void usage_with_options(const char * const *usagestr,
182 - const struct option *options);
182 + const struct option *options);
183
184 extern NORETURN void usage_msg_opt(const char *msg,
185 const char * const *usagestr,
quote.c
+1 -1
@@ -234,7 +234,7 @@ static size_t next_quote_pos(const char *s, ssize_t maxlen)
234 * Return value is the same as in (1).
235 */
236 static size_t quote_c_style_counted(const char *name, ssize_t maxlen,
237 - struct strbuf *sb, FILE *fp, int no_dq)
237 + struct strbuf *sb, FILE *fp, int no_dq)
238 {
239 #undef EMIT
240 #define EMIT(c) \
read-cache.c
+59 -59
@@ -3494,71 +3494,71 @@ static void write_eoie_extension(struct strbuf *sb, git_hash_ctx *eoie_context,
3494
3495 static struct index_entry_offset_table *read_ieot_extension(const char *mmap, size_t mmap_size, size_t offset)
3496 {
3497 - const char *index = NULL;
3498 - uint32_t extsize, ext_version;
3499 - struct index_entry_offset_table *ieot;
3500 - int i, nr;
3501 -
3502 - /* find the IEOT extension */
3503 - if (!offset)
3504 - return NULL;
3505 - while (offset <= mmap_size - the_hash_algo->rawsz - 8) {
3506 - extsize = get_be32(mmap + offset + 4);
3507 - if (CACHE_EXT((mmap + offset)) == CACHE_EXT_INDEXENTRYOFFSETTABLE) {
3508 - index = mmap + offset + 4 + 4;
3509 - break;
3510 - }
3511 - offset += 8;
3512 - offset += extsize;
3513 - }
3514 - if (!index)
3515 - return NULL;
3516 -
3517 - /* validate the version is IEOT_VERSION */
3518 - ext_version = get_be32(index);
3519 - if (ext_version != IEOT_VERSION) {
3520 - error("invalid IEOT version %d", ext_version);
3521 - return NULL;
3522 - }
3523 - index += sizeof(uint32_t);
3524 -
3525 - /* extension size - version bytes / bytes per entry */
3526 - nr = (extsize - sizeof(uint32_t)) / (sizeof(uint32_t) + sizeof(uint32_t));
3527 - if (!nr) {
3528 - error("invalid number of IEOT entries %d", nr);
3529 - return NULL;
3530 - }
3531 - ieot = xmalloc(sizeof(struct index_entry_offset_table)
3532 - + (nr * sizeof(struct index_entry_offset)));
3533 - ieot->nr = nr;
3534 - for (i = 0; i < nr; i++) {
3535 - ieot->entries[i].offset = get_be32(index);
3536 - index += sizeof(uint32_t);
3537 - ieot->entries[i].nr = get_be32(index);
3538 - index += sizeof(uint32_t);
3539 - }
3540 -
3541 - return ieot;
3497 + const char *index = NULL;
3498 + uint32_t extsize, ext_version;
3499 + struct index_entry_offset_table *ieot;
3500 + int i, nr;
3501 +
3502 + /* find the IEOT extension */
3503 + if (!offset)
3504 + return NULL;
3505 + while (offset <= mmap_size - the_hash_algo->rawsz - 8) {
3506 + extsize = get_be32(mmap + offset + 4);
3507 + if (CACHE_EXT((mmap + offset)) == CACHE_EXT_INDEXENTRYOFFSETTABLE) {
3508 + index = mmap + offset + 4 + 4;
3509 + break;
3510 + }
3511 + offset += 8;
3512 + offset += extsize;
3513 + }
3514 + if (!index)
3515 + return NULL;
3516 +
3517 + /* validate the version is IEOT_VERSION */
3518 + ext_version = get_be32(index);
3519 + if (ext_version != IEOT_VERSION) {
3520 + error("invalid IEOT version %d", ext_version);
3521 + return NULL;
3522 + }
3523 + index += sizeof(uint32_t);
3524 +
3525 + /* extension size - version bytes / bytes per entry */
3526 + nr = (extsize - sizeof(uint32_t)) / (sizeof(uint32_t) + sizeof(uint32_t));
3527 + if (!nr) {
3528 + error("invalid number of IEOT entries %d", nr);
3529 + return NULL;
3530 + }
3531 + ieot = xmalloc(sizeof(struct index_entry_offset_table)
3532 + + (nr * sizeof(struct index_entry_offset)));
3533 + ieot->nr = nr;
3534 + for (i = 0; i < nr; i++) {
3535 + ieot->entries[i].offset = get_be32(index);
3536 + index += sizeof(uint32_t);
3537 + ieot->entries[i].nr = get_be32(index);
3538 + index += sizeof(uint32_t);
3539 + }
3540 +
3541 + return ieot;
3542 }
3543
3544 static void write_ieot_extension(struct strbuf *sb, struct index_entry_offset_table *ieot)
3545 {
3546 - uint32_t buffer;
3547 - int i;
3546 + uint32_t buffer;
3547 + int i;
3548
3549 - /* version */
3550 - put_be32(&buffer, IEOT_VERSION);
3551 - strbuf_add(sb, &buffer, sizeof(uint32_t));
3549 + /* version */
3550 + put_be32(&buffer, IEOT_VERSION);
3551 + strbuf_add(sb, &buffer, sizeof(uint32_t));
3552
3553 - /* ieot */
3554 - for (i = 0; i < ieot->nr; i++) {
3553 + /* ieot */
3554 + for (i = 0; i < ieot->nr; i++) {
3555
3556 - /* offset */
3557 - put_be32(&buffer, ieot->entries[i].offset);
3558 - strbuf_add(sb, &buffer, sizeof(uint32_t));
3556 + /* offset */
3557 + put_be32(&buffer, ieot->entries[i].offset);
3558 + strbuf_add(sb, &buffer, sizeof(uint32_t));
3559
3560 - /* count */
3561 - put_be32(&buffer, ieot->entries[i].nr);
3562 - strbuf_add(sb, &buffer, sizeof(uint32_t));
3563 - }
3560 + /* count */
3561 + put_be32(&buffer, ieot->entries[i].nr);
3562 + strbuf_add(sb, &buffer, sizeof(uint32_t));
3563 + }
3564 }
revision.c
+2 -2
@@ -1495,8 +1495,8 @@ void repo_init_revisions(struct repository *r,
1495 }
1496
1497 static void add_pending_commit_list(struct rev_info *revs,
1498 - struct commit_list *commit_list,
1499 - unsigned int flags)
1498 + struct commit_list *commit_list,
1499 + unsigned int flags)
1500 {
1501 while (commit_list) {
1502 struct object *object = &commit_list->item->object;
symlinks.c
+1 -1
@@ -221,7 +221,7 @@ int has_symlink_leading_path(const char *name, int len)
221 */
222 int check_leading_path(const char *name, int len)
223 {
224 - return threaded_check_leading_path(&default_cache, name, len);
224 + return threaded_check_leading_path(&default_cache, name, len);
225 }
226
227 /*