Compare commits
No commits in common. "c44c718d0603c4ff10875b73833aefc5a12cfe82" and "bfeae89ab52d1696c4a56768b7f0c6682efaff82" have entirely different histories.
c44c718d06
...
bfeae89ab5
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,6 +1,3 @@
|
|||||||
[submodule "code/aoc-2020"]
|
[submodule "code/aoc-2020"]
|
||||||
path = code/aoc-2020
|
path = code/aoc-2020
|
||||||
url = https://dev.danilafe.com/Advent-of-Code/AdventOfCode-2020.git
|
url = https://dev.danilafe.com/Advent-of-Code/AdventOfCode-2020.git
|
||||||
[submodule "code/libabacus"]
|
|
||||||
path = code/libabacus
|
|
||||||
url = https://dev.danilafe.com/Experiments/libabacus
|
|
||||||
|
@ -1,27 +1,19 @@
|
|||||||
puts "[params]"
|
puts "[params]"
|
||||||
puts " [params.submoduleLinks]"
|
puts " [params.submoduleLinks]"
|
||||||
|
|
||||||
def each_submodule(base_path)
|
`git submodule status --recursive`.lines do |line|
|
||||||
`cd #{base_path} && git submodule status`.lines do |line|
|
hash, path = line[1..].split " "
|
||||||
hash, path = line[1..].split " "
|
next unless path.start_with? "code/"
|
||||||
full_path = "#{base_path}/#{path}"
|
code_path = path.delete_prefix "code/"
|
||||||
url = `git config --file #{base_path}/.gitmodules --get 'submodule.#{path}.url'`.chomp.delete_suffix(".git")
|
url = `git config --file .gitmodules --get 'submodule.#{path}.url'`.chomp.delete_suffix(".git")
|
||||||
safe_name = full_path.gsub(/\/|-|_\./, "")
|
safe_name = code_path.gsub(/\/|-|_/, "")
|
||||||
|
|
||||||
if url =~ /dev.danilafe.com/
|
if url =~ /dev.danilafe.com/
|
||||||
file_url = "#{url}/src/commit/#{hash}"
|
file_url = "#{url}/src/commit/#{hash}"
|
||||||
else
|
else
|
||||||
raise "Submodule URL #{url.dump} not in a known format!"
|
raise "Submodule URL not in a known format!"
|
||||||
end
|
|
||||||
|
|
||||||
yield ({ :path => full_path, :url => file_url, :name => safe_name })
|
|
||||||
each_submodule(full_path) { |m| yield m }
|
|
||||||
end
|
end
|
||||||
end
|
puts " [params.submoduleLinks.#{safe_name}]"
|
||||||
|
puts " path = #{code_path.dump}"
|
||||||
each_submodule(".") do |m|
|
puts " url = #{file_url.dump}"
|
||||||
next unless m[:path].start_with? "./code/"
|
|
||||||
puts " [params.submoduleLinks.#{m[:name].delete_prefix(".code")}]"
|
|
||||||
puts " url = #{m[:url].dump}"
|
|
||||||
puts " path = #{m[:path].delete_prefix("./code/").dump}"
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user