ROOT Analyzer/Git

From HallCWiki
Revision as of 08:05, 20 March 2012 by Saw (talk | contribs) (Git references)
Jump to navigationJump to search

It has been proposed that Hall C use the Git version control system to manage development of the Hall C 12 Gev analysis software. To start working with git, a public repository of a bare skeleton of a Hall C analyzer based on the Hall A PODD analyzer has been created.

Setting up Git

You should have git, with at least version 1.5.3 installed on your computer. Most linux systems will have git installed. https://cc.jlab.org/system/files/JLabWinCA-2011.crt Personalize git on your machine with

 git config --global user.name "Firstname Lastname"
 git config --global user.email "your_email@youremail.com"

By default, git pops up the vi editor, for the user write comments when making commits. IWef you prefer emacs, do

 git config --global core.editor "emacs"

We will be pulling the git repository from hallcweb, so we must install the JLab web certificate authority root. Get the latest certificate file (JLabWinCA-2011.crt) from [1] and put it somewhere. Then tell git the location of the crt file with

 git config --global http.sslCAInfo "/pathto/JLabWinCA-2011.crt"

On machines with old git versions (e.g. ifarml machines), it seems to be also necessary to set the following option:

 git config --global --global http.sslVerify 0

Retrieving the Hall C analyzer skeleton with git

To retrive the Hall C code with git, do

 git clone https://hallcweb.jlab.org/git/hcana.git hcana

The last word on the command line is the name of the directory that will be created. Any directory name could be used.

The hcana project includes a git "submodule" containing the source code for the Hall A analyzer. The Hall A code is not automatically downloaded with the "git clone" command. Before proceeding, do

 cd hcana
 git submodule init
 git submodule update

If you want to update your copy of the respository to the lastest public version, do

 git pull origin

See Analyzer/Compiling and Analyzer/Running to try out the code.

Using Git to develop the analyzer

We need to have a workflow methodology for developing the Hall C analyzer. "Understanding the Git Workflow" and "Our Simple Git Workflow" have some discussion of straight forward workflows.

Basically if you want to develop the analyzer, clone the git archive as described above. Then create a private branch for yourself with

 git checkout -b myprivatebranch

Then work on the code do git commit -a frequently. Don't worry about committing changes frequently. You will have the opportunity to clean up the revision history before pushing your changes to the public repository.

There are a variety of ways to share your work. If someone you want to share it with is on the same machine (and your files are readable), he can clone or pull from your archive. If your working directory is available on the web, then anyone can clone or pull from it. To put your changes in the public git repository, contact one of the code maintainers.

Branches

The public repository (https://hallcweb.jlab.org/git/hcana.git) may contain branches, either for different experiments, or for work in progress that a developer wants to share. To see what branches exist, type

 git pull origin    #Updates the local repo from the public repo
 git branch -a

from the directory you cloned the project into. For example, at the moment, there is a branch "saw_decoding" of non-working code that will be listed as "remotes/origin/saw_decoding". To check this branch out, type

 git checkout saw_decoding

Git References

Git Magic: An online book about using Git.

The Git Community Book: The official book introducing Git.

Understanding the Git Workflow

Our Simple Git Workflow