setup git repo fixtures
This commit is contained in:
parent
7316645730
commit
f7cc510d3c
1
integration/repos/config_media_url.git/HEAD
Normal file
1
integration/repos/config_media_url.git/HEAD
Normal file
@ -0,0 +1 @@
|
|||||||
|
ref: refs/heads/master
|
7
integration/repos/config_media_url.git/config
Normal file
7
integration/repos/config_media_url.git/config
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[core]
|
||||||
|
repositoryformatversion = 0
|
||||||
|
filemode = true
|
||||||
|
bare = false
|
||||||
|
logallrefupdates = true
|
||||||
|
ignorecase = true
|
||||||
|
precomposeunicode = true
|
1
integration/repos/config_media_url.git/description
Normal file
1
integration/repos/config_media_url.git/description
Normal file
@ -0,0 +1 @@
|
|||||||
|
Unnamed repository; edit this file 'description' to name the repository.
|
54
integration/repos/config_media_url.git/hooks/pre-push.sample
Executable file
54
integration/repos/config_media_url.git/hooks/pre-push.sample
Executable file
@ -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:
|
||||||
|
#
|
||||||
|
# <local ref> <local sha1> <remote ref> <remote sha1>
|
||||||
|
#
|
||||||
|
# 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
|
1
integration/repos/config_media_url.git/logs/HEAD
Normal file
1
integration/repos/config_media_url.git/logs/HEAD
Normal file
@ -0,0 +1 @@
|
|||||||
|
0000000000000000000000000000000000000000 00df65f30b769b694e2a1ca57e054d45d3d8bf9b Rick Olson <technoweenie@gmail.com> 1401306971 -0600 commit (initial): add .gitconfig
|
@ -0,0 +1 @@
|
|||||||
|
0000000000000000000000000000000000000000 00df65f30b769b694e2a1ca57e054d45d3d8bf9b Rick Olson <technoweenie@gmail.com> 1401306971 -0600 commit (initial): add .gitconfig
|
2
integration/repos/config_media_url.git/objects/00/df65f30b769b694e2a1ca57e054d45d3d8bf9b
Normal file
2
integration/repos/config_media_url.git/objects/00/df65f30b769b694e2a1ca57e054d45d3d8bf9b
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
x<01>Í[
|
||||||
|
à @Ñ~»ŠÙ@ƒ&ñ¡t…îÀŒ£‘FRK·ß¬¡¿¹ÖÒA9}éÌät²n¤HÑÛirkÔ&Y=&¯µ5¥Y=*/§o|À³àû›,<2C>pkü%j…²Èõj–j’Æ[Wi¤g=§<>þä"ÄC.¹¥’Å;ð<O
|
BIN
integration/repos/config_media_url.git/objects/4e/85f782eded97338bd56f752f955768c06b9c19
Normal file
BIN
integration/repos/config_media_url.git/objects/4e/85f782eded97338bd56f752f955768c06b9c19
Normal file
Binary file not shown.
BIN
integration/repos/config_media_url.git/objects/fb/997f8b3da8eba5bc99f681ba8767dd885646df
Normal file
BIN
integration/repos/config_media_url.git/objects/fb/997f8b3da8eba5bc99f681ba8767dd885646df
Normal file
Binary file not shown.
1
integration/repos/config_media_url.git/refs/heads/master
Normal file
1
integration/repos/config_media_url.git/refs/heads/master
Normal file
@ -0,0 +1 @@
|
|||||||
|
00df65f30b769b694e2a1ca57e054d45d3d8bf9b
|
@ -1,4 +1,5 @@
|
|||||||
require "tmpdir"
|
require "tmpdir"
|
||||||
|
require "fileutils"
|
||||||
|
|
||||||
class Suite
|
class Suite
|
||||||
class Config < Struct.new(:root)
|
class Config < Struct.new(:root)
|
||||||
@ -45,18 +46,46 @@ class Suite
|
|||||||
@tests ||= []
|
@tests ||= []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.test_tmpdir
|
||||||
|
@test_tmpdir ||= File.join(config.tmp, "git-media-tests")
|
||||||
|
end
|
||||||
|
FileUtils.rm_rf(test_tmpdir)
|
||||||
|
|
||||||
|
# Gets the global git configuration.
|
||||||
def self.global_git_config
|
def self.global_git_config
|
||||||
`git config -l --global`.strip.split("\n")
|
`git config -l --global`.strip.split("\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Clones the sample repository to a test
|
||||||
|
def self.repository(name)
|
||||||
|
path = File.join(config.root, "integration", "repos", name.to_s)
|
||||||
|
if !File.exist?(path)
|
||||||
|
path += ".git"
|
||||||
|
end
|
||||||
|
|
||||||
|
if !File.exist?(path)
|
||||||
|
raise ArgumentError, "No example repository #{name} (#{path.inspect})"
|
||||||
|
end
|
||||||
|
|
||||||
|
dest = File.join(test_tmpdir, name.to_s)
|
||||||
|
Dir.chdir File.join(config.root, "integration", "repos") do
|
||||||
|
%x{git clone #{name} #{dest}}
|
||||||
|
end
|
||||||
|
|
||||||
|
dest
|
||||||
|
end
|
||||||
|
|
||||||
def self.test(repository)
|
def self.test(repository)
|
||||||
t = Test.new(repository, "#{repository}/.git")
|
t = Test.new(repository)
|
||||||
yield t if block_given?
|
yield t if block_given?
|
||||||
tests << t
|
tests << t
|
||||||
end
|
end
|
||||||
|
|
||||||
class Test
|
class Test
|
||||||
|
attr_reader :path
|
||||||
|
|
||||||
def initialize(*repositories)
|
def initialize(*repositories)
|
||||||
|
@path = repositories.first
|
||||||
@repositories = repositories
|
@repositories = repositories
|
||||||
@commands = []
|
@commands = []
|
||||||
@successful = true
|
@successful = true
|
||||||
@ -136,5 +165,6 @@ class Suite
|
|||||||
if tests.any?(&:failed?)
|
if tests.any?(&:failed?)
|
||||||
abort "Failed."
|
abort "Failed."
|
||||||
end
|
end
|
||||||
|
FileUtils.remove_entry_secure(test_tmpdir)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,7 +2,8 @@ require File.expand_path("../suite", __FILE__)
|
|||||||
config = Suite.config
|
config = Suite.config
|
||||||
|
|
||||||
Suite.test config.root do |t|
|
Suite.test config.root do |t|
|
||||||
t.repository File.join(config.root, "integration") # sub directory!
|
t.repository File.join(t.path, ".git")
|
||||||
|
t.repository File.join(t.path, "integration") # sub directory!
|
||||||
|
|
||||||
# really simple test
|
# really simple test
|
||||||
t.command "version",
|
t.command "version",
|
||||||
@ -18,9 +19,9 @@ Nothing may see Gah Lak Tus and survive.
|
|||||||
t.command "config",
|
t.command "config",
|
||||||
<<-END
|
<<-END
|
||||||
Endpoint=https://github.com/github/git-media.git/info/media
|
Endpoint=https://github.com/github/git-media.git/info/media
|
||||||
LocalWorkingDir=#{config.root}
|
LocalWorkingDir=#{t.path}
|
||||||
LocalGitDir=#{File.join config.root, ".git"}
|
LocalGitDir=#{File.join t.path, ".git"}
|
||||||
LocalMediaDir=#{File.join config.root, ".git", "media"}
|
LocalMediaDir=#{File.join t.path, ".git", "media"}
|
||||||
TempDir=#{File.join config.tmp, "git-media"}
|
TempDir=#{File.join config.tmp, "git-media"}
|
||||||
#{config.env_string}
|
#{config.env_string}
|
||||||
END
|
END
|
||||||
@ -52,9 +53,9 @@ Suite.test Suite.repository(:config_media_url) do |t|
|
|||||||
t.command "config",
|
t.command "config",
|
||||||
<<-END
|
<<-END
|
||||||
Endpoint=http://foo/bar
|
Endpoint=http://foo/bar
|
||||||
LocalWorkingDir=#{config.root}
|
LocalWorkingDir=#{File.join "/private", t.path}
|
||||||
LocalGitDir=#{File.join config.root, ".git"}
|
LocalGitDir=#{File.join "/private", t.path, ".git"}
|
||||||
LocalMediaDir=#{File.join config.root, ".git", "media"}
|
LocalMediaDir=#{File.join "/private", t.path, ".git", "media"}
|
||||||
TempDir=#{File.join config.tmp, "git-media"}
|
TempDir=#{File.join config.tmp, "git-media"}
|
||||||
#{config.env_string}
|
#{config.env_string}
|
||||||
END
|
END
|
||||||
|
Loading…
Reference in New Issue
Block a user