|
|
@@ -498,6 +498,8 @@ parsingLoop: |
|
|
|
break parsingLoop |
|
|
|
} |
|
|
|
switch { |
|
|
|
case strings.HasPrefix(line, cmdDiffHead): |
|
|
|
break curFileLoop |
|
|
|
case strings.HasPrefix(line, "old mode ") || |
|
|
|
strings.HasPrefix(line, "new mode "): |
|
|
|
if strings.HasSuffix(line, " 160000\n") { |
|
|
@@ -815,8 +817,15 @@ func GetDiffRangeWithWhitespaceBehavior(repoPath, beforeCommitID, afterCommitID |
|
|
|
ctx, cancel := context.WithCancel(git.DefaultContext) |
|
|
|
defer cancel() |
|
|
|
var cmd *exec.Cmd |
|
|
|
if len(beforeCommitID) == 0 && commit.ParentCount() == 0 { |
|
|
|
cmd = exec.CommandContext(ctx, git.GitExecutable, "show", afterCommitID) |
|
|
|
if (len(beforeCommitID) == 0 || beforeCommitID == git.EmptySHA) && commit.ParentCount() == 0 { |
|
|
|
diffArgs := []string{"diff", "--src-prefix=\\a/", "--dst-prefix=\\b/", "-M"} |
|
|
|
if len(whitespaceBehavior) != 0 { |
|
|
|
diffArgs = append(diffArgs, whitespaceBehavior) |
|
|
|
} |
|
|
|
// append empty tree ref |
|
|
|
diffArgs = append(diffArgs, "4b825dc642cb6eb9a060e54bf8d69288fbee4904") |
|
|
|
diffArgs = append(diffArgs, afterCommitID) |
|
|
|
cmd = exec.CommandContext(ctx, git.GitExecutable, diffArgs...) |
|
|
|
} else { |
|
|
|
actualBeforeCommitID := beforeCommitID |
|
|
|
if len(actualBeforeCommitID) == 0 { |