aboutsummaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/diff.c b/diff.c
index 1ddfdfbc2..ccc9f1f64 100644
--- a/diff.c
+++ b/diff.c
@@ -2711,10 +2711,16 @@ static void diff_fill_sha1_info(struct diff_filespec *one)
static void strip_prefix(int prefix_length, const char **namep, const char **otherp)
{
/* Strip the prefix but do not molest /dev/null and absolute paths */
- if (*namep && **namep != '/')
+ if (*namep && **namep != '/') {
*namep += prefix_length;
- if (*otherp && **otherp != '/')
+ if (**namep == '/')
+ ++*namep;
+ }
+ if (*otherp && **otherp != '/') {
*otherp += prefix_length;
+ if (**otherp == '/')
+ ++*otherp;
+ }
}
static void run_diff(struct diff_filepair *p, struct diff_options *o)
@@ -2821,7 +2827,6 @@ static void run_checkdiff(struct diff_filepair *p, struct diff_options *o)
void diff_setup(struct diff_options *options)
{
memcpy(options, &default_diff_options, sizeof(*options));
- memset(&diff_queued_diff, 0, sizeof(diff_queued_diff));
options->file = stdout;