{"thread":{"id":"49960","subject":"[PATCH] Indent code with TABs","startedAt":"2018-12-06T15:42:16Z","lastAt":"2018-12-06T15:42:16Z","messageCount":1,"participants":["Nguyễn Thái Ngọc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"364691","messageId":"20181206154206.16197-1-pclouds@gmail.com","threadId":"49960","inReplyTo":null,"subject":"[PATCH] Indent code with TABs","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-12-06T15:42:06Z","receivedAt":"2018-12-06T15:42:16Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"We indent with TABs and sometimes for fine alignment, TABs followed by\nspaces, but never all spaces (unless the indentation is less than 8\ncolumns). Indenting with spaces slips through in some places. Fix\nthem.\n\nImported code and compat/ are left alone on purpose. The former should\nremain as close as upstream as possible. The latter pretty much has\nseparate maintainers, it's up to them to decide.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Should be quite safe to merge since \"git diff -b\" is empty\n\n archive-tar.c     |   2 +-\n archive.c         |   4 +-\n builtin/add.c     |   2 +-\n builtin/gc.c      |   2 +-\n cache-tree.c      |   2 +-\n convert.c         |   6 +--\n git-compat-util.h |   2 +-\n parse-options.c   |   2 +-\n parse-options.h   |   6 +--\n quote.c           |   2 +-\n read-cache.c      | 118 +++++++++++++++++++++++-----------------------\n revision.c        |   4 +-\n symlinks.c        |   2 +-\n 13 files changed, 77 insertions(+), 77 deletions(-)\n\ndiff --git a/archive-tar.c b/archive-tar.c\nindex a58e1a8ebf..4aabd566fb 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -142,7 +142,7 @@ static int stream_blocked(const struct object_id *oid)\n  * string and appends it to a struct strbuf.\n  */\n static void strbuf_append_ext_header(struct strbuf *sb, const char *keyword,\n-                                     const char *value, unsigned int valuelen)\n+\t\t\t\t     const char *value, unsigned int valuelen)\n {\n \tint len, tmp;\n \ndiff --git a/archive.c b/archive.c\nindex fd556c28e4..c2fe16ad33 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -36,8 +36,8 @@ void init_archivers(void)\n }\n \n static void format_subst(const struct commit *commit,\n-                         const char *src, size_t len,\n-                         struct strbuf *buf)\n+\t\t\t const char *src, size_t len,\n+\t\t\t struct strbuf *buf)\n {\n \tchar *to_free = NULL;\n \tstruct strbuf fmt = STRBUF_INIT;\ndiff --git a/builtin/add.c b/builtin/add.c\nindex f65c172299..12247b48fd 100644\n--- a/builtin/add.c\n+++ b/builtin/add.c\n@@ -176,7 +176,7 @@ static void refresh(int verbose, const struct pathspec *pathspec)\n \t\t\tdie(_(\"pathspec '%s' did not match any files\"),\n \t\t\t    pathspec->items[i].match);\n \t}\n-        free(seen);\n+\tfree(seen);\n }\n \n int run_add_interactive(const char *revision, const char *patch_mode,\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 871a56f1c5..7696017cd4 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -317,7 +317,7 @@ static void add_repack_all_option(struct string_list *keep_pack)\n \n static void add_repack_incremental_option(void)\n {\n-       argv_array_push(&repack, \"--no-write-bitmap-index\");\n+\targv_array_push(&repack, \"--no-write-bitmap-index\");\n }\n \n static int need_to_gc(void)\ndiff --git a/cache-tree.c b/cache-tree.c\nindex 9d454d24bc..d6dbbebfb2 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -448,7 +448,7 @@ int cache_tree_update(struct index_state *istate, int flags)\n }\n \n static void write_one(struct strbuf *buffer, struct cache_tree *it,\n-                      const char *path, int pathlen)\n+\t\t      const char *path, int pathlen)\n {\n \tint i;\n \ndiff --git a/convert.c b/convert.c\nindex e0848226d2..5f60c11ce0 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -705,7 +705,7 @@ static int filter_buffer_or_fd(int in, int out, void *data)\n }\n \n static int apply_single_file_filter(const char *path, const char *src, size_t len, int fd,\n-                        struct strbuf *dst, const char *cmd)\n+\t\t\t\t    struct strbuf *dst, const char *cmd)\n {\n \t/*\n \t * Create a pipeline to have the command filter the buffer's\n@@ -1091,7 +1091,7 @@ static int count_ident(const char *cp, unsigned long size)\n }\n \n static int ident_to_git(const char *path, const char *src, size_t len,\n-                        struct strbuf *buf, int ident)\n+\t\t\tstruct strbuf *buf, int ident)\n {\n \tchar *dst, *dollar;\n \n@@ -1135,7 +1135,7 @@ static int ident_to_git(const char *path, const char *src, size_t len,\n }\n \n static int ident_to_worktree(const char *path, const char *src, size_t len,\n-                             struct strbuf *buf, int ident)\n+\t\t\t     struct strbuf *buf, int ident)\n {\n \tstruct object_id oid;\n \tchar *to_free = NULL, *dollar, *spc;\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 09b0102cae..f281aa5185 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -721,7 +721,7 @@ extern const char *githstrerror(int herror);\n #ifdef NO_MEMMEM\n #define memmem gitmemmem\n void *gitmemmem(const void *haystack, size_t haystacklen,\n-                const void *needle, size_t needlelen);\n+\t\tconst void *needle, size_t needlelen);\n #endif\n \n #ifdef OVERRIDE_STRDUP\ndiff --git a/parse-options.c b/parse-options.c\nindex 3b874a83a0..27353c8e8d 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -236,7 +236,7 @@ static int parse_short_opt(struct parse_opt_ctx_t *p, const struct option *optio\n }\n \n static int parse_long_opt(struct parse_opt_ctx_t *p, const char *arg,\n-                          const struct option *options)\n+\t\t\t  const struct option *options)\n {\n \tconst struct option *all_opts = options;\n \tconst char *arg_end = strchrnul(arg, '=');\ndiff --git a/parse-options.h b/parse-options.h\nindex 6c4fe2016d..bd88f6424a 100644\n--- a/parse-options.h\n+++ b/parse-options.h\n@@ -175,11 +175,11 @@ struct option {\n  * Returns the number of arguments left in argv[].\n  */\n extern int parse_options(int argc, const char **argv, const char *prefix,\n-                         const struct option *options,\n-                         const char * const usagestr[], int flags);\n+\t\t\t const struct option *options,\n+\t\t\t const char * const usagestr[], int flags);\n \n extern NORETURN void usage_with_options(const char * const *usagestr,\n-                                        const struct option *options);\n+\t\t\t\t\tconst struct option *options);\n \n extern NORETURN void usage_msg_opt(const char *msg,\n \t\t\t\t   const char * const *usagestr,\ndiff --git a/quote.c b/quote.c\nindex c95dd2cafb..7f2aa6faa4 100644\n--- a/quote.c\n+++ b/quote.c\n@@ -234,7 +234,7 @@ static size_t next_quote_pos(const char *s, ssize_t maxlen)\n  *     Return value is the same as in (1).\n  */\n static size_t quote_c_style_counted(const char *name, ssize_t maxlen,\n-                                    struct strbuf *sb, FILE *fp, int no_dq)\n+\t\t\t\t    struct strbuf *sb, FILE *fp, int no_dq)\n {\n #undef EMIT\n #define EMIT(c)                                 \\\ndiff --git a/read-cache.c b/read-cache.c\nindex bd45dc3e24..3428d34f34 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -3494,71 +3494,71 @@ static void write_eoie_extension(struct strbuf *sb, git_hash_ctx *eoie_context,\n \n static struct index_entry_offset_table *read_ieot_extension(const char *mmap, size_t mmap_size, size_t offset)\n {\n-       const char *index = NULL;\n-       uint32_t extsize, ext_version;\n-       struct index_entry_offset_table *ieot;\n-       int i, nr;\n-\n-       /* find the IEOT extension */\n-       if (!offset)\n-\t       return NULL;\n-       while (offset <= mmap_size - the_hash_algo->rawsz - 8) {\n-\t       extsize = get_be32(mmap + offset + 4);\n-\t       if (CACHE_EXT((mmap + offset)) == CACHE_EXT_INDEXENTRYOFFSETTABLE) {\n-\t\t       index = mmap + offset + 4 + 4;\n-\t\t       break;\n-\t       }\n-\t       offset += 8;\n-\t       offset += extsize;\n-       }\n-       if (!index)\n-\t       return NULL;\n-\n-       /* validate the version is IEOT_VERSION */\n-       ext_version = get_be32(index);\n-       if (ext_version != IEOT_VERSION) {\n-\t       error(\"invalid IEOT version %d\", ext_version);\n-\t       return NULL;\n-       }\n-       index += sizeof(uint32_t);\n-\n-       /* extension size - version bytes / bytes per entry */\n-       nr = (extsize - sizeof(uint32_t)) / (sizeof(uint32_t) + sizeof(uint32_t));\n-       if (!nr) {\n-\t       error(\"invalid number of IEOT entries %d\", nr);\n-\t       return NULL;\n-       }\n-       ieot = xmalloc(sizeof(struct index_entry_offset_table)\n-\t       + (nr * sizeof(struct index_entry_offset)));\n-       ieot->nr = nr;\n-       for (i = 0; i < nr; i++) {\n-\t       ieot->entries[i].offset = get_be32(index);\n-\t       index += sizeof(uint32_t);\n-\t       ieot->entries[i].nr = get_be32(index);\n-\t       index += sizeof(uint32_t);\n-       }\n-\n-       return ieot;\n+\tconst char *index = NULL;\n+\tuint32_t extsize, ext_version;\n+\tstruct index_entry_offset_table *ieot;\n+\tint i, nr;\n+\n+\t/* find the IEOT extension */\n+\tif (!offset)\n+\t\treturn NULL;\n+\twhile (offset <= mmap_size - the_hash_algo->rawsz - 8) {\n+\t\textsize = get_be32(mmap + offset + 4);\n+\t\tif (CACHE_EXT((mmap + offset)) == CACHE_EXT_INDEXENTRYOFFSETTABLE) {\n+\t\t\tindex = mmap + offset + 4 + 4;\n+\t\t\tbreak;\n+\t\t}\n+\t\toffset += 8;\n+\t\toffset += extsize;\n+\t}\n+\tif (!index)\n+\t\treturn NULL;\n+\n+\t/* validate the version is IEOT_VERSION */\n+\text_version = get_be32(index);\n+\tif (ext_version != IEOT_VERSION) {\n+\t\terror(\"invalid IEOT version %d\", ext_version);\n+\t\treturn NULL;\n+\t}\n+\tindex += sizeof(uint32_t);\n+\n+\t/* extension size - version bytes / bytes per entry */\n+\tnr = (extsize - sizeof(uint32_t)) / (sizeof(uint32_t) + sizeof(uint32_t));\n+\tif (!nr) {\n+\t\terror(\"invalid number of IEOT entries %d\", nr);\n+\t\treturn NULL;\n+\t}\n+\tieot = xmalloc(sizeof(struct index_entry_offset_table)\n+\t\t       + (nr * sizeof(struct index_entry_offset)));\n+\tieot->nr = nr;\n+\tfor (i = 0; i < nr; i++) {\n+\t\tieot->entries[i].offset = get_be32(index);\n+\t\tindex += sizeof(uint32_t);\n+\t\tieot->entries[i].nr = get_be32(index);\n+\t\tindex += sizeof(uint32_t);\n+\t}\n+\n+\treturn ieot;\n }\n \n static void write_ieot_extension(struct strbuf *sb, struct index_entry_offset_table *ieot)\n {\n-       uint32_t buffer;\n-       int i;\n+\tuint32_t buffer;\n+\tint i;\n \n-       /* version */\n-       put_be32(&buffer, IEOT_VERSION);\n-       strbuf_add(sb, &buffer, sizeof(uint32_t));\n+\t/* version */\n+\tput_be32(&buffer, IEOT_VERSION);\n+\tstrbuf_add(sb, &buffer, sizeof(uint32_t));\n \n-       /* ieot */\n-       for (i = 0; i < ieot->nr; i++) {\n+\t/* ieot */\n+\tfor (i = 0; i < ieot->nr; i++) {\n \n-\t       /* offset */\n-\t       put_be32(&buffer, ieot->entries[i].offset);\n-\t       strbuf_add(sb, &buffer, sizeof(uint32_t));\n+\t\t/* offset */\n+\t\tput_be32(&buffer, ieot->entries[i].offset);\n+\t\tstrbuf_add(sb, &buffer, sizeof(uint32_t));\n \n-\t       /* count */\n-\t       put_be32(&buffer, ieot->entries[i].nr);\n-\t       strbuf_add(sb, &buffer, sizeof(uint32_t));\n-       }\n+\t\t/* count */\n+\t\tput_be32(&buffer, ieot->entries[i].nr);\n+\t\tstrbuf_add(sb, &buffer, sizeof(uint32_t));\n+\t}\n }\ndiff --git a/revision.c b/revision.c\nindex 13e0519c02..f9ca1a8d53 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1495,8 +1495,8 @@ void repo_init_revisions(struct repository *r,\n }\n \n static void add_pending_commit_list(struct rev_info *revs,\n-                                    struct commit_list *commit_list,\n-                                    unsigned int flags)\n+\t\t\t\t    struct commit_list *commit_list,\n+\t\t\t\t    unsigned int flags)\n {\n \twhile (commit_list) {\n \t\tstruct object *object = &commit_list->item->object;\ndiff --git a/symlinks.c b/symlinks.c\nindex 5261e8cf49..69d458a24d 100644\n--- a/symlinks.c\n+++ b/symlinks.c\n@@ -221,7 +221,7 @@ int has_symlink_leading_path(const char *name, int len)\n  */\n int check_leading_path(const char *name, int len)\n {\n-    return threaded_check_leading_path(&default_cache, name, len);\n+\treturn threaded_check_leading_path(&default_cache, name, len);\n }\n \n /*\n-- \n2.20.0.rc2.461.g47d1d16d8d\n\n"}]}