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

alaadahmed
Hi folks, I tried Phoenix 1.7 and it is awesome, but I have small suggestion, which in my opinion will organize files in a better way. ...
New
rmoorman
Current situation Currently, the structure of the HTML returned by phoenix is determined by the layouts (components/layouts/[root,app].ht...
New
PJUllrich
Hey folks, I have the unique problem that I need to ignore all “change” and “input” events for one specific input element in a LiveView F...
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
GenericJam
I’ve been messing around with image generation models recently and thought this could be wrapped in a library or people could just use th...
New
woylie
We are seeing a lot of warning logs like this: navigate event to "https://someurl" failed because you are redirecting across live_sessio...
New
eagle-head
Hi everyone, I’ve been researching Content Security Policy Level 3 support in Phoenix and wanted to share my findings and a proposal for...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44139 214
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New

We're in Beta

About us Mission Statement