aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/add.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/add.c')
-rw-r--r--builtin/add.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/builtin/add.c b/builtin/add.c
index 773b7224a4..7c292ffdc6 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -3,6 +3,7 @@
*
* Copyright (C) 2006 Linus Torvalds
*/
+
#include "builtin.h"
#include "advice.h"
#include "config.h"
@@ -39,9 +40,9 @@ static int chmod_pathspec(struct repository *repo,
char flip,
int show_only)
{
- int i, ret = 0;
+ int ret = 0;
- for (i = 0; i < repo->index->cache_nr; i++) {
+ for (size_t i = 0; i < repo->index->cache_nr; i++) {
struct cache_entry *ce = repo->index->cache[i];
int err;
@@ -69,9 +70,9 @@ static int renormalize_tracked_files(struct repository *repo,
const struct pathspec *pathspec,
int flags)
{
- int i, retval = 0;
+ int retval = 0;
- for (i = 0; i < repo->index->cache_nr; i++) {
+ for (size_t i = 0; i < repo->index->cache_nr; i++) {
struct cache_entry *ce = repo->index->cache[i];
if (!include_sparse &&
@@ -389,6 +390,10 @@ int cmd_add(int argc,
argc = parse_options(argc, argv, prefix, builtin_add_options,
builtin_add_usage, PARSE_OPT_KEEP_ARGV0);
+
+ prepare_repo_settings(repo);
+ repo->settings.command_requires_full_index = 0;
+
if (patch_interactive)
add_interactive = 1;
if (add_interactive) {
@@ -425,9 +430,6 @@ int cmd_add(int argc,
add_new_files = !take_worktree_changes && !refresh_only && !add_renormalize;
require_pathspec = !(take_worktree_changes || (0 < addremove_explicit));
- prepare_repo_settings(repo);
- repo->settings.command_requires_full_index = 0;
-
repo_hold_locked_index(repo, &lock_file, LOCK_DIE_ON_ERROR);
/*