Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass command line args through to diff-files in status view #1155

Merged
merged 2 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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