MordechaiHadad / bob

A version manager for neovim
MIT License
1.45k stars 35 forks source link

Building from source takes longer than it should #155

Closed lostl1ght closed 1 year ago

lostl1ght commented 1 year ago

Hello!

IMO bob should not clone the entire neovim repo when building from source because it is 230 MiB in size. Instead it should only clone a commit that is requested by a user.

This can be achieved with the following script:

if [[ -d neovim-git ]]; then
    cd neovim-git
else
    mkdir neovim-git
    cd neovim-git
    [[ -d .git ]] || git init
fi
if git remote get-url origin >/dev/null 2>/dev/null; then
    git remote set-url origin https://github.com/neovim/neovim.git
else
    git remote add origin https://github.com/neovim/neovim.git
fi
git fetch --depth 1 origin "$HASH"
git checkout FETCH_HEAD

As far as I understand this should match the current behaviour when a user tries to build multiple versions from source and bob does that in the same neovim-git folder.

Cloning neovim this way downloads only 12 MiB of files.

Are you interested in such fuctionality? If so I can try to implement that.

MordechaiHadad commented 1 year ago

I was looking with another user for cloning by hash instead of the entire repo recently and only found being able to get the source code of a specific commit via github's API, but this seems a lot better.

If you are willing to make a PR be my guest, but make sure it's cross platform so the only sub process you will run is git.

This is a very good solution btw

MordechaiHadad commented 1 year ago

@tamton-aquib seems like someone is willing to make your wish come true