# [PATCH 00/10] trivial style and other fixes

11 messages from 2013-09-28 to 2013-09-28. Participants: Felipe Contreras.
Thread: https://gitlist.dev/t/35043

## Felipe Contreras, 2013-09-28 21:51

Subject: [PATCH 00/10] trivial style and other fixes
Message-ID: <1380405106-29430-1-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1380405106-29430-1-git-send-email-felipe.contreras%40gmail.com

```
Felipe Contreras (10):
  transport-helper: trivial style fix
  describe: trivial style fixes
  pretty: trivial style fix
  revision: trivial style fixes
  revision: add missing include
  shortlog: add missing declaration
  diff: trivial style fix
  run-command: trivial style fixes
  revision: trivial style fixes
  setup: trivial style fixes

 builtin/describe.c |  7 +++----
 builtin/diff.c     |  2 +-
 pretty.c           |  2 +-
 revision.c         | 14 ++++++--------
 revision.h         |  1 +
 run-command.c      | 13 +++++--------
 setup.c            |  4 ++--
 shortlog.h         |  2 ++
 transport-helper.c |  1 +
 9 files changed, 22 insertions(+), 24 deletions(-)

-- 
1.8.4-fc

```

## Felipe Contreras, 2013-09-28 21:51

Subject: [PATCH 01/10] transport-helper: trivial style fix
Message-ID: <1380405106-29430-2-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1380405106-29430-2-git-send-email-felipe.contreras%40gmail.com
In-Reply-To: <1380405106-29430-1-git-send-email-felipe.contreras@gmail.com>

```
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 transport-helper.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/transport-helper.c b/transport-helper.c
index b32e2d6..673b7c2 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -269,6 +269,7 @@ static const char *unsupported_options[] = {
 	TRANS_OPT_THIN,
 	TRANS_OPT_KEEP
 	};
+
 static const char *boolean_options[] = {
 	TRANS_OPT_THIN,
 	TRANS_OPT_KEEP,
-- 
1.8.4-fc

```

## Felipe Contreras, 2013-09-28 21:51

Subject: [PATCH 02/10] describe: trivial style fixes
Message-ID: <1380405106-29430-3-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1380405106-29430-3-git-send-email-felipe.contreras%40gmail.com
In-Reply-To: <1380405106-29430-1-git-send-email-felipe.contreras@gmail.com>

```
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 builtin/describe.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/builtin/describe.c b/builtin/describe.c
index b9d3603..6f62109 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -9,7 +9,7 @@
 #include "hash.h"
 #include "argv-array.h"
 
-#define SEEN		(1u<<0)
+#define SEEN		(1u << 0)
 #define MAX_TAGS	(FLAG_BITS - 1)
 
 static const char * const describe_usage[] = {
@@ -36,7 +36,6 @@ static const char *diff_index_args[] = {
 	"diff-index", "--quiet", "HEAD", "--", NULL
 };
 
-
 struct commit_name {
 	struct commit_name *next;
 	unsigned char peeled[20];
@@ -46,6 +45,7 @@ struct commit_name {
 	unsigned char sha1[20];
 	char *path;
 };
+
 static const char *prio_names[] = {
 	"head", "lightweight", "annotated",
 };
@@ -488,9 +488,8 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
 	} else if (dirty) {
 		die(_("--dirty is incompatible with commit-ishes"));
 	} else {
-		while (argc-- > 0) {
+		while (argc-- > 0)
 			describe(*argv++, argc == 0);
-		}
 	}
 	return 0;
 }
-- 
1.8.4-fc

```

## Felipe Contreras, 2013-09-28 21:51

Subject: [PATCH 03/10] pretty: trivial style fix
Message-ID: <1380405106-29430-4-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1380405106-29430-4-git-send-email-felipe.contreras%40gmail.com
In-Reply-To: <1380405106-29430-1-git-send-email-felipe.contreras@gmail.com>

```
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 pretty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pretty.c b/pretty.c
index b4e32b7..962e82b 100644
--- a/pretty.c
+++ b/pretty.c
@@ -497,7 +497,7 @@ void pp_user_info(struct pretty_print_context *pp,
 static int is_empty_line(const char *line, int *len_p)
 {
 	int len = *len_p;
-	while (len && isspace(line[len-1]))
+	while (len && isspace(line[len - 1]))
 		len--;
 	*len_p = len;
 	return !len;
-- 
1.8.4-fc

```

## Felipe Contreras, 2013-09-28 21:51

