rhcarvalho

rhcarvalho

Mix Git dependency with shallow clone

Hi all,

I would like to gather some feedback before a more intentional proposal to add a new :depth option when specifying a Git dependency on mix.exs.

I noticed that Mix Git dependencies have several smart options, including :ref and :sparse, but there is no way to tell mix to make shallow clones for use cases where the full repository history is not needed.

Shallow clones have the potential to reduce the space in disk for dependencies installed from Git/GitHub, as well as save time on deployments/CI by downloading less data.

One use case for me is to depend on a tagged version of Heroicons by pulling in as little data as possible (see Vendored heroicons take up considerable space on new projects · Issue #5622 · phoenixframework/phoenix · GitHub).

Would your workflows benefit from such new :depth option? Would you prefer having something else instead?


Notes

  • Impact on existing eco-system: I think minimal. The change would add one more line in the Mix documentation linked above, code changes to pass the --depth flag to git (though I’m not familiar with how Git integration is actually implemented yet). The option can be safely ignored by most people, and appreciated by those who need it.
  • Impact on learning: No one needs to learn about this until they need to use it (and then they might bring their Git knowledge from elsewhere anyway).
  • I have not found similar suggestions in the past. I found that the most recent addition was :subdir in Elixir 1.13.

If the community finds this useful and a proposal would be accepted, I would like to work on it and submit a PR.

Most Liked

josevalim

josevalim

Creator of Elixir

I would accept a PR for --depth but we need to be careful with what happens when you initially clone a repo with --depth 1 and then you change it to point to another reference. Our code needs to be smart enough to know that it needs to fetch something more recent.

Where Next?

Popular in Proposals: Ideas Top

snofang
In a typical business development task, having a function in a context module which accepts attributes of map type and passes them to Ect...
New
nhpip
So the other day I was rearranging the supervisor hierarchy of our product and I had a thought. In addition to creating a child spec with...
New
rhcarvalho
Hi all, I would like to gather some feedback before a more intentional proposal to add a new :depth option when specifying a Git depende...
New
cevado
Being able to build nested relations in a schemaless changeset would be helpful to deal with complex forms on Phoenix without the need to...
New
jakeprem
Goal: To make JS.patch and JS.navigate more interoperable with JS.push. Scenario: Imagine making a reusable Phoenix component and you wa...
New
markevans
Hi! I’m excited about everything that’s going on re. gradual typing and am really pleased to see that Jose and the team seem to be think...
New
manhvu
In a large repo, working with module need to add alias too much is quite annoyed and not good for organizing code. I think better add su...
New
winsalva
Hello all. First of all i’m running this using termux on an android phone. Running mix assets.setup shows this message 06:54:08.450 [de...
New
sodapopcan
So after complaining about this for the third or fourth time on this forum, I figured I should make a proposal. TL;DR with can be hard t...
New
bartblast
This could resolve to {[a: 1, b: 2]}. Was it ever considered to allow such syntax? Notice this: {:abc, a: 1, b: 2} and this: my_fun(:abc,...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement