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