Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Thursday, December 3, 2015

git core.filemode set to true in .git/config files

I notice that in all the project .git folders, core.filemode property is set to true. So I encounter so many unmodified files reported as modified when I run git status, and conflicts leading to an abort of git pull.

This is what I found.
OpenDaylight/integration$ git diff test/csit/suites/openflowplugin/Flows_OF13/306__eth_ip_qos.txt
diff --git a/test/csit/suites/openflowplugin/Flows_OF13/306__eth_ip_qos.txt b/test/csit/suites/openflowplugin/Flows_OF13/306__eth_ip_qos.txt
old mode 100644
new mode 100755
  
While I am not sure why git core.filemode set to true in .git/config files in OpenDaylight, setting it false helped me fix this block on git pull.

Changing the author name for git/gerrit commit

So this was my second time having some adventure with gerrit for OpenDaylight (also read about the first time, if you are curious). This time, I pulled the remote changes and tried to commit my new changes by adding my changes. This created a merge as the commit from the remote repository and my local commits merged in a single pull request, and hence my commit failed with the below message.

$ git review

You are about to submit multiple commits. This is expected if you are
submitting a commit that is dependent on one or more in-review
commits. Otherwise you should consider squashing your changes into one
commit before submitting.

The outstanding commits are:

fe17631 (HEAD, master) Fix bug 4535/4541
475fae6 Use odlparent-lite as artifacts parent

Do you really want to submit the above commits?
Type 'yes' to confirm, other to cancel: yes
remote: Processing changes: refs: 1, done   
To ssh://pradeeban@git.opendaylight.org:29418/messaging4transport.git
 ! [remote rejected] HEAD -> refs/publish/master/bug/4535 (you are not allowed to upload merges)
error: failed to push some refs to 'ssh://pradeeban@git.opendaylight.org:29418/messaging4transport.git'

Now,
$ git statusOn branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit, working directory clean
 
So it indeed shows as 2 commits - one mine, and the one pulled from the remote repository.

I had to rebase to the master fix this.
$  git rebase origin/master

However, this left my commit attributed to the author of the previous commit in the commit log, when I try to git review.

I had to amend the author to finally fix the commit message successfully git review following that.
$ git commit --amend --author "FirstName LastName "

Friday, October 16, 2015

Git Rebase for OpenDaylight/Gerrit

I hate merge conflicts, and luckily so far I did not have to do a git rebase for gerrit in OpenDaylight. However, this time I had to. So here are the steps I followed.

https://git.opendaylight.org/gerrit/#/c/28471/1

pradeeban@llovizna:~/OpenDaylight/distribution$ git-review -d  28471
Creating a git remote called "gerrit" that maps to:
    ssh://pradeeban@git.opendaylight.org:29418/integration/distribution.git
Downloading refs/changes/71/28471/1 from gerrit
Switched to branch "review/pradeeban_kathiravelu/28471"
pradeeban@llovizna:~/OpenDaylight/distribution$


pradeeban@llovizna:~/OpenDaylight/distribution$ git rebase origin/master
First, rewinding head to replay your work on top of it...
Applying: Add messaging4transport to integration
Using index info to reconstruct a base tree...
M    features/index/pom.xml
M    features/index/src/main/resources/features.xml
M    features/test/src/main/resources/features.xml
M    pom.xml
Falling back to patching base and 3-way merge...
Auto-merging pom.xml
CONFLICT (content): Merge conflict in pom.xml
Auto-merging features/test/src/main/resources/features.xml
CONFLICT (content): Merge conflict in features/test/src/main/resources/features.xml
Auto-merging features/index/src/main/resources/features.xml
CONFLICT (content): Merge conflict in features/index/src/main/resources/features.xml
Auto-merging features/index/pom.xml
CONFLICT (content): Merge conflict in features/index/pom.xml
Failed to merge in the changes.
Patch failed at 0001 Add messaging4transport to integration
The copy of the patch that failed is found in:
   /home/pradeeban/OpenDaylight/distribution/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".




pradeeban@llovizna:~/OpenDaylight/distribution$ git status
rebase in progress; onto b524a56
You are currently rebasing branch 'review/pradeeban_kathiravelu/28471' on 'b524a56'.
  (fix conflicts and then run "git rebase --continue")
  (use "git rebase --skip" to skip this patch)
  (use "git rebase --abort" to check out the original branch)

Unmerged paths:
  (use "git reset HEAD ..." to unstage)
  (use "git add ..." to mark resolution)

    both modified:      features/index/pom.xml
    both modified:      features/index/src/main/resources/features.xml
    both modified:      features/test/src/main/resources/features.xml
    both modified:      pom.xml

no changes added to commit (use "git add" and/or "git commit -a")



Modify the offending files, the files that are marked as 'both modified'.

Add the modified files.
pradeeban@llovizna:~/OpenDaylight/distribution$ git add features/index/pom.xml features/index/src/main/resources/features.xml features/test/src/main/resources/features.xml pom.xml

