summaryrefslogtreecommitdiff
path: root/combine-diff.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2008-09-18 20:32:50 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-09-18 20:32:50 -0700
commitdde4af4313c6fba5269df384d97ef4fa3ab5971d (patch)
tree0441889cf594719be3e4e6f6b7e2234171218fb6 /combine-diff.c
parentTeach "git diff -p" to locate PHP class methods (diff)
parentdiff.*.xfuncname which uses "extended" regex's for hunk header selection (diff)
downloadtgif-dde4af4313c6fba5269df384d97ef4fa3ab5971d.tar.xz
Merge branch 'bc/maint-diff-hunk-header-fix' into bc/master-diff-hunk-header-fix
* bc/maint-diff-hunk-header-fix: diff.*.xfuncname which uses "extended" regex's for hunk header selection diff.c: associate a flag with each pattern and use it for compiling regex diff.c: return pattern entry pointer rather than just the hunk header pattern Cosmetical command name fix Start conforming code to "git subcmd" style part 3 t9700/test.pl: remove File::Temp requirement t9700/test.pl: avoid bareword 'STDERR' in 3-argument open() GIT 1.6.0.2 Fix some manual typos. Use compatibility regex library also on FreeBSD Use compatibility regex library also on AIX Update draft release notes for 1.6.0.2 Use compatibility regex library for OSX/Darwin git-svn: Fixes my() parameter list syntax error in pre-5.8 Perl Git.pm: Use File::Temp->tempfile instead of ->new t7501: always use test_cmp instead of diff Start conforming code to "git subcmd" style part 2 diff: Help "less" hide ^M from the output checkout: do not check out unmerged higher stages randomly Conflicts: Documentation/git.txt Documentation/gitattributes.txt Makefile diff.c t/t7201-co.sh
Diffstat (limited to 'combine-diff.c')
-rw-r--r--combine-diff.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/combine-diff.c b/combine-diff.c
index 0cf2a830b5..dcb90b1701 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -496,6 +496,18 @@ static int hunk_comment_line(const char *bol)
return (isalpha(ch) || ch == '_' || ch == '$');
}
+static void show_line_to_eol(const char *line, int len, const char *reset)
+{
+ int saw_cr_at_eol = 0;
+ if (len < 0)
+ len = strlen(line);
+ saw_cr_at_eol = (len && line[len-1] == '\r');
+
+ printf("%.*s%s%s\n", len - saw_cr_at_eol, line,
+ reset,
+ saw_cr_at_eol ? "\r" : "");
+}
+
static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
int use_color)
{
@@ -589,7 +601,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
else
putchar(' ');
}
- printf("%s%s\n", ll->line, c_reset);
+ show_line_to_eol(ll->line, -1, c_reset);
ll = ll->next;
}
if (cnt < lno)
@@ -613,7 +625,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
putchar(' ');
p_mask <<= 1;
}
- printf("%.*s%s\n", sl->len, sl->bol, c_reset);
+ show_line_to_eol(sl->bol, sl->len, c_reset);
}
}
}