Skip to content

Commit e57f46f

Browse files
author
Joshua Liebowitz
committed
Merge remote-tracking branch 'upstream/master'
2 parents ae1baa3 + fd2642a commit e57f46f

File tree

7 files changed

+49
-8
lines changed

7 files changed

+49
-8
lines changed

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
@@ -609,10 +609,12 @@ def stashes_all
609609
arr = []
610610
filename = File.join(@git_dir, 'logs/refs/stash')
611611
if File.exist?(filename)
612-
File.open(filename).each_with_index { |line, i|
613-
m = line.match(/:(.*)$/)
614-
arr << [i, m[1].strip]
615-
}
612+
File.open(filename) do |f|
613+
f.each_with_index do |line, i|
614+
m = line.match(/:(.*)$/)
615+
arr << [i, m[1].strip]
616+
end
617+
end
616618
end
617619
arr
618620
end
@@ -760,6 +762,7 @@ def push(remote, branch = 'master', opts = {})
760762

761763
arr_opts = []
762764
arr_opts << '--mirror' if opts[:mirror]
765+
arr_opts << '--delete' if opts[:delete]
763766
arr_opts << '--force' if opts[:force] || opts[:f]
764767
arr_opts << remote
765768

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)