Permalink
Browse files

fixes issue with sharing hooks (feature was a false positive)

  • Loading branch information...
1 parent 8051748 commit 6a9f2f85345d678ccb23ad7486e46c6a502339a5 @timcharper committed Feb 25, 2010
@@ -10,7 +10,7 @@ remote_branch=$(git show-ref origin/--hooks--)
[ "${remote_branch%% *}" != "$local_rev" ] && (
echo "Hook updates were applied:" 1>&2
GIT_OBJECT_DIRECTORY=../../objects git branch origin/--hooks-- ${remote_branch%% *} -f 1>&2
- GIT_OBJECT_DIRECTORY=../../objects git reset --hard ${remote_branch%% *} 1>&2
+ GIT_OBJECT_DIRECTORY=../../objects git merge ${remote_branch%% *} 1>&2
)
)
View
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
-$: << File.dirname(__FILE__) + "/../lib/"
+$:.unshift(File.dirname(__FILE__) + "/../lib/")
require "gitty"
Gitty::HookCommand.new(ARGV).run
@@ -30,28 +30,30 @@ Feature: publishing hooks
Then the latest commit on origin/--hooks-- should contain "added a validation hook to increase team morale"
When I clone "$REMOTES_PATH/remote.git" as "cloned"
+ And I switch to the directory "cloned"
When I run:
"""
git hook init
- echo content > README.txt
- git add README.txt
+ echo content > README
+ git add README
git commit -m 'added a readme'
"""
Then the error output should contain "That is the greatest code I've ever seen written! You're amazing!"
When I run:
"""
- git hook uninstall --shared validation
+ git hook uninstall validation
git hook publish -m 'Removed team morale booster.'
"""
- And I switch back to the original repository
-
+ And I switch to the directory "sandbox"
And I run:
"""
git fetch
- echo more content >> README.txt
+ echo more content >> README
+ pwd
git commit -m 'added content to the readme' -a
"""
-
- Then the error output should not contain "That is the greatest code I've ever seen written! You're amazing!"
+ Then the last exit status should be 0
+ And the error output should contain "Hook updates were applied"
+ And the error output should not contain "That is the greatest code I've ever seen written! You're amazing!"
@@ -28,7 +28,6 @@
in_dir(SandboxWorld::TMP_PATH.to_s) do
run("git clone '#{source}' #{path}")
end
- @current_dir = SandboxWorld::TMP_PATH + path
end
@@ -8,8 +8,8 @@
end
-Given /^I am in the directory "(.*)"$/ do |path|
- path = (SandboxWorld::SANDBOX_PATH + path).to_s
+When /^I switch to the directory "(.*)"$/ do |path|
+ path = (SandboxWorld::TMP_PATH + path).to_s
FileUtils.mkdir_p(path)
@current_dir = File.join(path)
end
@@ -34,7 +34,8 @@ def run
cmd(*%w[git symbolic-ref HEAD refs/heads/--hooks--])
cmd(*%w[git commit --allow-empty -m initial\ commit])
end
- cmd(*%w[git reset --hard] + hooks_rev) if hooks_rev
+ cmd("git reset --hard #{hooks_rev}") if hooks_rev
+
end
end
end

0 comments on commit 6a9f2f8

Please sign in to comment.