Skip to content

Commit

Permalink
Fix ending problems that corruptes the remotes fixture repository
Browse files Browse the repository at this point in the history
  • Loading branch information
feugy committed Sep 15, 2012
1 parent 6fb57d6 commit 3e966bc
Show file tree
Hide file tree
Showing 43 changed files with 41 additions and 49 deletions.
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# automatic ending correction
* text

# To avoid corrupting fixtures
test/fixtures/remotes/* binary
test/fixtures/remotes/hooks/* binary
test/fixtures/remotes/info/* binary
test/fixtures/remotes/objects/pack/* binary
test/fixtures/remotes/refs/heads/* binary
test/fixtures/remotes/refs/remotes/origin/* binary
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
, "dependencies": {"underscore": "1.x.x"}
, "devDependencies":
{ "chai": "1.0.x"
, "mocha": "0.x.x"
, "mocha": "1.4.x"
, "coffee-script": "1.3.x"
, "rimraf": "2.0.x"
}
Expand Down
7 changes: 2 additions & 5 deletions test/fixtures/remotes/config
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
[core]
repositoryformatversion = 0
filemode = false
filemode = true
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://github.com/feugy/gift.git
url = git@github.com:octocat/Spoon-Knife.git
[branch "master"]
remote = origin
merge = refs/heads/master
Empty file modified test/fixtures/remotes/hooks/applypatch-msg.sample
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion test/fixtures/remotes/hooks/commit-msg.sample
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# 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.
Expand Down
Empty file modified test/fixtures/remotes/hooks/post-commit.sample
100755 → 100644
Empty file.
Empty file modified test/fixtures/remotes/hooks/post-receive.sample
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion test/fixtures/remotes/hooks/post-update.sample
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
#
# To enable this hook, rename this file to "post-update".

exec git update-server-info
exec git-update-server-info
Empty file modified test/fixtures/remotes/hooks/pre-applypatch.sample
100755 → 100644
Empty file.
12 changes: 4 additions & 8 deletions test/fixtures/remotes/hooks/pre-commit.sample
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# 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
if git-rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
Expand All @@ -18,18 +18,15 @@ fi
# If you want to allow non-ascii filenames set this variable to true.
allownonascii=$(git config 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
test "$(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0')"
then
echo "Error: Attempt to add a non-ascii file name."
echo
Expand All @@ -46,5 +43,4 @@ then
exit 1
fi

# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --
20 changes: 10 additions & 10 deletions test/fixtures/remotes/hooks/pre-rebase.sample
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# 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.
#
Expand Down Expand Up @@ -43,19 +43,19 @@ git show-ref -q "$topic" || {
}

# Is topic fully merged to master?
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
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`
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`
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"
Expand All @@ -64,8 +64,8 @@ then
exit 0
fi
else
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
/usr/bin/perl -e '
not_in_next=`git-rev-list --pretty=oneline ^${publish} "$topic"`
perl -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {
Expand Down Expand Up @@ -157,13 +157,13 @@ B to be deleted.
To compute (1):
git rev-list ^master ^topic next
git rev-list ^master next
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
git-rev-list master..topic
if this is empty, it is fully merged to "master".
6 changes: 3 additions & 3 deletions test/fixtures/remotes/hooks/prepare-commit-msg.sample
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/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
# 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,
Expand All @@ -22,10 +22,10 @@

case "$2,$3" in
merge,)
/usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;

# ,|template,)
# /usr/bin/perl -i.bak -pe '
# perl -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
# if /^#/ && $first++ == 0' "$1" ;;

Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/remotes/hooks/update.sample
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
#
# An example hook script to blocks unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
# Called by git-receive-pack with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
Expand Down Expand Up @@ -64,7 +64,7 @@ zero="0000000000000000000000000000000000000000"
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
newrev_type=$(git cat-file -t $newrev)
newrev_type=$(git-cat-file -t $newrev)
fi

case "$refname","$newrev_type" in
Expand Down
Binary file modified test/fixtures/remotes/index
Binary file not shown.
2 changes: 1 addition & 1 deletion test/fixtures/remotes/info/exclude
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# git ls-files --others --exclude-from=.git/info/exclude
# 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):
Expand Down
4 changes: 1 addition & 3 deletions test/fixtures/remotes/logs/HEAD
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
0000000000000000000000000000000000000000 80b4f47883767e410b1e533020db7bcdfacb760f feugy <[email protected]> 1347602361 +0200 clone: from https://github.com/feugy/gift.git
80b4f47883767e410b1e533020db7bcdfacb760f c8bc9abb44b3f7a0b01ea2c4fd2543b55705aced feugy <[email protected]> 1347605639 +0200 commit: initial commit
c8bc9abb44b3f7a0b01ea2c4fd2543b55705aced 80b4f47883767e410b1e533020db7bcdfacb760f feugy <[email protected]> 1347605708 +0200 reset: moving to HEAD~1
0000000000000000000000000000000000000000 bdd3996d38d885e18e5c5960df1c2c06e34d673f sentientwaffle <[email protected]> 1329101708 -0700 clone: from [email protected]:octocat/Spoon-Knife.git
4 changes: 1 addition & 3 deletions test/fixtures/remotes/logs/refs/heads/master
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
0000000000000000000000000000000000000000 80b4f47883767e410b1e533020db7bcdfacb760f feugy <[email protected]> 1347602361 +0200 clone: from https://github.com/feugy/gift.git
80b4f47883767e410b1e533020db7bcdfacb760f c8bc9abb44b3f7a0b01ea2c4fd2543b55705aced feugy <[email protected]> 1347605639 +0200 commit: initial commit
c8bc9abb44b3f7a0b01ea2c4fd2543b55705aced 80b4f47883767e410b1e533020db7bcdfacb760f feugy <[email protected]> 1347605708 +0200 reset: moving to HEAD~1
0000000000000000000000000000000000000000 bdd3996d38d885e18e5c5960df1c2c06e34d673f sentientwaffle <[email protected]> 1329101708 -0700 clone: from [email protected]:octocat/Spoon-Knife.git
1 change: 0 additions & 1 deletion test/fixtures/remotes/logs/refs/remotes/origin/HEAD

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 1 addition & 7 deletions test/fixtures/remotes/packed-refs
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
# pack-refs with: peeled
80b4f47883767e410b1e533020db7bcdfacb760f refs/remotes/origin/master
418ad9607ddd6bd7eeae370e87195ffcede37c00 refs/tags/v0.0.2
^b566b6db9d8ca20ee9501c59e9e8ddf7a90fb2fe
2fd494b53f81f0df5465f4786f3f3b4c9bd827c6 refs/tags/v0.0.3
^50f81834a787ce5800044be2397bb07368a9ae70
a84da5dfda3cded9e0801ab16103500fd6c44ac8 refs/tags/v0.0.4
a92e358f21b417e568512e24103bebe852683dba refs/tags/v0.0.5
bdd3996d38d885e18e5c5960df1c2c06e34d673f refs/remotes/origin/master
2 changes: 1 addition & 1 deletion test/fixtures/remotes/refs/heads/master
Original file line number Diff line number Diff line change
@@ -1 +1 @@
80b4f47883767e410b1e533020db7bcdfacb760f
bdd3996d38d885e18e5c5960df1c2c06e34d673f
4 changes: 2 additions & 2 deletions test/repo.test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ describe "Repo", ->
remotes[0].should.be.an.instanceof Ref

it "contains the correct Refs", ->
remotes[0].commit.id.should.eql "80b4f47883767e410b1e533020db7bcdfacb760f"
remotes[0].commit.id.should.eql "bdd3996d38d885e18e5c5960df1c2c06e34d673f"
remotes[0].name.should.eql "origin/HEAD"
remotes[1].commit.id.should.eql "80b4f47883767e410b1e533020db7bcdfacb760f"
remotes[1].commit.id.should.eql "bdd3996d38d885e18e5c5960df1c2c06e34d673f"
remotes[1].name.should.eql "origin/master"

describe "when there are no remotes", ->
Expand Down

0 comments on commit 3e966bc

Please sign in to comment.