{"thread":{"id":"35752","subject":"[PATCH] archive.c: reduce scope of variables","startedAt":"2014-01-29T13:18:35Z","lastAt":"2014-01-29T18:28:10Z","messageCount":2,"participants":["Elia Pinto","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"233886","messageId":"1391001515-5672-1-git-send-email-gitter.spiros@gmail.com","threadId":"35752","inReplyTo":null,"subject":"[PATCH] archive.c: reduce scope of variables","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2014-01-29T13:18:35Z","receivedAt":"2014-01-29T13:18:35Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>\n---\n archive.c |    4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/archive.c b/archive.c\nindex 346f3b2..49b79f8 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -112,7 +112,6 @@ static int write_archive_entry(const unsigned char *sha1, const char *base,\n \twrite_archive_entry_fn_t write_entry = c->write_entry;\n \tstruct git_attr_check check[2];\n \tconst char *path_without_prefix;\n-\tint err;\n \n \targs->convert = 0;\n \tstrbuf_reset(&path);\n@@ -132,6 +131,7 @@ static int write_archive_entry(const unsigned char *sha1, const char *base,\n \t}\n \n \tif (S_ISDIR(mode) || S_ISGITLINK(mode)) {\n+                int err;\n \t\tif (args->verbose)\n \t\t\tfprintf(stderr, \"%.*s\\n\", (int)path.len, path.buf);\n \t\terr = write_entry(args, sha1, path.buf, path.len, mode);\n@@ -319,7 +319,6 @@ static int parse_archive_args(int argc, const char **argv,\n \tconst char *output = NULL;\n \tint compression_level = -1;\n \tint verbose = 0;\n-\tint i;\n \tint list = 0;\n \tint worktree_attributes = 0;\n \tstruct option opts[] = {\n@@ -366,6 +365,7 @@ static int parse_archive_args(int argc, const char **argv,\n \t\tbase = \"\";\n \n \tif (list) {\n+                int i;\n \t\tfor (i = 0; i < nr_archivers; i++)\n \t\t\tif (!is_remote || archivers[i]->flags & ARCHIVER_REMOTE)\n \t\t\t\tprintf(\"%s\\n\", archivers[i]->name);\n-- \n1.7.10.4\n"},{"id":"233896","messageId":"xmqqa9eek5hh.fsf@gitster.dls.corp.google.com","threadId":"35752","inReplyTo":"1391001515-5672-1-git-send-email-gitter.spiros@gmail.com","subject":"Re: [PATCH] archive.c: reduce scope of variables","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-01-29T18:28:10Z","receivedAt":"2014-01-29T18:28:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Elia Pinto <gitter.spiros@gmail.com> writes:\n\n> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>\n> ---\n\nEither the patch is whitespace damaged during the mail transport, or\nyou are incorrectly indenting the lines with all spaces.\n\n>  archive.c |    4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/archive.c b/archive.c\n> index 346f3b2..49b79f8 100644\n> --- a/archive.c\n> +++ b/archive.c\n> @@ -112,7 +112,6 @@ static int write_archive_entry(const unsigned char *sha1, const char *base,\n>  \twrite_archive_entry_fn_t write_entry = c->write_entry;\n>  \tstruct git_attr_check check[2];\n>  \tconst char *path_without_prefix;\n> -\tint err;\n>  \n>  \targs->convert = 0;\n>  \tstrbuf_reset(&path);\n> @@ -132,6 +131,7 @@ static int write_archive_entry(const unsigned char *sha1, const char *base,\n>  \t}\n>  \n>  \tif (S_ISDIR(mode) || S_ISGITLINK(mode)) {\n> +                int err;\n>  \t\tif (args->verbose)\n>  \t\t\tfprintf(stderr, \"%.*s\\n\", (int)path.len, path.buf);\n>  \t\terr = write_entry(args, sha1, path.buf, path.len, mode);\n> @@ -319,7 +319,6 @@ static int parse_archive_args(int argc, const char **argv,\n>  \tconst char *output = NULL;\n>  \tint compression_level = -1;\n>  \tint verbose = 0;\n> -\tint i;\n>  \tint list = 0;\n>  \tint worktree_attributes = 0;\n>  \tstruct option opts[] = {\n> @@ -366,6 +365,7 @@ static int parse_archive_args(int argc, const char **argv,\n>  \t\tbase = \"\";\n>  \n>  \tif (list) {\n> +                int i;\n>  \t\tfor (i = 0; i < nr_archivers; i++)\n>  \t\t\tif (!is_remote || archivers[i]->flags & ARCHIVER_REMOTE)\n>  \t\t\t\tprintf(\"%s\\n\", archivers[i]->name);\n"}]}