Skip to content

Conversation

@mobileoverlord
Copy link
Contributor

This is a start to adding sparse checkout to the GIT SCM.

Sparse checkout can be used for picking a dep from a repo which may contain many deps in sub folders

For example.

The git repository
https://github.com/nerves-project/toolchains
contains many toolchains including
nerves_toolchain_armv5tejl_unknown_linux_musleabi

To use git and single out that subfolder int he repo as the dependency destination we could use sparse

{:nerves_toolchain_armv5tejl_unknown_linux_musleabi, github: "nerves-project/toolchains", sparse: "nerves_toolchain_armv5tejl_unknown_linux_musleabi"}

@mobileoverlord
Copy link
Contributor Author

mobileoverlord commented Jul 26, 2016

Things to do yet

  • Verify update / locks
  • Verify git version minimum for sparse checkout (1.7.0)
  • Add tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can store the :dest option as :checkout or :git_dest so you don't need to use replace_suffix later on.

@josevalim
Copy link
Member

One of the scenarios we will need to test is using the same checkout and moving from sparse to non-sparse and vice-versa (i.e. add and remove the sparse option, does it still work?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot use sparse with the other options?

@mobileoverlord
Copy link
Contributor Author

I agree @ericmj I misunderstood the intention. I have changed it to revert that test and I have also added the ability to define multiple sparse options as the sparse function allows this. I haven't figured out a reason you would need to do this to satisfy a dependency, but, I also don't know of a reason not to allow it.

As per testing turning it off and on and updating. I didn't see any active git tests in the suite. Should I just try these scenarios out, or do we want to use this time to make additional tests?

@mobileoverlord
Copy link
Contributor Author

hum thats curious, those tests didn't fail for me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should allow multiple sparse because dest will point to only one of them.

@mobileoverlord
Copy link
Contributor Author

I don't understand why I am getting different test results. I don;t get this failure when I run make test but I do get other failures

test uniq/1 (EnumTest.Range)
     test/elixir/enum_test.exs:1236
     ** (UndefinedFunctionError) function Stream.Reducers.uniq_by/1 is undefined or private. Did you mean one of:

           * uniq_by/1
           * uniq_by/2

     stacktrace:
       (elixir) Stream.Reducers.uniq_by(#Function<187.4743325/1 in Enum.uniq/1>)
       (elixir) lib/enum.ex:2489: Enum.uniq_by/2
       test/elixir/enum_test.exs:1237: (test)

@mobileoverlord
Copy link
Contributor Author

mobileoverlord commented Jul 30, 2016

I figured out the tests 😄

@mobileoverlord
Copy link
Contributor Author

mobileoverlord commented Jul 30, 2016

so I added a helper which chooses :git_dest if it exists and falls back to :dest. I talked with @ericmj and I am not sure which approach is better, this or always having :git_dest. We would have to fix a handful of tests to include the git_dest key.

@mobileoverlord
Copy link
Contributor Author

Also, I've been using this sample for testing
https://github.com/mobileoverlord/sparse

@josevalim josevalim merged commit f6b9c99 into elixir-lang:master Aug 20, 2016
josevalim pushed a commit that referenced this pull request Aug 20, 2016
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants