Page History
...
To make an initial checkout of the master Lustre Git repository:
| No Format |
|---|
$ git clone -b master http://git.whamcloud.com/fs/lustre-release.git lustre-master
$ cd lustre-master
|
Typically in git, one creates a new local branch for each change being made. The branch is created based on one of the local, pristine branches follow the main development branches, usually the master. A new local branch is usually create using checkout:
| No Format |
|---|
$ git checkout -b my-brilliant-idea master
|
...
In order ensure that the commit description contains the correct name and email address for you, it is possible to specify this directly to Git creating or modifying the $HOME/.gitconfig file in your home directory (preferred), or in the .git/config file in the local repository. This only needs to be done one time, or once per checkout, if done in the local repository.
| No Format |
|---|
[user]
name = Random J. Developer
email = random@developer.example.org
|
...
For Lustre patches, the both the code needs to follow specific code style guidelines (which is basically the Linux kernel CodingStyle, with extra details for Lustre), as do the commit comments for each patch. In order to help maintain the uniform code style, Lustre-specific Git commit hooks should be installed in all Lustre development trees. In the top-level directory of the checked-out Lustre repository install the hooks using:
| No Format |
|---|
ln -sf ../../build/commit-msg .git/hooks/
ln -sf ../../build/prepare-commit-msg .git/hooks/
|
...
Once you've made the change, and you're ready to create an inspection, you commit. Before you commit in Git, you need to identify which new or changed files you want to commit using git add <filename>. If you haven't added any new files, and you want to commit all the files that you have changed (which is the usual case), then you can use the -a option to commit:
| No Format |
|---|
$ git commit -av
|
This will put you into an editor to update your commit comment, and when you save it will commit the change locally. The -v option appends the diff to the edit buffer so you can review what is about to be committed. This is very useful to verify that you are committing what you want to commit, and not changes or files that are unrelated to the current change.
It is best to commit relatively frequently to keep your changes limited to a single fix. If you notice other, unrelated, issues that need to be fixed, then it's best to put them in a separate commit on a separate branch, so they can be submitted to Gerrit independently for inspection, testing, and landing. The stash command is handy for this:
| No Format |
|---|
# While fixing a bug you notice something evil that must be fixed.
# First set your current work aside:
$ git stash
# Next go create a new branch and purge the ugliness you just discovered:
$ git checkout -b my-eyes-are-bleeding master
\{ fix ugliness \}
$ git commit -av
# Now go back to what you were working on:
$ git checkout my-brilliant-idea
$ git stash pop
|
...
Sample Commit message:
| No Format |
|---|
LU-nnn component: short description of change under 62 columns
A more detailed explanation of the change being made. This can be
as detailed as you'd like, possibly several paragraphs in length.
Please provide a detailed explanation of what problem was solved,
a good high-level description of how it was solved, and which
parts of the code were affected (including function names as
needed, for easier searching). Wrap lines at 70 columns or less.
Signed-off-by: Random J Developer <random@developer.example.org>
Change-Id: Ica9ed1612eab0c4673dee088f8b441d806c64932
|
...
If you have a series of independent commits to be reviewed, each one should be in a separate local branch and pushed separately to Gerrit. This allows the patches to be inspected, tested, and landed independently, and will avoid the overhead and delay of repeatedly inspecting, building, and testing patches that are only refreshed because of an earlier (unrelated) patch in a series being modified.
| No Format |
|---|
git push ssh://USER@review.whamcloud.com:29418/fs/lustre-release HEAD:refs/for/master
|
for the "master" branch of the lustre-release repo, or:
| No Format |
|---|
git push ssh://USER@review.whamcloud.com:29418/fs/lustre-release HEAD:refs/for/b1_8
|
for the "b1_8" branch of the lustre-release repo, or:
| No Format |
|---|
git push ssh://USER@review.whamcloud.com:29418/tools/e2fsprogs HEAD:refs/for/master-lustre
|
...
For convenience, you can add this to your ~/.ssh/config file:
| No Format |
|---|
Host review
Hostname review.whamcloud.com
Port 29418
User \{YourUserid\}
IdentityFile ~/.ssh/my-key-id_rsa
|
Creating an inspection request for a change against master (assuming the remote alias has been added to ssh config):
| No Format |
|---|
git push ssh://review/fs/lustre-release HEAD:refs/for/master
|
Creating an inspection request for a change against b1_8 (assuming the remote alias has been added to ssh config):
| No Format |
|---|
git push ssh://review/fs/lustre-release HEAD:refs/for/b1_8
|
And add a the Gerrit server as a remote to your git repository:
| No Format |
|---|
$ git remote add review ssh://review/fs/lustre-release
|
...
In the case where changes need to be based on a patch from another developer, it is possible to check out the desired patch from Gerrit using one of the supplied Git URLs in the Download section under the patchset. Select the checkout and Anonymous HTTP tags, then copy the URL and paste it into a working Lustre checkout, for example to fetch patchset 16 from http://review.whamcloud.com/1264, create a branch for it, and then create a new branch for your local changes based on that change, use:
| Code Block |
|---|
[lustre]$ git fetch http://review.whamcloud.com/p/fs/lustre-release refs/changes/64/1264/16 && git checkout FETCH_HEAD
[lustre]$ git checkout -b b_1264
[lustre]$ git checkout -b b_my_changes
|
...
Create the tag with:
| Code Block |
|---|
git tag -a TAG_NAME
|
then push it upstream with
| No Format |
|---|
git push TAG_NAME
|
Note, this requires certain privileges on the server. If review is a secondary server for your repository, use
| No Format |
|---|
git push review TAG_NAME
|
Searching on Gerrit
...