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

martosaur
TL;DR Logger.Translator acts as a global filter and swallows structure of some OTP reports, which some logger handlers could benefit from...
New
Asd
Process.resolve/1 What it does Takes any possible name of the process and returns a pid of the process or port (or nil if none found). Si...
New
mudasobwa
I am not sure it deserves to be discussed in the mailing list, so I’d start here. assert/1 and/or refute/1 macros print the following er...
New
MeerKatDev
many times we do stuff like (e.g. test setups, json views in phoenix) aaa = ... bbb = ... ccc = ... %{aaa: aaa, bbb: bbb, ccc: ccc} and...
New
pdgonzalez872
Hi! There has been some discussion about hiring/jobs on here and I thought about running this by everyone. I wanted to try to help recr...
New
RobinBoers
Hi. We had a few issues in our project regarding mix tasks, where we expected the items in the @requirements module tag to have been exec...
New
ffloyd
The Problem Currently, if I define a struct in the following way: defmodule MyStruct do # Both x and y will have the FIXED values unti...
New
7rans
I implemented Access behavior for a struct today. Pseudo-code… defmodule MyStruct do defstruct data: %{} @behaviour Access # ... ...
New
Oliver
One common problem we face in constructing lists is that there is (AFAIK) no support for conditionally inserting members into list declar...
New
cheerfulstoic
I feel like Elixir is getting big enough and old enough that I’m starting to experience problems with conflicting dependencies. An examp...
New

Other popular topics Top

sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
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
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

We're in Beta

About us Mission Statement