@@ -470,6 +470,7 @@ Misc
|X |Toggle commit ID display on/off
|% |Toggle file filtering in order to see the full diff instead of only
the diff concerning the currently selected file.
+|^ |Toggle revision filtering in the main view.
|$ |Toggle highlighting of commit title overflow.
|H |Go to the HEAD commit.
|: |Open prompt. This allows you to specify what command to run and also to
@@ -72,6 +72,7 @@ extern struct argv_env argv_env;
enum argv_flag {
argv_flag_first = 1 << 0,
argv_flag_file_filter = 1 << 1,
+ argv_flag_rev_filter = 1 << 2,
};
bool argv_format(struct argv_env *argv_env, const char ***dst_argv, const char *src_argv[], int flags);
@@ -69,6 +69,7 @@ typedef struct view_column *view_settings;
_(refresh_mode, enum refresh_mode, VIEW_NO_FLAGS) \
_(refs_view, view_settings, VIEW_NO_FLAGS) \
_(rev_args, const char **, VIEW_NO_FLAGS) \
+ _(rev_filter, bool, VIEW_LOG_LIKE) \
_(send_child_enter, bool, VIEW_NO_FLAGS) \
_(show_changes, bool, VIEW_NO_FLAGS) \
_(show_notes, bool, VIEW_NO_FLAGS) \
@@ -65,13 +65,14 @@ enum view_flag {
VIEW_BLAME_LIKE = 1 << 8,
VIEW_SEND_CHILD_ENTER = 1 << 9,
VIEW_FILE_FILTER = 1 << 10,
- VIEW_LOG_LIKE = 1 << 11,
- VIEW_STATUS_LIKE = 1 << 12,
- VIEW_REFRESH = 1 << 13,
- VIEW_GREP_LIKE = 1 << 14,
- VIEW_SORTABLE = 1 << 15,
- VIEW_FLEX_WIDTH = 1 << 16,
- VIEW_RESET_DISPLAY = 1 << 17,
+ VIEW_REV_FILTER = 1 << 11,
+ VIEW_LOG_LIKE = 1 << 12,
+ VIEW_STATUS_LIKE = 1 << 13,
+ VIEW_REFRESH = 1 << 14,
+ VIEW_GREP_LIKE = 1 << 15,
+ VIEW_SORTABLE = 1 << 16,
+ VIEW_FLEX_WIDTH = 1 << 17,
+ VIEW_RESET_DISPLAY = 1 << 18,
};
#define view_has_flags(view, flag) ((view)->ops->flags & (flag))
@@ -464,7 +464,7 @@ argv_format(struct argv_env *argv_env, const char ***dst_argv, const char *src_a
} else if (!strcmp(arg, "%(revargs)") ||
((flags & argv_flag_first) && !strcmp(arg, "%(commit)"))) {
- if (!argv_append_array(dst_argv, opt_rev_args))
+ if ((flags & argv_flag_rev_filter) && !argv_append_array(dst_argv, opt_rev_args))
break;
} else if (!format_append_arg(&format, dst_argv, arg)) {
@@ -606,7 +606,7 @@ argv_format_arg(struct argv_env *argv_env, const char *src_arg)
const char **dst_argv = NULL;
char *dst_arg = NULL;
- if (argv_format(argv_env, &dst_argv, src_argv, argv_flag_file_filter))
+ if (argv_format(argv_env, &dst_argv, src_argv, argv_flag_file_filter | argv_flag_rev_filter))
dst_arg = (char *) dst_argv[0];
free(dst_argv);
@@ -629,7 +629,7 @@ main_select(struct view *view, struct line *line)
static struct view_ops main_ops = {
"commit",
argv_env.head,
- VIEW_SEND_CHILD_ENTER | VIEW_FILE_FILTER | VIEW_LOG_LIKE | VIEW_REFRESH,
+ VIEW_SEND_CHILD_ENTER | VIEW_FILE_FILTER | VIEW_REV_FILTER | VIEW_LOG_LIKE | VIEW_REFRESH,
sizeof(struct main_state),
main_open,
main_read,
@@ -873,6 +873,7 @@ option_bind_command(int argc, const char *argv[])
{ "toggle-date", "date" },
{ "toggle-files", "file-filter" },
{ "toggle-file-filter", "file-filter" },
+ { "toggle-rev-filter", "rev-filter" },
{ "toggle-file-size", "file-size" },
{ "toggle-filename", "filename" },
{ "toggle-graphic", "show-graphic" },
@@ -1058,6 +1059,7 @@ load_options(void)
char buf[SIZEOF_STR];
opt_file_filter = true;
+ opt_rev_filter = true;
if (!find_option_info_by_value(&opt_diff_context)->seen)
opt_diff_context = -3;
@@ -939,7 +939,7 @@ run_prompt_command(struct view *view, const char *argv[])
/* Trim the leading '!'. */
argv[0] = cmd + 1;
- copied = argv_format(view->env, &next->argv, argv, argv_flag_file_filter);
+ copied = argv_format(view->env, &next->argv, argv, argv_flag_file_filter | argv_flag_rev_filter);
argv[0] = cmd;
if (!copied) {
@@ -967,7 +967,7 @@ run_prompt_command(struct view *view, const char *argv[])
if (argv[1]
&& strlen(argv[1]) > 0
- && (!argv_format(view->env, &fmt_argv, &argv[1], argv_flag_file_filter)
+ && (!argv_format(view->env, &fmt_argv, &argv[1], argv_flag_file_filter | argv_flag_rev_filter)
|| !argv_to_string(fmt_argv, text, sizeof(text), " ")
)) {
report("Failed to format echo string");
@@ -1102,7 +1102,7 @@ exec_run_request(struct view *view, struct run_request *req)
if (!argv_to_string(req->argv, cmd, sizeof(cmd), " ")
|| !argv_from_string_no_quotes(req_argv, &req_argc, cmd)
- || !argv_format(view->env, &argv, req_argv, argv_flag_file_filter)
+ || !argv_format(view->env, &argv, req_argv, argv_flag_file_filter | argv_flag_rev_filter)
|| !argv) {
report("Failed to format arguments");
return REQ_NONE;
@@ -104,6 +104,7 @@ view_request(struct view *view, enum request request)
_('C', "local change display", "show-changes"), \
_('X', "commit ID display", "id"), \
_('%', "file filtering", "file-filter"), \
+ _('^', "revision filtering", "rev-filter"), \
_('$', "commit title overflow display", "commit-title-overflow"), \
_('d', "untracked directory info", "status-show-untracked-dirs"), \
_('|', "view split", "vertical-split"), \
@@ -580,6 +580,8 @@ begin_update(struct view *view, const char *dir, const char **argv, enum open_fl
flags |= argv_flag_first;
if (!view_has_flags(view, VIEW_FILE_FILTER) || opt_file_filter)
flags |= argv_flag_file_filter;
+ if (!view_has_flags(view, VIEW_REV_FILTER) || opt_rev_filter)
+ flags |= argv_flag_rev_filter;
view->dir = dir;
if (!argv_format(view->env, &view->argv, argv, flags))
@@ -3,7 +3,7 @@
. libtest.sh
export COLUMNS=90
-export LINES=129
+export LINES=130
steps '
:view-help
@@ -68,6 +68,7 @@ Option toggling:
X :toggle id
$ :toggle commit-title-overflow
% :toggle file-filter
+ ^ :toggle rev-filter
[-] search bindings
View manipulation
<Ctrl-C> view-close Close the current view
@@ -125,4 +126,4 @@ External commands:
[-] pager bindings
Internal commands:
@ :/^@@
-[help] - line 1 of 127 100%
+[help] - line 1 of 128 100%
@@ -51,7 +51,7 @@ View manipulation
R, <F5> refresh Reload and refresh view
O maximize Maximize the current view
q view-close Close the current view
-[help] - line 1 of 127 22%
+[help] - line 1 of 128 21%
EOF
assert_equals 'help-search.screen' <<EOF
@@ -83,7 +83,7 @@ View manipulation
R, <F5> refresh Reload and refresh view
O maximize Maximize the current view
q view-close Close the current view
-[help] - line 19 of 127 22%
+[help] - line 19 of 128 21%
EOF
assert_equals 'help-collapsed.screen' <<EOF
@@ -55,5 +55,5 @@ Searching
[-] main bindings
Cursor navigation
G move-last-line Move cursor to last line
-[help] - line 80 of 154 69%
+[help] - line 81 of 155 69%
EOF
@@ -309,7 +309,8 @@ bind generic $ :toggle commit-title-overflow
# bind generic ??? :toggle status-show-untracked-dirs
# Toggle display of file in untracked directories
# bind generic ??? :toggle vertical-split # Toggle vertical split
-bind generic % :toggle file-filter
+bind generic % :toggle file-filter # Toggle filtering by pathspecs in file-args
+bind generic ^ :toggle rev-filter # Toggle filtering by revisions in rev-args
# Misc
bind generic e edit # Open in editor