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>
This commit is contained in:
committed by
Junio C Hamano
parent
e666b89d76
commit
e23fd15ada
@ -307,7 +307,6 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,
|
|||||||
int fd;
|
int fd;
|
||||||
struct string_list partial;
|
struct string_list partial;
|
||||||
struct pathspec pathspec;
|
struct pathspec pathspec;
|
||||||
char *old_index_env = NULL;
|
|
||||||
int refresh_flags = REFRESH_QUIET;
|
int refresh_flags = REFRESH_QUIET;
|
||||||
|
|
||||||
if (is_status)
|
if (is_status)
|
||||||
@ -320,6 +319,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,
|
|||||||
die(_("index file corrupt"));
|
die(_("index file corrupt"));
|
||||||
|
|
||||||
if (interactive) {
|
if (interactive) {
|
||||||
|
char *old_index_env = NULL;
|
||||||
fd = hold_locked_index(&index_lock, 1);
|
fd = hold_locked_index(&index_lock, 1);
|
||||||
|
|
||||||
refresh_cache_or_die(refresh_flags);
|
refresh_cache_or_die(refresh_flags);
|
||||||
@ -600,12 +600,10 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
|||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
struct strbuf committer_ident = STRBUF_INIT;
|
struct strbuf committer_ident = STRBUF_INIT;
|
||||||
int commitable, saved_color_setting;
|
int commitable;
|
||||||
struct strbuf sb = STRBUF_INIT;
|
struct strbuf sb = STRBUF_INIT;
|
||||||
char *buffer;
|
|
||||||
const char *hook_arg1 = NULL;
|
const char *hook_arg1 = NULL;
|
||||||
const char *hook_arg2 = NULL;
|
const char *hook_arg2 = NULL;
|
||||||
int ident_shown = 0;
|
|
||||||
int clean_message_contents = (cleanup_mode != CLEANUP_NONE);
|
int clean_message_contents = (cleanup_mode != CLEANUP_NONE);
|
||||||
int old_display_comment_prefix;
|
int old_display_comment_prefix;
|
||||||
|
|
||||||
@ -649,6 +647,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
|||||||
logfile);
|
logfile);
|
||||||
hook_arg1 = "message";
|
hook_arg1 = "message";
|
||||||
} else if (use_message) {
|
} else if (use_message) {
|
||||||
|
char *buffer;
|
||||||
buffer = strstr(use_message_buffer, "\n\n");
|
buffer = strstr(use_message_buffer, "\n\n");
|
||||||
if (!use_editor && (!buffer || buffer[2] == '\0'))
|
if (!use_editor && (!buffer || buffer[2] == '\0'))
|
||||||
die(_("commit has empty message"));
|
die(_("commit has empty message"));
|
||||||
@ -753,6 +752,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
|||||||
/* This checks if committer ident is explicitly given */
|
/* This checks if committer ident is explicitly given */
|
||||||
strbuf_addstr(&committer_ident, git_committer_info(IDENT_STRICT));
|
strbuf_addstr(&committer_ident, git_committer_info(IDENT_STRICT));
|
||||||
if (use_editor && include_status) {
|
if (use_editor && include_status) {
|
||||||
|
int ident_shown = 0;
|
||||||
|
int saved_color_setting;
|
||||||
char *ai_tmp, *ci_tmp;
|
char *ai_tmp, *ci_tmp;
|
||||||
if (whence != FROM_COMMIT)
|
if (whence != FROM_COMMIT)
|
||||||
status_printf_ln(s, GIT_COLOR_NORMAL,
|
status_printf_ln(s, GIT_COLOR_NORMAL,
|
||||||
@ -1510,7 +1511,6 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
|
|||||||
struct ref_lock *ref_lock;
|
struct ref_lock *ref_lock;
|
||||||
struct commit_list *parents = NULL, **pptr = &parents;
|
struct commit_list *parents = NULL, **pptr = &parents;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
int allow_fast_forward = 1;
|
|
||||||
struct commit *current_head = NULL;
|
struct commit *current_head = NULL;
|
||||||
struct commit_extra_header *extra = NULL;
|
struct commit_extra_header *extra = NULL;
|
||||||
|
|
||||||
@ -1558,6 +1558,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
|
|||||||
} else if (whence == FROM_MERGE) {
|
} else if (whence == FROM_MERGE) {
|
||||||
struct strbuf m = STRBUF_INIT;
|
struct strbuf m = STRBUF_INIT;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
int allow_fast_forward = 1;
|
||||||
|
|
||||||
if (!reflog_msg)
|
if (!reflog_msg)
|
||||||
reflog_msg = "commit (merge)";
|
reflog_msg = "commit (merge)";
|
||||||
|
|||||||
Reference in New Issue
Block a user