Skip to content

Commit

Permalink
Pass command line args through to diff-files in status view (#1155)
Browse files Browse the repository at this point in the history
This makes it possible to use `tig --ignore-submodules` to speed up
the status view for a repo with many submodules.

Closes #1152

Reported-by: Benjamin Titmus <ben.titmus@cantab.net>
Reviewed-by: Johannes Altmanninger <aclopte@gmail.com>
  • Loading branch information
koutcher authored Nov 11, 2021
1 parent f92286a commit 4885101
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions include/tig/git.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@

/* Don't show staged unmerged entries. */
#define GIT_DIFF_STAGED_FILES(output_arg) \
"git", "diff-index", (output_arg), "--diff-filter=ACDMRTXB", "-C", "--cached", "HEAD", "--", NULL
"git", "diff-index", (output_arg), "%(cmdlineargs)", "--diff-filter=ACDMRTXB", \
"-C", "--cached", "HEAD", "--", NULL

#define GIT_DIFF_UNSTAGED_FILES(output_arg) \
"git", "diff-files", (output_arg), NULL
"git", "diff-files", (output_arg), "%(cmdlineargs)", NULL

#define GIT_DIFF_BLAME(encoding_arg, context_arg, space_arg, new_name) \
GIT_DIFF_UNSTAGED(encoding_arg, context_arg, space_arg, "", new_name)
Expand Down
7 changes: 6 additions & 1 deletion src/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,13 @@ status_run(struct view *view, const char *argv[], char status, enum line_type ty
struct status *unmerged = NULL;
struct buffer buf;
struct io io;
const char **status_argv = NULL;
bool ok = argv_format(view->env, &status_argv, argv, false, false) &&
io_run(&io, IO_RD, repo.exec_dir, NULL, status_argv);

if (!io_run(&io, IO_RD, repo.exec_dir, NULL, argv))
argv_free(status_argv);
free(status_argv);
if (!ok)
return false;

add_line_nodata(view, type);
Expand Down

0 comments on commit 4885101

Please sign in to comment.