rtyler / otto

Otto is your friendly continuous delivery companion.
GNU Affero General Public License v3.0
80 stars 5 forks source link

git step caches should act as proper reference repositories #61

Open rtyler opened 3 years ago

rtyler commented 3 years ago

Right now the git step is doing some funny business to cache git repositories on the agent. The git2 crate which is itself based on libgit2 doesn't overtly support using a reference repository on the clone operation.

After some discussion in #libgit2, there's potentially a workaround:

13:26:00 rtyler | my understanding for cloning with a reference repository is that the reference is used primarily, and then the "upstream" repo 
                | is the alternate (to use this parlance)
13:27:55 qyliss | I'm not sure                                                                                                       
13:28:00 qyliss | but should be easy to test                                                                                          
13:30:41 qyliss | rtyler: it looks like the odb is a property of the repository                                                          
13:30:50 qyliss | see here: https://libgit2.org/libgit2/#HEAD/group/repository/git_repository_odb                                     
13:31:22 qyliss | so I think what you'd want to do is make an empty repository, set up your remote, get the odb, set up your alternate, and then
                | fetch
13:31:36 qyliss | I think in this case the alternate would be the other local repository.                                             
13:31:45 rtyler | yeah that makes sense                       

For this issue, first need to validate the experimental approach of:

If that actually works, replacing the clone() function in stdlib/git should be relatively straightforward.