Skip to content

Commit

Permalink
status: unbreak the (deprecated) --no-lock-index option
Browse files Browse the repository at this point in the history
When core Git introduced the --no-optional-locks option in v2.15.0, it
knowingly implemented a different solution to the same problem, causing
merge conflicts and requiring an upgrade to Team Explorer.

To lessen the impact of that, I tried to handle --no-lock-index by
triggering the same code as --no-optional-locks, with a big fat warning
that --no-lock-index is deprecated.

In the last-minute rebasing frenzy leading up to Git for Windows
v2.15.0, however, I managed to forget about the validation of that code
(and I also wanted to update the commit message, which I also forgot).

And of course my patch broke the feature, by using the `no_lock_index`
variable before the command-line options were parsed :-(

This commit fixes it (and also reverts another patch that is no longer
necessary, which persisted the --no-lock-index flag to spawned
processes). It is a combination of two separate fixup commits that
already made it into Git for Windows' `master` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Nov 2, 2017
1 parent 56bfcf7 commit e2a6a4e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions builtin/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1428,23 +1428,18 @@ int cmd_status(int argc, const char **argv, const char *prefix)
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(builtin_status_usage, builtin_status_options);

if (no_lock_index) {
warning("--no-lock-index is deprecated, use --no-optional-locks"
" instead");
setenv(GIT_OPTIONAL_LOCKS_ENVIRONMENT, "false", 1);
}

status_init_config(&s, git_status_config);
argc = parse_options(argc, argv, prefix,
builtin_status_options,
builtin_status_usage, 0);
finalize_colopts(&s.colopts, -1);
finalize_deferred_config(&s);

if (no_lock_index)
setenv("GIT_LOCK_INDEX", "false", 1);
else if (!git_parse_maybe_bool(getenv("GIT_LOCK_INDEX")))
no_lock_index = 1;
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);
Expand Down

0 comments on commit e2a6a4e

Please sign in to comment.