Subject: [PATCH 04/10] revision: trivial style fixes
Message-ID: <1380405106-29430-5-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1380405106-29430-5-git-send-email-felipe.contreras%40gmail.com
In-Reply-To: <1380405106-29430-1-git-send-email-felipe.contreras@gmail.com>

```
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 revision.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/revision.c b/revision.c
index 0173e01..3ebd558 100644
--- a/revision.c
+++ b/revision.c
@@ -2971,7 +2971,7 @@ static struct commit *get_revision_internal(struct rev_info *revs)
 	if (revs->max_count) {
 		c = get_revision_1(revs);
 		if (c) {
-			while (0 < revs->skip_count) {
+			while (revs->skip_count > 0) {
 				revs->skip_count--;
 				c = get_revision_1(revs);
 				if (!c)
@@ -2986,9 +2986,8 @@ static struct commit *get_revision_internal(struct rev_info *revs)
 	if (c)
 		c->object.flags |= SHOWN;
 
-	if (!revs->boundary) {
+	if (!revs->boundary)
 		return c;
-	}
 
 	if (!c) {
 		/*
@@ -3034,9 +3033,8 @@ struct commit *get_revision(struct rev_info *revs)
 
 	if (revs->reverse) {
 		reversed = NULL;
-		while ((c = get_revision_internal(revs))) {
+		while ((c = get_revision_internal(revs)))
 			commit_list_insert(c, &reversed);
-		}
 		revs->commits = reversed;
 		revs->reverse = 0;
 		revs->reverse_output_stage = 1;
-- 
1.8.4-fc

```

## Felipe Contreras, 2013-09-28 21:51

Subject: [PATCH 05/10] revision: add missing include
Message-ID: <1380405106-29430-6-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1380405106-29430-6-git-send-email-felipe.contreras%40gmail.com
In-Reply-To: <1380405106-29430-1-git-send-email-felipe.contreras@gmail.com>

```
Otherwise we might not have 'struct diff_options'.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 revision.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/revision.h b/revision.h
index e7f1d21..89132df 100644
--- a/revision.h
+++ b/revision.h
@@ -5,6 +5,7 @@
 #include "grep.h"
 #include "notes.h"
 #include "commit.h"
+#include "diff.h"
 
 #define SEEN		(1u<<0)
 #define UNINTERESTING   (1u<<1)
-- 
1.8.4-fc

```

## Felipe Contreras, 2013-09-28 21:51

Subject: [PATCH 06/10] shortlog: add missing declaration
Message-ID: <1380405106-29430-7-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1380405106-29430-7-git-send-email-felipe.contreras%40gmail.com
In-Reply-To: <1380405106-29430-1-git-send-email-felipe.contreras@gmail.com>

```
Otherwise we would have to include commit.h.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 shortlog.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/shortlog.h b/shortlog.h
index de4f86f..54bc07c 100644
--- a/shortlog.h
+++ b/shortlog.h
@@ -19,6 +19,8 @@ struct shortlog {
 	struct string_list mailmap;
 };
 
+struct commit;
+
 void shortlog_init(struct shortlog *log);
 
 void shortlog_add_commit(struct shortlog *log, struct commit *commit);
-- 
1.8.4-fc

```

## Felipe Contreras, 2013-09-28 21:51

Subject: [PATCH 07/10] diff: trivial style fix
Message-ID: <1380405106-29430-8-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1380405106-29430-8-git-send-email-felipe.contreras%40gmail.com
In-Reply-To: <1380405106-29430-1-git-send-email-felipe.contreras@gmail.com>

```
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 builtin/diff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/diff.c b/builtin/diff.c
index 2fb8c5d..adb93a9 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -169,7 +169,7 @@ static int builtin_diff_tree(struct rev_info *revs,
 	if (ent1->item->flags & UNINTERESTING)
 		swap = 1;
 	sha1[swap] = ent0->item->sha1;
-	sha1[1-swap] = ent1->item->sha1;
+	sha1[1 - swap] = ent1->item->sha1;
 	diff_tree_sha1(sha1[0], sha1[1], "", &revs->diffopt);
 	log_tree_diff_flush(revs);
 	return 0;
-- 
1.8.4-fc

```

## Felipe Contreras, 2013-09-28 21:51

Subject: [PATCH 08/10] run-command: trivial style fixes
Message-ID: <1380405106-29430-9-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1380405106-29430-9-git-send-email-felipe.contreras%40gmail.com
In-Reply-To: <1380405106-29430-1-git-send-email-felipe.contreras@gmail.com>

