whiskey_disk 0.6.11 → 0.6.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/CHANGELOG +8 -0
  2. data/README.markdown +2 -1
  3. data/Rakefile +4 -0
  4. data/VERSION +1 -1
  5. data/lib/whiskey_disk.rb +1 -1
  6. data/spec/spec_helper.rb +4 -0
  7. data/spec/whiskey_disk_spec.rb +2 -2
  8. data/whiskey_disk.gemspec +1 -54
  9. metadata +3 -56
  10. data/scenarios/git_repositories/config.git/HEAD +0 -1
  11. data/scenarios/git_repositories/config.git/config +0 -5
  12. data/scenarios/git_repositories/config.git/description +0 -1
  13. data/scenarios/git_repositories/config.git/git-daemon-export-ok +0 -0
  14. data/scenarios/git_repositories/config.git/hooks/applypatch-msg.sample +0 -15
  15. data/scenarios/git_repositories/config.git/hooks/commit-msg.sample +0 -24
  16. data/scenarios/git_repositories/config.git/hooks/post-commit.sample +0 -8
  17. data/scenarios/git_repositories/config.git/hooks/post-receive.sample +0 -15
  18. data/scenarios/git_repositories/config.git/hooks/post-update.sample +0 -8
  19. data/scenarios/git_repositories/config.git/hooks/pre-applypatch.sample +0 -14
  20. data/scenarios/git_repositories/config.git/hooks/pre-commit.sample +0 -46
  21. data/scenarios/git_repositories/config.git/hooks/pre-rebase.sample +0 -169
  22. data/scenarios/git_repositories/config.git/hooks/prepare-commit-msg.sample +0 -36
  23. data/scenarios/git_repositories/config.git/hooks/update.sample +0 -128
  24. data/scenarios/git_repositories/config.git/info/exclude +0 -6
  25. data/scenarios/git_repositories/config.git/objects/17/6bf54cf17d1d1c24556dc059c4144a5df230e8 +0 -0
  26. data/scenarios/git_repositories/config.git/objects/20/e9ff3feaa8ede30f707e5f1b4356e3c02bb7ec +0 -0
  27. data/scenarios/git_repositories/config.git/objects/45/117b1c775f0de415478dbf08ed9d667ab17d13 +0 -0
  28. data/scenarios/git_repositories/config.git/objects/71/eb5df52676e8e6efba471050b46978173af110 +0 -1
  29. data/scenarios/git_repositories/config.git/objects/d1/0bcd51fec41f854001e4d61f99d9e282a695d3 +0 -0
  30. data/scenarios/git_repositories/config.git/objects/e6/b02c66ad632e6b8535c4630cb8fe07732a72fc +0 -0
  31. data/scenarios/git_repositories/config.git/objects/f9/49d5d8a4f12c91471e34d4e277239c35ebd10d +0 -0
  32. data/scenarios/git_repositories/config.git/refs/heads/master +0 -1
  33. data/scenarios/git_repositories/project.git/HEAD +0 -1
  34. data/scenarios/git_repositories/project.git/config +0 -5
  35. data/scenarios/git_repositories/project.git/description +0 -1
  36. data/scenarios/git_repositories/project.git/git-daemon-export-ok +0 -0
  37. data/scenarios/git_repositories/project.git/hooks/applypatch-msg.sample +0 -15
  38. data/scenarios/git_repositories/project.git/hooks/commit-msg.sample +0 -24
  39. data/scenarios/git_repositories/project.git/hooks/post-commit.sample +0 -8
  40. data/scenarios/git_repositories/project.git/hooks/post-receive.sample +0 -15
  41. data/scenarios/git_repositories/project.git/hooks/post-update.sample +0 -8
  42. data/scenarios/git_repositories/project.git/hooks/pre-applypatch.sample +0 -14
  43. data/scenarios/git_repositories/project.git/hooks/pre-commit.sample +0 -46
  44. data/scenarios/git_repositories/project.git/hooks/pre-rebase.sample +0 -169
  45. data/scenarios/git_repositories/project.git/hooks/prepare-commit-msg.sample +0 -36
  46. data/scenarios/git_repositories/project.git/hooks/update.sample +0 -128
  47. data/scenarios/git_repositories/project.git/info/exclude +0 -6
  48. data/scenarios/git_repositories/project.git/objects/20/1c7641c2e42b0b904e5c1f793489d8b858e4da +0 -2
  49. data/scenarios/git_repositories/project.git/objects/80/26076649ceccbe96a6292f2432652f08483035 +0 -0
  50. data/scenarios/git_repositories/project.git/objects/ef/2a88894d5421920b9dfe67a9a4d8043830e62e +0 -0
  51. data/scenarios/git_repositories/project.git/refs/heads/master +0 -1
  52. data/scenarios/invalid/deploy.yml +0 -1
  53. data/scenarios/local/deploy.yml +0 -16
  54. data/scenarios/remote/deploy.yml +0 -5
  55. data/spec/integration/deployment_failures_spec.rb +0 -106
  56. data/spec/integration/invalid_configuration_spec.rb +0 -39
  57. data/spec/integration/local_deployments_spec.rb +0 -230
  58. data/spec/integration/remote_deployments_spec.rb +0 -54
