Files @ e54ddaa52fee
Branch filter:

Location: kallithea/.travis.yml

Andrew Shadura
hooks: parse incoming git refs correctly

Hooks receive a line of the following format on standard input:

<old-value> SP <new-value> SP <ref-name> LF

where <old-value> is the old object name stored in the ref,
<new-value> is the new object name to be stored in the ref
and <ref-name> is the full name of the ref.

This means, we have to strip at least the LF in order to have a
correct version of the ref name after the split. Also, when
parsing the ref name itself, use all components but first instead
of just second, as a ref name may have slashes in it.

Previously, failure to parse ref name correctly would lead to the
following behaviour. A newly created repository with no commits pushed
has HEAD set to refs/heads/master by default, even though there's no
such ref in the repository yet. Upon first push, Kallithea rewrites
this symbolic reference with a reference to a real branch.

However, due to a bug in ref name parsing, if a ref name had a slash,
Kallithea would update HEAD to an invalid reference:

git push origin feature/branch

would rewrite HEAD to refs/heads/feature. All future attempts to work
with this repository would fail because dulwich would complain it can't
read HEAD as it is a directory.
language: python
python:
  - "2.6"
  - "2.7"

env:  
  - TEST_DB=sqlite:////tmp/kallithea_test.sqlite
  - TEST_DB=mysql://root@127.0.0.1/kallithea_test
  - TEST_DB=postgresql://postgres@127.0.0.1/kallithea_test

services:
  - mysql
  - postgresql

# command to install dependencies
before_script:
  - mysql -e 'create database kallithea_test;'
  - psql -c 'create database kallithea_test;' -U postgres
  - git --version

before_install:
  - sudo apt-get remove git
  - sudo add-apt-repository ppa:pdoes/ppa -y
  - sudo apt-get update -y
  - sudo apt-get install git -y

install:
  - pip install mysql-python psycopg2 mock unittest2
  - pip install . --use-mirrors

# command to run tests
script: nosetests

notifications:
    email:
        - ci@kallithea-scm.org
    irc: "irc.freenode.org#kallithea"

branches:
  only:
    - master