Where are saved git-commited packages?

When I run:

Pkg.add(url="git@github.com:sylvaticus/DICE.jl.git", rev="master")

(without Pkg.dev)

where the source code of the package is saved ?

Let’s try it out, with a simpler package.

$ mkdir /tmp/testdepot
$ JULIA_DEPOT_PATH=/tmp/testdepot julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.7 (2024-11-26)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(@v1.10) pkg> add Example#master
  Installing known registries into `/tmp/testdepot`
       Added `General` registry to /tmp/testdepot/registries
       Added `CVRegistry` registry to /tmp/testdepot/registries
     Cloning git-repo `https://github.com/JuliaLang/Example.jl.git`
    Updating git-repo `https://github.com/JuliaLang/Example.jl.git`
    Updating registry at `/tmp/testdepot/registries/CVRegistry.toml`
    Updating registry at `/tmp/testdepot/registries/General.toml`
   Resolving package versions...
    Updating `/tmp/testdepot/environments/v1.10/Project.toml`
  [7876af07] + Example v0.5.5 `https://github.com/JuliaLang/Example.jl.git#master`
    Updating `/tmp/testdepot/environments/v1.10/Manifest.toml`
  [7876af07] + Example v0.5.5 `https://github.com/JuliaLang/Example.jl.git#master`
Precompiling project...
  1 dependency successfully precompiled in 1 seconds

(@v1.10) pkg> 

$ tree -d -L 3 /tmp/testdepot/
/tmp/testdepot/
β”œβ”€β”€ clones
β”‚   └── 4643033083726148914
β”‚       β”œβ”€β”€ hooks
β”‚       β”œβ”€β”€ info
β”‚       β”œβ”€β”€ objects
β”‚       └── refs
β”œβ”€β”€ compiled
β”‚   └── v1.10
β”‚       └── Example
β”œβ”€β”€ environments
β”‚   └── v1.10
β”œβ”€β”€ logs
β”œβ”€β”€ packages
β”‚   └── Example
β”‚       └── A1z7K
β”œβ”€β”€ registries
└── scratchspaces
    └── 44cfe95a-1eb2-52ea-b672-e2afdf69b78f

It’s maybe not completely obvious but I interpret this to be that we have a clone of the Example repository in clones and a snapshot of the master branch in packages. When you don’t set JULIA_DEPOT_PATH those would be inside your .julia directory.

The subdirectory name A1z7K is computed from some information that I don’t remember in detail but you can find it for the loaded version of the package with pathof. I have never looked into the naming of the subdirectories of clones.

2 Likes

It is a CRC32 hash of the uuid and the tree sha1 hash.