Skip to content

Commit

Permalink
vbehar
Browse files Browse the repository at this point in the history
  • Loading branch information
jashandeep-sohi authored Sep 9, 2024
1 parent abe9f08 commit c86a23b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions repository/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,18 +437,18 @@ func buildDiffTreeEntries(ctx context.Context, base, head *object.Commit) ([]*gi

for _, c := range treeDiff {
var path, mode, treeType, sha, content *string
var entry object.TreeEntry
var entry object.ChangeEntry

switch c.To.TreeEntry.Mode {
case filemode.Empty:
entry = c.From.TreeEntry
entry = c.From
case filemode.Dir, filemode.Submodule:
entry = c.To.TreeEntry
sha = ptr(entry.Hash.String())
entry = c.To
sha = ptr(entry.TreeEntry.Hash.String())
default:
entry = c.To.TreeEntry
entry = c.To

file, err := c.To.Tree.TreeEntryFile(&entry)
file, err := c.To.Tree.TreeEntryFile(&entry.TreeEntry)
if err != nil {
return nil, fmt.Errorf("failed to get tree entry file: %w", err)
}
Expand All @@ -461,8 +461,8 @@ func buildDiffTreeEntries(ctx context.Context, base, head *object.Commit) ([]*gi
}

path = ptr(entry.Name)
treeType = ptr(treeEntryModeToTreeType(entry.Mode))
mode = ptr(fmt.Sprintf("%06o", uint32(entry.Mode)))
treeType = ptr(treeEntryModeToTreeType(entry.TreeEntry.Mode))
mode = ptr(fmt.Sprintf("%06o", uint32(entry.TreeEntry.Mode)))

treeEntries = append(treeEntries, &github.TreeEntry{
Path: path,
Expand Down

0 comments on commit c86a23b

Please sign in to comment.