data/CHANGELOG CHANGED
@@ -1,4 +1,12 @@
1
1
 
2
+ 0.6.12 / 2011-02-20
3
+ ==================
4
+
5
+ * bad Rakefile should cause deployment to fail
6
+ * post_* rake task specs
7
+ * new scenarios to use when testing post_* rake hooks
8
+ * adding a dump_log helper to use when developing integration specs
9
+
2
10
  0.6.11 / 2011-02-18
3
11
  ==================
4
12
 
data/README.markdown CHANGED
@@ -767,7 +767,8 @@ to see what we have in mind for the near future.
767
767
  ### Contributors ###
768
768
 
769
769
  - Rick Bradley (rick@rickbradley.com, github:rick)
770
- - Alex Sharp (ajsharp@gmail.com) - issues, real-world usage cases, design feedback
771
770
  - Jeremy Holland (jeremy@jeremypholland.com, github:therubyneck): feature/bugfix contributions
772
771
  - Kevin Barnes (@vinbarnes), Yossef Mendellsohn (cardioid) for design help and proofreading
772
+ - Alex Sharp (ajsharp@gmail.com) - issues, real-world usage cases, design feedback
773
+ - Josh Moore (josh@codingforrent.com) - tracking down issues handling bad project Rakefiles
773
774
  - Cristi Balan (evilchelu) for feedback and proofreading
data/Rakefile CHANGED
@@ -20,6 +20,10 @@ begin
20
20
  gemspec.homepage = "http://github.com/flogic/whiskey_disk"
21
21
  gemspec.authors = ["Rick Bradley"]
22
22
  gemspec.add_dependency('rake')
23
+
24
+ # I've decided that the integration spec shizzle shouldn't go into the gem
25
+ gemspec.files.exclude 'scenarios', 'spec/integration'
26
+ gemspec.test_files.exclude 'scenarios', 'spec/integration'
23
27
  end
24
28
  Jeweler::GemcutterTasks.new
25
29
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.11
1
+ 0.6.12
data/lib/whiskey_disk.rb CHANGED
@@ -187,7 +187,7 @@ class WhiskeyDisk
187
187
  end
188
188
 
189
189
  def if_task_defined(task, cmd)
