mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 20:36:03 +02:00
support setting the author of a commit
update copy
This commit is contained in:
parent
901ab3ac1b
commit
9591cc381a
31 changed files with 141 additions and 14 deletions
|
@ -63,9 +63,21 @@ func (self *RebaseCommands) RewordCommitInEditor(commits []*models.Commit, index
|
|||
}
|
||||
|
||||
func (self *RebaseCommands) ResetCommitAuthor(commits []*models.Commit, index int) error {
|
||||
return self.GenericAmend(commits, index, func() error {
|
||||
return self.commit.ResetAuthor()
|
||||
})
|
||||
}
|
||||
|
||||
func (self *RebaseCommands) SetCommitAuthor(commits []*models.Commit, index int, value string) error {
|
||||
return self.GenericAmend(commits, index, func() error {
|
||||
return self.commit.SetAuthor(value)
|
||||
})
|
||||
}
|
||||
|
||||
func (self *RebaseCommands) GenericAmend(commits []*models.Commit, index int, f func() error) error {
|
||||
if index == 0 {
|
||||
// we've selected the top commit so no rebase is required
|
||||
return self.commit.ResetAuthor()
|
||||
return f()
|
||||
}
|
||||
|
||||
err := self.BeginInteractiveRebaseForCommit(commits, index)
|
||||
|
@ -73,8 +85,8 @@ func (self *RebaseCommands) ResetCommitAuthor(commits []*models.Commit, index in
|
|||
return err
|
||||
}
|
||||
|
||||
// now the selected commit should be our head so we'll amend it with the new author
|
||||
err = self.commit.ResetAuthor()
|
||||
// now the selected commit should be our head so we'll amend it
|
||||
err = f()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue