Skip to content

Commit

Permalink
td: Handle name changes. (#723)
Browse files Browse the repository at this point in the history
This commit updates the change name to try to use the `To` name first.
Given we skip deletes, the to field should always be populated.
  • Loading branch information
betterengineering authored Apr 17, 2023
1 parent 3c71b53 commit 18292b5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tools/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,12 @@ func DetermineChanges(dir string, oldCommit string, newCommit string) ([]string,

func getChangeName(change *object.Change) string {
var empty = object.ChangeEntry{}
if change.From != empty {
return change.From.Name

// Given we skip deletes, this should never be empty. To should be populated
// on inserts and modifications.
if change.To != empty {
return change.To.Name
}

return change.To.Name
return change.From.Name
}

0 comments on commit 18292b5

Please sign in to comment.