Skip to content

Commit

Permalink
Make user tigrc location configurable
Browse files Browse the repository at this point in the history
Introduces the variable TIG_USER_CONFIG which defaults to `~/.tigrc`.

Closes #479
  • Loading branch information
spk authored and jonas committed Apr 13, 2016
1 parent 8e20478 commit 9916cb8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions INSTALL.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ can be one of the following flags:
- `NO_BUILTIN_TIGRC`: Reduce the size of the binary by not including a
built-in tigrc. The built-in tigrc is used as a fallback when no
`tigrc` is found in the system configuration directory (e.g. `/etc`).
- `TIG_USER_CONFIG`: Allow to customize the `tigrc` path (default `~/.tigrc`).

The following example `config.make` manually configures Tig to use the ncurses
library with wide character support and include the proper ncurses header file
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ endif

override CPPFLAGS += '-DTIG_VERSION="$(VERSION)"'
override CPPFLAGS += '-DSYSCONFDIR="$(sysconfdir)"'
ifdef TIG_USER_CONFIG
override CPPFLAGS += '-DTIG_USER_CONFIG="$(TIG_USER_CONFIG)"'
endif

ASCIIDOC ?= asciidoc
ASCIIDOC_FLAGS = -aversion=$(VERSION) -asysconfdir=$(sysconfdir) -f doc/asciidoc.conf
Expand Down
1 change: 1 addition & 0 deletions NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Improvements:
- Add sample git-flow keybinding (GH #421)
- Add chocolate theme (GH #432)
- Show stash diffs. (GH #328)
- Make user tigrc location configurable. (GH #479)

Bug fixes:

Expand Down
4 changes: 4 additions & 0 deletions include/tig/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ struct ref_format;
struct view_column;
typedef struct view_column *view_settings;

#ifndef TIG_USER_CONFIG
#define TIG_USER_CONFIG "~/.tigrc"
#endif

#define OPTION_INFO(_) \
_(blame_options, const char **, VIEW_BLAME_LIKE) \
_(blame_view, view_settings, VIEW_NO_FLAGS) \
Expand Down
2 changes: 1 addition & 1 deletion src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ load_options(void)
}

if (!tigrc_user)
tigrc_user = "~/.tigrc";
tigrc_user = TIG_USER_CONFIG;
load_option_file(tigrc_user);

if (!diff_opts_from_args && tig_diff_opts && *tig_diff_opts) {
Expand Down

0 comments on commit 9916cb8

Please sign in to comment.