190
- %Q{if [[ `#{env_vars} rake -P | grep #{task}` != "" ]]; then #{cmd}; fi}
190
+ %Q(rakep=`#{env_vars} rake -P` && if [[ `echo "${rakep}" | grep #{task}` != "" ]]; then #{cmd}; fi )
191
191
  end
192
192
 
193
193
  def clone_repository(repo, path)
data/spec/spec_helper.rb CHANGED
@@ -59,4 +59,8 @@ end
59
59
 
60
60
  def deployed_file(path)
61
61
  File.join(deployment_root, path)
62
+ end
63
+
64
+ def dump_log
65
+ STDERR.puts("\n\n\n" + File.read(integration_log) + "\n\n\n")
62
66
  end
@@ -447,7 +447,7 @@ describe 'WhiskeyDisk' do
447
447
 
448
448
  it 'should make the post setup rake tasks conditional on the deploy:post_setup rake task being defined' do
449
449
  WhiskeyDisk.run_post_setup_hooks
450
- WhiskeyDisk.buffer.join(' ').should.match(%r{if \[\[ \`rake -P | grep deploy:post_setup\` != "" \]\]; })
450
+ WhiskeyDisk.buffer.join(' ').should.match(%r{rakep=\`.*rake -P\` && if \[\[ \`echo "\$\{rakep\}" | grep deploy:post_setup\` != "" \]\];})
451
451
  end
452
452
 
453
453
  it 'should ensure that any rake ENV variable are set when checking for deploy:post_setup tasks' do
@@ -555,7 +555,7 @@ describe 'WhiskeyDisk' do
555
555
 
556
556
  it 'should make the post deployment rake tasks conditional on the deploy:post_deploy rake task being defined' do
557
557
  WhiskeyDisk.run_post_deploy_hooks
558
- WhiskeyDisk.buffer.join(' ').should.match(%r{if \[\[ \`rake -P | grep deploy:post_deploy\` != "" \]\]; })
558
+ WhiskeyDisk.buffer.join(' ').should.match(%r{rakep=\`.*rake -P\` && if \[\[ \`echo "\$\{rakep\}" | grep deploy:post_deploy\` != "" \]\];})
559
559
  end
560
560
 
561
561
  it 'should ensure that any rake ENV variable are set when checking for deploy:post_setup tasks' do
data/whiskey_disk.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{whiskey_disk}
8
- s.version = "0.6.11"
8
+ s.version = "0.6.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rick Bradley"]
@@ -39,58 +39,9 @@ Gem::Specification.new do |s|
39
39
  "lib/whiskey_disk/config.rb",
40
40
  "lib/whiskey_disk/helpers.rb",
41
41
  "lib/whiskey_disk/rake.rb",
42
- "scenarios/git_repositories/config.git/HEAD",
43
- "scenarios/git_repositories/config.git/config",
44
- "scenarios/git_repositories/config.git/description",
45
- "scenarios/git_repositories/config.git/git-daemon-export-ok",
46
- "scenarios/git_repositories/config.git/hooks/applypatch-msg.sample",
47
- "scenarios/git_repositories/config.git/hooks/commit-msg.sample",
48
- "scenarios/git_repositories/config.git/hooks/post-commit.sample",
49
- "scenarios/git_repositories/config.git/hooks/post-receive.sample",
50
- "scenarios/git_repositories/config.git/hooks/post-update.sample",
51
- "scenarios/git_repositories/config.git/hooks/pre-applypatch.sample",
52
- "scenarios/git_repositories/config.git/hooks/pre-commit.sample",
53
- "scenarios/git_repositories/config.git/hooks/pre-rebase.sample",
54
- "scenarios/git_repositories/config.git/hooks/prepare-commit-msg.sample",
55
- "scenarios/git_repositories/config.git/hooks/update.sample",
56
- "scenarios/git_repositories/config.git/info/exclude",
57
- "scenarios/git_repositories/config.git/objects/17/6bf54cf17d1d1c24556dc059c4144a5df230e8",
58
- "scenarios/git_repositories/config.git/objects/20/e9ff3feaa8ede30f707e5f1b4356e3c02bb7ec",
59
- "scenarios/git_repositories/config.git/objects/45/117b1c775f0de415478dbf08ed9d667ab17d13",
60
- "scenarios/git_repositories/config.git/objects/71/eb5df52676e8e6efba471050b46978173af110",
61
- "scenarios/git_repositories/config.git/objects/d1/0bcd51fec41f854001e4d61f99d9e282a695d3",
62
- "scenarios/git_repositories/config.git/objects/e6/b02c66ad632e6b8535c4630cb8fe07732a72fc",
63
- "scenarios/git_repositories/config.git/objects/f9/49d5d8a4f12c91471e34d4e277239c35ebd10d",
64
- "scenarios/git_repositories/config.git/refs/heads/master",
65
- "scenarios/git_repositories/project.git/HEAD",
66
- "scenarios/git_repositories/project.git/config",
67
- "scenarios/git_repositories/project.git/description",
68
- "scenarios/git_repositories/project.git/git-daemon-export-ok",
69
- "scenarios/git_repositories/project.git/hooks/applypatch-msg.sample",
70
- "scenarios/git_repositories/project.git/hooks/commit-msg.sample",
71
- "scenarios/git_repositories/project.git/hooks/post-commit.sample",
72
- "scenarios/git_repositories/project.git/hooks/post-receive.sample",
73
- "scenarios/git_repositories/project.git/hooks/post-update.sample",
74
- "scenarios/git_repositories/project.git/hooks/pre-applypatch.sample",
75
- "scenarios/git_repositories/project.git/hooks/pre-commit.sample",
76
- "scenarios/git_repositories/project.git/hooks/pre-rebase.sample",
77
- "scenarios/git_repositories/project.git/hooks/prepare-commit-msg.sample",
78
- "scenarios/git_repositories/project.git/hooks/update.sample",
79
- "scenarios/git_repositories/project.git/info/exclude",
80
- "scenarios/git_repositories/project.git/objects/20/1c7641c2e42b0b904e5c1f793489d8b858e4da",
81
- "scenarios/git_repositories/project.git/objects/80/26076649ceccbe96a6292f2432652f08483035",
82
- "scenarios/git_repositories/project.git/objects/ef/2a88894d5421920b9dfe67a9a4d8043830e62e",
83
- "scenarios/git_repositories/project.git/refs/heads/master",
84
- "scenarios/invalid/deploy.yml",
85
- "scenarios/local/deploy.yml",
86
- "scenarios/remote/deploy.yml",
87
42
  "spec/.bacon",
88
43
  "spec/init_spec.rb",
89
44
  "spec/install_spec.rb",
90
- "spec/integration/deployment_failures_spec.rb",
91
- "spec/integration/invalid_configuration_spec.rb",
92
- "spec/integration/local_deployments_spec.rb",
93
- "spec/integration/remote_deployments_spec.rb",
94
45
  "spec/spec_helper.rb",
95
46
  "spec/wd_command_spec.rb",
96
47
  "spec/wd_role_command_spec.rb",
@@ -108,10 +59,6 @@ Gem::Specification.new do |s|
108
59
  s.test_files = [
109
60
  "spec/init_spec.rb",
110
61
  "spec/install_spec.rb",
111
- "spec/integration/deployment_failures_spec.rb",
112
- "spec/integration/invalid_configuration_spec.rb",
113
- "spec/integration/local_deployments_spec.rb",
114
- "spec/integration/remote_deployments_spec.rb",
115
62
  "spec/spec_helper.rb",
116
63
  "spec/wd_command_spec.rb",
117
64
  "spec/wd_role_command_spec.rb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whiskey_disk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 11
10
- version: 0.6.11
9
+ - 12
10
+ version: 0.6.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rick Bradley
@@ -64,58 +64,9 @@ files:
64
64
  - lib/whiskey_disk/config.rb
65
65
  - lib/whiskey_disk/helpers.rb
66
66
  - lib/whiskey_disk/rake.rb
67
- - scenarios/git_repositories/config.git/HEAD
68
- - scenarios/git_repositories/config.git/config
69
- - scenarios/git_repositories/config.git/description
70
- - scenarios/git_repositories/config.git/git-daemon-export-ok
71
- - scenarios/git_repositories/config.git/hooks/applypatch-msg.sample
72
- - scenarios/git_repositories/config.git/hooks/commit-msg.sample
73
- - scenarios/git_repositories/config.git/hooks/post-commit.sample
74
- - scenarios/git_repositories/config.git/hooks/post-receive.sample
75
- - scenarios/git_repositories/config.git/hooks/post-update.sample
76
- - scenarios/git_repositories/config.git/hooks/pre-applypatch.sample
77
- - scenarios/git_repositories/config.git/hooks/pre-commit.sample
78
- - scenarios/git_repositories/config.git/hooks/pre-rebase.sample
79
- - scenarios/git_repositories/config.git/hooks/prepare-commit-msg.sample
80
- - scenarios/git_repositories/config.git/hooks/update.sample
81
- - scenarios/git_repositories/config.git/info/exclude
82
- - scenarios/git_repositories/config.git/objects/17/6bf54cf17d1d1c24556dc059c4144a5df230e8
83
- - scenarios/git_repositories/config.git/objects/20/e9ff3feaa8ede30f707e5f1b4356e3c02bb7ec
84
- - scenarios/git_repositories/config.git/objects/45/117b1c775f0de415478dbf08ed9d667ab17d13
85
- - scenarios/git_repositories/config.git/objects/71/eb5df52676e8e6efba471050b46978173af110
86
- - scenarios/git_repositories/config.git/objects/d1/0bcd51fec41f854001e4d61f99d9e282a695d3
87
- - scenarios/git_repositories/config.git/objects/e6/b02c66ad632e6b8535c4630cb8fe07732a72fc
88
- - scenarios/git_repositories/config.git/objects/f9/49d5d8a4f12c91471e34d4e277239c35ebd10d
89
- - scenarios/git_repositories/config.git/refs/heads/master
90
- - scenarios/git_repositories/project.git/HEAD
91
- - scenarios/git_repositories/project.git/config
92
- - scenarios/git_repositories/project.git/description
93
- - scenarios/git_repositories/project.git/git-daemon-export-ok
94
- - scenarios/git_repositories/project.git/hooks/applypatch-msg.sample
95
- - scenarios/git_repositories/project.git/hooks/commit-msg.sample
96
- - scenarios/git_repositories/project.git/hooks/post-commit.sample
97
- - scenarios/git_repositories/project.git/hooks/post-receive.sample
98
- - scenarios/git_repositories/project.git/hooks/post-update.sample
99
- - scenarios/git_repositories/project.git/hooks/pre-applypatch.sample
100
- - scenarios/git_repositories/project.git/hooks/pre-commit.sample
101
- - scenarios/git_repositories/project.git/hooks/pre-rebase.sample
102
- - scenarios/git_repositories/project.git/hooks/prepare-commit-msg.sample
103
- - scenarios/git_repositories/project.git/hooks/update.sample
104
- - scenarios/git_repositories/project.git/info/exclude
105
- - scenarios/git_repositories/project.git/objects/20/1c7641c2e42b0b904e5c1f793489d8b858e4da
106
- - scenarios/git_repositories/project.git/objects/80/26076649ceccbe96a6292f2432652f08483035
107
- - scenarios/git_repositories/project.git/objects/ef/2a88894d5421920b9dfe67a9a4d8043830e62e
108
- - scenarios/git_repositories/project.git/refs/heads/master
109
- - scenarios/invalid/deploy.yml
110
- - scenarios/local/deploy.yml
111
- - scenarios/remote/deploy.yml
112
67
  - spec/.bacon
113
68
  - spec/init_spec.rb
114
69
  - spec/install_spec.rb
115
- - spec/integration/deployment_failures_spec.rb
116
- - spec/integration/invalid_configuration_spec.rb
117
- - spec/integration/local_deployments_spec.rb
118
- - spec/integration/remote_deployments_spec.rb
119
70
  - spec/spec_helper.rb
120
71
  - spec/wd_command_spec.rb
121
72
  - spec/wd_role_command_spec.rb
@@ -162,10 +113,6 @@ summary: embarrassingly fast deployments.
162
113
  test_files:
163
114
  - spec/init_spec.rb
164
115
  - spec/install_spec.rb
165
- - spec/integration/deployment_failures_spec.rb
166
- - spec/integration/invalid_configuration_spec.rb
167
- - spec/integration/local_deployments_spec.rb
168
- - spec/integration/remote_deployments_spec.rb
169
116
  - spec/spec_helper.rb
170
117
  - spec/wd_command_spec.rb
171
118
  - spec/wd_role_command_spec.rb
@@ -1 +0,0 @@
1
- ref: refs/heads/master
@@ -1,5 +0,0 @@
1
- [core]
2
- repositoryformatversion = 0
3
- filemode = true
4
- bare = true
5
- ignorecase = true
@@ -1 +0,0 @@
1
- Unnamed repository; edit this file 'description' to name the repository.
@@ -1,15 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # An example hook script to check the commit log message taken by
4
- # applypatch from an e-mail message.
5
- #
6
- # The hook should exit with non-zero status after issuing an
7
- # appropriate message if it wants to stop the commit. The hook is
8
- # allowed to edit the commit message file.
9
- #
10
- # To enable this hook, rename this file to "applypatch-msg".
11
-
12
- . git-sh-setup
13
- test -x "$GIT_DIR/hooks/commit-msg" &&
14
- exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
15
- :
@@ -1,24 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # An example hook script to check the commit log message.
4
- # Called by git-commit with one argument, the name of the file
5
- # that has the commit message. The hook should exit with non-zero
6
- # status after issuing an appropriate message if it wants to stop the
7
- # commit. The hook is allowed to edit the commit message file.
8
- #
9
- # To enable this hook, rename this file to "commit-msg".
10
-
11
- # Uncomment the below to add a Signed-off-by line to the message.
12
- # Doing this in a hook is a bad idea in general, but the prepare-commit-msg
13
- # hook is more suited to it.
14
- #
15
- # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
16
- # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
17
-
18
- # This example catches duplicate Signed-off-by lines.
19
-
20
- test "" = "$(grep '^Signed-off-by: ' "$1" |
21
- sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
22
- echo >&2 Duplicate Signed-off-by lines.
23
- exit 1
24
- }
@@ -1,8 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # An example hook script that is called after a successful
4
- # commit is made.
5
- #
6
- # To enable this hook, rename this file to "post-commit".
7
-
8
- : Nothing
@@ -1,15 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # An example hook script for the "post-receive" event.
4
- #
5
- # The "post-receive" script is run after receive-pack has accepted a pack
6
- # and the repository has been updated. It is passed arguments in through
7
- # stdin in the form
8
- # <oldrev> <newrev> <refname>
9
- # For example:
10
- # aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
11
- #
12
- # see contrib/hooks/ for a sample, or uncomment the next line and
13
- # rename the file to "post-receive".
14
-
15
- #. /usr/share/doc/git-core/contrib/hooks/post-receive-email
@@ -1,8 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # An example hook script to prepare a packed repository for use over
4
- # dumb transports.
5
- #
6
- # To enable this hook, rename this file to "post-update".
7
-
8
- exec git-update-server-info
@@ -1,14 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # An example hook script to verify what is about to be committed
4
- # by applypatch from an e-mail message.
5
- #
6
- # The hook should exit with non-zero status after issuing an
7
- # appropriate message if it wants to stop the commit.
8
- #
9
- # To enable this hook, rename this file to "pre-applypatch".
10
-
11
- . git-sh-setup
12
- test -x "$GIT_DIR/hooks/pre-commit" &&
13
- exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
14
- :
@@ -1,46 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # An example hook script to verify what is about to be committed.
4
- # Called by git-commit with no arguments. The hook should
5
- # exit with non-zero status after issuing an appropriate message if
6
- # it wants to stop the commit.
7
- #
8
- # To enable this hook, rename this file to "pre-commit".
9
-
10
- if git-rev-parse --verify HEAD >/dev/null 2>&1
11
- then
12
- against=HEAD
13
- else
14
- # Initial commit: diff against an empty tree object
15
- against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
16
- fi
17
-
18
- # If you want to allow non-ascii filenames set this variable to true.
19
- allownonascii=$(git config hooks.allownonascii)
20
-
21
- # Cross platform projects tend to avoid non-ascii filenames; prevent
22
- # them from being added to the repository. We exploit the fact that the
23
- # printable range starts at the space character and ends with tilde.
24
- if [ "$allownonascii" != "true" ] &&
25
- # Note that the use of brackets around a tr range is ok here, (it's
26
- # even required, for portability to Solaris 10's /usr/bin/tr), since
27
- # the square bracket bytes happen to fall in the designated range.
28
- test "$(git diff --cached --name-only --diff-filter=A -z $against |
29
- LC_ALL=C tr -d '[ -~]\0')"
30
- then
31
- echo "Error: Attempt to add a non-ascii file name."
32
- echo
33
- echo "This can cause problems if you want to work"
34
- echo "with people on other platforms."
35
- echo
36
- echo "To be portable it is advisable to rename the file ..."
37
- echo
38
- echo "If you know what you are doing you can disable this"
39
- echo "check using:"
40
- echo
41
- echo " git config hooks.allownonascii true"
42
- echo
43
- exit 1
44
- fi
45
-
46
- exec git diff-index --check --cached $against --
@@ -1,169 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # Copyright (c) 2006, 2008 Junio C Hamano
4
- #
5
- # The "pre-rebase" hook is run just before "git-rebase" starts doing
6
- # its job, and can prevent the command from running by exiting with
7
- # non-zero status.
8
- #
9
- # The hook is called with the following parameters:
10
- #
11
- # $1 -- the upstream the series was forked from.
12
- # $2 -- the branch being rebased (or empty when rebasing the current branch).
13
- #
14
- # This sample shows how to prevent topic branches that are already
15
- # merged to 'next' branch from getting rebased, because allowing it
16
- # would result in rebasing already published history.
17
-
18
- publish=next
19
- basebranch="$1"
20
- if test "$#" = 2
21
- then
22
- topic="refs/heads/$2"
23
- else
24
- topic=`git symbolic-ref HEAD` ||
25
- exit 0 ;# we do not interrupt rebasing detached HEAD
26
- fi
27
-
28
- case "$topic" in
29
- refs/heads/??/*)
30
- ;;
31
- *)
32
- exit 0 ;# we do not interrupt others.
33
- ;;
34
- esac
35
-
36
- # Now we are dealing with a topic branch being rebased
37
- # on top of master. Is it OK to rebase it?
38
-
39
- # Does the topic really exist?
40
- git show-ref -q "$topic" || {
41
- echo >&2 "No such branch $topic"
42
- exit 1
43
- }
44
-
45
- # Is topic fully merged to master?
46
- not_in_master=`git-rev-list --pretty=oneline ^master "$topic"`
47
- if test -z "$not_in_master"
48
- then
49
- echo >&2 "$topic is fully merged to master; better remove it."
50
- exit 1 ;# we could allow it, but there is no point.
51
- fi
52
-
53
- # Is topic ever merged to next? If so you should not be rebasing it.
54
- only_next_1=`git-rev-list ^master "^$topic" ${publish} | sort`
55
- only_next_2=`git-rev-list ^master ${publish} | sort`
56
- if test "$only_next_1" = "$only_next_2"
57
- then
58
- not_in_topic=`git-rev-list "^$topic" master`
59
- if test -z "$not_in_topic"
60
- then
61
- echo >&2 "$topic is already up-to-date with master"
62
- exit 1 ;# we could allow it, but there is no point.
63
- else
64
- exit 0
65
- fi
66
- else
67
- not_in_next=`git-rev-list --pretty=oneline ^${publish} "$topic"`
68
- perl -e '
69
- my $topic = $ARGV[0];
70
- my $msg = "* $topic has commits already merged to public branch:\n";
71
- my (%not_in_next) = map {
72
- /^([0-9a-f]+) /;
73
- ($1 => 1);
74
- } split(/\n/, $ARGV[1]);
75
- for my $elem (map {
76
- /^([0-9a-f]+) (.*)$/;
77
- [$1 => $2];
78
- } split(/\n/, $ARGV[2])) {
79
- if (!exists $not_in_next{$elem->[0]}) {
80
- if ($msg) {
81
- print STDERR $msg;
82
- undef $msg;
83
- }
84
- print STDERR " $elem->[1]\n";
85
- }
86
- }
87
- ' "$topic" "$not_in_next" "$not_in_master"
88
- exit 1
89
- fi
90
-
91
- exit 0
92
-
93
- ################################################################
94
-
95
- This sample hook safeguards topic branches that have been
96
- published from being rewound.
97
-
98
- The workflow assumed here is:
99
-
100
- * Once a topic branch forks from "master", "master" is never
101
- merged into it again (either directly or indirectly).
102
-
103
- * Once a topic branch is fully cooked and merged into "master",
104
- it is deleted. If you need to build on top of it to correct
105
- earlier mistakes, a new topic branch is created by forking at
106
- the tip of the "master". This is not strictly necessary, but
107
- it makes it easier to keep your history simple.
108
-
109
- * Whenever you need to test or publish your changes to topic
110
- branches, merge them into "next" branch.
111
-
112
- The script, being an example, hardcodes the publish branch name
113
- to be "next", but it is trivial to make it configurable via
114
- $GIT_DIR/config mechanism.
115
-
116
- With this workflow, you would want to know:
117
-
118
- (1) ... if a topic branch has ever been merged to "next". Young
119
- topic branches can have stupid mistakes you would rather
120
- clean up before publishing, and things that have not been
121
- merged into other branches can be easily rebased without
122
- affecting other people. But once it is published, you would
123
- not want to rewind it.
124
-
125
- (2) ... if a topic branch has been fully merged to "master".
126
- Then you can delete it. More importantly, you should not
127
- build on top of it -- other people may already want to
128
- change things related to the topic as patches against your
129
- "master", so if you need further changes, it is better to
130
- fork the topic (perhaps with the same name) afresh from the
131
- tip of "master".
132
-
133
- Let's look at this example:
134
-
135
- o---o---o---o---o---o---o---o---o---o "next"
136
- / / / /
137
- / a---a---b A / /
138
- / / / /
139
- / / c---c---c---c B /
140
- / / / \ /
141
- / / / b---b C \ /
142
- / / / / \ /
143
- ---o---o---o---o---o---o---o---o---o---o---o "master"
144
-
145
-
146
- A, B and C are topic branches.
147
-
148
- * A has one fix since it was merged up to "next".
149
-
150
- * B has finished. It has been fully merged up to "master" and "next",
151
- and is ready to be deleted.
152
-
153
- * C has not merged to "next" at all.
154
-
155
- We would want to allow C to be rebased, refuse A, and encourage
156
- B to be deleted.
157
-
158
- To compute (1):
159
-
160
- git-rev-list ^master ^topic next
161
- git-rev-list ^master next
162
-
163
- if these match, topic has not merged in next at all.
164
-
165
- To compute (2):
166
-
167
- git-rev-list master..topic
168
-
169
- if this is empty, it is fully merged to "master".
@@ -1,36 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # An example hook script to prepare the commit log message.
4
- # Called by git-commit with the name of the file that has the
5
- # commit message, followed by the description of the commit
6
- # message's source. The hook's purpose is to edit the commit
7
- # message file. If the hook fails with a non-zero status,
8
- # the commit is aborted.
9
- #
10
- # To enable this hook, rename this file to "prepare-commit-msg".
11
-
12
- # This hook includes three examples. The first comments out the
13
- # "Conflicts:" part of a merge commit.
14
- #
15
- # The second includes the output of "git diff --name-status -r"
16
- # into the message, just before the "git status" output. It is
17
- # commented because it doesn't cope with --amend or with squashed
18
- # commits.
19
- #
20
- # The third example adds a Signed-off-by line to the message, that can
21
- # still be edited. This is rarely a good idea.
22
-
23
- case "$2,$3" in
24
- merge,)
25
- perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
26
-
27
- # ,|template,)
28
- # perl -i.bak -pe '
29
- # print "\n" . `git diff --cached --name-status -r`
30
- # if /^#/ && $first++ == 0' "$1" ;;
31
-
32
- *) ;;
33
- esac
34
-
35
- # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
36
- # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"