Skip to content

Instantly share code, notes, and snippets.

@parthibx24
Last active August 29, 2023 14:55
Show Gist options
  • Save parthibx24/66354a9e3f0049e90a919edcb7f291d2 to your computer and use it in GitHub Desktop.
Save parthibx24/66354a9e3f0049e90a919edcb7f291d2 to your computer and use it in GitHub Desktop.

same git dir across remotes

diff --git i/manifest_xml.py w/manifest_xml.py
index 73be1b6..89de42e 100644
--- i/manifest_xml.py
+++ w/manifest_xml.py
@@ -1953,6 +1953,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
                 namepath = os.path.join(remote, f"{name}.git")
             else:
                 namepath = f"{name}.git"
+            
+            # force use path as git dir
+            # i.e. use same .git across manifests/remotes
+            namepath = f"{path}.git"
             worktree = os.path.join(self.topdir, path).replace("\\", "/")
             gitdir = os.path.join(self.subdir, "projects", "%s.git" % path)
             # We allow people to mix git worktrees & non-git worktrees for now.

# .repo/manifests.git/config
[core]
        repositoryFormatVersion = 1
        filemode = true
[filter "lfs"]
        smudge = git-lfs smudge --skip -- %f
        process = git-lfs filter-process --skip
[remote "origin"]
        url = https://github.com/LineageOS/android.git
        fetch = +refs/heads/*:refs/remotes/origin/*
        partialclonefilter = blob:none
[manifest]
        platform = linux
        groups = default,platform-linux
[repo]
        reference = /mnt/ext1/lineage/ #
        worktree = true #
        partialclone = true #
        clonefilter = blob:none # 
        git-lfs = true #
        clonefilterfordepth = blob:none # disables shallow clone / depth=1 for all projects

[extensions]
        partialclone = origin
[branch "default"]
        remote = origin
        merge = refs/heads/lineage-19.1
# rely on fs level compression
git -C . config core.looseCompression 0
git -C . config core.compression 0 
git -C . config pack.compression 0 

# default compression; disk 1.6G
time repo sync -v platform/frameworks/base                                 1 ✘ 
Fetching: 100% (1/1), done in 0.773s
Updating files: 100% (43556/43556), done.
Checking out: 100% (1/1), done in 37.605s
repo sync has finished successfully.
repo sync -v platform/frameworks/base  4.44s user 3.25s system 19% cpu 39.806 total

time repo sync -v platform/frameworks/base
Fetching: 100% (1/1), done in 0.840s
Updating files: 100% (43556/43556), done.
Checking out: 100% (1/1), done in 9.216s
repo sync has finished successfully.
repo sync -v platform/frameworks/base  4.54s user 5.27s system 79% cpu 12.287 total

time repo sync -v platform/frameworks/base        ✔ 
Fetching: 100% (1/1), done in 0.777s
Updating files: 100% (43556/43556), done.
Checking out: 100% (1/1), done in 7.822s
repo sync has finished successfully.
repo sync -v platform/frameworks/base  4.50s user 3.94s system 83% cpu 10.080 total




# git compression 0; disk 3G
time repo sync -v platform/frameworks/base                                   ✔ 
Fetching: 100% (1/1), done in 0.840s
Updating files: 100% (43556/43556), done.
Checking out: 100% (1/1), done in 37.145s
repo sync has finished successfully.
repo sync -v platform/frameworks/base  1.49s user 5.34s system 17% cpu 39.802 total

time repo sync -v platform/frameworks/base        ✔ 
Fetching: 100% (1/1), done in 0.841s
Updating files: 100% (43556/43556), done.
Checking out: 100% (1/1), done in 5.287s
repo sync has finished successfully.
repo sync -v platform/frameworks/base  1.75s user 3.78s system 72% cpu 7.620 total


# git compression 0; disk 3G ; 2nd run
time repo sync -v platform/frameworks/base                                   ✔ 
Fetching: 100% (1/1), done in 0.813s
Updating files: 100% (43556/43556), done.
Checking out: 100% (1/1), done in 38.428s
repo sync has finished successfully.
repo sync -v platform/frameworks/base  1.48s user 3.57s system 12% cpu 40.631 total

# git compression 0; disk 3G ; 3rd run
time repo sync -v platform/frameworks/base                                   ✔ 
Fetching: 100% (1/1), done in 0.786s
Updating files: 100% (43556/43556), done.
Checking out: 100% (1/1), done in 39.031s
repo sync has finished successfully.
repo sync -v platform/frameworks/base  1.69s user 3.51s system 12% cpu 41.278 total

# git compression 0; btrfs compression zstd-15 - 2G; disk 3G diff drive
time repo sync -v platform/frameworks/base        ✔ 
Fetching: 100% (1/1), done in 0.781s
Updating files: 100% (43556/43556), done.
Checking out: 100% (1/1), done in 5.309s
repo sync has finished successfully.
repo sync -v platform/frameworks/base  1.95s user 3.88s system 75% cpu 7.689 total

time repo sync -v platform/frameworks/base        ✔ 
Fetching: 100% (1/1), done in 0.835s
Updating files: 100% (43556/43556), done.
Checking out: 100% (1/1), done in 5.759s
repo sync has finished successfully.
repo sync -v platform/frameworks/base  1.97s user 4.10s system 65% cpu 9.215 total

time repo sync -v platform/frameworks/base        ✔ 
Fetching: 100% (1/1), done in 0.777s
Updating files: 100% (43556/43556), done.
Checking out: 100% (1/1), done in 4.890s
repo sync has finished successfully.
repo sync -v platform/frameworks/base  1.76s user 3.75s system 76% cpu 7.188 total
    ~/Do

time repo sync -v platform/frameworks/base        ✔ 
Fetching: 100% (1/1), done in 0.948s
Updating files: 100% (43556/43556), done.
Checking out: 100% (1/1), done in 4.786s
repo sync has finished successfully.
repo sync -v platform/frameworks/base  1.64s user 3.87s system 76% cpu 7.180 total


btrfs zstd-5
time repo sync -v platform/frameworks/base        ✔ 
Fetching: 100% (1/1), done in 0.806s
Updating files: 100% (43556/43556), done.
Checking out: 100% (1/1), done in 4.677s
repo sync has finished successfully.
repo sync -v platform/frameworks/base  1.80s user 3.92s system 81% cpu 6.999 total


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment