Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve blame argument behavior #597

Merged
merged 2 commits into from May 29, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 14 additions & 12 deletions src/blame.c
Expand Up @@ -81,25 +81,17 @@ blame_open(struct view *view, enum open_flags flags)
char path[SIZEOF_STR];
size_t i;

if (opt_blame_options) {
for (i = 0; opt_blame_options[i]; i++) {
if (prefixcmp(opt_blame_options[i], "-C"))
continue;
state->auto_filename_display = true;
}
}

blame_update_file_name_visibility(view);

if (is_initial_view(view)) {
/* Finish validating and setting up blame options */
if (!opt_file_args || opt_file_args[1])
usage("Invalid number of options to blame");

string_ncopy(view->env->file, opt_file_args[0], strlen(opt_file_args[0]));

opt_blame_options = opt_cmdline_args;
opt_cmdline_args = NULL;
if (opt_cmdline_args) {
opt_blame_options = opt_cmdline_args;
opt_cmdline_args = NULL;
}

/*
* flags (like "--max-age=123") and bottom limits (like "^foo")
Expand All @@ -124,6 +116,16 @@ blame_open(struct view *view, enum open_flags flags)
}
}

if (opt_blame_options) {
for (i = 0; opt_blame_options[i]; i++) {
if (prefixcmp(opt_blame_options[i], "-C"))
continue;
state->auto_filename_display = true;
}
}

blame_update_file_name_visibility(view);

if (!view->env->file[0])
return error("No file chosen, press %s to open tree view",
get_view_key(view, REQ_VIEW_TREE));
Expand Down