Skip to content

Commit 879bf40

Browse files
committed
Always use full-index in repo_diff
1 parent 3bf9b91 commit 879bf40

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

repo_diff.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ func (r *Repository) RawDiff(rev string, diffType RawDiffFormat, w io.Writer, op
9797
switch diffType {
9898
case RawDiffNormal:
9999
if commit.ParentsCount() == 0 {
100-
cmd.AddArgs("show", rev)
100+
cmd.AddArgs("show", "--full-index", rev)
101101
} else {
102102
c, _ := commit.Parent(0)
103-
cmd.AddArgs("diff", "-M", c.ID.String(), rev)
103+
cmd.AddArgs("diff", "--full-index", "-M", c.ID.String(), rev)
104104
}
105105
case RawDiffPatch:
106106
if commit.ParentsCount() == 0 {
107-
cmd.AddArgs("format-patch", "--no-signature", "--stdout", "--root", rev)
107+
cmd.AddArgs("format-patch", "--full-index", "--no-signature", "--stdout", "--root", rev)
108108
} else {
109109
c, _ := commit.Parent(0)
110-
cmd.AddArgs("format-patch", "--no-signature", "--stdout", rev+"..."+c.ID.String())
110+
cmd.AddArgs("format-patch", "--full-index", "--no-signature", "--stdout", rev+"..."+c.ID.String())
111111
}
112112
default:
113113
return fmt.Errorf("invalid diffType: %s", diffType)
@@ -135,5 +135,5 @@ func (r *Repository) DiffBinary(base, head string, opts ...DiffBinaryOptions) ([
135135
opt = opts[0]
136136
}
137137

138-
return NewCommand("diff", "--binary", base, head).RunInDirWithTimeout(opt.Timeout, r.path)
138+
return NewCommand("diff", "--full-index", "--binary", base, head).RunInDirWithTimeout(opt.Timeout, r.path)
139139
}

0 commit comments

Comments
 (0)