Skip to content

Commit

Permalink
Merge pull request #597 from m42a/master
Browse files Browse the repository at this point in the history
Improve blame argument behavior
  • Loading branch information
jonas authored May 29, 2017
2 parents f0b41d1 + f178716 commit d829cb4
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/blame.c
Original file line number Diff line number Diff line change
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

0 comments on commit d829cb4

Please sign in to comment.