index e5612c197c7320b51ea0303284ab52718ca6d9eb..a82a4686e4696316a00eeb9473d8deb934df6e4b 100644 (file)
--- a/tig.c
+++ b/tig.c
const char *home = getenv("HOME");
const char *tigrc_user = getenv("TIGRC_USER");
const char *tigrc_system = getenv("TIGRC_SYSTEM");
+ const char *tig_diff_opts = getenv("TIG_DIFF_OPTS");
char buf[SIZEOF_STR];
if (!tigrc_system)
* that conflict with keybindings. */
add_builtin_run_requests();
+ if (!opt_diff_args && tig_diff_opts && *tig_diff_opts) {
+ static const char *diff_opts[SIZEOF_ARG] = { NULL };
+ int argc = 0;
+
+ if (!string_format(buf, "%s", tig_diff_opts) ||
+ !argv_from_string(diff_opts, &argc, buf))
+ die("TIG_DIFF_OPTS contains too many arguments");
+ else if (!argv_copy(&opt_diff_args, diff_opts))
+ die("Failed to format TIG_DIFF_OPTS arguments");
+ }
+
return OK;
}
const char *arg = src_argv[argc];
size_t bufpos = 0;
- if (!strcmp(arg, "%(file-args)")) {
+ if (!strcmp(arg, "%(fileargs)")) {
if (!argv_append_array(dst_argv, opt_file_args))
break;
continue;
- } else if (!strcmp(arg, "%(diff-args)")) {
+ } else if (!strcmp(arg, "%(diffargs)")) {
if (!argv_append_array(dst_argv, opt_diff_args))
break;
continue;
- } else if (!strcmp(arg, "%(rev-args)")) {
+ } else if (!strcmp(arg, "%(revargs)")) {
if (!argv_append_array(dst_argv, opt_rev_args))
break;
continue;
static const char *diff_argv[SIZEOF_ARG] = {
"git", "show", "--pretty=fuller", "--no-color", "--root",
"--patch-with-stat", "--find-copies-harder", "-C",
- "%(diff-args)", "%(commit)", "--", "%(file-args)", NULL
+ "%(diffargs)", "%(commit)", "--", "%(fileargs)", NULL
};
static struct view_ops diff_ops = {
static const char *main_argv[SIZEOF_ARG] = {
"git", "log", "--no-color", "--pretty=raw", "--parents",
- "--topo-order", "%(diff-args)", "%(rev-args)",
- "--", "%(file-args)", NULL
+ "--topo-order", "%(diffargs)", "%(revargs)",
+ "--", "%(fileargs)", NULL
};
static bool