git_pretty_accept 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12f24d9aa0af834a4394838c7075e19e55c7573e
4
- data.tar.gz: 2ec2c68340f2e2b906d1225d805cbc08e34d17d9
3
+ metadata.gz: 301fb377312331048a8fbc82097fb708ebbccae1
4
+ data.tar.gz: e39af5ebd744e927e3ae52893c5857e1018ba705
5
5
  SHA512:
6
- metadata.gz: 0c77d78b5c061b26f954bfbfe6708ae83925a21186deafa8cb957e440d84295a70a2c6e4ed937526f3b66bed74b2f3f3b3367953aadb3b17cb547b48537a2e14
7
- data.tar.gz: c544dcc0f68d9ba1efed28a9841407c9d60b0acff1028f578b2410ccddb50d944d03ce5225d7b13e10581a24dc1ac78e7220b404c1fe086bfc0aa7cda535a7bb
6
+ metadata.gz: 43d47927d2a8b3657efc1827d4e6f87d3975b66cc345662fc081363d6aaea07c1e39eda586de33b10e4084d2bf61f55a281bb74c9740707de9e91f6a78f12658
7
+ data.tar.gz: fa5da0797101ef3d8990234e842f8968df95b8f3d103ee0b5de03530f7ce33142975b571e1c26e25ec47abfbb03c298b5641c9204e04a2d4eb2ad8f1b7193d9f
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ before_script:
2
+ - git config --global user.email "you@example.com"
3
+ - git config --global user.name "Your Name"
4
+ script: bundle exec rspec
5
+ rvm:
6
+ - 1.9.3
7
+ - 2.0.0
8
+ - 2.1.0
9
+ - rbx
10
+ cache: bundler
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.4.0 - 2014-02-20
2
+
3
+ * Prevent merging when the target branch is different from origin. Prevents
4
+ commits in master from being accidentally pushed to origin along with the
5
+ pull request.
6
+
1
7
  ## 0.3.1 - 2014-01-21
2
8
 
3
9
  * Transfer ownership to Love With Food.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # git-pretty-accept
2
2
 
3
+ [![Build Status](https://travis-ci.org/lovewithfood/git_pretty_accept.png)](https://travis-ci.org/lovewithfood/git_pretty_accept)
4
+
3
5
  `git-pretty-accept` is a script that rebases a pull request before merging
4
6
  to master. Pull requests are _always_ merged recursively. The result is a
5
7
  linear history with merge bubbles indicating pull requests. In short, pretty.
@@ -52,6 +54,11 @@ script
52
54
  1. Complains if you accidentally try to accept the master branch to a feature
53
55
  branch.
54
56
 
57
+ ## Known to be working on
58
+
59
+ * git 1.7.9
60
+ * ruby 2.0.0
61
+
55
62
  ## Contributing
56
63
 
57
64
  1. Fork it
@@ -13,6 +13,8 @@ module GitPrettyAccept
13
13
  [
14
14
  "git fetch origin",
15
15
  "git rebase origin/#{source_branch}",
16
+ "echo 'Confirming that #{source_branch} is not ahead of origin/#{source_branch}...'",
17
+ "test `git rev-parse HEAD` = `git rev-parse origin/#{source_branch}`",
16
18
  "git checkout #{branch}",
17
19
  "git rebase origin/#{branch}",
18
20
  "git rebase origin/#{source_branch}",
@@ -1,3 +1,3 @@
1
1
  module GitPrettyAccept
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -65,6 +65,19 @@ describe GitPrettyAccept::App do
65
65
  expect(local_repo.git.log[3].parents.size).to eq(0)
66
66
  end
67
67
 
68
+ And 'the PR_BRANCH should be on top of the previous origin/master' do
69
+ commit_of_our_change_in_pr_branch = local_repo.git.log.find do |log|
70
+ log.message == our_change_in_pr_branch
71
+ end
72
+
73
+ commit_of_their_change_in_master = local_repo.git.log.find do |log|
74
+ log.message == their_change_in_master
75
+ end
76
+
77
+ expect(commit_of_our_change_in_pr_branch.parent.message)
78
+ .to eq(commit_of_their_change_in_master.message)
79
+ end
80
+
68
81
  And 'it should push the PR_BRANCH commits' do
69
82
  expect(local_repo.git.branches['origin/master'].gcommit.message)
70
83
  .to eq("Merge branch '#{pr_branch}'")
@@ -200,4 +213,41 @@ describe GitPrettyAccept::App do
200
213
  .to include(remote_pr_message)
201
214
  end
202
215
  end
216
+
217
+ Steps "should not merge into source branch when it is different from origin" do
218
+ our_change_in_master = 'our_change_in_master'
219
+ our_change_in_pr_branch = 'our_change_in_pr_branch'
220
+
221
+ Given 'I have a local repo' do
222
+ local_repo
223
+ end
224
+
225
+ And 'my local source branch is ahead of origin' do
226
+ local_repo.checkout 'master'
227
+ local_repo.commit_some_change our_change_in_master
228
+ end
229
+
230
+ And 'I have a PR_BRANCH that is not up-to-date with master' do
231
+ local_repo.checkout pr_branch
232
+ local_repo.push_some_change our_change_in_pr_branch
233
+ end
234
+
235
+ And 'the current branch is master' do
236
+ local_repo.checkout 'master'
237
+ end
238
+
239
+ When 'I run `git pretty-accept PR_BRANCH`' do
240
+ command =
241
+ "bundle exec #{project_path}/bin/git-pretty-accept --no-edit #{pr_branch}"
242
+
243
+ FileUtils.cd(our_path) do
244
+ @result = system(command, err: '/tmp/err.log')
245
+ end
246
+ end
247
+
248
+ Then 'it should not merge the PR_BRANCH due to the commit in the local source branch' do
249
+ expect(@result).to be_false
250
+ expect(File.read('/tmp/err.log')).to include('git push origin master')
251
+ end
252
+ end
203
253
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_pretty_accept
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Love With Food, George Mendoza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-21 00:00:00.000000000 Z
11
+ date: 2014-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -161,10 +161,10 @@ extensions: []
161
161
  extra_rdoc_files: []
162
162
  files:
163
163
  - .gitignore
164
+ - .travis.yml
164
165
  - CHANGELOG.markdown
165
166
  - Gemfile
166
167
  - Guardfile
167
- - LICENSE.txt
168
168
  - MIT-LICENSE
169
169
  - README.md
170
170
  - Rakefile
data/LICENSE.txt DELETED
@@ -1,7 +0,0 @@
1
- Copyright (c) 2013 YOUR NAME
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.