builtin/commit.c: reduce scope of variables
Signed-off-by: Elia Pinto <gitter.spiros@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elia Pinto committed
Jan 30, 2014 at 07:15 UTC
e23fd15adab11eef216fd49a6329f381ce14061f
1 file changed
+6
-5
builtin/commit.c
+6
-5
@@ -307,7 +307,6 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,
307
int fd;
308
struct string_list partial;
309
struct pathspec pathspec;
310
- char *old_index_env = NULL;
310
int refresh_flags = REFRESH_QUIET;
311
312
if (is_status)
@@ -320,6 +319,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,
319
die(_("index file corrupt"));
320
321
if (interactive) {
322
+ char *old_index_env = NULL;
323
fd = hold_locked_index(&index_lock, 1);
324
325
refresh_cache_or_die(refresh_flags);
@@ -600,12 +600,10 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
600
{
601
struct stat statbuf;
602
struct strbuf committer_ident = STRBUF_INIT;
603
- int commitable, saved_color_setting;
603
+ int commitable;
604
struct strbuf sb = STRBUF_INIT;
605
- char *buffer;
605
const char *hook_arg1 = NULL;
606
const char *hook_arg2 = NULL;
608
- int ident_shown = 0;
607
int clean_message_contents = (cleanup_mode != CLEANUP_NONE);
608
int old_display_comment_prefix;
609
@@ -649,6 +647,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
647
logfile);
648
hook_arg1 = "message";
649
} else if (use_message) {
650
+ char *buffer;
651
buffer = strstr(use_message_buffer, "\n\n");
652
if (!use_editor && (!buffer || buffer[2] == '\0'))
653
die(_("commit has empty message"));
@@ -753,6 +752,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
752
/* This checks if committer ident is explicitly given */
753
strbuf_addstr(&committer_ident, git_committer_info(IDENT_STRICT));
754
if (use_editor && include_status) {
755
+ int ident_shown = 0;
756
+ int saved_color_setting;
757
char *ai_tmp, *ci_tmp;
758
if (whence != FROM_COMMIT)
759
status_printf_ln(s, GIT_COLOR_NORMAL,
@@ -1510,7 +1511,6 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1511
struct ref_lock *ref_lock;
1512
struct commit_list *parents = NULL, **pptr = &parents;
1513
struct stat statbuf;
1513
- int allow_fast_forward = 1;
1514
struct commit *current_head = NULL;
1515
struct commit_extra_header *extra = NULL;
1516
@@ -1558,6 +1558,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1558
} else if (whence == FROM_MERGE) {
1559
struct strbuf m = STRBUF_INIT;
1560
FILE *fp;
1561
+ int allow_fast_forward = 1;
1562
1563
if (!reflog_msg)
1564
reflog_msg = "commit (merge)";