[Contents] [TitleIndex] [WordIndex

GIT: Reviewing a commit

This information is for Scilab developers and code contributors. See GIT for a table of content.

If you are a user of Scilab, you probably don't need to look at this.

In this page, we describe the process to apply to review a commit.

Summary of the process

The following assumes that the commit affects the master branch.

The abstract is the following.

1. Getting the commit to be updated

   1 git fetch ssh://{USERNAME}@git.scilab.org:29418/scilab refs/changes/{COMMIT_ID} && \
   2 git cherry-pick FETCH_HEAD
   3 # where {USERNAME} is your CodeReview username found in your CodeReview Setting
   4 # and {COMMIT_ID} is the ID of the commit found on CodeReview
   5 

Gerrit actually gives you the command, on the upper right: gerrit_cherry-pick.png

2. Make the review: compile, run the tests, build the help.

3. Update the commit into Gerrit

git add scilab/CHANGES_{SCILAB_VERSION}
git commit -c FETCH_HEAD
git push origin master:refs/for/master

3. Getting clean back again

git fetch
git reset --hard remotes/origin/master

Detailed session

1. Getting the commit to be updated

user@MYMACHINE /c/mygitrepository/git-master/scilab (master)
$ git status
# On branch master
nothing to commit (working directory clean)

$ git fetch ssh://firstname.lastname@git.scilab.org:29418/scilab refs/changes/29/2629/3 && git cherry-pick FETCH_HEAD
remote: Counting objects: 30244, done
remote: Compressing objects: 100% (10/10)
Unpacking objects: 100% (10/10), done.
From ssh://git.scilab.org:29418/scilab
 * branch            refs/changes/29/2629/3 -> FETCH_HEAD
Automatic cherry-pick failed.  After resolving the conflicts,
mark the corrected paths with 'git add <paths>' or 'git rm <paths>'
and commit the result with:

        git commit -c FETCH_HEAD

2. Make the review: compile, run the tests, build the help.

Here we have a conflict in the CHANGES.

user@MYMACHINE /c/mygitrepository/git-master/scilab (master)
$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   scilab/modules/helptools/help/en_US/man.xml
#       deleted:    scilab/modules/helptools/help/pt_BR/man.xml
#
# Unmerged paths:
#   (use "git reset HEAD <file>..." to unstage)
#   (use "git add/rm <file>..." as appropriate to mark resolution)
#
#       both modified:      scilab/CHANGES_{SCILAB_VERSION}
#

3. Update the commit into Gerrit

user@MYMACHINE /c/mygitrepository/git-master/scilab (master)

$ git add scilab/CHANGES_{SCILAB_VERSION}
user@MYMACHINE /c/mygitrepository/git-master/scilab (master)

$ git commit -c FETCH_HEAD
[master 9977016] bug 4821 fixed - help file 'man' was obsolete.
 Author: Allan CORNET <allan.cornet@scilab.org>
 3 files changed, 238 insertions(+), 552 deletions(-)
 rewrite scilab/modules/helptools/help/en_US/man.xml (91%)
 delete mode 100644 scilab/modules/helptools/help/pt_BR/man.xml
user@MYMACHINE /c/mygitrepository/git-master/scilab (master)

$ git push origin master:refs/for/master
Counting objects: 19, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 2.95 KiB, done.
Total 10 (delta 7), reused 0 (delta 0)
To ssh://firstname.lastname@git.scilab.org:29418/scilab
 * [new branch]      master -> refs/for/master

4. Getting clean back again

user@MYMACHINE /c/mygitrepository/git-master/scilab (master)
$ git fetch
Enter passphrase for key '/c/Users/user/.ssh/id_rsa':
remote: Counting objects: 34652, done
remote: Compressing objects: 100% (143/143)
Receiving objects: 100% (143/143), 25.63 KiB, done.
Resolving deltas: 100% (105/105), completed with 59 local objects.
From ssh://git.scilab.org:29418/scilab
   4b25c38..0600169  master     -> origin/master
   184789c..393e2ef  YaSp       -> origin/YaSp

user@MYMACHINE /c/mygitrepository/git-master/scilab (master)
$ git reset --hard remotes/origin/master
HEAD is now at 0600169 View Code capability does not work under MacOSX.

2022-09-08 09:27