Updating a Git Baselibs Component
Updating a Git Baselibs Component Steps
This will use cURL as an example.
Clone component (if not cloned)
First, clone the component:
$ git clone git@developer.nasa.gov:mathomp4/ESMA-Baselibs-curl.git $ cd ESMA-Baselibs-curl
Update component (if cloned already)
$ git remote update $ git pull (if necessary)
Work on vendor branch
Next, move to the vendor branch:
$ git checkout vendor
(Note, if vendor doesn't exist yet, make it with git checkout -b vendor)
Move to new code
Synchronize the code:
$ rsync -avi --exclude '.gitignore' --exclude '.git' /ford1/share/gmao_SIteam/Baselibs/Submodules/curl-7.53.1/ /ford1/share/gmao_SIteam/Baselibs/Submodules/ESMA-Baselibs-curl/
Now, this can be dangerous. If you know some files need to be kept because of patches, then --exclude them or copy them away and restore. The next thing to do is to make sure things are the same/similar:
$ xxdiff -r /ford1/share/gmao_SIteam/Baselibs/Submodules/curl-7.53.1/ /ford1/share/gmao_SIteam/Baselibs/Submodules/ESMA-Baselibs-curl/
Examine that. If files or directories need to be deleted, you can either re-run the above rsync with --delete, or do so manually.
Commit to vendor
Once you are satisfied that the code is correct, commit and tag:
$ git add . $ git commit -m 'Update cURL to 7.53.1' $ git tag -a vendor/7.53.1 -m "Tag vendor/7.53.1"
If you need to check things out, run tig to verify:
$ tig --all
Merge to master
Now merge to master:
$ git checkout master $ git merge vendor
Push our changes
$ git push --all $ git push --tags
The all push moves both branches over, and the tags for the vendor tag.
Create our version tags
Because the .gitmodules file that submodules works with only accepts branches, we create a "fake" version branch, push it, and do a normal tag:
$ git branch version/7.53.1 $ git push origin version/7.53.1 $ git tag -a 7.53.1 -m "Tag version 7.53.1" $ git push --tags
Main Repo
Don't forget to then update the .gitmodules in the main ESMA-Baselibs repo to refer to the new version/<num> branch. To do this, first do a nice clean checkout of the repo for safety:
$ git clone --recursive git@developer.nasa.gov:mathomp4/ESMA-Baselibs.git
Then, you can go into it and edit .gitmodules. Once you've changed the branch to use then issue:
$ git submodule update --remote <component>
If you have more than one, you can leave off the component and it will update all the submodules.
Now you can commit your changes, and push. First:
$ git status
Make sure you see the updates for the submodules like:
$ git status On branch master Your branch is up to date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: .gitmodules modified: Arch.mk modified: Base.mk modified: CONTENTS modified: ChangeLog modified: GNUmakefile modified: INSTALL modified: README modified: VERSION modified: cdo (new commits) modified: curl (new commits) modified: esmf (new commits) modified: esmf_rules.mk modified: nco (new commits) modified: netcdf (new commits) Submodules changed but not updated: * cdo 4ece165...1595029 (1): > Merge branch 'vendor' * curl 05e9abd...ae61aef (1): > Update cURL to 7.60.0 * esmf 433c628...eccfad6 (1): > Merge branch 'vendor' * nco 5ed56ad...23f4000 (1): > Update NCO to 4.7.4 * netcdf c45c7c2...871d029 (2): > Merge branch 'vendor' > Merge branch 'vendor' no changes added to commit (use "git add" and/or "git commit -a")
Once that's done, commit with a good message (usually what the new stuff added to ChangeLog is):
$ git add . $ git commit $ git push $ git tag -a 5.1.1 -m "Tag version 5.1.1" $ git push --tags
$ git