Merge branch 'js/diff-notice-has-drive-prefix'

Under certain circumstances, "git diff D:/a/b/c D:/a/b/d" on
Windows would strip initial parts from the paths because they
were not recognized as absolute, which has been corrected.

* js/diff-notice-has-drive-prefix:
  diff: don't attempt to strip prefix from absolute Windows paths
This commit is contained in:
Junio C Hamano
2018-10-30 15:43:45 +09:00
2 changed files with 12 additions and 2 deletions

4
diff.c
View File

@ -4302,12 +4302,12 @@ static void diff_fill_oid_info(struct diff_filespec *one, struct index_state *is
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 && !is_absolute_path(*namep)) {
*namep += prefix_length;
if (**namep == '/')
++*namep;
}
if (*otherp && **otherp != '/') {
if (*otherp && !is_absolute_path(*otherp)) {
*otherp += prefix_length;
if (**otherp == '/')
++*otherp;