pradeeban@llovizna:~/OpenDaylight/distribution$ git rebase --continue
Applying: Add messaging4transport to integration


pradeeban@llovizna:~/OpenDaylight/distribution$ git status
On branch review/pradeeban_kathiravelu/28471
nothing to commit, working directory clean

To amend or modify the commit message,
pradeeban@llovizna:~/OpenDaylight/distribution$ git commit --amend -s

Finally submitting the changes to gerrit,
pradeeban@llovizna:~/OpenDaylight/distribution$ git review
Your change was committed before the commit hook was installed.
Amending the commit to add a gerrit change id.
remote: Processing changes: updated: 1, refs: 1, done   
remote:
remote: Updated Changes:
remote:   https://git.opendaylight.org/gerrit/28471 Adding messaging4transport features.
remote:
To ssh://pradeeban@git.opendaylight.org:29418/integration/distribution.git
 * [new branch]      HEAD -> refs/publish/master/28471

Sunday, July 1, 2012

Installing xchat-gnome from the source, on Ubuntu 12.04 / 64 bit

Building and installing xchat-gnome from the source, on Ubuntu 12.04 / 64 bit is pretty simple.

0) Install git, if you don't have already.
$ sudo apt-get install git-core

1) Check out the source code of xchat-gnome.

If you are going to build it at a later time, it is time to take a git update too (just like an svn up).
$ git pull
 
2) Get the dependencies from the repositories (If you are not following this, you will end up installing them one-by-one, as I did. Explained below under "Trial and Error - How I got the dependencies" - only for the interested, as that is an optional read).
$ sudo apt-get install gnome-common gnome-doc-utils libnotify-dev libvorbis-dev libnotify-dev libgconf2-dev libltdl-dev
 
Note: There may be more dependencies, that I may already have had in my system. If complained during the step (4), make sure to install them too!

3) Libcanberra!
Download and install libcanberra 0.29, since the version in the repositories is 0.28, and at least 0.29 is required for xchat-gnome.
Extract the tar and cd to libcanberra-0.29
$ ./configure
$ make
$ sudo make install 

4) Now building!
Move to the xchat-gnome folder
$ cd xchat-gnome
$ ./configure
$ make
$ sudo make install

5) Start xchat-gnome!
Now you may start xchat, by typing as below.
$ xchat-gnome



[Optional Read] Trial and Error - How I got the dependencies

Attempting a build, from the xchat-gnome directory.
$ sh autogen.shYou need to install gnome-common from the GNOME CVS

Let's install gnome-common
$ sudo apt-get install gnome-common

Retry.

$ sh autogen.sh
***Error***: You must have gnome-doc-utils >= 0.4.2 installed
  to build xchat-gnome.  Download the appropriate package for
  from your distribution or get the source tarball at
    http://ftp.gnome.org/pub/GNOME/sources/gnome-doc-utils/

Let's install gnome-doc-utils.
$ sudo apt-get install gnome-doc-utils

Retry.
$ sh autogen.sh
checking for LIBNOTIFY... no
configure: error: Package requirements (libnotify >= 0.7) were not met:

No package 'libnotify' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBNOTIFY_CFLAGS
and LIBNOTIFY_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.


Let's install libnotify.
$ sudo apt-get install libnotify-dev

Retry.
$ sh autogen.sh
checking for LIBCANBERRAGTK... no
configure: error: Package requirements (libcanberra-gtk3 >= 0.29) were not met:

No package 'libcanberra-gtk3' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBCANBERRAGTK_CFLAGS
and LIBCANBERRAGTK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.


Let's install libcanberra-gtk3.
$ sudo apt-get install libcanberra-gtk3-dev


Retry.
$ sh autogen.sh
oh-oh.. minimal version requirement not met!
checking whether to enable notification sounds using libcanberra... yes
checking for LIBCANBERRAGTK... no
configure: error: Package requirements (libcanberra-gtk3 >= 0.29) were not met:

Requested 'libcanberra-gtk3 >= 0.29' but version of libcanberra-gtk3 is 0.28

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBCANBERRAGTK_CFLAGS
and LIBCANBERRAGTK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

Let's download libcanberra 0.29
Extract the tar and cd to libcanberra-0.29

$ ./configure
configure: WARNING: *** lynx not found, plain text README will not be built ***
checking for VORBIS... no
configure: error: Package requirements ( vorbisfile ) were not met:

No package 'vorbisfile' found

Let's install vorbisfile
$ sudo apt-get install libvorbis-dev

Again,
$ ./configure
It is successful now.

Let's make.
$ make$ sudo make install 

Now back to xchat-gnome directory
$ sh autogen.sh
Successful!

Now make!
$ make 
$ sudo make install

Now it is built and configured!
Now you may start xchat, by typing as below.
$ xchat-gnome