vcs
Git Error: trailing whitespace, indent SP followed by a TAB, unresolved merge conflict
6I have been using Git from last few days, and faced following errors while committing:
1) Trailing whitespace
2) Indent SP followed by a TAB
3) Unresolved merge conflict
The first error “Trailing whitespace” is because of carriage-return/line-feed(windows style line feed/end). To resolve this problem comment following lines(58-60) in .git/hooks/pre-commit file:
if (/\s$/) { bad_line("trailing whitespace", $_); }
The second one “Indent SP followed by a TAB” is because of leading spaces/tabs. To resolve this problem comment following lines(61-63) in .git/hooks/pre-commit file:
if (/^\s* /) { bad_line("indent SP followed by a TAB", $_); }
The third one “Unresolved merge conflict” is because of seven or more successive occurrence of = or < or > characters. Major chances of having seven = character in README or doc files. To resolve this problem replace following line(64) in .git/hooks/pre-commit file:
if (/^(?:[<>=]){7}/) {
by
if (/^(?:[<>=]){7}$/) {
These tricks worked for me, I hope it could help you.
Git – Fast Version Control System
3Git is getting popular in Rails community these days, as there were being many changes in rails to support Git.
Git is a open sourse fast version controller system. It was originally designed by Linus Torvalds to handle large projects. It was inspired by Monotone & BitKeeper. It is a distributed version controlling system. It gives you ability to commit, traverse into history while being offline. Actually every working copy of Git is a full-fledged repository. It has no central server like SVN. One can share his working-copy/repository by using various protocols like ssh, http, ftp etc. One thing I like about Git over SVN is that the size of Git’s repository, which is smaller compared to SVN.
I gave an introductory presentation in VinSol. I am sharing it with you, this is not very explanatory as I focused on speech more. Please share your views.
Installing subversion from pre-compiled packages or source code
0What is subversion(svn):
Subversion is an open source version control system used for keep track of change to source code. Subversion manages files and directories over time an increments revision made to the file system. A tree of file is placed into a central repository. The repository is much like an ordinary file server, except that it remembers every change ever made to your files and directories. This allows you to recover older version of your date or examine the history of how your data changed.
Subversion can access its repository across networks, which allows it to be used by people on different computers. At some level, the ability for various people to modify and manage the same set of data from their respective locations fosters collaboration.
Installation:
There are two types of installation:
- Installation from pre-compiled packages
- Installation from source code
Installation from packages:
For RedHat Linux(or other Linux distributions which supports RPM) download subversion RPM package and install. See manual of rpm utility for installation.
For Debian Linux issue apt-get install subversion
and by confirming the installation you are done. I also recommend to install subversion-tools by issuing apt-get install subversion-tools
.
Installation from source:
Installation from source code is slightly tricky. First of all download latest version of subversion code from http://subversion.tigris.org.
Now extract source to your preferred directory (lets assume /home/testuser/svncode/
), and issue the following command in sequence after switching to svncode directory:
- ./configure
- make
- make install
./configure
will create Makefile
make
makes Subversion form the just-created Makefile
make install
install Subversion if make
is successfullyAnd you are done….
Issue svnadmin create /home/testuser/repository
to create a new repository, this should create a directory structure like:
drwxrwxrwx 7 root root 4096 2006-11-07 17:18 .
drwxrwxrwx 14 root root 4096 2006-11-07 17:18 ..
drwxrwxrwx 2 root root 4096 2006-11-07 17:18 con
drwxrwxrwx 2 root root 4096 2006-11-07 17:18 dav
drwxrwxrwx 2 root root 4096 2006-11-07 17:18 db
-rwxrwxrwx 1 root root 2 2006-11-07 17:18 format
drwxrwxrwx 2 root root 4096 2006-11-07 17:18 hooks
drwxrwxrwx 2 root root 4096 2006-11-07 17:18 locks
-rwxrwxrwx 1 root root 379 2006-11-07 17:18 README.txt
Now we need to allow remote access to it so that users can import their files. By editing conf/svnserve.conf
we can set user accounts, permissions.
Initially svnserve.conf looks like:
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository. (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)
### Visit http://subversion.tigris.org/ for more information.
### [general]
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
### anon-access = write
### auth-access = write
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the conf directory.
### The format of the password database is similar to this file.
### It contains one section labelled [users]. The name and
### password for each user follow, one account per line. The
### format is
### USERNAME = PASSWORD
### Please note that both the user name and password are case
### sensitive. There is no default for the password file.
### password-db = passwd
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
### realm = My First Repository
Uncomment line containing [general]
, anon-access
, auth-access
and password-db
with suitable permissions. Also add file named passwd parallel to svnserve.conf containing
[users]SVNUSERNAME = SVNUSERPASSOWRD
You can add as many users you want. Now you are done with user accounts and permissions.
Next you have to start the svnserver by issuing svnserve -d -r /home/testuser/repository
.
Now you are ready with your subversion server, you can access your repository from svn://yourdomain.com/repository/
On some systems (like Debian GNU/Linux) this requires to write an init script so that the server starts up every time the system is rebooted. This could be done by creating a file called svnserve
in the /etc/init.d
directory, and then editing it to look like the following example file:
#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/svnserve NAME=svnserve DESC="SVN Repository Server Daemon"
test -x $DAEMON || exit 0
OPTIONS="-d -r /cvs/src"
# Get lsb functions
#. /lib/lsb/init-functions
. /etc/default/rcS start() { echo "Starting $DESC... "
# echo "Starting $DESC: "
if ! start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- $OPTIONS
>/dev/null 2>&1; then
status=$?
echo $status
return $status
fi log_end_msg 0
return 0
}
case "$1" in
start)
start
;;
stop)
echo "Stopping $DESC: "
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
echo $?
;;
restart|force-reload)
$0 stop
sleep 1
start
#echo "$NAME."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac exit 0
This script also allows to manually start and stop the svnserver service whenever needed. Note: be sure and change the OPTIONS
line to reflect the location of your repository; in our previous example this location was /home/testuser/repository
. Once this file is created and edited to look like the previous example, you need to chmod
the script to be executable by issuing chmod +x /etc/init.d/svnserve
and also set it to startup at boot time by issuing update-rc.d svnserve defaults
Now simply start/stop the service by issuing:
/etc/init.d/svnserve start/stop
Please refer Subversion book for more help and usage.