Skip to content
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
2 changes: 1 addition & 1 deletion src/diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ read_timestamp (const char *timestamp, struct tm *result, long *zone)
}

/* Helper function to strip Git a/ or b/ prefixes from a filename */
static char *
char *
strip_git_prefix_from_filename (const char *filename, enum git_prefix_mode prefix_mode)
{
if (prefix_mode == GIT_PREFIX_STRIP &&
Expand Down
1 change: 1 addition & 0 deletions src/diff.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ enum git_prefix_mode {

char *filename_from_header (const char *header);
char *filename_from_header_with_git_prefix_mode (const char *header, enum git_prefix_mode prefix_mode);
char *strip_git_prefix_from_filename (const char *filename, enum git_prefix_mode prefix_mode);

enum git_diff_type detect_git_diff_type (char **headers, unsigned int num_headers);
int extract_git_filenames (char **headers, unsigned int num_headers,
Expand Down
13 changes: 12 additions & 1 deletion src/filterdiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ file_matches (void)
static void display_filename (unsigned long linenum, char status,
const char *filename, const char *patchname)
{
const char *processed_filename;
char *git_stripped_filename = NULL;

if (mode == mode_list && !file_matches ())
/* This is lsdiff --files=... and this file is not to be
* listed. */
Expand All @@ -288,7 +291,15 @@ static void display_filename (unsigned long linenum, char status,
printf ("%c ", status);
if (prefix_to_add)
fputs (prefix_to_add, stdout);
puts (stripped (filename, strip_components));

/* Handle git prefix stripping if needed */
git_stripped_filename = strip_git_prefix_from_filename(filename, git_prefix_mode);
processed_filename = stripped(git_stripped_filename, strip_components);

puts (processed_filename);

/* Clean up allocated memory */
free (git_stripped_filename);
}

static int
Expand Down