```
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 run-command.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/run-command.c b/run-command.c
index 1b7f88e..3914d9c 100644
--- a/run-command.c
+++ b/run-command.c
@@ -406,13 +406,12 @@ fail_pipe:
 					unsetenv(*cmd->env);
 			}
 		}
-		if (cmd->git_cmd) {
+		if (cmd->git_cmd)
 			execv_git_cmd(cmd->argv);
-		} else if (cmd->use_shell) {
+		else if (cmd->use_shell)
 			execv_shell_cmd(cmd->argv);
-		} else {
+		else
 			sane_execvp(cmd->argv[0], (char *const*) cmd->argv);
-		}
 		if (errno == ENOENT) {
 			if (!cmd->silent_exec_failure)
 				error("cannot run %s: %s", cmd->argv[0],
@@ -446,7 +445,6 @@ fail_pipe:
 		cmd->pid = -1;
 	}
 	close(notify_pipe[0]);
-
 }
 #else
 {
@@ -480,11 +478,10 @@ fail_pipe:
 	if (cmd->env)
 		env = make_augmented_environ(cmd->env);
 
-	if (cmd->git_cmd) {
+	if (cmd->git_cmd)
 		cmd->argv = prepare_git_cmd(cmd->argv);
-	} else if (cmd->use_shell) {
+	else if (cmd->use_shell)
 		cmd->argv = prepare_shell_cmd(cmd->argv);
-	}
 
 	cmd->pid = mingw_spawnvpe(cmd->argv[0], cmd->argv, env, cmd->dir,
 				  fhin, fhout, fherr);
-- 
1.8.4-fc

```

## Felipe Contreras, 2013-09-28 21:51

Subject: [PATCH 09/10] revision: trivial style fixes
Message-ID: <1380405106-29430-10-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1380405106-29430-10-git-send-email-felipe.contreras%40gmail.com
In-Reply-To: <1380405106-29430-1-git-send-email-felipe.contreras@gmail.com>

```
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 revision.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/revision.c b/revision.c
index 3ebd558..4049867 100644
--- a/revision.c
+++ b/revision.c
@@ -1503,7 +1503,7 @@ struct cmdline_pathspec {
 static void append_prune_data(struct cmdline_pathspec *prune, const char **av)
 {
 	while (*av) {
-		ALLOC_GROW(prune->path, prune->nr+1, prune->alloc);
+		ALLOC_GROW(prune->path, prune->nr + 1, prune->alloc);
 		prune->path[prune->nr++] = *(av++);
 	}
 }
@@ -1515,7 +1515,7 @@ static void read_pathspec_from_stdin(struct rev_info *revs, struct strbuf *sb,
 		int len = sb->len;
 		if (len && sb->buf[len - 1] == '\n')
 			sb->buf[--len] = '\0';
-		ALLOC_GROW(prune->path, prune->nr+1, prune->alloc);
+		ALLOC_GROW(prune->path, prune->nr + 1, prune->alloc);
 		prune->path[prune->nr++] = xstrdup(sb->buf);
 	}
 }
@@ -2118,7 +2118,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
 		 *	call init_pathspec() to set revs->prune_data here.
 		 * }
 		 */
-		ALLOC_GROW(prune_data.path, prune_data.nr+1, prune_data.alloc);
+		ALLOC_GROW(prune_data.path, prune_data.nr + 1, prune_data.alloc);
 		prune_data.path[prune_data.nr++] = NULL;
 		parse_pathspec(&revs->prune_data, 0, 0,
 			       revs->prefix, prune_data.path);
-- 
1.8.4-fc

```

## Felipe Contreras, 2013-09-28 21:51

Subject: [PATCH 10/10] setup: trivial style fixes
Message-ID: <1380405106-29430-11-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1380405106-29430-11-git-send-email-felipe.contreras%40gmail.com
In-Reply-To: <1380405106-29430-1-git-send-email-felipe.contreras@gmail.com>

```
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/setup.c b/setup.c
index f08dd64..c717db4 100644
--- a/setup.c
+++ b/setup.c
@@ -566,7 +566,7 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
 {
 	const char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);
 	struct string_list ceiling_dirs = STRING_LIST_INIT_DUP;
-	static char cwd[PATH_MAX+1];
+	static char cwd[PATH_MAX + 1];
 	const char *gitdirenv, *ret;
 	char *gitfile;
 	int len, offset, offset_parent, ceil_offset = -1;
@@ -581,7 +581,7 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
 	if (nongit_ok)
 		*nongit_ok = 0;
 
-	if (!getcwd(cwd, sizeof(cwd)-1))
+	if (!getcwd(cwd, sizeof(cwd) - 1))
 		die_errno("Unable to read current working directory");
 	offset = len = strlen(cwd);
 
-- 
1.8.4-fc

```
