(s storer.EncodedObjectStorer, old, new plumbing.Hash, earliestShallow *plumbing.Hash)
| 1112 | } |
| 1113 | |
| 1114 | func isFastForward(s storer.EncodedObjectStorer, old, new plumbing.Hash, earliestShallow *plumbing.Hash) (bool, error) { |
| 1115 | c, err := object.GetCommit(s, new) |
| 1116 | if err != nil { |
| 1117 | return false, err |
| 1118 | } |
| 1119 | |
| 1120 | parentsToIgnore := []plumbing.Hash{} |
| 1121 | if earliestShallow != nil { |
| 1122 | earliestCommit, err := object.GetCommit(s, *earliestShallow) |
| 1123 | if err != nil { |
| 1124 | return false, err |
| 1125 | } |
| 1126 | |
| 1127 | parentsToIgnore = earliestCommit.ParentHashes |
| 1128 | } |
| 1129 | |
| 1130 | found := false |
| 1131 | // stop iterating at the earliest shallow commit, ignoring its parents |
| 1132 | // note: when pull depth is smaller than the number of new changes on the remote, this fails due to missing parents. |
| 1133 | // as far as i can tell, without the commits in-between the shallow pull and the earliest shallow, there's no |
| 1134 | // real way of telling whether it will be a fast-forward merge. |
| 1135 | iter := object.NewCommitPreorderIter(c, nil, parentsToIgnore) |
| 1136 | err = iter.ForEach(func(c *object.Commit) error { |
| 1137 | if c.Hash != old { |
| 1138 | return nil |
| 1139 | } |
| 1140 | |
| 1141 | found = true |
| 1142 | return storer.ErrStop |
| 1143 | }) |
| 1144 | return found, err |
| 1145 | } |
| 1146 | |
| 1147 | func (r *Remote) newUploadPackRequest(o *FetchOptions, |
| 1148 | ar *packp.AdvRefs) (*packp.UploadPackRequest, error) { |
no test coverage detected