Skip to content

Commit 9aa9024

Browse files
authored
Merge branch 'master' into add-merge-base
2 parents 957bcfc + 7d43d23 commit 9aa9024

File tree

9 files changed

+54
-14
lines changed

9 files changed

+54
-14
lines changed

.jrubyrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ rvm:
33
- 2.3
44
- 2.4
55
- 2.5
6+
- 2.6
7+
- ruby-head
68
- jruby
9+
710
matrix:
811
allow_failures:
912
- rvm: jruby
10-
fast_finish: true
11-
before_install:
12-
- gem install bundler
13-
- bundle --version
14-
- git --version
13+
- rvm: ruby-head
14+
fast_finish: true

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
## 1.5.0
4+
5+
See https://github.com/ruby-git/ruby-git/releases/tag/v1.5.0
6+
7+
## 1.4.0
8+
9+
See https://github.com/ruby-git/ruby-git/releases/tag/v1.4.0
10+
311
## 1.3.0
412

513
* Dropping Ruby 1.8.x support

VERSION

Lines changed: 0 additions & 2 deletions
This file was deleted.

git.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Gem::Specification.new do |s|
2828
'MAINTAINERS.md',
2929
'LICENSE',
3030
'README.md',
31-
'VERSION',
3231
'lib/git.rb',
3332
'lib/git/author.rb',
3433
'lib/git/base.rb',

lib/git/lib.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,12 @@ def stashes_all
604604
arr = []
605605
filename = File.join(@git_dir, 'logs/refs/stash')
606606
if File.exist?(filename)
607-
File.open(filename).each_with_index { |line, i|
608-
m = line.match(/:(.*)$/)
609-
arr << [i, m[1].strip]
610-
}
607+
File.open(filename) do |f|
608+
f.each_with_index do |line, i|
609+
m = line.match(/:(.*)$/)
610+
arr << [i, m[1].strip]
611+
end
612+
end
611613
end
612614
arr
613615
end
@@ -770,6 +772,7 @@ def push(remote, branch = 'master', opts = {})
770772

771773
arr_opts = []
772774
arr_opts << '--mirror' if opts[:mirror]
775+
arr_opts << '--delete' if opts[:delete]
773776
arr_opts << '--force' if opts[:force] || opts[:f]
774777
arr_opts << remote
775778

lib/git/stashes.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ def initialize(base)
1313
@stashes.unshift(Git::Stash.new(@base, message, true))
1414
end
1515
end
16+
17+
#
18+
# Returns an multi-dimensional Array of elements that have been stash saved.
19+
# Array is based on position and name. See Example
20+
#
21+
# @example Returns Array of items that have been stashed
22+
# .all - [0, "testing-stash-all"]]
23+
# @return [Array]
24+
def all
25+
@base.lib.stashes_all
26+
end
1627

1728
def save(message)
1829
s = Git::Stash.new(@base, message)

lib/git/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Git
22
# The current gem version
33
# @return [String] the current gem version.
4-
VERSION='1.4.0'
4+
VERSION='1.5.0'
55
end

tests/units/test_stashes.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,27 @@ def test_stash_unstash
3232
end
3333
end
3434
end
35+
36+
def test_stashes_all
37+
in_temp_dir do |path|
38+
g = Git.clone(@wbare, 'stash_test')
39+
Dir.chdir('stash_test') do
40+
assert_equal(0, g.branch.stashes.size)
41+
new_file('test-file1', 'blahblahblah1')
42+
new_file('test-file2', 'blahblahblah2')
43+
assert(g.status.untracked.assoc('test-file1'))
44+
45+
g.add
46+
47+
assert(g.status.added.assoc('test-file1'))
48+
49+
g.branch.stashes.save('testing-stash-all')
50+
51+
stashes = g.branch.stashes.all
52+
53+
assert(stashes[0].include?('testing-stash-all'))
54+
end
55+
end
56+
end
3557

3658
end

0 commit comments

Comments
 (0)