diff --git a/.gitignore b/.gitignore index b5dd1eb..6060cf3 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,9 @@ tags __pycache__/ *.pyc +build/ +dist/ +*.egg-info/ +.cache/ +env/ +tests/test_project_fixtures/*/.git/ diff --git a/README.md b/README.md index b86c956..8a87528 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Detect backward incompatible migrations for your django project. Needed software (in PATH): -* `python` (only tested on python2.7 (yet)) +* `python` * `git` * UNIX command line tools like `tail` @@ -27,12 +27,6 @@ The linter will try to detect if the project is a django project and is versione ## Tests -Launch the tests with: `python -m unittest test_migration_linter` +The easiest way to run the tests is to invoke [py.test](https://docs.pytest.org/en/latest/). -More test are to be written. - -## Improvements - -* More tests (always!) -* Detect data migration (not only scheme migrations) -* Detection dependent on specified database (mysql, postgresql, ...) +More tests are always welcome. diff --git a/django_migration_linter/__init__.py b/django_migration_linter/__init__.py new file mode 100644 index 0000000..7d5a0bc --- /dev/null +++ b/django_migration_linter/__init__.py @@ -0,0 +1 @@ +from migration_linter import * # noqa diff --git a/migration_linter.py b/django_migration_linter/migration_linter.py similarity index 99% rename from migration_linter.py rename to django_migration_linter/migration_linter.py index 9e755c6..84c8746 100644 --- a/migration_linter.py +++ b/django_migration_linter/migration_linter.py @@ -238,7 +238,7 @@ def split_path(path): return (split_path(a) if len(a) > 0 else []) + [b] -if __name__ == '__main__': +def _main(): parser = argparse.ArgumentParser( description='Detect backward incompatible django migrations.') parser.add_argument( @@ -310,3 +310,7 @@ if __name__ == '__main__': sys.exit(1) else: sys.exit(1) + + +if __name__ == '__main__': + _main() diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..b88b8db --- /dev/null +++ b/setup.py @@ -0,0 +1,65 @@ +# Copyright 2017 3YOURMIND GmbH + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from codecs import open +from os import path +from setuptools import setup, find_packages + + +PROJECT_DIR = path.abspath(path.dirname(__file__)) + +with open(path.join(PROJECT_DIR, 'README.md'), encoding='utf-8') as f: + long_description = f.read() + +install_requirements = [ +] + +test_requirements = [ + 'pytest', + 'django', + 'django-fake-database-backends' +] + +setup( + name='django-migration-linter', + version='0.0.1', + + description='Detect backward incompatible migrations for your django project', + long_description=long_description, + url='https://github.com/3YOURMIND/django-migration-linter', + author='3YOURMIND GmbH', + license='Apache License 2.0', + + packages=find_packages(exclude=['tests/']), + install_requires=install_requirements, + extras_require={ + 'test': test_requirements + }, + entry_points={ + 'console_scripts': [ + 'django-migration-linter = django_migration_linter.migration_linter:_main' + ] + }, + + keywords='django migration lint linter database backward compatibility', + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Developers', + 'Environment :: Web Environment', + 'Framework :: Django', + + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + ] +) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/fixtures.py b/tests/fixtures.py new file mode 100644 index 0000000..e3748c6 --- /dev/null +++ b/tests/fixtures.py @@ -0,0 +1,70 @@ +# Copyright 2017 3YOURMIND GmbH + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import shutil + +_BASE_DIR = os.path.join( + os.path.dirname(os.path.dirname(os.path.abspath(__file__))), + 'tests/') +_FIXTURES_FOLDER = os.path.join(_BASE_DIR, 'test_project_fixtures/') + +ADD_NOT_NULL_COLUMN_PROJECT = os.path.join( + _FIXTURES_FOLDER, 'test_project_add_not_null_column/') +CREATE_TABLE_WITH_NOT_NULL_COLUMN_PROJECT = os.path.join( + _FIXTURES_FOLDER, 'test_project_create_table_with_not_null_column/') +DROP_COLUMN_PROJECT = os.path.join( + _FIXTURES_FOLDER, 'test_project_drop_column/') +RENAME_COLUMN_PROJECT = os.path.join( + _FIXTURES_FOLDER, 'test_project_rename_column/') +RENAME_TABLE_PROJECT = os.path.join( + _FIXTURES_FOLDER, 'test_project_rename_table/') +ADD_NOT_NULL_COLUMN_FOLLOWED_BY_DEFAULT_PROJECT = os.path.join( + _FIXTURES_FOLDER, 'test_project_add_not_null_column_followed_by_default/') +MULTI_COMMIT_PROJECT = os.path.join( + _FIXTURES_FOLDER, 'test_project_multi_commit/') + +NOT_DJANGO_GIT_PROJECT = os.path.join( + _FIXTURES_FOLDER, 'test_git_project/') +NOT_GIT_DJANGO_PROJECT = os.path.join( + _FIXTURES_FOLDER, 'test_django_without_git_project/') + +ALL_GIT_PROJECTS = ( + NOT_DJANGO_GIT_PROJECT, + ADD_NOT_NULL_COLUMN_PROJECT, + CREATE_TABLE_WITH_NOT_NULL_COLUMN_PROJECT, + DROP_COLUMN_PROJECT, + RENAME_COLUMN_PROJECT, + RENAME_TABLE_PROJECT, + ADD_NOT_NULL_COLUMN_FOLLOWED_BY_DEFAULT_PROJECT, + MULTI_COMMIT_PROJECT +) + + +def prepare_git_project(path): + """Copy the git/ folder to .git/ so it is + actually versioned""" + src_git = os.path.join(path, 'git/') + dest_git = os.path.join(path, '.git/') + try: + shutil.copytree(src_git, dest_git) + except OSError: + pass # .git/ might already exist + + +def clear_all_git_projects(): + """Delete all .git/ folders in test projects""" + for project_path in ALL_GIT_PROJECTS: + git_path = os.path.join(project_path, '.git/') + shutil.rmtree(git_path, ignore_errors=True) diff --git a/tests/functional/__init__.py b/tests/functional/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/functional/test_migration_linter.py b/tests/functional/test_migration_linter.py new file mode 100644 index 0000000..0a07823 --- /dev/null +++ b/tests/functional/test_migration_linter.py @@ -0,0 +1,78 @@ +# Copyright 2017 3YOURMIND GmbH + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest + +from django_migration_linter import MigrationLinter +from tests import fixtures + + +class BackwardcompatibilityDetectionTest(unittest.TestCase): + def tearDown(self, *args, **kwargs): + fixtures.clear_all_git_projects() + super( + BackwardcompatibilityDetectionTest, + self).tearDown(*args, **kwargs) + + def test_create_table_with_not_null_column(self): + test_project_path = fixtures.CREATE_TABLE_WITH_NOT_NULL_COLUMN_PROJECT + fixtures.prepare_git_project(test_project_path) + self._test_linter_finds_no_errors(test_project_path) + + def test_detect_adding_not_null_column(self): + test_project_path = fixtures.ADD_NOT_NULL_COLUMN_PROJECT + fixtures.prepare_git_project(test_project_path) + self._test_linter_finds_errors(test_project_path) + + def test_detect_drop_column(self): + test_project_path = fixtures.DROP_COLUMN_PROJECT + fixtures.prepare_git_project(test_project_path) + self._test_linter_finds_errors(test_project_path) + + def test_detect_rename_column(self): + test_project_path = fixtures.RENAME_COLUMN_PROJECT + fixtures.prepare_git_project(test_project_path) + self._test_linter_finds_errors(test_project_path) + + def test_detect_rename_table(self): + test_project_path = fixtures.RENAME_TABLE_PROJECT + fixtures.prepare_git_project(test_project_path) + self._test_linter_finds_errors(test_project_path) + + def test_accept_not_null_column_followed_by_adding_default(self): + test_project_path = \ + fixtures.ADD_NOT_NULL_COLUMN_FOLLOWED_BY_DEFAULT_PROJECT + fixtures.prepare_git_project(test_project_path) + self._test_linter_finds_no_errors(test_project_path) + + def test_specify_git_hash(self): + test_project_path = fixtures.MULTI_COMMIT_PROJECT + fixtures.prepare_git_project(test_project_path) + + self._test_linter_finds_errors(test_project_path, commit_id=None) + + self._test_linter_finds_no_errors( + test_project_path, + commit_id='44330921696018f8f1480df897b38310549982cb') + self._test_linter_finds_no_errors(test_project_path, commit_id='tag1') + + def _test_linter_finds_errors(self, path, commit_id=None): + linter = MigrationLinter(path, commit_id=commit_id) + has_errors = linter.lint_migrations() + self.assertTrue(has_errors) + + def _test_linter_finds_no_errors(self, path, commit_id=None): + linter = MigrationLinter(path, commit_id=commit_id) + has_errors = linter.lint_migrations() + self.assertFalse(has_errors) diff --git a/tests/test_project_fixtures/test_django_without_git_project/manage.py b/tests/test_project_fixtures/test_django_without_git_project/manage.py new file mode 100644 index 0000000..1462610 --- /dev/null +++ b/tests/test_project_fixtures/test_django_without_git_project/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_django_without_git_project.settings") + try: + from django.core.management import execute_from_command_line + except ImportError: + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) + raise + execute_from_command_line(sys.argv) diff --git a/tests/test_project_fixtures/test_django_without_git_project/test_app/__init__.py b/tests/test_project_fixtures/test_django_without_git_project/test_app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_django_without_git_project/test_app/admin.py b/tests/test_project_fixtures/test_django_without_git_project/test_app/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/tests/test_project_fixtures/test_django_without_git_project/test_app/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/tests/test_project_fixtures/test_django_without_git_project/test_app/apps.py b/tests/test_project_fixtures/test_django_without_git_project/test_app/apps.py new file mode 100644 index 0000000..fc04070 --- /dev/null +++ b/tests/test_project_fixtures/test_django_without_git_project/test_app/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class TestAppConfig(AppConfig): + name = 'test_app' diff --git a/tests/test_project_fixtures/test_django_without_git_project/test_app/migrations/__init__.py b/tests/test_project_fixtures/test_django_without_git_project/test_app/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_django_without_git_project/test_app/models.py b/tests/test_project_fixtures/test_django_without_git_project/test_app/models.py new file mode 100644 index 0000000..137941f --- /dev/null +++ b/tests/test_project_fixtures/test_django_without_git_project/test_app/models.py @@ -0,0 +1 @@ +from django.db import models diff --git a/tests/test_project_fixtures/test_django_without_git_project/test_app/tests.py b/tests/test_project_fixtures/test_django_without_git_project/test_app/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/tests/test_project_fixtures/test_django_without_git_project/test_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/tests/test_project_fixtures/test_django_without_git_project/test_app/views.py b/tests/test_project_fixtures/test_django_without_git_project/test_app/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/tests/test_project_fixtures/test_django_without_git_project/test_app/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/tests/test_project_fixtures/test_django_without_git_project/test_django_without_git_project/__init__.py b/tests/test_project_fixtures/test_django_without_git_project/test_django_without_git_project/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_django_without_git_project/test_django_without_git_project/settings.py b/tests/test_project_fixtures/test_django_without_git_project/test_django_without_git_project/settings.py new file mode 100644 index 0000000..b91306d --- /dev/null +++ b/tests/test_project_fixtures/test_django_without_git_project/test_django_without_git_project/settings.py @@ -0,0 +1,121 @@ +""" +Django settings for test_django_without_git_project project. + +Generated by 'django-admin startproject' using Django 1.11.6. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.11/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'gtb+mohs%gf0+#fr89vw7e&#edmv=q8!iv+n&j_soawk$tkj3^' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'test_app' +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'test_django_without_git_project.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'test_django_without_git_project.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/1.11/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.11/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/tests/test_project_fixtures/test_django_without_git_project/test_django_without_git_project/urls.py b/tests/test_project_fixtures/test_django_without_git_project/test_django_without_git_project/urls.py new file mode 100644 index 0000000..735de5d --- /dev/null +++ b/tests/test_project_fixtures/test_django_without_git_project/test_django_without_git_project/urls.py @@ -0,0 +1,21 @@ +"""linter_test_project URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/1.11/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.conf.urls import url, include + 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) +""" +from django.conf.urls import url +from django.contrib import admin + +urlpatterns = [ + url(r'^admin/', admin.site.urls), +] diff --git a/tests/test_project_fixtures/test_django_without_git_project/test_django_without_git_project/wsgi.py b/tests/test_project_fixtures/test_django_without_git_project/test_django_without_git_project/wsgi.py new file mode 100644 index 0000000..6741b31 --- /dev/null +++ b/tests/test_project_fixtures/test_django_without_git_project/test_django_without_git_project/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for linter_test_project project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project_add_not_null_column.settings") + +application = get_wsgi_application() diff --git a/tests/test_project_fixtures/test_git_project/git/COMMIT_EDITMSG b/tests/test_project_fixtures/test_git_project/git/COMMIT_EDITMSG new file mode 100644 index 0000000..972ea8f --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/COMMIT_EDITMSG @@ -0,0 +1 @@ +Init diff --git a/tests/test_project_fixtures/test_git_project/git/HEAD b/tests/test_project_fixtures/test_git_project/git/HEAD new file mode 100644 index 0000000..cb089cd --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/tests/test_project_fixtures/test_git_project/git/config b/tests/test_project_fixtures/test_git_project/git/config new file mode 100644 index 0000000..eeb8dd7 --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/config @@ -0,0 +1,5 @@ +[core] + repositoryformatversion = 0 + filemode = false + bare = false + logallrefupdates = true diff --git a/tests/test_project_fixtures/test_git_project/git/description b/tests/test_project_fixtures/test_git_project/git/description new file mode 100644 index 0000000..498b267 --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/tests/test_project_fixtures/test_git_project/git/hooks/applypatch-msg.sample b/tests/test_project_fixtures/test_git_project/git/hooks/applypatch-msg.sample new file mode 100644 index 0000000..8b2a2fe --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/hooks/applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +test -x "$GIT_DIR/hooks/commit-msg" && + exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_git_project/git/hooks/commit-msg.sample b/tests/test_project_fixtures/test_git_project/git/hooks/commit-msg.sample new file mode 100644 index 0000000..b58d118 --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/hooks/commit-msg.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/tests/test_project_fixtures/test_git_project/git/hooks/post-update.sample b/tests/test_project_fixtures/test_git_project/git/hooks/post-update.sample new file mode 100644 index 0000000..ec17ec1 --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/tests/test_project_fixtures/test_git_project/git/hooks/pre-applypatch.sample b/tests/test_project_fixtures/test_git_project/git/hooks/pre-applypatch.sample new file mode 100644 index 0000000..b1f187c --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_git_project/git/hooks/pre-commit.sample b/tests/test_project_fixtures/test_git_project/git/hooks/pre-commit.sample new file mode 100644 index 0000000..68d62d5 --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/tests/test_project_fixtures/test_git_project/git/hooks/pre-push.sample b/tests/test_project_fixtures/test_git_project/git/hooks/pre-push.sample new file mode 100644 index 0000000..1f3bceb --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/hooks/pre-push.sample @@ -0,0 +1,54 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +IFS=' ' +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/tests/test_project_fixtures/test_git_project/git/hooks/pre-rebase.sample b/tests/test_project_fixtures/test_git_project/git/hooks/pre-rebase.sample new file mode 100644 index 0000000..33730ca --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up-to-date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/tests/test_project_fixtures/test_git_project/git/hooks/prepare-commit-msg.sample b/tests/test_project_fixtures/test_git_project/git/hooks/prepare-commit-msg.sample new file mode 100644 index 0000000..f093a02 --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/hooks/prepare-commit-msg.sample @@ -0,0 +1,36 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first comments out the +# "Conflicts:" part of a merge commit. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +case "$2,$3" in + merge,) + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; + +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$1" ;; + + *) ;; +esac + +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff --git a/tests/test_project_fixtures/test_git_project/git/hooks/update.sample b/tests/test_project_fixtures/test_git_project/git/hooks/update.sample new file mode 100644 index 0000000..d847583 --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/hooks/update.sample @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to blocks unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/tests/test_project_fixtures/test_git_project/git/info/exclude b/tests/test_project_fixtures/test_git_project/git/info/exclude new file mode 100644 index 0000000..a5196d1 --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/tests/test_project_fixtures/test_git_project/git/logs/HEAD b/tests/test_project_fixtures/test_git_project/git/logs/HEAD new file mode 100644 index 0000000..86bb128 --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/logs/HEAD @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 7be2007c11ae031c7749e1fb1be9e41a8bfc1bdd David-Wobrock 1509048040 +0200 commit (initial): Init diff --git a/tests/test_project_fixtures/test_git_project/git/logs/refs/heads/master b/tests/test_project_fixtures/test_git_project/git/logs/refs/heads/master new file mode 100644 index 0000000..86bb128 --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/logs/refs/heads/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 7be2007c11ae031c7749e1fb1be9e41a8bfc1bdd David-Wobrock 1509048040 +0200 commit (initial): Init diff --git a/tests/test_project_fixtures/test_git_project/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/tests/test_project_fixtures/test_git_project/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 new file mode 100644 index 0000000..adf6411 Binary files /dev/null and b/tests/test_project_fixtures/test_git_project/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 differ diff --git a/tests/test_project_fixtures/test_git_project/git/objects/7b/e2007c11ae031c7749e1fb1be9e41a8bfc1bdd b/tests/test_project_fixtures/test_git_project/git/objects/7b/e2007c11ae031c7749e1fb1be9e41a8bfc1bdd new file mode 100644 index 0000000..29cba1d Binary files /dev/null and b/tests/test_project_fixtures/test_git_project/git/objects/7b/e2007c11ae031c7749e1fb1be9e41a8bfc1bdd differ diff --git a/tests/test_project_fixtures/test_git_project/git/refs/heads/master b/tests/test_project_fixtures/test_git_project/git/refs/heads/master new file mode 100644 index 0000000..0de34be --- /dev/null +++ b/tests/test_project_fixtures/test_git_project/git/refs/heads/master @@ -0,0 +1 @@ +7be2007c11ae031c7749e1fb1be9e41a8bfc1bdd diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/.gitignore b/tests/test_project_fixtures/test_project_add_not_null_column/.gitignore new file mode 100644 index 0000000..63973d0 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/.gitignore @@ -0,0 +1,3 @@ +*.pyc +__pycache__/ +*sqlite3 diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/COMMIT_EDITMSG b/tests/test_project_fixtures/test_project_add_not_null_column/git/COMMIT_EDITMSG new file mode 100644 index 0000000..c347860 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/COMMIT_EDITMSG @@ -0,0 +1,22 @@ +All files + +# Veuillez saisir le message de validation pour vos modifications. Les lignes +# commençant par '#' seront ignorées, et un message vide abandonne la validation. +# Sur la branche master +# Modifications qui seront validées : +# nouveau fichier: .gitignore +# nouveau fichier: manage.py +# nouveau fichier: test_app/__init__.py +# nouveau fichier: test_app/admin.py +# nouveau fichier: test_app/apps.py +# nouveau fichier: test_app/migrations/0001_create_table.py +# nouveau fichier: test_app/migrations/0002_add_new_not_null_field.py +# nouveau fichier: test_app/migrations/__init__.py +# nouveau fichier: test_app/models.py +# nouveau fichier: test_app/tests.py +# nouveau fichier: test_app/views.py +# nouveau fichier: test_project_add_not_null_column/__init__.py +# nouveau fichier: test_project_add_not_null_column/settings.py +# nouveau fichier: test_project_add_not_null_column/urls.py +# nouveau fichier: test_project_add_not_null_column/wsgi.py +# diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/HEAD b/tests/test_project_fixtures/test_project_add_not_null_column/git/HEAD new file mode 100644 index 0000000..cb089cd --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/config b/tests/test_project_fixtures/test_project_add_not_null_column/git/config new file mode 100644 index 0000000..eeb8dd7 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/config @@ -0,0 +1,5 @@ +[core] + repositoryformatversion = 0 + filemode = false + bare = false + logallrefupdates = true diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/description b/tests/test_project_fixtures/test_project_add_not_null_column/git/description new file mode 100644 index 0000000..498b267 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/applypatch-msg.sample b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/applypatch-msg.sample new file mode 100644 index 0000000..8b2a2fe --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +test -x "$GIT_DIR/hooks/commit-msg" && + exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/commit-msg.sample b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/commit-msg.sample new file mode 100644 index 0000000..b58d118 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/commit-msg.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/post-update.sample b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/post-update.sample new file mode 100644 index 0000000..ec17ec1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/pre-applypatch.sample b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/pre-applypatch.sample new file mode 100644 index 0000000..b1f187c --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/pre-commit.sample b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/pre-commit.sample new file mode 100644 index 0000000..68d62d5 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/pre-push.sample b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/pre-push.sample new file mode 100644 index 0000000..1f3bceb --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/pre-push.sample @@ -0,0 +1,54 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +IFS=' ' +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/pre-rebase.sample b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/pre-rebase.sample new file mode 100644 index 0000000..33730ca --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up-to-date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/prepare-commit-msg.sample b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/prepare-commit-msg.sample new file mode 100644 index 0000000..f093a02 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/prepare-commit-msg.sample @@ -0,0 +1,36 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first comments out the +# "Conflicts:" part of a merge commit. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +case "$2,$3" in + merge,) + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; + +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$1" ;; + + *) ;; +esac + +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/update.sample b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/update.sample new file mode 100644 index 0000000..d847583 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/hooks/update.sample @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to blocks unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/index b/tests/test_project_fixtures/test_project_add_not_null_column/git/index new file mode 100644 index 0000000..1a18263 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/index differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/info/exclude b/tests/test_project_fixtures/test_project_add_not_null_column/git/info/exclude new file mode 100644 index 0000000..a5196d1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/logs/HEAD b/tests/test_project_fixtures/test_project_add_not_null_column/git/logs/HEAD new file mode 100644 index 0000000..c52e8aa --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/logs/HEAD @@ -0,0 +1,3 @@ +0000000000000000000000000000000000000000 13850658e796761657478d38eacd426e208b05b0 David-Wobrock 1509046620 +0200 commit (initial): Init +13850658e796761657478d38eacd426e208b05b0 0c78bfd0462272a51e3515731a6e6776bea72f72 David-Wobrock 1509046634 +0200 commit: All files +0c78bfd0462272a51e3515731a6e6776bea72f72 13ddff99f80afca39dc64eaa65928244584a88d3 David-Wobrock 1509046854 +0200 commit (amend): All files diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/logs/refs/heads/master b/tests/test_project_fixtures/test_project_add_not_null_column/git/logs/refs/heads/master new file mode 100644 index 0000000..c52e8aa --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/logs/refs/heads/master @@ -0,0 +1,3 @@ +0000000000000000000000000000000000000000 13850658e796761657478d38eacd426e208b05b0 David-Wobrock 1509046620 +0200 commit (initial): Init +13850658e796761657478d38eacd426e208b05b0 0c78bfd0462272a51e3515731a6e6776bea72f72 David-Wobrock 1509046634 +0200 commit: All files +0c78bfd0462272a51e3515731a6e6776bea72f72 13ddff99f80afca39dc64eaa65928244584a88d3 David-Wobrock 1509046854 +0200 commit (amend): All files diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/09/d00ce23e0b42f2c18895ee5fa577f57f14b2ac b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/09/d00ce23e0b42f2c18895ee5fa577f57f14b2ac new file mode 100644 index 0000000..4d7d160 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/09/d00ce23e0b42f2c18895ee5fa577f57f14b2ac @@ -0,0 +1,3 @@ +x]PËjÃ0ìÙ_±�ƒ�;Ôm øRrÈ­·„m­�ZY2zÒ¯¯dåY„˜™�™UÃee™?Ì }L¡•”‰~Öté«G¢¼£@U¤ÐaóU‹^B‘Eö RÀ2/^Ò"O—%O«¼Œ:% ¤³Æ*$Ø0JeÀ +æÌ‘pfœ×QÒÉ/£ÍY7°Þ…1)ô7à•QËk­a¦’«(»€óU�;L0Ãj|(‹£8¢ (Z†ÚŸ“ð89úí|à…ñ67o +Ýú{_&™&=ï�¨¬âu¼¸C;†œê*„a¸“˜Ñø¼U¶¶Fn½4©Ý‹´S­|錊 µ:’o<ž�ÊmÅ~±Úºßs’T�ÔHB‰Ý&žÏï{øÐ$–s2UºFï„ÁUH÷‚)ãÿüájwr>Dqá£& \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/0c/78bfd0462272a51e3515731a6e6776bea72f72 b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/0c/78bfd0462272a51e3515731a6e6776bea72f72 new file mode 100644 index 0000000..20be75f Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/0c/78bfd0462272a51e3515731a6e6776bea72f72 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/13/850658e796761657478d38eacd426e208b05b0 b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/13/850658e796761657478d38eacd426e208b05b0 new file mode 100644 index 0000000..eb88956 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/13/850658e796761657478d38eacd426e208b05b0 @@ -0,0 +1,2 @@ +x¥�Á +B!E[û³�óL…ˆmú‚ÖŽÎ+)Äê÷3ú„–ç¹'ÖRr‡ÙmW½‰€a§mŠdtdö Å^\"¯�[XÄx4*<ûµ68†WN›såVã vé‹Óû‡‡K ù>ÅZö0[‘FX£FTcá.\¨Ó#wõ"";ã \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/13/ddff99f80afca39dc64eaa65928244584a88d3 b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/13/ddff99f80afca39dc64eaa65928244584a88d3 new file mode 100644 index 0000000..8ecddb5 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/13/ddff99f80afca39dc64eaa65928244584a88d3 @@ -0,0 +1,3 @@ +x•ŽA +Â0E]çÙ‹ešf&SQð®ÓɨÅÖH�z}+âü»÷�'yûb]C‹2©ZñÞÍKNñ-A”V# 0 + ×,€ ÄÜâ¤×bë†YCK�jÂ৆5JòŽÔw€˜ø(ç<Ù}|öiuÈÝ”åb×éƒÕë‹ÛÓû¡’tœ8+Õ$pv)ë^ep´(æØ›«¨Jq.1î}âXf‡�Ý‘ ŠñÛË|º0ËÉj5›O—æc1þ|Ÿ·P\ÿÏXçLd1qGdj¦]8Ùˆ�m.†J]¡àþK0ª_òCš€ \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/73/47b0f2a9845fa268ad4a19967c706e5d7be38b b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/73/47b0f2a9845fa268ad4a19967c706e5d7be38b new file mode 100644 index 0000000..621f4fc Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/73/47b0f2a9845fa268ad4a19967c706e5d7be38b differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee new file mode 100644 index 0000000..66ccc09 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 new file mode 100644 index 0000000..250bef6 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/88/80cfa9557a6ce785b43fb300748310b7e995ed b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/88/80cfa9557a6ce785b43fb300748310b7e995ed new file mode 100644 index 0000000..688ed38 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/88/80cfa9557a6ce785b43fb300748310b7e995ed differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e new file mode 100644 index 0000000..e68f806 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/91/ea44a218fbd2f408430959283f0419c921093e b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/91/ea44a218fbd2f408430959283f0419c921093e new file mode 100644 index 0000000..263fc8c Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/91/ea44a218fbd2f408430959283f0419c921093e differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/95/a7313de6fcb6553cd7a0e4993ee1c6c2760d0e b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/95/a7313de6fcb6553cd7a0e4993ee1c6c2760d0e new file mode 100644 index 0000000..13fc88e Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/95/a7313de6fcb6553cd7a0e4993ee1c6c2760d0e differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/bd/6e4d7737b3cb2f0ae260b05511342c3f6f1b45 b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/bd/6e4d7737b3cb2f0ae260b05511342c3f6f1b45 new file mode 100644 index 0000000..a2af518 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/bd/6e4d7737b3cb2f0ae260b05511342c3f6f1b45 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/c4/42222d2e5f0960ac9ea05c85c05818c070860c b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/c4/42222d2e5f0960ac9ea05c85c05818c070860c new file mode 100644 index 0000000..eb8b496 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/c4/42222d2e5f0960ac9ea05c85c05818c070860c differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/d4/942ceb12ecd35cfbb0d21fee3062c019e659c3 b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/d4/942ceb12ecd35cfbb0d21fee3062c019e659c3 new file mode 100644 index 0000000..61838b7 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/d4/942ceb12ecd35cfbb0d21fee3062c019e659c3 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/dd/a78f10740fe52637c5a7ba4d18816672c627fa b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/dd/a78f10740fe52637c5a7ba4d18816672c627fa new file mode 100644 index 0000000..02f7652 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/dd/a78f10740fe52637c5a7ba4d18816672c627fa differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 new file mode 100644 index 0000000..7112238 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/f4/c75b2e69145f2c603b0a0851cc97757766e511 b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/f4/c75b2e69145f2c603b0a0851cc97757766e511 new file mode 100644 index 0000000..eedd426 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/f4/c75b2e69145f2c603b0a0851cc97757766e511 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 new file mode 100644 index 0000000..a0339be Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/git/refs/heads/master b/tests/test_project_fixtures/test_project_add_not_null_column/git/refs/heads/master new file mode 100644 index 0000000..ef760ea --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/git/refs/heads/master @@ -0,0 +1 @@ +13ddff99f80afca39dc64eaa65928244584a88d3 diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/manage.py b/tests/test_project_fixtures/test_project_add_not_null_column/manage.py new file mode 100644 index 0000000..f4c75b2 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project_add_not_null_column.settings") + try: + from django.core.management import execute_from_command_line + except ImportError: + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) + raise + execute_from_command_line(sys.argv) diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/test_app/__init__.py b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/test_app/admin.py b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/test_app/apps.py b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/apps.py new file mode 100644 index 0000000..fc04070 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class TestAppConfig(AppConfig): + name = 'test_app' diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/test_app/migrations/0001_create_table.py b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/migrations/0001_create_table.py new file mode 100644 index 0000000..09d00ce --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/migrations/0001_create_table.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-25 14:05 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='A', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('null_field', models.IntegerField(null=True)), + ], + ), + ] diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/test_app/migrations/0002_add_new_not_null_field.py b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/migrations/0002_add_new_not_null_field.py new file mode 100644 index 0000000..7347b0f --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/migrations/0002_add_new_not_null_field.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-25 14:06 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('test_app', '0001_create_table'), + ] + + operations = [ + migrations.AddField( + model_name='a', + name='new_not_null_field', + field=models.IntegerField(default=1), + preserve_default=False, + ), + ] diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/test_app/migrations/__init__.py b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/test_app/models.py b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/models.py new file mode 100644 index 0000000..dda78f1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/models.py @@ -0,0 +1,5 @@ +from django.db import models + +class A(models.Model): + null_field = models.IntegerField(null=True) + new_not_null_field = models.IntegerField(null=False) diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/test_app/tests.py b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/test_app/views.py b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/test_app/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/test_project_add_not_null_column/__init__.py b/tests/test_project_fixtures/test_project_add_not_null_column/test_project_add_not_null_column/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/test_project_add_not_null_column/settings.py b/tests/test_project_fixtures/test_project_add_not_null_column/test_project_add_not_null_column/settings.py new file mode 100644 index 0000000..95a7313 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/test_project_add_not_null_column/settings.py @@ -0,0 +1,121 @@ +""" +Django settings for test_project_add_not_null_column project. + +Generated by 'django-admin startproject' using Django 1.11.6. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.11/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'gtb+mohs%gf0+#fr89vw7e&#edmv=q8!iv+n&j_soawk$tkj3^' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'test_app' +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'test_project_add_not_null_column.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'test_project_add_not_null_column.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/1.11/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.11/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/test_project_add_not_null_column/urls.py b/tests/test_project_fixtures/test_project_add_not_null_column/test_project_add_not_null_column/urls.py new file mode 100644 index 0000000..735de5d --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/test_project_add_not_null_column/urls.py @@ -0,0 +1,21 @@ +"""linter_test_project URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/1.11/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.conf.urls import url, include + 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) +""" +from django.conf.urls import url +from django.contrib import admin + +urlpatterns = [ + url(r'^admin/', admin.site.urls), +] diff --git a/tests/test_project_fixtures/test_project_add_not_null_column/test_project_add_not_null_column/wsgi.py b/tests/test_project_fixtures/test_project_add_not_null_column/test_project_add_not_null_column/wsgi.py new file mode 100644 index 0000000..6741b31 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column/test_project_add_not_null_column/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for linter_test_project project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project_add_not_null_column.settings") + +application = get_wsgi_application() diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/.gitignore b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/.gitignore new file mode 100644 index 0000000..63973d0 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/.gitignore @@ -0,0 +1,3 @@ +*.pyc +__pycache__/ +*sqlite3 diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/COMMIT_EDITMSG b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/COMMIT_EDITMSG new file mode 100644 index 0000000..e3faf61 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/COMMIT_EDITMSG @@ -0,0 +1,23 @@ +All files + +# Veuillez saisir le message de validation pour vos modifications. Les lignes +# commençant par '#' seront ignorées, et un message vide abandonne la validation. +# Sur la branche master +# Modifications qui seront validées : +# nouveau fichier: .gitignore +# nouveau fichier: manage.py +# nouveau fichier: test_app/__init__.py +# nouveau fichier: test_app/admin.py +# nouveau fichier: test_app/apps.py +# nouveau fichier: test_app/migrations/0001_create_table.py +# nouveau fichier: test_app/migrations/0002_add_new_not_null_field.py +# nouveau fichier: test_app/migrations/__init__.py +# nouveau fichier: test_app/migrations_utils.py +# nouveau fichier: test_app/models.py +# nouveau fichier: test_app/tests.py +# nouveau fichier: test_app/views.py +# nouveau fichier: test_project_add_not_null_column_followed_by_default/__init__.py +# nouveau fichier: test_project_add_not_null_column_followed_by_default/settings.py +# nouveau fichier: test_project_add_not_null_column_followed_by_default/urls.py +# nouveau fichier: test_project_add_not_null_column_followed_by_default/wsgi.py +# diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/HEAD b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/HEAD new file mode 100644 index 0000000..cb089cd --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/config b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/config new file mode 100644 index 0000000..eeb8dd7 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/config @@ -0,0 +1,5 @@ +[core] + repositoryformatversion = 0 + filemode = false + bare = false + logallrefupdates = true diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/description b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/description new file mode 100644 index 0000000..498b267 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/applypatch-msg.sample b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/applypatch-msg.sample new file mode 100644 index 0000000..8b2a2fe --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +test -x "$GIT_DIR/hooks/commit-msg" && + exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/commit-msg.sample b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/commit-msg.sample new file mode 100644 index 0000000..b58d118 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/commit-msg.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/post-update.sample b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/post-update.sample new file mode 100644 index 0000000..ec17ec1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/pre-applypatch.sample b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/pre-applypatch.sample new file mode 100644 index 0000000..b1f187c --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/pre-commit.sample b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/pre-commit.sample new file mode 100644 index 0000000..68d62d5 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/pre-push.sample b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/pre-push.sample new file mode 100644 index 0000000..1f3bceb --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/pre-push.sample @@ -0,0 +1,54 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +IFS=' ' +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/pre-rebase.sample b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/pre-rebase.sample new file mode 100644 index 0000000..33730ca --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up-to-date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/prepare-commit-msg.sample b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/prepare-commit-msg.sample new file mode 100644 index 0000000..f093a02 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/prepare-commit-msg.sample @@ -0,0 +1,36 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first comments out the +# "Conflicts:" part of a merge commit. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +case "$2,$3" in + merge,) + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; + +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$1" ;; + + *) ;; +esac + +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/update.sample b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/update.sample new file mode 100644 index 0000000..d847583 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/hooks/update.sample @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to blocks unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/index b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/index new file mode 100644 index 0000000..75cbd0c Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/index differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/info/exclude b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/info/exclude new file mode 100644 index 0000000..a5196d1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/logs/HEAD b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/logs/HEAD new file mode 100644 index 0000000..a0e2bfa --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/logs/HEAD @@ -0,0 +1,4 @@ +0000000000000000000000000000000000000000 188d1e847da762e20ec43db374ffba8c5ee40581 David-Wobrock 1509048870 +0200 commit (initial): Init +188d1e847da762e20ec43db374ffba8c5ee40581 1ed2db048937886ab77c892d7ffa4bb3da6ae8a9 David-Wobrock 1509048882 +0200 commit: All files +1ed2db048937886ab77c892d7ffa4bb3da6ae8a9 4c2edb394b46664ac61f0b6fb29e57fe807ce21e David-Wobrock 1509049863 +0200 commit (amend): All files +4c2edb394b46664ac61f0b6fb29e57fe807ce21e 16fd55a08b9ad1af4282cafccf5c14adf1f2a1dc David-Wobrock 1509381987 +0100 commit (amend): All files diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/logs/refs/heads/master b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/logs/refs/heads/master new file mode 100644 index 0000000..a0e2bfa --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/logs/refs/heads/master @@ -0,0 +1,4 @@ +0000000000000000000000000000000000000000 188d1e847da762e20ec43db374ffba8c5ee40581 David-Wobrock 1509048870 +0200 commit (initial): Init +188d1e847da762e20ec43db374ffba8c5ee40581 1ed2db048937886ab77c892d7ffa4bb3da6ae8a9 David-Wobrock 1509048882 +0200 commit: All files +1ed2db048937886ab77c892d7ffa4bb3da6ae8a9 4c2edb394b46664ac61f0b6fb29e57fe807ce21e David-Wobrock 1509049863 +0200 commit (amend): All files +4c2edb394b46664ac61f0b6fb29e57fe807ce21e 16fd55a08b9ad1af4282cafccf5c14adf1f2a1dc David-Wobrock 1509381987 +0100 commit (amend): All files diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/09/d00ce23e0b42f2c18895ee5fa577f57f14b2ac b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/09/d00ce23e0b42f2c18895ee5fa577f57f14b2ac new file mode 100644 index 0000000..4d7d160 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/09/d00ce23e0b42f2c18895ee5fa577f57f14b2ac @@ -0,0 +1,3 @@ +x]PËjÃ0ìÙ_±�ƒ�;Ôm øRrÈ­·„m­�ZY2zÒ¯¯dåY„˜™�™UÃee™?Ì }L¡•”‰~Öté«G¢¼£@U¤ÐaóU‹^B‘Eö RÀ2/^Ò"O—%O«¼Œ:% ¤³Æ*$Ø0JeÀ +æÌ‘pfœ×QÒÉ/£ÍY7°Þ…1)ô7à•QËk­a¦’«(»€óU�;L0Ãj|(‹£8¢ (Z†ÚŸ“ð89úí|à…ñ67o +Ýú{_&™&=ï�¨¬âu¼¸C;†œê*„a¸“˜Ñø¼U¶¶Fn½4©Ý‹´S­|錊 µ:’o<ž�ÊmÅ~±Úºßs’T�ÔHB‰Ý&žÏï{øÐ$–s2UºFï„ÁUH÷‚)ãÿüájwr>Dqá£& \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/0c/4155a27f085fa8e954384cd3072054781ea238 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/0c/4155a27f085fa8e954384cd3072054781ea238 new file mode 100644 index 0000000..e8c1e71 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/0c/4155a27f085fa8e954384cd3072054781ea238 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/16/fd55a08b9ad1af4282cafccf5c14adf1f2a1dc b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/16/fd55a08b9ad1af4282cafccf5c14adf1f2a1dc new file mode 100644 index 0000000..36e89fe --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/16/fd55a08b9ad1af4282cafccf5c14adf1f2a1dc @@ -0,0 +1,3 @@ +x•ÎM +Â0†a×9Eöb™üOADÁ;¸N2S-¶FjÔëñ.ßoñðå2Ïc•ÚøU]˜%š”}Šˆ �í!xta }*iŸ ™,îqá[• +‘£ ƒ×¬�³5”L°ÃИì˜-8T">ë¥,ò_#mN%-%_å–¾Ù½¹?Ïqœº\æ�Tz°ˆ¨å4€hk;Zù? ê14B5B¦IãÄñøK& \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/18/8d1e847da762e20ec43db374ffba8c5ee40581 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/18/8d1e847da762e20ec43db374ffba8c5ee40581 new file mode 100644 index 0000000..d3792e2 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/18/8d1e847da762e20ec43db374ffba8c5ee40581 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/19/b0fd33394f0a1c56a43446422ec5ef7e9c87e2 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/19/b0fd33394f0a1c56a43446422ec5ef7e9c87e2 new file mode 100644 index 0000000..6694436 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/19/b0fd33394f0a1c56a43446422ec5ef7e9c87e2 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/1e/d2db048937886ab77c892d7ffa4bb3da6ae8a9 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/1e/d2db048937886ab77c892d7ffa4bb3da6ae8a9 new file mode 100644 index 0000000..50c871f Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/1e/d2db048937886ab77c892d7ffa4bb3da6ae8a9 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/1f/660a3639a3c11ad69f8e7f0fcef1af842778d8 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/1f/660a3639a3c11ad69f8e7f0fcef1af842778d8 new file mode 100644 index 0000000..c7d64a3 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/1f/660a3639a3c11ad69f8e7f0fcef1af842778d8 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/27/e9ce4a241beb6bc95a87c57501f5df8bd389c3 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/27/e9ce4a241beb6bc95a87c57501f5df8bd389c3 new file mode 100644 index 0000000..8613608 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/27/e9ce4a241beb6bc95a87c57501f5df8bd389c3 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/3c/9094321361af2955414f87b28796b4c8c42cec b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/3c/9094321361af2955414f87b28796b4c8c42cec new file mode 100644 index 0000000..8c584b1 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/3c/9094321361af2955414f87b28796b4c8c42cec differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 new file mode 100644 index 0000000..adf6411 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/4c/2edb394b46664ac61f0b6fb29e57fe807ce21e b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/4c/2edb394b46664ac61f0b6fb29e57fe807ce21e new file mode 100644 index 0000000..c77bc34 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/4c/2edb394b46664ac61f0b6fb29e57fe807ce21e differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/53/e59303633e807579d18f4174cb2a3dd3c15157 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/53/e59303633e807579d18f4174cb2a3dd3c15157 new file mode 100644 index 0000000..f7baccd Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/53/e59303633e807579d18f4174cb2a3dd3c15157 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/60/70f2b1c3bce797d6373c9aac3e723af36b1658 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/60/70f2b1c3bce797d6373c9aac3e723af36b1658 new file mode 100644 index 0000000..e267d62 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/60/70f2b1c3bce797d6373c9aac3e723af36b1658 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 new file mode 100644 index 0000000..3f771d5 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 new file mode 100644 index 0000000..cf19499 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 @@ -0,0 +1 @@ +xm�OOA Å=ϧhö‰îãE& Á(ÀxœvºË�Ît3S@¿½Ëžš¦¯ï÷Ú5ñîoŠ¢P_Ëé jŽ�o¡áä£`2‚YL—x‹µÀ¥–JÍð»ãŒdƒp^¶DvM6ƒ…ÀnGxG¸G‚½Mþ4Š6 ƒª²]G¾¶â9VUï÷Ú'{x8 €coî34žð2¢ÚˆtùIkÇu.ÝÖÆ–ÿ2Õ4F=*G#½áƒ°vØÿŒ¢¹õZÏT>tœ8+Õ$pv)ë^ep´(æØ›«¨Jq.1î}âXf‡�Ý‘ ŠñÛË|º0ËÉj5›O—æc1þ|Ÿ·P\ÿÏXçLd1qGdj¦]8Ùˆ�m.†J]¡àþK0ª_òCš€ \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/6e/ac9768027d572282f4f50c9c8154d081303928 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/6e/ac9768027d572282f4f50c9c8154d081303928 new file mode 100644 index 0000000..785458e Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/6e/ac9768027d572282f4f50c9c8154d081303928 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee new file mode 100644 index 0000000..66ccc09 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/78/76e7751f6ce1a191c135a017afaaece86b6e63 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/78/76e7751f6ce1a191c135a017afaaece86b6e63 new file mode 100644 index 0000000..6afd695 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/78/76e7751f6ce1a191c135a017afaaece86b6e63 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 new file mode 100644 index 0000000..250bef6 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/83/bc6ba8802549076857fd3a69017dd26b0add3c b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/83/bc6ba8802549076857fd3a69017dd26b0add3c new file mode 100644 index 0000000..9c9e366 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/83/bc6ba8802549076857fd3a69017dd26b0add3c differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/88/05d565409f35e08d0f55ac83126ed71a021814 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/88/05d565409f35e08d0f55ac83126ed71a021814 new file mode 100644 index 0000000..8a7f1ef Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/88/05d565409f35e08d0f55ac83126ed71a021814 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e new file mode 100644 index 0000000..e68f806 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/8c/5be9edbe3253011bbcd7c3b0f58e0b23b64006 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/8c/5be9edbe3253011bbcd7c3b0f58e0b23b64006 new file mode 100644 index 0000000..1ea5b73 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/8c/5be9edbe3253011bbcd7c3b0f58e0b23b64006 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/91/ea44a218fbd2f408430959283f0419c921093e b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/91/ea44a218fbd2f408430959283f0419c921093e new file mode 100644 index 0000000..263fc8c Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/91/ea44a218fbd2f408430959283f0419c921093e differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/b9/d7998b28816a1910160972b501976d1c3137e9 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/b9/d7998b28816a1910160972b501976d1c3137e9 new file mode 100644 index 0000000..76acb00 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/b9/d7998b28816a1910160972b501976d1c3137e9 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/c7/beda138c33c089001615811df53292c56ce647 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/c7/beda138c33c089001615811df53292c56ce647 new file mode 100644 index 0000000..739a1d5 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/c7/beda138c33c089001615811df53292c56ce647 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/d5/33aa0b42cd49ffe6b9745faf19ed6f688eae48 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/d5/33aa0b42cd49ffe6b9745faf19ed6f688eae48 new file mode 100644 index 0000000..961bb6a Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/d5/33aa0b42cd49ffe6b9745faf19ed6f688eae48 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/da/51ff0946cae8c000592184b1b05d831692d58f b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/da/51ff0946cae8c000592184b1b05d831692d58f new file mode 100644 index 0000000..555d7f6 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/da/51ff0946cae8c000592184b1b05d831692d58f differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/db/58264a0a37c4f14e5a616c286fa2f1b215baf3 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/db/58264a0a37c4f14e5a616c286fa2f1b215baf3 new file mode 100644 index 0000000..b51a008 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/db/58264a0a37c4f14e5a616c286fa2f1b215baf3 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/dd/a78f10740fe52637c5a7ba4d18816672c627fa b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/dd/a78f10740fe52637c5a7ba4d18816672c627fa new file mode 100644 index 0000000..02f7652 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/dd/a78f10740fe52637c5a7ba4d18816672c627fa differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 new file mode 100644 index 0000000..7112238 Binary files /dev/null and b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 differ diff --git a/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/fa/a30528db5930caebddd08ab642f8e4c00a6c60 b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/fa/a30528db5930caebddd08ab642f8e4c00a6c60 new file mode 100644 index 0000000..ca50370 --- /dev/null +++ b/tests/test_project_fixtures/test_project_add_not_null_column_followed_by_default/git/objects/fa/a30528db5930caebddd08ab642f8e4c00a6c60 @@ -0,0 +1,2 @@ +x­‘1OÃ0…™ó+Nê�5Q\A@•2 UE ¬,YN|‰Œ;rì"þ=vÜ´…®x|~þÞ½s-u eYÞ, »Í Ñ\¨n ζÙcP’<£BÃ,r¨¿a÷ÉT§�ä„ä%h›‚\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/post-update.sample b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/post-update.sample new file mode 100644 index 0000000..ec17ec1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/pre-applypatch.sample b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/pre-applypatch.sample new file mode 100644 index 0000000..b1f187c --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/pre-commit.sample b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/pre-commit.sample new file mode 100644 index 0000000..68d62d5 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/pre-push.sample b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/pre-push.sample new file mode 100644 index 0000000..1f3bceb --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/pre-push.sample @@ -0,0 +1,54 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +IFS=' ' +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/pre-rebase.sample b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/pre-rebase.sample new file mode 100644 index 0000000..33730ca --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up-to-date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/prepare-commit-msg.sample b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/prepare-commit-msg.sample new file mode 100644 index 0000000..f093a02 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/prepare-commit-msg.sample @@ -0,0 +1,36 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first comments out the +# "Conflicts:" part of a merge commit. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +case "$2,$3" in + merge,) + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; + +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$1" ;; + + *) ;; +esac + +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/update.sample b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/update.sample new file mode 100644 index 0000000..d847583 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/hooks/update.sample @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to blocks unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/index b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/index new file mode 100644 index 0000000..14b0331 Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/index differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/info/exclude b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/info/exclude new file mode 100644 index 0000000..a5196d1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/logs/HEAD b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/logs/HEAD new file mode 100644 index 0000000..a75a602 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/logs/HEAD @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 dbb570854ffac36f2c6c83f05b462f488ab9ea2e David-Wobrock 1509046997 +0200 commit (initial): Init +dbb570854ffac36f2c6c83f05b462f488ab9ea2e ba1eccf45ea15453cdb70eccb93febdfeb020b5b David-Wobrock 1509047009 +0200 commit: All files diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/logs/refs/heads/master b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/logs/refs/heads/master new file mode 100644 index 0000000..a75a602 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/logs/refs/heads/master @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 dbb570854ffac36f2c6c83f05b462f488ab9ea2e David-Wobrock 1509046997 +0200 commit (initial): Init +dbb570854ffac36f2c6c83f05b462f488ab9ea2e ba1eccf45ea15453cdb70eccb93febdfeb020b5b David-Wobrock 1509047009 +0200 commit: All files diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/1c/10d0afe6768cf62149ccdade6d7c21e9f563c2 b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/1c/10d0afe6768cf62149ccdade6d7c21e9f563c2 new file mode 100644 index 0000000..484862b Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/1c/10d0afe6768cf62149ccdade6d7c21e9f563c2 differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 new file mode 100644 index 0000000..adf6411 Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 new file mode 100644 index 0000000..3f771d5 Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 new file mode 100644 index 0000000..cf19499 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 @@ -0,0 +1 @@ +xm�OOA Å=ϧhö‰îãE& Á(ÀxœvºË�Ît3S@¿½Ëžš¦¯ï÷Ú5ñîoŠ¢P_Ëé jŽ�o¡áä£`2‚YL—x‹µÀ¥–JÍð»ãŒdƒp^¶DvM6ƒ…ÀnGxG¸G‚½Mþ4Š6 ƒª²]G¾¶â9VUï÷Ú'{x8 €coî34žð2¢ÚˆtùIkÇu.ÝÖÆ–ÿ2Õ4F=*G#½áƒ°vØÿŒ¢¹õZÏT>tœ8+Õ$pv)ë^ep´(æØ›«¨Jq.1î}âXf‡�Ý‘ ŠñÛË|º0ËÉj5›O—æc1þ|Ÿ·P\ÿÏXçLd1qGdj¦]8Ùˆ�m.†J]¡àþK0ª_òCš€ \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/6f/60aa19497fb69e565a609b77a9d9a153ce5166 b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/6f/60aa19497fb69e565a609b77a9d9a153ce5166 new file mode 100644 index 0000000..f83db9c Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/6f/60aa19497fb69e565a609b77a9d9a153ce5166 differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee new file mode 100644 index 0000000..66ccc09 Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/76/cc5dc6375ab11196a4a33e8483e90a4644cca6 b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/76/cc5dc6375ab11196a4a33e8483e90a4644cca6 new file mode 100644 index 0000000..27897af Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/76/cc5dc6375ab11196a4a33e8483e90a4644cca6 differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/7c/cafd52dbcbcf6381c02cf1f7de90dbfa1a43cc b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/7c/cafd52dbcbcf6381c02cf1f7de90dbfa1a43cc new file mode 100644 index 0000000..4308bad Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/7c/cafd52dbcbcf6381c02cf1f7de90dbfa1a43cc differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 new file mode 100644 index 0000000..250bef6 Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e new file mode 100644 index 0000000..e68f806 Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/91/ea44a218fbd2f408430959283f0419c921093e b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/91/ea44a218fbd2f408430959283f0419c921093e new file mode 100644 index 0000000..263fc8c Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/91/ea44a218fbd2f408430959283f0419c921093e differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/9f/a7aec38f3098aa3035f03195a084ca8c2a6fd4 b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/9f/a7aec38f3098aa3035f03195a084ca8c2a6fd4 new file mode 100644 index 0000000..0027b71 Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/9f/a7aec38f3098aa3035f03195a084ca8c2a6fd4 differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/ba/1eccf45ea15453cdb70eccb93febdfeb020b5b b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/ba/1eccf45ea15453cdb70eccb93febdfeb020b5b new file mode 100644 index 0000000..92eda4a Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/ba/1eccf45ea15453cdb70eccb93febdfeb020b5b differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/d3/7815c8d2a6f36f5ee21d79ca061aac9eda3096 b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/d3/7815c8d2a6f36f5ee21d79ca061aac9eda3096 new file mode 100644 index 0000000..acbb322 Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/d3/7815c8d2a6f36f5ee21d79ca061aac9eda3096 differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/d3/91b69ccab5441e2fdb073dcafb869e88c9aa6b b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/d3/91b69ccab5441e2fdb073dcafb869e88c9aa6b new file mode 100644 index 0000000..873eba0 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/d3/91b69ccab5441e2fdb073dcafb869e88c9aa6b @@ -0,0 +1,2 @@ +x]P±nÂ0윯xCBE"B¡THP[· +YNü¹uìÈv*ѯ¯(õ`Yw÷î„Õrõ0�ô1…J1.› ô¶N_<Mà %jj‘Ay†Ý'•�‚<Ëó씄Å<_§ù<]¬ Ú,×Q­U „Ô½í5¼í”¶ÐKîÌ‘n�›0Q²Á/cå¨ky㸒f­ðʨÔ8ŽTreWpº‰"p‡Kn9PÀ»î1` ;” eÅÑ8âcž§:¿�¼2ÞæOÄ«F·þÑ—I†IÏû#i‹E¼�gwhÍQ0S„� ws�[eÛÞª½—&Ô½H5„°Â—žA§yKõ™|áù‚Ôn+þƒÅÞýž“|£.•AJvñtzßÇ&±T–È^2ԺŤÅuhðôtsº˜ž¢_2á¡G \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/db/b570854ffac36f2c6c83f05b462f488ab9ea2e b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/db/b570854ffac36f2c6c83f05b462f488ab9ea2e new file mode 100644 index 0000000..0fea269 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/db/b570854ffac36f2c6c83f05b462f488ab9ea2e @@ -0,0 +1 @@ +x¥�1!E­9ÅôÆÍ,BbÌ6žÀš�Y%+’V¯/Æ#X¾Ÿ¼ÿBÉ95í~Ó*3(²RÇ`” d˜œGƒ¬Í6'­�‰Y9T¯í^*œý+ÅݵP-a�cüâðþátË>=†Pò F�Ý2Î`‹Qôµ‡ÿq!.ÏÔÄ(‹< \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/de/2a6fb35877e85acd92f4871e5fd18783ae0c3f b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/de/2a6fb35877e85acd92f4871e5fd18783ae0c3f new file mode 100644 index 0000000..3de107b Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/de/2a6fb35877e85acd92f4871e5fd18783ae0c3f differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 new file mode 100644 index 0000000..7112238 Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 new file mode 100644 index 0000000..a0339be Binary files /dev/null and b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 differ diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/refs/heads/master b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/refs/heads/master new file mode 100644 index 0000000..2cb9811 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/git/refs/heads/master @@ -0,0 +1 @@ +ba1eccf45ea15453cdb70eccb93febdfeb020b5b diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/manage.py b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/manage.py new file mode 100644 index 0000000..6f60aa1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project_create_table_with_not_null_column.settings") + try: + from django.core.management import execute_from_command_line + except ImportError: + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) + raise + execute_from_command_line(sys.argv) diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/__init__.py b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/admin.py b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/apps.py b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/apps.py new file mode 100644 index 0000000..fc04070 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class TestAppConfig(AppConfig): + name = 'test_app' diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/migrations/0001_create_table_with_not_null_field.py b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/migrations/0001_create_table_with_not_null_field.py new file mode 100644 index 0000000..d391b69 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/migrations/0001_create_table_with_not_null_field.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-25 13:47 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='A', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('not_null_field', models.IntegerField()), + ], + ), + ] diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/migrations/__init__.py b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/models.py b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/models.py new file mode 100644 index 0000000..76cc5dc --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/models.py @@ -0,0 +1,4 @@ +from django.db import models + +class A(models.Model): + not_null_field = models.IntegerField(null=False) diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/tests.py b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/views.py b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_app/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_project_create_table_with_not_null_column/__init__.py b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_project_create_table_with_not_null_column/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_project_create_table_with_not_null_column/settings.py b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_project_create_table_with_not_null_column/settings.py new file mode 100644 index 0000000..7ccafd5 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_project_create_table_with_not_null_column/settings.py @@ -0,0 +1,121 @@ +""" +Django settings for test_project_create_table_with_not_null_column project. + +Generated by 'django-admin startproject' using Django 1.11.6. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.11/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'gtb+mohs%gf0+#fr89vw7e&#edmv=q8!iv+n&j_soawk$tkj3^' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'test_app' +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'test_project_create_table_with_not_null_column.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'test_project_create_table_with_not_null_column.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/1.11/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.11/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_project_create_table_with_not_null_column/urls.py b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_project_create_table_with_not_null_column/urls.py new file mode 100644 index 0000000..735de5d --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_project_create_table_with_not_null_column/urls.py @@ -0,0 +1,21 @@ +"""linter_test_project URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/1.11/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.conf.urls import url, include + 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) +""" +from django.conf.urls import url +from django.contrib import admin + +urlpatterns = [ + url(r'^admin/', admin.site.urls), +] diff --git a/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_project_create_table_with_not_null_column/wsgi.py b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_project_create_table_with_not_null_column/wsgi.py new file mode 100644 index 0000000..6741b31 --- /dev/null +++ b/tests/test_project_fixtures/test_project_create_table_with_not_null_column/test_project_create_table_with_not_null_column/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for linter_test_project project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project_add_not_null_column.settings") + +application = get_wsgi_application() diff --git a/tests/test_project_fixtures/test_project_drop_column/.gitignore b/tests/test_project_fixtures/test_project_drop_column/.gitignore new file mode 100644 index 0000000..63973d0 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/.gitignore @@ -0,0 +1,3 @@ +*.pyc +__pycache__/ +*sqlite3 diff --git a/tests/test_project_fixtures/test_project_drop_column/git/COMMIT_EDITMSG b/tests/test_project_fixtures/test_project_drop_column/git/COMMIT_EDITMSG new file mode 100644 index 0000000..3b5cc13 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/COMMIT_EDITMSG @@ -0,0 +1,22 @@ +All files + +# Veuillez saisir le message de validation pour vos modifications. Les lignes +# commençant par '#' seront ignorées, et un message vide abandonne la validation. +# Sur la branche master +# Modifications qui seront validées : +# nouveau fichier: .gitignore +# nouveau fichier: manage.py +# nouveau fichier: test_app/__init__.py +# nouveau fichier: test_app/admin.py +# nouveau fichier: test_app/apps.py +# nouveau fichier: test_app/migrations/0001_create_table.py +# nouveau fichier: test_app/migrations/0002_drop_column.py +# nouveau fichier: test_app/migrations/__init__.py +# nouveau fichier: test_app/models.py +# nouveau fichier: test_app/tests.py +# nouveau fichier: test_app/views.py +# nouveau fichier: test_project_drop_column/__init__.py +# nouveau fichier: test_project_drop_column/settings.py +# nouveau fichier: test_project_drop_column/urls.py +# nouveau fichier: test_project_drop_column/wsgi.py +# diff --git a/tests/test_project_fixtures/test_project_drop_column/git/HEAD b/tests/test_project_fixtures/test_project_drop_column/git/HEAD new file mode 100644 index 0000000..cb089cd --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/tests/test_project_fixtures/test_project_drop_column/git/config b/tests/test_project_fixtures/test_project_drop_column/git/config new file mode 100644 index 0000000..eeb8dd7 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/config @@ -0,0 +1,5 @@ +[core] + repositoryformatversion = 0 + filemode = false + bare = false + logallrefupdates = true diff --git a/tests/test_project_fixtures/test_project_drop_column/git/description b/tests/test_project_fixtures/test_project_drop_column/git/description new file mode 100644 index 0000000..498b267 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/tests/test_project_fixtures/test_project_drop_column/git/hooks/applypatch-msg.sample b/tests/test_project_fixtures/test_project_drop_column/git/hooks/applypatch-msg.sample new file mode 100644 index 0000000..8b2a2fe --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/hooks/applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +test -x "$GIT_DIR/hooks/commit-msg" && + exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_project_drop_column/git/hooks/commit-msg.sample b/tests/test_project_fixtures/test_project_drop_column/git/hooks/commit-msg.sample new file mode 100644 index 0000000..b58d118 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/hooks/commit-msg.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/tests/test_project_fixtures/test_project_drop_column/git/hooks/post-update.sample b/tests/test_project_fixtures/test_project_drop_column/git/hooks/post-update.sample new file mode 100644 index 0000000..ec17ec1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/tests/test_project_fixtures/test_project_drop_column/git/hooks/pre-applypatch.sample b/tests/test_project_fixtures/test_project_drop_column/git/hooks/pre-applypatch.sample new file mode 100644 index 0000000..b1f187c --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_project_drop_column/git/hooks/pre-commit.sample b/tests/test_project_fixtures/test_project_drop_column/git/hooks/pre-commit.sample new file mode 100644 index 0000000..68d62d5 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/tests/test_project_fixtures/test_project_drop_column/git/hooks/pre-push.sample b/tests/test_project_fixtures/test_project_drop_column/git/hooks/pre-push.sample new file mode 100644 index 0000000..1f3bceb --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/hooks/pre-push.sample @@ -0,0 +1,54 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +IFS=' ' +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/tests/test_project_fixtures/test_project_drop_column/git/hooks/pre-rebase.sample b/tests/test_project_fixtures/test_project_drop_column/git/hooks/pre-rebase.sample new file mode 100644 index 0000000..33730ca --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up-to-date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/tests/test_project_fixtures/test_project_drop_column/git/hooks/prepare-commit-msg.sample b/tests/test_project_fixtures/test_project_drop_column/git/hooks/prepare-commit-msg.sample new file mode 100644 index 0000000..f093a02 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/hooks/prepare-commit-msg.sample @@ -0,0 +1,36 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first comments out the +# "Conflicts:" part of a merge commit. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +case "$2,$3" in + merge,) + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; + +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$1" ;; + + *) ;; +esac + +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff --git a/tests/test_project_fixtures/test_project_drop_column/git/hooks/update.sample b/tests/test_project_fixtures/test_project_drop_column/git/hooks/update.sample new file mode 100644 index 0000000..d847583 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/hooks/update.sample @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to blocks unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/tests/test_project_fixtures/test_project_drop_column/git/index b/tests/test_project_fixtures/test_project_drop_column/git/index new file mode 100644 index 0000000..b7a985f Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/index differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/info/exclude b/tests/test_project_fixtures/test_project_drop_column/git/info/exclude new file mode 100644 index 0000000..a5196d1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/logs/HEAD b/tests/test_project_fixtures/test_project_drop_column/git/logs/HEAD new file mode 100644 index 0000000..e0c0e72 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/logs/HEAD @@ -0,0 +1,3 @@ +0000000000000000000000000000000000000000 6a34c365ae581e0bd73521ffc69021e039d54d19 David-Wobrock 1509047306 +0200 commit (initial): Init +6a34c365ae581e0bd73521ffc69021e039d54d19 424a54e5916970e0c48fdcefc707b00d07d8190a David-Wobrock 1509047317 +0200 commit: All files +424a54e5916970e0c48fdcefc707b00d07d8190a 24f18b5897f6361405dd5c1c900869d693430801 David-Wobrock 1509047363 +0200 commit (amend): All files diff --git a/tests/test_project_fixtures/test_project_drop_column/git/logs/refs/heads/master b/tests/test_project_fixtures/test_project_drop_column/git/logs/refs/heads/master new file mode 100644 index 0000000..e0c0e72 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/logs/refs/heads/master @@ -0,0 +1,3 @@ +0000000000000000000000000000000000000000 6a34c365ae581e0bd73521ffc69021e039d54d19 David-Wobrock 1509047306 +0200 commit (initial): Init +6a34c365ae581e0bd73521ffc69021e039d54d19 424a54e5916970e0c48fdcefc707b00d07d8190a David-Wobrock 1509047317 +0200 commit: All files +424a54e5916970e0c48fdcefc707b00d07d8190a 24f18b5897f6361405dd5c1c900869d693430801 David-Wobrock 1509047363 +0200 commit (amend): All files diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/03/0a39f4edf75b9d3a5506a722b3726296a87ef4 b/tests/test_project_fixtures/test_project_drop_column/git/objects/03/0a39f4edf75b9d3a5506a722b3726296a87ef4 new file mode 100644 index 0000000..cb2bc2b Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/03/0a39f4edf75b9d3a5506a722b3726296a87ef4 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/1f/c7cd90b9ed61da4f88a4455d34977143489aa7 b/tests/test_project_fixtures/test_project_drop_column/git/objects/1f/c7cd90b9ed61da4f88a4455d34977143489aa7 new file mode 100644 index 0000000..d25ba48 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/1f/c7cd90b9ed61da4f88a4455d34977143489aa7 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/24/f18b5897f6361405dd5c1c900869d693430801 b/tests/test_project_fixtures/test_project_drop_column/git/objects/24/f18b5897f6361405dd5c1c900869d693430801 new file mode 100644 index 0000000..e033d63 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/24/f18b5897f6361405dd5c1c900869d693430801 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/37/8f8dec7827972177bb4f79b05a508afe2fbb65 b/tests/test_project_fixtures/test_project_drop_column/git/objects/37/8f8dec7827972177bb4f79b05a508afe2fbb65 new file mode 100644 index 0000000..0649b52 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/37/8f8dec7827972177bb4f79b05a508afe2fbb65 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/42/4a54e5916970e0c48fdcefc707b00d07d8190a b/tests/test_project_fixtures/test_project_drop_column/git/objects/42/4a54e5916970e0c48fdcefc707b00d07d8190a new file mode 100644 index 0000000..8f82a1d Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/42/4a54e5916970e0c48fdcefc707b00d07d8190a differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/tests/test_project_fixtures/test_project_drop_column/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 new file mode 100644 index 0000000..adf6411 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/4c/14a9e6112b6f7648ab793c423cdf598431fa93 b/tests/test_project_fixtures/test_project_drop_column/git/objects/4c/14a9e6112b6f7648ab793c423cdf598431fa93 new file mode 100644 index 0000000..9580adc Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/4c/14a9e6112b6f7648ab793c423cdf598431fa93 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/5a/6a22e2af1152c5fb11a8a3e94eac9a21612b22 b/tests/test_project_fixtures/test_project_drop_column/git/objects/5a/6a22e2af1152c5fb11a8a3e94eac9a21612b22 new file mode 100644 index 0000000..9f46cf2 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/5a/6a22e2af1152c5fb11a8a3e94eac9a21612b22 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/62/ba4ba170fdcc4677c50b5155980671d1dc8776 b/tests/test_project_fixtures/test_project_drop_column/git/objects/62/ba4ba170fdcc4677c50b5155980671d1dc8776 new file mode 100644 index 0000000..47f128e Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/62/ba4ba170fdcc4677c50b5155980671d1dc8776 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 b/tests/test_project_fixtures/test_project_drop_column/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 new file mode 100644 index 0000000..3f771d5 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 b/tests/test_project_fixtures/test_project_drop_column/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 new file mode 100644 index 0000000..cf19499 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 @@ -0,0 +1 @@ +xm�OOA Å=ϧhö‰îãE& Á(ÀxœvºË�Ît3S@¿½Ëžš¦¯ï÷Ú5ñîoŠ¢P_Ëé jŽ�o¡áä£`2‚YL—x‹µÀ¥–JÍð»ãŒdƒp^¶DvM6ƒ…ÀnGxG¸G‚½Mþ4Š6 ƒª²]G¾¶â9VUï÷Ú'{x8 €coî34žð2¢ÚˆtùIkÇu.ÝÖÆ–ÿ2Õ4F=*G#½áƒ°vØÿŒ¢¹õZÏT>tœ8+Õ$pv)ë^ep´(æØ›«¨Jq.1î}âXf‡�Ý‘ ŠñÛË|º0ËÉj5›O—æc1þ|Ÿ·P\ÿÏXçLd1qGdj¦]8Ùˆ�m.†J]¡àþK0ª_òCš€ \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/6a/34c365ae581e0bd73521ffc69021e039d54d19 b/tests/test_project_fixtures/test_project_drop_column/git/objects/6a/34c365ae581e0bd73521ffc69021e039d54d19 new file mode 100644 index 0000000..b36c27a --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/objects/6a/34c365ae581e0bd73521ffc69021e039d54d19 @@ -0,0 +1 @@ +x¥�1!E­9ÅôÆÍ, ‰ÙXØxkf•(’V¯/Æ#X¾Ÿ¼ÿBÉ95í´i•Y©c0J2LΣAÖŠ�“Ö.Ĭ*á×v+Nþ•âîR¨–p‡Cüâðþáñš}z ¡äF�ÝÚOh`‹Qôµ‡ÿq!ÎÏÔÄ"Ö;ç \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee b/tests/test_project_fixtures/test_project_drop_column/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee new file mode 100644 index 0000000..66ccc09 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/7a/9637de11249631dbaeebc348bf69a235dfbd34 b/tests/test_project_fixtures/test_project_drop_column/git/objects/7a/9637de11249631dbaeebc348bf69a235dfbd34 new file mode 100644 index 0000000..fbb70e0 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/7a/9637de11249631dbaeebc348bf69a235dfbd34 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 b/tests/test_project_fixtures/test_project_drop_column/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 new file mode 100644 index 0000000..250bef6 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e b/tests/test_project_fixtures/test_project_drop_column/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e new file mode 100644 index 0000000..e68f806 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/91/ea44a218fbd2f408430959283f0419c921093e b/tests/test_project_fixtures/test_project_drop_column/git/objects/91/ea44a218fbd2f408430959283f0419c921093e new file mode 100644 index 0000000..263fc8c Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/91/ea44a218fbd2f408430959283f0419c921093e differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/95/a7313de6fcb6553cd7a0e4993ee1c6c2760d0e b/tests/test_project_fixtures/test_project_drop_column/git/objects/95/a7313de6fcb6553cd7a0e4993ee1c6c2760d0e new file mode 100644 index 0000000..13fc88e Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/95/a7313de6fcb6553cd7a0e4993ee1c6c2760d0e differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/a4/b2b15bde4d6744a83c82f5c27287dc2ffd0f39 b/tests/test_project_fixtures/test_project_drop_column/git/objects/a4/b2b15bde4d6744a83c82f5c27287dc2ffd0f39 new file mode 100644 index 0000000..16d025e --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/objects/a4/b2b15bde4d6744a83c82f5c27287dc2ffd0f39 @@ -0,0 +1,4 @@ +x]PËjÃ0ìY_±�ƒ�›8mÒð!4¤ä�[o%ÙZµ²d$¹�~}%+�¶:13;3«Jê +–Ëùݲû jÍ…j×0¸&{™À+*4Ì!‡êÛ¦Z E^ù +´‚żxÊŠy¶XBñ¸~X‘Æè(m7¤D×kã`P›#•Ây7iIòÑ/çÕE׉և ­ì :?”¤–ÌZ8\¨ô&ʯàtMø#”p‚I(áÍ 1Ž=*Žªh=ñ> +�‘Ó}Ø.^™`ó+âÅ _ÿʤãdàÃQ¬Ã2Ù$³?h#Pr[Æ�(Œwšž\¶Ê7ƒÓ» M™Ñz áe(=ƒÞˆŽ™ýÄÓ±hüVâË�ÿ=/ùBSi‹4–Øo“éôo�š&j�’Ž•nÑ{å°EÓƒ`Ìø?¼Ù���äy`£* \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/bf/21b1d9dc89a31ac4f2f6260996da59814e2f1e b/tests/test_project_fixtures/test_project_drop_column/git/objects/bf/21b1d9dc89a31ac4f2f6260996da59814e2f1e new file mode 100644 index 0000000..bf5a515 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/bf/21b1d9dc89a31ac4f2f6260996da59814e2f1e differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/d4/942ceb12ecd35cfbb0d21fee3062c019e659c3 b/tests/test_project_fixtures/test_project_drop_column/git/objects/d4/942ceb12ecd35cfbb0d21fee3062c019e659c3 new file mode 100644 index 0000000..61838b7 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/d4/942ceb12ecd35cfbb0d21fee3062c019e659c3 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/dd/58746c94048ea2fe86d773395b68803c4ef832 b/tests/test_project_fixtures/test_project_drop_column/git/objects/dd/58746c94048ea2fe86d773395b68803c4ef832 new file mode 100644 index 0000000..9670018 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/dd/58746c94048ea2fe86d773395b68803c4ef832 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/tests/test_project_fixtures/test_project_drop_column/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 new file mode 100644 index 0000000..7112238 Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 b/tests/test_project_fixtures/test_project_drop_column/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 new file mode 100644 index 0000000..a0339be Binary files /dev/null and b/tests/test_project_fixtures/test_project_drop_column/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 differ diff --git a/tests/test_project_fixtures/test_project_drop_column/git/refs/heads/master b/tests/test_project_fixtures/test_project_drop_column/git/refs/heads/master new file mode 100644 index 0000000..e48b674 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/git/refs/heads/master @@ -0,0 +1 @@ +24f18b5897f6361405dd5c1c900869d693430801 diff --git a/tests/test_project_fixtures/test_project_drop_column/manage.py b/tests/test_project_fixtures/test_project_drop_column/manage.py new file mode 100644 index 0000000..378f8de --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project_drop_column.settings") + try: + from django.core.management import execute_from_command_line + except ImportError: + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) + raise + execute_from_command_line(sys.argv) diff --git a/tests/test_project_fixtures/test_project_drop_column/test_app/__init__.py b/tests/test_project_fixtures/test_project_drop_column/test_app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_drop_column/test_app/admin.py b/tests/test_project_fixtures/test_project_drop_column/test_app/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/test_app/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/tests/test_project_fixtures/test_project_drop_column/test_app/apps.py b/tests/test_project_fixtures/test_project_drop_column/test_app/apps.py new file mode 100644 index 0000000..fc04070 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/test_app/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class TestAppConfig(AppConfig): + name = 'test_app' diff --git a/tests/test_project_fixtures/test_project_drop_column/test_app/migrations/0001_create_table.py b/tests/test_project_fixtures/test_project_drop_column/test_app/migrations/0001_create_table.py new file mode 100644 index 0000000..a4b2b15 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/test_app/migrations/0001_create_table.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-25 14:36 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='A', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('null_field', models.IntegerField(null=True)), + ], + ), + ] diff --git a/tests/test_project_fixtures/test_project_drop_column/test_app/migrations/0002_drop_column.py b/tests/test_project_fixtures/test_project_drop_column/test_app/migrations/0002_drop_column.py new file mode 100644 index 0000000..7a9637d --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/test_app/migrations/0002_drop_column.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-25 14:36 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('test_app', '0001_create_table'), + ] + + operations = [ + migrations.RemoveField( + model_name='a', + name='null_field', + ), + ] diff --git a/tests/test_project_fixtures/test_project_drop_column/test_app/migrations/__init__.py b/tests/test_project_fixtures/test_project_drop_column/test_app/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_drop_column/test_app/models.py b/tests/test_project_fixtures/test_project_drop_column/test_app/models.py new file mode 100644 index 0000000..bf21b1d --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/test_app/models.py @@ -0,0 +1,4 @@ +from django.db import models + +class A(models.Model): + pass diff --git a/tests/test_project_fixtures/test_project_drop_column/test_app/tests.py b/tests/test_project_fixtures/test_project_drop_column/test_app/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/test_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/tests/test_project_fixtures/test_project_drop_column/test_app/views.py b/tests/test_project_fixtures/test_project_drop_column/test_app/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/test_app/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/tests/test_project_fixtures/test_project_drop_column/test_project_drop_column/__init__.py b/tests/test_project_fixtures/test_project_drop_column/test_project_drop_column/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_drop_column/test_project_drop_column/settings.py b/tests/test_project_fixtures/test_project_drop_column/test_project_drop_column/settings.py new file mode 100644 index 0000000..62ba4ba --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/test_project_drop_column/settings.py @@ -0,0 +1,121 @@ +""" +Django settings for test_project_drop_column project. + +Generated by 'django-admin startproject' using Django 1.11.6. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.11/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'gtb+mohs%gf0+#fr89vw7e&#edmv=q8!iv+n&j_soawk$tkj3^' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'test_app' +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'test_project_drop_column.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'test_project_drop_column.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/1.11/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.11/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/tests/test_project_fixtures/test_project_drop_column/test_project_drop_column/urls.py b/tests/test_project_fixtures/test_project_drop_column/test_project_drop_column/urls.py new file mode 100644 index 0000000..735de5d --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/test_project_drop_column/urls.py @@ -0,0 +1,21 @@ +"""linter_test_project URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/1.11/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.conf.urls import url, include + 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) +""" +from django.conf.urls import url +from django.contrib import admin + +urlpatterns = [ + url(r'^admin/', admin.site.urls), +] diff --git a/tests/test_project_fixtures/test_project_drop_column/test_project_drop_column/wsgi.py b/tests/test_project_fixtures/test_project_drop_column/test_project_drop_column/wsgi.py new file mode 100644 index 0000000..6741b31 --- /dev/null +++ b/tests/test_project_fixtures/test_project_drop_column/test_project_drop_column/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for linter_test_project project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project_add_not_null_column.settings") + +application = get_wsgi_application() diff --git a/tests/test_project_fixtures/test_project_multi_commit/.gitignore b/tests/test_project_fixtures/test_project_multi_commit/.gitignore new file mode 100644 index 0000000..63973d0 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/.gitignore @@ -0,0 +1,3 @@ +*.pyc +__pycache__/ +*sqlite3 diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/COMMIT_EDITMSG b/tests/test_project_fixtures/test_project_multi_commit/git/COMMIT_EDITMSG new file mode 100644 index 0000000..822b1e1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/COMMIT_EDITMSG @@ -0,0 +1,10 @@ +Add accepted migration + +# Veuillez saisir le message de validation pour vos modifications. Les lignes +# commençant par '#' seront ignorées, et un message vide abandonne la validation. +# Sur la branche master +# Modifications qui seront validées : +# nouveau fichier: test_app/migrations/0003_add_new_nullable_field.py +# modifié: test_app/models.py +# modifié: test_project_multi_commit/settings.py +# diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/HEAD b/tests/test_project_fixtures/test_project_multi_commit/git/HEAD new file mode 100644 index 0000000..cb089cd --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/config b/tests/test_project_fixtures/test_project_multi_commit/git/config new file mode 100644 index 0000000..eeb8dd7 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/config @@ -0,0 +1,5 @@ +[core] + repositoryformatversion = 0 + filemode = false + bare = false + logallrefupdates = true diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/description b/tests/test_project_fixtures/test_project_multi_commit/git/description new file mode 100644 index 0000000..498b267 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/hooks/applypatch-msg.sample b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/applypatch-msg.sample new file mode 100644 index 0000000..8b2a2fe --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +test -x "$GIT_DIR/hooks/commit-msg" && + exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/hooks/commit-msg.sample b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/commit-msg.sample new file mode 100644 index 0000000..b58d118 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/commit-msg.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/hooks/post-update.sample b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/post-update.sample new file mode 100644 index 0000000..ec17ec1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/hooks/pre-applypatch.sample b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/pre-applypatch.sample new file mode 100644 index 0000000..b1f187c --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/hooks/pre-commit.sample b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/pre-commit.sample new file mode 100644 index 0000000..68d62d5 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/hooks/pre-push.sample b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/pre-push.sample new file mode 100644 index 0000000..1f3bceb --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/pre-push.sample @@ -0,0 +1,54 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +IFS=' ' +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/hooks/pre-rebase.sample b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/pre-rebase.sample new file mode 100644 index 0000000..33730ca --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up-to-date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/hooks/prepare-commit-msg.sample b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/prepare-commit-msg.sample new file mode 100644 index 0000000..f093a02 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/prepare-commit-msg.sample @@ -0,0 +1,36 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first comments out the +# "Conflicts:" part of a merge commit. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +case "$2,$3" in + merge,) + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; + +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$1" ;; + + *) ;; +esac + +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/hooks/update.sample b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/update.sample new file mode 100644 index 0000000..d847583 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/hooks/update.sample @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to blocks unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/index b/tests/test_project_fixtures/test_project_multi_commit/git/index new file mode 100644 index 0000000..54ffd1c Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/index differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/info/exclude b/tests/test_project_fixtures/test_project_multi_commit/git/info/exclude new file mode 100644 index 0000000..a5196d1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/logs/HEAD b/tests/test_project_fixtures/test_project_multi_commit/git/logs/HEAD new file mode 100644 index 0000000..afe94b7 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/logs/HEAD @@ -0,0 +1,4 @@ +0000000000000000000000000000000000000000 39d82d794ccb9af40a19c1b708eea6f90695c4d8 David-Wobrock 1509050010 +0200 commit (initial): Init +39d82d794ccb9af40a19c1b708eea6f90695c4d8 44330921696018f8f1480df897b38310549982cb David-Wobrock 1509050030 +0200 commit: All files +44330921696018f8f1480df897b38310549982cb fe961bc4402a57bace36648e1a6f1998bae3c5e3 David-Wobrock 1509050084 +0200 commit: Add accepted migration +fe961bc4402a57bace36648e1a6f1998bae3c5e3 dc16039b7458a98bcf9be2b92389e176ae1d9461 David-Wobrock 1509381925 +0100 commit (amend): Add accepted migration diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/logs/refs/heads/master b/tests/test_project_fixtures/test_project_multi_commit/git/logs/refs/heads/master new file mode 100644 index 0000000..afe94b7 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/logs/refs/heads/master @@ -0,0 +1,4 @@ +0000000000000000000000000000000000000000 39d82d794ccb9af40a19c1b708eea6f90695c4d8 David-Wobrock 1509050010 +0200 commit (initial): Init +39d82d794ccb9af40a19c1b708eea6f90695c4d8 44330921696018f8f1480df897b38310549982cb David-Wobrock 1509050030 +0200 commit: All files +44330921696018f8f1480df897b38310549982cb fe961bc4402a57bace36648e1a6f1998bae3c5e3 David-Wobrock 1509050084 +0200 commit: Add accepted migration +fe961bc4402a57bace36648e1a6f1998bae3c5e3 dc16039b7458a98bcf9be2b92389e176ae1d9461 David-Wobrock 1509381925 +0100 commit (amend): Add accepted migration diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/09/d00ce23e0b42f2c18895ee5fa577f57f14b2ac b/tests/test_project_fixtures/test_project_multi_commit/git/objects/09/d00ce23e0b42f2c18895ee5fa577f57f14b2ac new file mode 100644 index 0000000..4d7d160 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/objects/09/d00ce23e0b42f2c18895ee5fa577f57f14b2ac @@ -0,0 +1,3 @@ +x]PËjÃ0ìÙ_±�ƒ�;Ôm øRrÈ­·„m­�ZY2zÒ¯¯dåY„˜™�™UÃee™?Ì }L¡•”‰~Öté«G¢¼£@U¤ÐaóU‹^B‘Eö RÀ2/^Ò"O—%O«¼Œ:% ¤³Æ*$Ø0JeÀ +æÌ‘pfœ×QÒÉ/£ÍY7°Þ…1)ô7à•QËk­a¦’«(»€óU�;L0Ãj|(‹£8¢ (Z†ÚŸ“ð89úí|à…ñ67o +Ýú{_&™&=ï�¨¬âu¼¸C;†œê*„a¸“˜Ñø¼U¶¶Fn½4©Ý‹´S­|錊 µ:’o<ž�ÊmÅ~±Úºßs’T�ÔHB‰Ý&žÏï{øÐ$–s2UºFï„ÁUH÷‚)ãÿüájwr>Dqá£& \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/2c/2d5b22159ce4123f0ecd22d631684742a6f298 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/2c/2d5b22159ce4123f0ecd22d631684742a6f298 new file mode 100644 index 0000000..5b47466 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/2c/2d5b22159ce4123f0ecd22d631684742a6f298 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/2f/eca9a38c232b4cb06c39d2db0b3d9be23a67e2 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/2f/eca9a38c232b4cb06c39d2db0b3d9be23a67e2 new file mode 100644 index 0000000..9aecb91 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/2f/eca9a38c232b4cb06c39d2db0b3d9be23a67e2 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/39/d82d794ccb9af40a19c1b708eea6f90695c4d8 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/39/d82d794ccb9af40a19c1b708eea6f90695c4d8 new file mode 100644 index 0000000..57e787d Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/39/d82d794ccb9af40a19c1b708eea6f90695c4d8 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/3a/c947d350f32c18f403dce1868ac36f275fa7b8 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/3a/c947d350f32c18f403dce1868ac36f275fa7b8 new file mode 100644 index 0000000..4a46d48 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/3a/c947d350f32c18f403dce1868ac36f275fa7b8 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/42/9e00355cee29f0d18bfcbc67555f9c8fbe0cf0 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/42/9e00355cee29f0d18bfcbc67555f9c8fbe0cf0 new file mode 100644 index 0000000..003a2f3 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/42/9e00355cee29f0d18bfcbc67555f9c8fbe0cf0 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/44/330921696018f8f1480df897b38310549982cb b/tests/test_project_fixtures/test_project_multi_commit/git/objects/44/330921696018f8f1480df897b38310549982cb new file mode 100644 index 0000000..c7466f4 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/44/330921696018f8f1480df897b38310549982cb differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/48/345f2d283caadec9aba8c78268ff6c48711836 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/48/345f2d283caadec9aba8c78268ff6c48711836 new file mode 100644 index 0000000..d9a9744 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/48/345f2d283caadec9aba8c78268ff6c48711836 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 new file mode 100644 index 0000000..adf6411 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/4c/e3b40413b7f8938d91828c437f33f66d57fcc9 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/4c/e3b40413b7f8938d91828c437f33f66d57fcc9 new file mode 100644 index 0000000..24365e0 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/objects/4c/e3b40413b7f8938d91828c437f33f66d57fcc9 @@ -0,0 +1 @@ +xU�Ak„0…{öW ìA·¨¨]l<JK½õVJˆf””8‘)ý÷Mâ®íæÞ¼yßK:¥;8ÕÅÍ²Û z-$� ¬vÈ¼à ·( û�§/N£†2/˼MPå}VYU»kswŠ£'`lXíj�1�Ó¬�…•¤ G¦¤uij‰6£y¹è.¾IŽ&5-)LnÁ;£^ñe�·Ë(ù3å»xl¢Ü8# ¤^â-|Ñ’ØâbŸç8…¸(ŠŠq!á7#m­J±A¢ñ1 KŸ[ žýó}£«¸…xö‹ÉÎò¼ÐžŸ°�y¼EzÝŸM h‡å�Â3úÚê´Û7ä¯dqD³‘|ÛöݬxîêC÷Ú¿ºÁ‹U \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 new file mode 100644 index 0000000..3f771d5 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 new file mode 100644 index 0000000..cf19499 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 @@ -0,0 +1 @@ +xm�OOA Å=ϧhö‰îãE& Á(ÀxœvºË�Ît3S@¿½Ëžš¦¯ï÷Ú5ñîoŠ¢P_Ëé jŽ�o¡áä£`2‚YL—x‹µÀ¥–JÍð»ãŒdƒp^¶DvM6ƒ…ÀnGxG¸G‚½Mþ4Š6 ƒª²]G¾¶â9VUï÷Ú'{x8 €coî34žð2¢ÚˆtùIkÇu.ÝÖÆ–ÿ2Õ4F=*G#½áƒ°vØÿŒ¢¹õZÏT>tœ8+Õ$pv)ë^ep´(æØ›«¨Jq.1î}âXf‡�Ý‘ ŠñÛË|º0ËÉj5›O—æc1þ|Ÿ·P\ÿÏXçLd1qGdj¦]8Ùˆ�m.†J]¡àþK0ª_òCš€ \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/73/47b0f2a9845fa268ad4a19967c706e5d7be38b b/tests/test_project_fixtures/test_project_multi_commit/git/objects/73/47b0f2a9845fa268ad4a19967c706e5d7be38b new file mode 100644 index 0000000..621f4fc Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/73/47b0f2a9845fa268ad4a19967c706e5d7be38b differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee b/tests/test_project_fixtures/test_project_multi_commit/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee new file mode 100644 index 0000000..66ccc09 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 new file mode 100644 index 0000000..250bef6 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/7f/dd1712d35fb3950479fa65119efa83a04f41fc b/tests/test_project_fixtures/test_project_multi_commit/git/objects/7f/dd1712d35fb3950479fa65119efa83a04f41fc new file mode 100644 index 0000000..ae05502 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/7f/dd1712d35fb3950479fa65119efa83a04f41fc differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/80/c1a28714bc4471a440cae6c348c7d0dfc76eed b/tests/test_project_fixtures/test_project_multi_commit/git/objects/80/c1a28714bc4471a440cae6c348c7d0dfc76eed new file mode 100644 index 0000000..9f46919 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/80/c1a28714bc4471a440cae6c348c7d0dfc76eed differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/87/76fa3b34105744f98699924fbfbc5fd7f4e59f b/tests/test_project_fixtures/test_project_multi_commit/git/objects/87/76fa3b34105744f98699924fbfbc5fd7f4e59f new file mode 100644 index 0000000..d39fd64 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/87/76fa3b34105744f98699924fbfbc5fd7f4e59f differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/88/80cfa9557a6ce785b43fb300748310b7e995ed b/tests/test_project_fixtures/test_project_multi_commit/git/objects/88/80cfa9557a6ce785b43fb300748310b7e995ed new file mode 100644 index 0000000..688ed38 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/88/80cfa9557a6ce785b43fb300748310b7e995ed differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e b/tests/test_project_fixtures/test_project_multi_commit/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e new file mode 100644 index 0000000..e68f806 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/91/ea44a218fbd2f408430959283f0419c921093e b/tests/test_project_fixtures/test_project_multi_commit/git/objects/91/ea44a218fbd2f408430959283f0419c921093e new file mode 100644 index 0000000..263fc8c Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/91/ea44a218fbd2f408430959283f0419c921093e differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/92/8f9938db104a389b465923b8ea1fcce7b5c678 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/92/8f9938db104a389b465923b8ea1fcce7b5c678 new file mode 100644 index 0000000..b6aaa40 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/92/8f9938db104a389b465923b8ea1fcce7b5c678 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/a9/9fb787f53fad33eb031f8d252086c8a22c71a3 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/a9/9fb787f53fad33eb031f8d252086c8a22c71a3 new file mode 100644 index 0000000..35df92a Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/a9/9fb787f53fad33eb031f8d252086c8a22c71a3 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/c0/2fb5754a33cbcd4408dc9e50260406fb6ee44a b/tests/test_project_fixtures/test_project_multi_commit/git/objects/c0/2fb5754a33cbcd4408dc9e50260406fb6ee44a new file mode 100644 index 0000000..8e90ccf Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/c0/2fb5754a33cbcd4408dc9e50260406fb6ee44a differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/dc/16039b7458a98bcf9be2b92389e176ae1d9461 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/dc/16039b7458a98bcf9be2b92389e176ae1d9461 new file mode 100644 index 0000000..82e8dcf Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/dc/16039b7458a98bcf9be2b92389e176ae1d9461 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/dd/a78f10740fe52637c5a7ba4d18816672c627fa b/tests/test_project_fixtures/test_project_multi_commit/git/objects/dd/a78f10740fe52637c5a7ba4d18816672c627fa new file mode 100644 index 0000000..02f7652 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/dd/a78f10740fe52637c5a7ba4d18816672c627fa differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/e0/e9599616de90471fbedcf6627e3392aee37e47 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/e0/e9599616de90471fbedcf6627e3392aee37e47 new file mode 100644 index 0000000..8e9d3bd Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/e0/e9599616de90471fbedcf6627e3392aee37e47 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/e5/d9d54f36eb3916eebe9ce689180572abc355f3 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/e5/d9d54f36eb3916eebe9ce689180572abc355f3 new file mode 100644 index 0000000..e6b6c06 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/e5/d9d54f36eb3916eebe9ce689180572abc355f3 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 new file mode 100644 index 0000000..7112238 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/f1/31a1ec97d003f08b920190bc152d82d850c4ca b/tests/test_project_fixtures/test_project_multi_commit/git/objects/f1/31a1ec97d003f08b920190bc152d82d850c4ca new file mode 100644 index 0000000..529c689 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/objects/f1/31a1ec97d003f08b920190bc152d82d850c4ca @@ -0,0 +1,2 @@ +x%ŒË +Â0E]ç+f/–™<ÚD\ø ‚뼩"5(þ½)]\¸gqN³HÊ]u÷èH)N£‘tÒ‰¤Æ�´™œÐ‚PIc4÷޵ß+‚¯¥Ì�µÞè£õä¸ÀÅ~æp¸U·Tÿ€cXqønxÎÅÎÏ¡›' …ò a�‘±k|·-õ<œ,Þ \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/f5/39458143158b494ab979422984dfb2c280303f b/tests/test_project_fixtures/test_project_multi_commit/git/objects/f5/39458143158b494ab979422984dfb2c280303f new file mode 100644 index 0000000..cd8c311 Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/f5/39458143158b494ab979422984dfb2c280303f differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 new file mode 100644 index 0000000..a0339be Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/objects/fe/961bc4402a57bace36648e1a6f1998bae3c5e3 b/tests/test_project_fixtures/test_project_multi_commit/git/objects/fe/961bc4402a57bace36648e1a6f1998bae3c5e3 new file mode 100644 index 0000000..abb994b Binary files /dev/null and b/tests/test_project_fixtures/test_project_multi_commit/git/objects/fe/961bc4402a57bace36648e1a6f1998bae3c5e3 differ diff --git a/tests/test_project_fixtures/test_project_multi_commit/git/refs/heads/master b/tests/test_project_fixtures/test_project_multi_commit/git/refs/heads/master new file mode 100644 index 0000000..fe0eab2 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/git/refs/heads/master @@ -0,0 +1 @@ +dc16039b7458a98bcf9be2b92389e176ae1d9461 diff --git a/tests/test_project_fixtures/test_project_multi_commit/manage.py b/tests/test_project_fixtures/test_project_multi_commit/manage.py new file mode 100644 index 0000000..e0e9599 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project_multi_commit.settings") + try: + from django.core.management import execute_from_command_line + except ImportError: + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) + raise + execute_from_command_line(sys.argv) diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_app/__init__.py b/tests/test_project_fixtures/test_project_multi_commit/test_app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_app/admin.py b/tests/test_project_fixtures/test_project_multi_commit/test_app/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/test_app/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_app/apps.py b/tests/test_project_fixtures/test_project_multi_commit/test_app/apps.py new file mode 100644 index 0000000..fc04070 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/test_app/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class TestAppConfig(AppConfig): + name = 'test_app' diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_app/migrations/0001_create_table.py b/tests/test_project_fixtures/test_project_multi_commit/test_app/migrations/0001_create_table.py new file mode 100644 index 0000000..09d00ce --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/test_app/migrations/0001_create_table.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-25 14:05 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='A', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('null_field', models.IntegerField(null=True)), + ], + ), + ] diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_app/migrations/0002_add_new_not_null_field.py b/tests/test_project_fixtures/test_project_multi_commit/test_app/migrations/0002_add_new_not_null_field.py new file mode 100644 index 0000000..7347b0f --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/test_app/migrations/0002_add_new_not_null_field.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-25 14:06 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('test_app', '0001_create_table'), + ] + + operations = [ + migrations.AddField( + model_name='a', + name='new_not_null_field', + field=models.IntegerField(default=1), + preserve_default=False, + ), + ] diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_app/migrations/0003_add_new_nullable_field.py b/tests/test_project_fixtures/test_project_multi_commit/test_app/migrations/0003_add_new_nullable_field.py new file mode 100644 index 0000000..4ce3b40 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/test_app/migrations/0003_add_new_nullable_field.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-26 20:34 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('test_app', '0002_add_new_not_null_field'), + ] + + operations = [ + migrations.AddField( + model_name='a', + name='new_nullable_field', + field=models.IntegerField(null=True), + ), + ] diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_app/migrations/__init__.py b/tests/test_project_fixtures/test_project_multi_commit/test_app/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_app/models.py b/tests/test_project_fixtures/test_project_multi_commit/test_app/models.py new file mode 100644 index 0000000..928f993 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/test_app/models.py @@ -0,0 +1,6 @@ +from django.db import models + +class A(models.Model): + null_field = models.IntegerField(null=True) + new_not_null_field = models.IntegerField(null=False) + new_nullable_field = models.IntegerField(null=True) diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_app/tests.py b/tests/test_project_fixtures/test_project_multi_commit/test_app/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/test_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_app/views.py b/tests/test_project_fixtures/test_project_multi_commit/test_app/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/test_app/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_project_multi_commit/__init__.py b/tests/test_project_fixtures/test_project_multi_commit/test_project_multi_commit/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_project_multi_commit/settings.py b/tests/test_project_fixtures/test_project_multi_commit/test_project_multi_commit/settings.py new file mode 100644 index 0000000..80c1a28 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/test_project_multi_commit/settings.py @@ -0,0 +1,120 @@ +""" +Django settings for test_project_multi_commit project. + +Generated by 'django-admin startproject' using Django 1.11.6. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.11/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'gtb+mohs%gf0+#fr89vw7e&#edmv=q8!iv+n&j_soawk$tkj3^' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'test_app' +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'test_project_multi_commit.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'test_project_multi_commit.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django_fake_database_backends.backends.mysql', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/1.11/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.11/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_project_multi_commit/urls.py b/tests/test_project_fixtures/test_project_multi_commit/test_project_multi_commit/urls.py new file mode 100644 index 0000000..735de5d --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/test_project_multi_commit/urls.py @@ -0,0 +1,21 @@ +"""linter_test_project URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/1.11/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.conf.urls import url, include + 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) +""" +from django.conf.urls import url +from django.contrib import admin + +urlpatterns = [ + url(r'^admin/', admin.site.urls), +] diff --git a/tests/test_project_fixtures/test_project_multi_commit/test_project_multi_commit/wsgi.py b/tests/test_project_fixtures/test_project_multi_commit/test_project_multi_commit/wsgi.py new file mode 100644 index 0000000..6741b31 --- /dev/null +++ b/tests/test_project_fixtures/test_project_multi_commit/test_project_multi_commit/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for linter_test_project project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project_add_not_null_column.settings") + +application = get_wsgi_application() diff --git a/tests/test_project_fixtures/test_project_rename_column/.gitignore b/tests/test_project_fixtures/test_project_rename_column/.gitignore new file mode 100644 index 0000000..63973d0 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/.gitignore @@ -0,0 +1,3 @@ +*.pyc +__pycache__/ +*sqlite3 diff --git a/tests/test_project_fixtures/test_project_rename_column/git/COMMIT_EDITMSG b/tests/test_project_fixtures/test_project_rename_column/git/COMMIT_EDITMSG new file mode 100644 index 0000000..64988b6 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/COMMIT_EDITMSG @@ -0,0 +1 @@ +All files diff --git a/tests/test_project_fixtures/test_project_rename_column/git/HEAD b/tests/test_project_fixtures/test_project_rename_column/git/HEAD new file mode 100644 index 0000000..cb089cd --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/tests/test_project_fixtures/test_project_rename_column/git/config b/tests/test_project_fixtures/test_project_rename_column/git/config new file mode 100644 index 0000000..eeb8dd7 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/config @@ -0,0 +1,5 @@ +[core] + repositoryformatversion = 0 + filemode = false + bare = false + logallrefupdates = true diff --git a/tests/test_project_fixtures/test_project_rename_column/git/description b/tests/test_project_fixtures/test_project_rename_column/git/description new file mode 100644 index 0000000..498b267 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/tests/test_project_fixtures/test_project_rename_column/git/hooks/applypatch-msg.sample b/tests/test_project_fixtures/test_project_rename_column/git/hooks/applypatch-msg.sample new file mode 100644 index 0000000..8b2a2fe --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/hooks/applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +test -x "$GIT_DIR/hooks/commit-msg" && + exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_project_rename_column/git/hooks/commit-msg.sample b/tests/test_project_fixtures/test_project_rename_column/git/hooks/commit-msg.sample new file mode 100644 index 0000000..b58d118 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/hooks/commit-msg.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/tests/test_project_fixtures/test_project_rename_column/git/hooks/post-update.sample b/tests/test_project_fixtures/test_project_rename_column/git/hooks/post-update.sample new file mode 100644 index 0000000..ec17ec1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/tests/test_project_fixtures/test_project_rename_column/git/hooks/pre-applypatch.sample b/tests/test_project_fixtures/test_project_rename_column/git/hooks/pre-applypatch.sample new file mode 100644 index 0000000..b1f187c --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_project_rename_column/git/hooks/pre-commit.sample b/tests/test_project_fixtures/test_project_rename_column/git/hooks/pre-commit.sample new file mode 100644 index 0000000..68d62d5 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/tests/test_project_fixtures/test_project_rename_column/git/hooks/pre-push.sample b/tests/test_project_fixtures/test_project_rename_column/git/hooks/pre-push.sample new file mode 100644 index 0000000..1f3bceb --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/hooks/pre-push.sample @@ -0,0 +1,54 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +IFS=' ' +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/tests/test_project_fixtures/test_project_rename_column/git/hooks/pre-rebase.sample b/tests/test_project_fixtures/test_project_rename_column/git/hooks/pre-rebase.sample new file mode 100644 index 0000000..33730ca --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up-to-date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/tests/test_project_fixtures/test_project_rename_column/git/hooks/prepare-commit-msg.sample b/tests/test_project_fixtures/test_project_rename_column/git/hooks/prepare-commit-msg.sample new file mode 100644 index 0000000..f093a02 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/hooks/prepare-commit-msg.sample @@ -0,0 +1,36 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first comments out the +# "Conflicts:" part of a merge commit. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +case "$2,$3" in + merge,) + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; + +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$1" ;; + + *) ;; +esac + +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff --git a/tests/test_project_fixtures/test_project_rename_column/git/hooks/update.sample b/tests/test_project_fixtures/test_project_rename_column/git/hooks/update.sample new file mode 100644 index 0000000..d847583 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/hooks/update.sample @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to blocks unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/tests/test_project_fixtures/test_project_rename_column/git/index b/tests/test_project_fixtures/test_project_rename_column/git/index new file mode 100644 index 0000000..abae302 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/index differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/info/exclude b/tests/test_project_fixtures/test_project_rename_column/git/info/exclude new file mode 100644 index 0000000..a5196d1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/logs/HEAD b/tests/test_project_fixtures/test_project_rename_column/git/logs/HEAD new file mode 100644 index 0000000..e835dee --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/logs/HEAD @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 1c81ac236b008c087902e21ef7d41a45c8ae9bf7 David-Wobrock 1509047595 +0200 commit (initial): Init +1c81ac236b008c087902e21ef7d41a45c8ae9bf7 0a898aa4fac2fd21adeabfa9a0f89df447b0b55e David-Wobrock 1509047604 +0200 commit: All files diff --git a/tests/test_project_fixtures/test_project_rename_column/git/logs/refs/heads/master b/tests/test_project_fixtures/test_project_rename_column/git/logs/refs/heads/master new file mode 100644 index 0000000..e835dee --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/logs/refs/heads/master @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 1c81ac236b008c087902e21ef7d41a45c8ae9bf7 David-Wobrock 1509047595 +0200 commit (initial): Init +1c81ac236b008c087902e21ef7d41a45c8ae9bf7 0a898aa4fac2fd21adeabfa9a0f89df447b0b55e David-Wobrock 1509047604 +0200 commit: All files diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/0a/898aa4fac2fd21adeabfa9a0f89df447b0b55e b/tests/test_project_fixtures/test_project_rename_column/git/objects/0a/898aa4fac2fd21adeabfa9a0f89df447b0b55e new file mode 100644 index 0000000..bc4a0e9 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/objects/0a/898aa4fac2fd21adeabfa9a0f89df447b0b55e @@ -0,0 +1,2 @@ +x¥ŽM +Â0F]çÙ‹e’¦ùïàz2™j°5£^ߊGpù>x��Ê<ç&uoW­2ËÁ±ë{zpHQk›È%ƒè 1õF{qÇÊ·&y…´èÀx@³V<.‚B3�GqtŸíRª<â+§Í©ÄZè*·é‹Ýû‡ûóŒyê¨Ì;©`œ#× IJ.Gÿ‘‡i’cžø!>|Jÿ \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/18/4f7577a2fc2b094acc06a5a0fa10fd88bdfe93 b/tests/test_project_fixtures/test_project_rename_column/git/objects/18/4f7577a2fc2b094acc06a5a0fa10fd88bdfe93 new file mode 100644 index 0000000..e3d8905 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/18/4f7577a2fc2b094acc06a5a0fa10fd88bdfe93 differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/1c/81ac236b008c087902e21ef7d41a45c8ae9bf7 b/tests/test_project_fixtures/test_project_rename_column/git/objects/1c/81ac236b008c087902e21ef7d41a45c8ae9bf7 new file mode 100644 index 0000000..dd6880d --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/objects/1c/81ac236b008c087902e21ef7d41a45c8ae9bf7 @@ -0,0 +1 @@ +x¥�1!E­9ÅôÆÍ,BbÌ6žÀš�Y%+’V¯/Æ#X¾Ÿ¼ÿBÉ95í~Ó*3(²RÇ`” d˜œGƒ¬Í6'­�‰Y9T¯í^*œý+ÅݵP-a�cüâðþátË>=†Pò F�Ý:h§a‹Qôµ‡ÿq!.ÏÔÄ&¦;û \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/3c/ee643962df7bfab0b21688f02af79fa19a214a b/tests/test_project_fixtures/test_project_rename_column/git/objects/3c/ee643962df7bfab0b21688f02af79fa19a214a new file mode 100644 index 0000000..99083d8 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/3c/ee643962df7bfab0b21688f02af79fa19a214a differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/tests/test_project_fixtures/test_project_rename_column/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 new file mode 100644 index 0000000..adf6411 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/57/e406836937bd0e9db226dc7d4aa70dec0c3428 b/tests/test_project_fixtures/test_project_rename_column/git/objects/57/e406836937bd0e9db226dc7d4aa70dec0c3428 new file mode 100644 index 0000000..d83b4a5 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/57/e406836937bd0e9db226dc7d4aa70dec0c3428 differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/5f/183f1a90221cd21354f05d604a9bfe9aa18bd3 b/tests/test_project_fixtures/test_project_rename_column/git/objects/5f/183f1a90221cd21354f05d604a9bfe9aa18bd3 new file mode 100644 index 0000000..5d6ca71 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/5f/183f1a90221cd21354f05d604a9bfe9aa18bd3 differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/62/bc1d2927e5023345701277baef9e0a52eb7b47 b/tests/test_project_fixtures/test_project_rename_column/git/objects/62/bc1d2927e5023345701277baef9e0a52eb7b47 new file mode 100644 index 0000000..f5b78d2 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/62/bc1d2927e5023345701277baef9e0a52eb7b47 differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 b/tests/test_project_fixtures/test_project_rename_column/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 new file mode 100644 index 0000000..3f771d5 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 b/tests/test_project_fixtures/test_project_rename_column/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 new file mode 100644 index 0000000..cf19499 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 @@ -0,0 +1 @@ +xm�OOA Å=ϧhö‰îãE& Á(ÀxœvºË�Ît3S@¿½Ëžš¦¯ï÷Ú5ñîoŠ¢P_Ëé jŽ�o¡áä£`2‚YL—x‹µÀ¥–JÍð»ãŒdƒp^¶DvM6ƒ…ÀnGxG¸G‚½Mþ4Š6 ƒª²]G¾¶â9VUï÷Ú'{x8 €coî34žð2¢ÚˆtùIkÇu.ÝÖÆ–ÿ2Õ4F=*G#½áƒ°vØÿŒ¢¹õZÏT>tœ8+Õ$pv)ë^ep´(æØ›«¨Jq.1î}âXf‡�Ý‘ ŠñÛË|º0ËÉj5›O—æc1þ|Ÿ·P\ÿÏXçLd1qGdj¦]8Ùˆ�m.†J]¡àþK0ª_òCš€ \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee b/tests/test_project_fixtures/test_project_rename_column/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee new file mode 100644 index 0000000..66ccc09 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 b/tests/test_project_fixtures/test_project_rename_column/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 new file mode 100644 index 0000000..250bef6 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e b/tests/test_project_fixtures/test_project_rename_column/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e new file mode 100644 index 0000000..e68f806 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/90/a71dcc5ba8aef7b217bba34450fe8f0083fa6b b/tests/test_project_fixtures/test_project_rename_column/git/objects/90/a71dcc5ba8aef7b217bba34450fe8f0083fa6b new file mode 100644 index 0000000..e91e43a --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/objects/90/a71dcc5ba8aef7b217bba34450fe8f0083fa6b @@ -0,0 +1,3 @@ +x]PËjÃ0ìÙ_±�ƒ�›(4m øRrÈ­·„m­�ZY2zÒ¯¯dåY„˜™�™U-T Ëåüaùc�b\v+p¶Í_’Là%êÊ"ƒú›¯Jv +HAHñ JÂbN^r2ÏK O+²HZ­z ´uÖi¤x?(mÁIîÍ‘ +n½›0I²Ñ¯`õY×ó·q%Í z?”I#*c`¦²«¨¸€ÓU’€?\rË+%|h‡c8 d(ŽÆŸ£ð95„íBà… 67oýúûP&'ެz,Óu:»C[Ž‚™2†Da¼³”³ô¼U±vVmƒ4«ü‹6c+Cé š÷•>Òo<žƒÚoűÜúßó’Ôµ2Hc‰Ý&�Nï{„Ð,•N:VºFï¤ÅuL‚1ãÿüájwr>$n$£$ \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/91/ea44a218fbd2f408430959283f0419c921093e b/tests/test_project_fixtures/test_project_rename_column/git/objects/91/ea44a218fbd2f408430959283f0419c921093e new file mode 100644 index 0000000..263fc8c Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/91/ea44a218fbd2f408430959283f0419c921093e differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/92/5381bcf8fca9f7afa84b0207362ab00ec4e378 b/tests/test_project_fixtures/test_project_rename_column/git/objects/92/5381bcf8fca9f7afa84b0207362ab00ec4e378 new file mode 100644 index 0000000..842d4a8 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/92/5381bcf8fca9f7afa84b0207362ab00ec4e378 differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/af/f774d1a90f96c114789edd25bd37521b829233 b/tests/test_project_fixtures/test_project_rename_column/git/objects/af/f774d1a90f96c114789edd25bd37521b829233 new file mode 100644 index 0000000..75a2266 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/af/f774d1a90f96c114789edd25bd37521b829233 differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/tests/test_project_fixtures/test_project_rename_column/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 new file mode 100644 index 0000000..7112238 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/e9/987576bd20e05b669a05e600a83b9afed6b0d8 b/tests/test_project_fixtures/test_project_rename_column/git/objects/e9/987576bd20e05b669a05e600a83b9afed6b0d8 new file mode 100644 index 0000000..133a77a Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/e9/987576bd20e05b669a05e600a83b9afed6b0d8 differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 b/tests/test_project_fixtures/test_project_rename_column/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 new file mode 100644 index 0000000..a0339be Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_column/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 differ diff --git a/tests/test_project_fixtures/test_project_rename_column/git/refs/heads/master b/tests/test_project_fixtures/test_project_rename_column/git/refs/heads/master new file mode 100644 index 0000000..5b17443 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/git/refs/heads/master @@ -0,0 +1 @@ +0a898aa4fac2fd21adeabfa9a0f89df447b0b55e diff --git a/tests/test_project_fixtures/test_project_rename_column/manage.py b/tests/test_project_fixtures/test_project_rename_column/manage.py new file mode 100644 index 0000000..184f757 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project_rename_column.settings") + try: + from django.core.management import execute_from_command_line + except ImportError: + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) + raise + execute_from_command_line(sys.argv) diff --git a/tests/test_project_fixtures/test_project_rename_column/test_app/__init__.py b/tests/test_project_fixtures/test_project_rename_column/test_app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_rename_column/test_app/admin.py b/tests/test_project_fixtures/test_project_rename_column/test_app/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/test_app/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/tests/test_project_fixtures/test_project_rename_column/test_app/apps.py b/tests/test_project_fixtures/test_project_rename_column/test_app/apps.py new file mode 100644 index 0000000..fc04070 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/test_app/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class TestAppConfig(AppConfig): + name = 'test_app' diff --git a/tests/test_project_fixtures/test_project_rename_column/test_app/migrations/0001_create_table.py b/tests/test_project_fixtures/test_project_rename_column/test_app/migrations/0001_create_table.py new file mode 100644 index 0000000..90a71dc --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/test_app/migrations/0001_create_table.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-25 14:12 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='A', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('null_field', models.IntegerField(null=True)), + ], + ), + ] diff --git a/tests/test_project_fixtures/test_project_rename_column/test_app/migrations/0002_rename_column.py b/tests/test_project_fixtures/test_project_rename_column/test_app/migrations/0002_rename_column.py new file mode 100644 index 0000000..e998757 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/test_app/migrations/0002_rename_column.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-25 14:12 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('test_app', '0001_create_table'), + ] + + operations = [ + migrations.RenameField( + model_name='a', + old_name='null_field', + new_name='new_name_field', + ), + ] diff --git a/tests/test_project_fixtures/test_project_rename_column/test_app/migrations/__init__.py b/tests/test_project_fixtures/test_project_rename_column/test_app/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_rename_column/test_app/models.py b/tests/test_project_fixtures/test_project_rename_column/test_app/models.py new file mode 100644 index 0000000..aff774d --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/test_app/models.py @@ -0,0 +1,4 @@ +from django.db import models + +class A(models.Model): + new_name_field = models.IntegerField(null=True) diff --git a/tests/test_project_fixtures/test_project_rename_column/test_app/tests.py b/tests/test_project_fixtures/test_project_rename_column/test_app/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/test_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/tests/test_project_fixtures/test_project_rename_column/test_app/views.py b/tests/test_project_fixtures/test_project_rename_column/test_app/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/test_app/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/tests/test_project_fixtures/test_project_rename_column/test_project_rename_column/__init__.py b/tests/test_project_fixtures/test_project_rename_column/test_project_rename_column/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_rename_column/test_project_rename_column/settings.py b/tests/test_project_fixtures/test_project_rename_column/test_project_rename_column/settings.py new file mode 100644 index 0000000..62bc1d2 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/test_project_rename_column/settings.py @@ -0,0 +1,121 @@ +""" +Django settings for test_project_rename_column project. + +Generated by 'django-admin startproject' using Django 1.11.6. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.11/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'gtb+mohs%gf0+#fr89vw7e&#edmv=q8!iv+n&j_soawk$tkj3^' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'test_app' +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'test_project_rename_column.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'test_project_rename_column.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/1.11/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.11/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/tests/test_project_fixtures/test_project_rename_column/test_project_rename_column/urls.py b/tests/test_project_fixtures/test_project_rename_column/test_project_rename_column/urls.py new file mode 100644 index 0000000..735de5d --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/test_project_rename_column/urls.py @@ -0,0 +1,21 @@ +"""linter_test_project URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/1.11/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.conf.urls import url, include + 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) +""" +from django.conf.urls import url +from django.contrib import admin + +urlpatterns = [ + url(r'^admin/', admin.site.urls), +] diff --git a/tests/test_project_fixtures/test_project_rename_column/test_project_rename_column/wsgi.py b/tests/test_project_fixtures/test_project_rename_column/test_project_rename_column/wsgi.py new file mode 100644 index 0000000..6741b31 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_column/test_project_rename_column/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for linter_test_project project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project_add_not_null_column.settings") + +application = get_wsgi_application() diff --git a/tests/test_project_fixtures/test_project_rename_table/.gitignore b/tests/test_project_fixtures/test_project_rename_table/.gitignore new file mode 100644 index 0000000..63973d0 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/.gitignore @@ -0,0 +1,3 @@ +*.pyc +__pycache__/ +*sqlite3 diff --git a/tests/test_project_fixtures/test_project_rename_table/git/COMMIT_EDITMSG b/tests/test_project_fixtures/test_project_rename_table/git/COMMIT_EDITMSG new file mode 100644 index 0000000..64988b6 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/COMMIT_EDITMSG @@ -0,0 +1 @@ +All files diff --git a/tests/test_project_fixtures/test_project_rename_table/git/HEAD b/tests/test_project_fixtures/test_project_rename_table/git/HEAD new file mode 100644 index 0000000..cb089cd --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/tests/test_project_fixtures/test_project_rename_table/git/config b/tests/test_project_fixtures/test_project_rename_table/git/config new file mode 100644 index 0000000..eeb8dd7 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/config @@ -0,0 +1,5 @@ +[core] + repositoryformatversion = 0 + filemode = false + bare = false + logallrefupdates = true diff --git a/tests/test_project_fixtures/test_project_rename_table/git/description b/tests/test_project_fixtures/test_project_rename_table/git/description new file mode 100644 index 0000000..498b267 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/tests/test_project_fixtures/test_project_rename_table/git/hooks/applypatch-msg.sample b/tests/test_project_fixtures/test_project_rename_table/git/hooks/applypatch-msg.sample new file mode 100644 index 0000000..8b2a2fe --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/hooks/applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +test -x "$GIT_DIR/hooks/commit-msg" && + exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_project_rename_table/git/hooks/commit-msg.sample b/tests/test_project_fixtures/test_project_rename_table/git/hooks/commit-msg.sample new file mode 100644 index 0000000..b58d118 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/hooks/commit-msg.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/tests/test_project_fixtures/test_project_rename_table/git/hooks/post-update.sample b/tests/test_project_fixtures/test_project_rename_table/git/hooks/post-update.sample new file mode 100644 index 0000000..ec17ec1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/tests/test_project_fixtures/test_project_rename_table/git/hooks/pre-applypatch.sample b/tests/test_project_fixtures/test_project_rename_table/git/hooks/pre-applypatch.sample new file mode 100644 index 0000000..b1f187c --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} +: diff --git a/tests/test_project_fixtures/test_project_rename_table/git/hooks/pre-commit.sample b/tests/test_project_fixtures/test_project_rename_table/git/hooks/pre-commit.sample new file mode 100644 index 0000000..68d62d5 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/tests/test_project_fixtures/test_project_rename_table/git/hooks/pre-push.sample b/tests/test_project_fixtures/test_project_rename_table/git/hooks/pre-push.sample new file mode 100644 index 0000000..1f3bceb --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/hooks/pre-push.sample @@ -0,0 +1,54 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +IFS=' ' +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/tests/test_project_fixtures/test_project_rename_table/git/hooks/pre-rebase.sample b/tests/test_project_fixtures/test_project_rename_table/git/hooks/pre-rebase.sample new file mode 100644 index 0000000..33730ca --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up-to-date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/tests/test_project_fixtures/test_project_rename_table/git/hooks/prepare-commit-msg.sample b/tests/test_project_fixtures/test_project_rename_table/git/hooks/prepare-commit-msg.sample new file mode 100644 index 0000000..f093a02 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/hooks/prepare-commit-msg.sample @@ -0,0 +1,36 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first comments out the +# "Conflicts:" part of a merge commit. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +case "$2,$3" in + merge,) + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; + +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$1" ;; + + *) ;; +esac + +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff --git a/tests/test_project_fixtures/test_project_rename_table/git/hooks/update.sample b/tests/test_project_fixtures/test_project_rename_table/git/hooks/update.sample new file mode 100644 index 0000000..d847583 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/hooks/update.sample @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to blocks unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/tests/test_project_fixtures/test_project_rename_table/git/index b/tests/test_project_fixtures/test_project_rename_table/git/index new file mode 100644 index 0000000..c9d7645 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/index differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/info/exclude b/tests/test_project_fixtures/test_project_rename_table/git/info/exclude new file mode 100644 index 0000000..a5196d1 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/logs/HEAD b/tests/test_project_fixtures/test_project_rename_table/git/logs/HEAD new file mode 100644 index 0000000..c50678d --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/logs/HEAD @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 bdc56b5a08fe5d060b09bcc9a54cf5d9c8b88dfa David-Wobrock 1509047712 +0200 commit (initial): Init +bdc56b5a08fe5d060b09bcc9a54cf5d9c8b88dfa cd1aa87abf1095d2ca6b9b64308931ab52e598c8 David-Wobrock 1509047722 +0200 commit: All files diff --git a/tests/test_project_fixtures/test_project_rename_table/git/logs/refs/heads/master b/tests/test_project_fixtures/test_project_rename_table/git/logs/refs/heads/master new file mode 100644 index 0000000..c50678d --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/logs/refs/heads/master @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 bdc56b5a08fe5d060b09bcc9a54cf5d9c8b88dfa David-Wobrock 1509047712 +0200 commit (initial): Init +bdc56b5a08fe5d060b09bcc9a54cf5d9c8b88dfa cd1aa87abf1095d2ca6b9b64308931ab52e598c8 David-Wobrock 1509047722 +0200 commit: All files diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/26/33c5502148ad76d39331a6f075cbc2aa3413ba b/tests/test_project_fixtures/test_project_rename_table/git/objects/26/33c5502148ad76d39331a6f075cbc2aa3413ba new file mode 100644 index 0000000..82bf546 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/26/33c5502148ad76d39331a6f075cbc2aa3413ba differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/tests/test_project_fixtures/test_project_rename_table/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 new file mode 100644 index 0000000..adf6411 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 b/tests/test_project_fixtures/test_project_rename_table/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 new file mode 100644 index 0000000..3f771d5 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/63/973d01988ba594743a8046c9c88c2aa527d307 differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 b/tests/test_project_fixtures/test_project_rename_table/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 new file mode 100644 index 0000000..cf19499 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/objects/67/41b31d80b759d26496e68078ea8c6993a5b206 @@ -0,0 +1 @@ +xm�OOA Å=ϧhö‰îãE& Á(ÀxœvºË�Ît3S@¿½Ëžš¦¯ï÷Ú5ñîoŠ¢P_Ëé jŽ�o¡áä£`2‚YL—x‹µÀ¥–JÍð»ãŒdƒp^¶DvM6ƒ…ÀnGxG¸G‚½Mþ4Š6 ƒª²]G¾¶â9VUï÷Ú'{x8 €coî34žð2¢ÚˆtùIkÇu.ÝÖÆ–ÿ2Õ4F=*G#½áƒ°vØÿŒ¢¹õZÏT>tœ8+Õ$pv)ë^ep´(æØ›«¨Jq.1î}âXf‡�Ý‘ ŠñÛË|º0ËÉj5›O—æc1þ|Ÿ·P\ÿÏXçLd1qGdj¦]8Ùˆ�m.†J]¡àþK0ª_òCš€ \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/71/6d88c3f72dfc3e2d9d97f861c19ba2318c9ef5 b/tests/test_project_fixtures/test_project_rename_table/git/objects/71/6d88c3f72dfc3e2d9d97f861c19ba2318c9ef5 new file mode 100644 index 0000000..76af696 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/71/6d88c3f72dfc3e2d9d97f861c19ba2318c9ef5 differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee b/tests/test_project_fixtures/test_project_rename_table/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee new file mode 100644 index 0000000..66ccc09 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/73/5de5db8bc5e1ed29b3cb7ece62b5e7c8db06ee differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 b/tests/test_project_fixtures/test_project_rename_table/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 new file mode 100644 index 0000000..250bef6 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/7c/e503c2dd97ba78597f6ff6e4393132753573f6 differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/7f/c9a68ff524659a2182df44137c56335a1d80b6 b/tests/test_project_fixtures/test_project_rename_table/git/objects/7f/c9a68ff524659a2182df44137c56335a1d80b6 new file mode 100644 index 0000000..2c43bef Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/7f/c9a68ff524659a2182df44137c56335a1d80b6 differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/86/e18cb66dc015f7c74d4d125ca9b814485e5ae4 b/tests/test_project_fixtures/test_project_rename_table/git/objects/86/e18cb66dc015f7c74d4d125ca9b814485e5ae4 new file mode 100644 index 0000000..06a24f0 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/86/e18cb66dc015f7c74d4d125ca9b814485e5ae4 differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e b/tests/test_project_fixtures/test_project_rename_table/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e new file mode 100644 index 0000000..e68f806 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/8c/38f3f3dad51e4585f3984282c2a4bec5349c1e differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/91/ea44a218fbd2f408430959283f0419c921093e b/tests/test_project_fixtures/test_project_rename_table/git/objects/91/ea44a218fbd2f408430959283f0419c921093e new file mode 100644 index 0000000..263fc8c Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/91/ea44a218fbd2f408430959283f0419c921093e differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/92/a21e6d935deaba88f676457f189e9c9c2a75bb b/tests/test_project_fixtures/test_project_rename_table/git/objects/92/a21e6d935deaba88f676457f189e9c9c2a75bb new file mode 100644 index 0000000..76f1a71 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/92/a21e6d935deaba88f676457f189e9c9c2a75bb differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/bd/c56b5a08fe5d060b09bcc9a54cf5d9c8b88dfa b/tests/test_project_fixtures/test_project_rename_table/git/objects/bd/c56b5a08fe5d060b09bcc9a54cf5d9c8b88dfa new file mode 100644 index 0000000..03b4008 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/objects/bd/c56b5a08fe5d060b09bcc9a54cf5d9c8b88dfa @@ -0,0 +1 @@ +x¥�1B!­9ÅöÆŸ�‰16žÀš…ýJIêõÅxËyɼ‰µ”ÜAºíª7fÐä”IÑjÉ2ù€ÙhZ\²^9·³ö¨Exökmp ¯œ6çJ­ÆìÒ§÷—ò}еìAÖ#G;é \ No newline at end of file diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/cd/1aa87abf1095d2ca6b9b64308931ab52e598c8 b/tests/test_project_fixtures/test_project_rename_table/git/objects/cd/1aa87abf1095d2ca6b9b64308931ab52e598c8 new file mode 100644 index 0000000..e08128c Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/cd/1aa87abf1095d2ca6b9b64308931ab52e598c8 differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/d8/47af6cf50a2587894a4fcb8a712e411adaaefd b/tests/test_project_fixtures/test_project_rename_table/git/objects/d8/47af6cf50a2587894a4fcb8a712e411adaaefd new file mode 100644 index 0000000..93b09f8 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/d8/47af6cf50a2587894a4fcb8a712e411adaaefd differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/de/e3fd6ea2c3257f15eed8ba7608f5ea9b20062e b/tests/test_project_fixtures/test_project_rename_table/git/objects/de/e3fd6ea2c3257f15eed8ba7608f5ea9b20062e new file mode 100644 index 0000000..074d608 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/de/e3fd6ea2c3257f15eed8ba7608f5ea9b20062e differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/tests/test_project_fixtures/test_project_rename_table/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 new file mode 100644 index 0000000..7112238 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/f7/2b890b4369aabb6e396db4ed71c857e72dd7de b/tests/test_project_fixtures/test_project_rename_table/git/objects/f7/2b890b4369aabb6e396db4ed71c857e72dd7de new file mode 100644 index 0000000..58dff70 Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/f7/2b890b4369aabb6e396db4ed71c857e72dd7de differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/f7/5ea5c1a969f7e950efb86deadd0a4e4fe1a256 b/tests/test_project_fixtures/test_project_rename_table/git/objects/f7/5ea5c1a969f7e950efb86deadd0a4e4fe1a256 new file mode 100644 index 0000000..bd4ba1a Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/f7/5ea5c1a969f7e950efb86deadd0a4e4fe1a256 differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 b/tests/test_project_fixtures/test_project_rename_table/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 new file mode 100644 index 0000000..a0339be Binary files /dev/null and b/tests/test_project_fixtures/test_project_rename_table/git/objects/fc/04070e8336f17e3b2402586653623e6bb51f67 differ diff --git a/tests/test_project_fixtures/test_project_rename_table/git/refs/heads/master b/tests/test_project_fixtures/test_project_rename_table/git/refs/heads/master new file mode 100644 index 0000000..b95031a --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/git/refs/heads/master @@ -0,0 +1 @@ +cd1aa87abf1095d2ca6b9b64308931ab52e598c8 diff --git a/tests/test_project_fixtures/test_project_rename_table/manage.py b/tests/test_project_fixtures/test_project_rename_table/manage.py new file mode 100644 index 0000000..dee3fd6 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project_rename_table.settings") + try: + from django.core.management import execute_from_command_line + except ImportError: + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) + raise + execute_from_command_line(sys.argv) diff --git a/tests/test_project_fixtures/test_project_rename_table/test_app/__init__.py b/tests/test_project_fixtures/test_project_rename_table/test_app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_rename_table/test_app/admin.py b/tests/test_project_fixtures/test_project_rename_table/test_app/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/test_app/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/tests/test_project_fixtures/test_project_rename_table/test_app/apps.py b/tests/test_project_fixtures/test_project_rename_table/test_app/apps.py new file mode 100644 index 0000000..fc04070 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/test_app/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class TestAppConfig(AppConfig): + name = 'test_app' diff --git a/tests/test_project_fixtures/test_project_rename_table/test_app/migrations/0001_create_table.py b/tests/test_project_fixtures/test_project_rename_table/test_app/migrations/0001_create_table.py new file mode 100644 index 0000000..d847af6 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/test_app/migrations/0001_create_table.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-25 14:15 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='A', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('null_field', models.IntegerField(null=True)), + ], + ), + ] diff --git a/tests/test_project_fixtures/test_project_rename_table/test_app/migrations/0002_rename_table.py b/tests/test_project_fixtures/test_project_rename_table/test_app/migrations/0002_rename_table.py new file mode 100644 index 0000000..f75ea5c --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/test_app/migrations/0002_rename_table.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-25 14:15 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('test_app', '0001_create_table'), + ] + + operations = [ + migrations.RenameModel( + old_name='A', + new_name='B', + ), + ] diff --git a/tests/test_project_fixtures/test_project_rename_table/test_app/migrations/__init__.py b/tests/test_project_fixtures/test_project_rename_table/test_app/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_rename_table/test_app/models.py b/tests/test_project_fixtures/test_project_rename_table/test_app/models.py new file mode 100644 index 0000000..2633c55 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/test_app/models.py @@ -0,0 +1,4 @@ +from django.db import models + +class B(models.Model): + null_field = models.IntegerField(null=True) diff --git a/tests/test_project_fixtures/test_project_rename_table/test_app/tests.py b/tests/test_project_fixtures/test_project_rename_table/test_app/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/test_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/tests/test_project_fixtures/test_project_rename_table/test_app/views.py b/tests/test_project_fixtures/test_project_rename_table/test_app/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/test_app/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/tests/test_project_fixtures/test_project_rename_table/test_project_rename_table/__init__.py b/tests/test_project_fixtures/test_project_rename_table/test_project_rename_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project_fixtures/test_project_rename_table/test_project_rename_table/settings.py b/tests/test_project_fixtures/test_project_rename_table/test_project_rename_table/settings.py new file mode 100644 index 0000000..92a21e6 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/test_project_rename_table/settings.py @@ -0,0 +1,121 @@ +""" +Django settings for test_project_rename_table project. + +Generated by 'django-admin startproject' using Django 1.11.6. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.11/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'gtb+mohs%gf0+#fr89vw7e&#edmv=q8!iv+n&j_soawk$tkj3^' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'test_app' +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'test_project_rename_table.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'test_project_rename_table.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/1.11/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.11/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/tests/test_project_fixtures/test_project_rename_table/test_project_rename_table/urls.py b/tests/test_project_fixtures/test_project_rename_table/test_project_rename_table/urls.py new file mode 100644 index 0000000..735de5d --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/test_project_rename_table/urls.py @@ -0,0 +1,21 @@ +"""linter_test_project URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/1.11/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.conf.urls import url, include + 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) +""" +from django.conf.urls import url +from django.contrib import admin + +urlpatterns = [ + url(r'^admin/', admin.site.urls), +] diff --git a/tests/test_project_fixtures/test_project_rename_table/test_project_rename_table/wsgi.py b/tests/test_project_fixtures/test_project_rename_table/test_project_rename_table/wsgi.py new file mode 100644 index 0000000..6741b31 --- /dev/null +++ b/tests/test_project_fixtures/test_project_rename_table/test_project_rename_table/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for linter_test_project project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project_add_not_null_column.settings") + +application = get_wsgi_application() diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test_migration_linter.py b/tests/unit/test_utils.py similarity index 56% rename from test_migration_linter.py rename to tests/unit/test_utils.py index 3dfbe92..151f48b 100644 --- a/test_migration_linter.py +++ b/tests/unit/test_utils.py @@ -14,10 +14,17 @@ import unittest -from migration_linter import MigrationLinter +from tests import fixtures +from django_migration_linter import MigrationLinter, valid_folder -class LinterTest(unittest.TestCase): +class UtilityFunctionTest(unittest.TestCase): + def tearDown(self, *args, **kwargs): + #fixtures.clear_all_git_projects() + super( + UtilityFunctionTest, + self).tearDown(*args, **kwargs) + def test_split_migration_path(self): input_path = 'apps/the_app/migrations/0001_stuff.py' app, mig = MigrationLinter._split_migration_path(input_path) @@ -29,3 +36,16 @@ class LinterTest(unittest.TestCase): app, mig = MigrationLinter._split_migration_path(input_path) self.assertEqual(app, 'the_app') self.assertEqual(mig, '0001_stuff') + + def test_detect_valid_folder(self): + test_project_path = fixtures.MULTI_COMMIT_PROJECT + fixtures.prepare_git_project(test_project_path) + self.assertTrue(valid_folder(test_project_path)) + + def test_detect_not_django_project(self): + test_project_path = fixtures.NOT_DJANGO_GIT_PROJECT + fixtures.prepare_git_project(test_project_path) + self.assertFalse(valid_folder(test_project_path)) + + def test_detect_not_git_project(self): + self.assertFalse(valid_folder(fixtures.NOT_GIT_DJANGO_PROJECT))