Skip to content

eCLM branch with full history from CLM5, CIME, FATES, MOSART #96

@jjokella

Description

@jjokella

Triggered by discussions with @DCaviedesV and @AGonzalezNicolas (additionally interesting for @kvrigor and @spoll ), I try to construct an eCLM-branch with the full history of all source files included: master-with-history-clean.

Goal

Have all the history of the source files of eCLM, all merged into the initial commit of eCLM, such that the eCLM-history since the initial commit is completely linear and identical to current master.

Workflow

Only to be tried out locally in a new clone/copy of eCLM!

Could possibly be made more stream-lined (e.g. two filter-repo commands turned into one).

Major points

  • adding upstream history with replace command
  • removing LFS files from the upstream history
    # 0. Add remotes and fetch branches/tags
    git remote add clm5 git@github.com:ESCOMP/CTSM.git
    git remote add cime git@github.com:ESMCI/cime.git
    git remote add fates https://github.com/NGEET/fates
    git remote add mosart https://github.com/ESCOMP/MOSART
    git fetch --all

    # 1. Create new clean branch from master-with-history
    git checkout -b master-with-history-clean master

    # 2. Apply graft to connect upstream history
    git replace --graft f6b981fe6 release-clm5.0 cime5.6.47 release-cesm2.0.04 sci.1.30.0_api.8.0.0

    # 3. Filter out LFS files - REMOVE the --refs parameter and add more file types
    rm -rf .git/filter-repo  # Clear any previous filter-repo state
    git filter-repo --force --invert-paths \
      --path-glob '*.nc' \
      --path-glob '*.pdf' \
      --path-glob '*.rda' \
      --path-glob '*.bin' \
      --path-glob '*.dat' \
      --refs master-with-history-clean

    # 4. Remove the graft replacement (now permanent in history)
    git replace -d f6b981fe6

    # 5. Optimize repository size
    git gc --aggressive --prune=now

    # 6. Uninstall LFS hooks and remove LFS config
    git filter-repo --force --blob-callback 'if len(blob.data) < 200 and blob.data.startswith(b"version https://git-lfs.github.com/spec/v1"): blob.skip()'

    #7. Check LFS
    git lfs migrate info --everything info

    # 8. Optimize repository size II
    git gc --aggressive --prune=now

    # 8. Checking that the blames contain the history
    git blame src/clm5/biogeochem/CNFUNMod.F90 | head -1
    git blame src/clm5/fates/biogeophys/EDSurfaceAlbedoMod.F90 | head -1
    git blame src/mosart/src/riverroute/RtmIO.F90 | head -1
    git blame src/eclm/prep_ice_mod.F90 | head -1
    git blame src/stub_comps/wav_comp_mct.F90 | head -1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions