{"thread":{"id":"35767","subject":"[PATCH 5/5] builtin/commit.c: reduce scope of variables","startedAt":"2014-01-30T15:15:56Z","lastAt":"2014-01-30T15:15:56Z","messageCount":1,"participants":["Elia Pinto"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"233948","messageId":"1391094956-5507-1-git-send-email-gitter.spiros@gmail.com","threadId":"35767","inReplyTo":null,"subject":"[PATCH 5/5] builtin/commit.c: reduce scope of variables","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2014-01-30T15:15:56Z","receivedAt":"2014-01-30T15:15:56Z","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---\nThis a reroll of a previous patch. Corrected the declaration\nafter statement issue.\n\n\n builtin/commit.c |   11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 3767478..a684296 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -307,7 +307,6 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,\n \tint fd;\n \tstruct string_list partial;\n \tstruct pathspec pathspec;\n-\tchar *old_index_env = NULL;\n \tint refresh_flags = REFRESH_QUIET;\n \n \tif (is_status)\n@@ -320,6 +319,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,\n \t\tdie(_(\"index file corrupt\"));\n \n \tif (interactive) {\n+\t\tchar *old_index_env = NULL;\n \t\tfd = hold_locked_index(&index_lock, 1);\n \n \t\trefresh_cache_or_die(refresh_flags);\n@@ -600,12 +600,10 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n {\n \tstruct stat statbuf;\n \tstruct strbuf committer_ident = STRBUF_INIT;\n-\tint commitable, saved_color_setting;\n+\tint commitable;\n \tstruct strbuf sb = STRBUF_INIT;\n-\tchar *buffer;\n \tconst char *hook_arg1 = NULL;\n \tconst char *hook_arg2 = NULL;\n-\tint ident_shown = 0;\n \tint clean_message_contents = (cleanup_mode != CLEANUP_NONE);\n \tint old_display_comment_prefix;\n \n@@ -649,6 +647,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\t\t\t  logfile);\n \t\thook_arg1 = \"message\";\n \t} else if (use_message) {\n+\t\tchar *buffer;\n \t\tbuffer = strstr(use_message_buffer, \"\\n\\n\");\n \t\tif (!use_editor && (!buffer || buffer[2] == '\\0'))\n \t\t\tdie(_(\"commit has empty message\"));\n@@ -753,6 +752,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t/* This checks if committer ident is explicitly given */\n \tstrbuf_addstr(&committer_ident, git_committer_info(IDENT_STRICT));\n \tif (use_editor && include_status) {\n+\t\tint ident_shown = 0;\n+\t\tint saved_color_setting;\n \t\tchar *ai_tmp, *ci_tmp;\n \t\tif (whence != FROM_COMMIT)\n \t\t\tstatus_printf_ln(s, GIT_COLOR_NORMAL,\n@@ -1510,7 +1511,6 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \tstruct ref_lock *ref_lock;\n \tstruct commit_list *parents = NULL, **pptr = &parents;\n \tstruct stat statbuf;\n-\tint allow_fast_forward = 1;\n \tstruct commit *current_head = NULL;\n \tstruct commit_extra_header *extra = NULL;\n \n@@ -1558,6 +1558,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \t} else if (whence == FROM_MERGE) {\n \t\tstruct strbuf m = STRBUF_INIT;\n \t\tFILE *fp;\n+\t\tint allow_fast_forward = 1;\n \n \t\tif (!reflog_msg)\n \t\t\treflog_msg = \"commit (merge)\";\n-- \n1.7.10.4\n"}]}