Merge branch 'status-no-lock-index'

This branch allows third-party tools to call `git status
--no-lock-index` to avoid lock contention with the interactive Git usage
of the actual human user.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2018-06-08 18:34:45 +02:00
3 changed files with 28 additions and 0 deletions

View File

@@ -1294,6 +1294,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
{
static int no_renames = -1;
static const char *rename_score_arg = (const char *)-1;
static int no_lock_index = 0;
static struct wt_status s;
int fd;
struct object_id oid;
@@ -1331,6 +1332,9 @@ int cmd_status(int argc, const char **argv, const char *prefix)
{ OPTION_CALLBACK, 'M', "find-renames", &rename_score_arg,
N_("n"), N_("detect renames, optionally set similarity index"),
PARSE_OPT_OPTARG, opt_parse_rename_score },
OPT_BOOL(0, "no-lock-index", &no_lock_index,
N_("(DEPRECATED: use `git --no-optional-locks status` "
"instead) Do not lock the index")),
OPT_END(),
};
@@ -1344,6 +1348,12 @@ int cmd_status(int argc, const char **argv, const char *prefix)
finalize_colopts(&s.colopts, -1);
finalize_deferred_config(&s);
if (no_lock_index) {
warning("--no-lock-index is deprecated, use --no-optional-locks"
" instead");
setenv(GIT_OPTIONAL_LOCKS_ENVIRONMENT, "false", 1);
}
handle_untracked_files_arg(&s);
handle_ignored_arg(&s);