3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/git_helpers/submodules.rb', line 3
def foreach(commited: true, modified: true, untracked: true, recursive: false, &b)
r=[]
st=status
st[:paths].each do |k,v|
sub=v[:submodule]
if sub
sub_commited=v[:sub_commited]
sub_modified=v[:sub_modified]
sub_untracked=v[:sub_untracked]
if (commited && sub_commited or modified && sub_modified or untracked && sub_untracked)
b.call(k, v) if b
r << k
end
if recursive
GitDir.new(k).with_dir do |g|
rec=g.foreach(commited: commited, modified: modified, untracked: untracked, recursive: true, &b)
r+=rec.map {|sub| g.reldir+sub}
end
end
end
end
r
end
|