git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] archive.c: reduce scope of variables

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 29, 2014, 18:28 UTC
Message-ID
<xmqqa9eek5hh.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1391001515-5672-1-git-send-email-gitter.spiros@gmail.com>
Elia Pinto <gitter.spiros@gmail.com> writes:
> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
> ---

Either the patch is whitespace damaged during the mail transport, or you are incorrectly indenting the lines with all spaces.

Show 39 quoted lines
>  archive.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/archive.c b/archive.c
> index 346f3b2..49b79f8 100644
> --- a/archive.c
> +++ b/archive.c
> @@ -112,7 +112,6 @@ static int write_archive_entry(const unsigned char *sha1, const char *base,
>  	write_archive_entry_fn_t write_entry = c->write_entry;
>  	struct git_attr_check check[2];
>  	const char *path_without_prefix;
> -	int err;
>  
>  	args->convert = 0;
>  	strbuf_reset(&path);
> @@ -132,6 +131,7 @@ static int write_archive_entry(const unsigned char *sha1, const char *base,
>  	}
>  
>  	if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
> +                int err;
>  		if (args->verbose)
>  			fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
>  		err = write_entry(args, sha1, path.buf, path.len, mode);
> @@ -319,7 +319,6 @@ static int parse_archive_args(int argc, const char **argv,
>  	const char *output = NULL;
>  	int compression_level = -1;
>  	int verbose = 0;
> -	int i;
>  	int list = 0;
>  	int worktree_attributes = 0;
>  	struct option opts[] = {
> @@ -366,6 +365,7 @@ static int parse_archive_args(int argc, const char **argv,
>  		base = "";
>  
>  	if (list) {
> +                int i;
>  		for (i = 0; i < nr_archivers; i++)
>  			if (!is_remote || archivers[i]->flags & ARCHIVER_REMOTE)
>  				printf("%s\n", archivers[i]->name);
Previous: Elia Pinto
Message 2 of 2 in “archive.c: reduce scope of variables”
  1. archive.c: reduce scope of variablesElia Pinto, Jan 29, 2014
  2. Junio C HamanoJan 29, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.