git/githistory: only update local refs

This commit is contained in:
Taylor Blau 2017-09-07 13:47:42 -04:00
parent 5e4f4ad3ba
commit 4cc043a6d4

@ -410,10 +410,29 @@ func (r *Rewriter) commitsToMigrate(opt *RewriteOptions) ([][]byte, error) {
// refsToMigrate returns a list of references to migrate, or an error if loading
// those references failed.
func (r *Rewriter) refsToMigrate() ([]*git.Ref, error) {
var refs []*git.Ref
var err error
if root, ok := r.db.Root(); ok {
return git.AllRefsIn(root)
refs, err = git.AllRefsIn(root)
} else {
refs, err = git.AllRefs()
}
return git.AllRefs()
if err != nil {
return nil, err
}
var local []*git.Ref
for _, ref := range refs {
if ref.Type == git.RefTypeRemoteBranch || ref.Type == git.RefTypeRemoteTag {
continue
}
local = append(local, ref)
}
return local, nil
}
// scannerOpts returns a *git.ScanRefsOptions instance to be given to the