Signed-off-by: Bai Jing baijing14@huawei.com --- bin/git-count | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/bin/git-count b/bin/git-count index 2b1359b..5799054 100755 --- a/bin/git-count +++ b/bin/git-count @@ -56,9 +56,12 @@ end
count_by_name.sort_by { |k, _v| k }
+%x(mkdir -p #{ENV['HOME']}/.am) unless File.exist?("#{ENV['HOME']}/.am") repos.each do |repo, files| - %x(git -C ~/.am/#{repo} pull --rebase) - %x(cd ~/.am/#{repo} && git shortlog -ens --no-merges --since "#{days} days ago" -- #{files}).each_line do |line| + %x(cd #{ENV['HOME']}/.am/ && git clone file:///c/#{repo}.git) unless File.exist?("#{ENV['HOME']}/.am/#{repo}") + %x(git -C #{ENV['HOME']}/.am/#{repo} pull --rebase 2>&1) + file = %x(cd #{ENV['HOME']}/.am/#{repo} && git shortlog -ens --no-merges --since "#{days} days ago" -- #{files}) + file.each_line do |line| if line =~ /(\d+)\t(.*) <(.*)>/ count = $1.to_i name = $2
In title, "todo: " is too general. It's already todo repo.
Please mention the error it fixed.
- %x(git -C ~/.am/#{repo} pull --rebase)
- %x(cd ~/.am/#{repo} && git shortlog -ens --no-merges --since "#{days} days ago" -- #{files}).each_line do |line|
No need change the above 2 lines?
Thanks, Fengguang
- %x(cd #{ENV['HOME']}/.am/ && git clone file:///c/#{repo}.git) unless File.exist?("#{ENV['HOME']}/.am/#{repo}")
- %x(git -C #{ENV['HOME']}/.am/#{repo} pull --rebase 2>&1)
- file = %x(cd #{ENV['HOME']}/.am/#{repo} && git shortlog -ens --no-merges --since "#{days} days ago" -- #{files})
- file.each_line do |line| if line =~ /(\d+)\t(.*) <(.*)>/ count = $1.to_i name = $2
-- 2.23.0
On Fri, Aug 21, 2020 at 01:20:07PM +0800, Wu Fengguang wrote:
In title, "todo: " is too general. It's already todo repo.
Please mention the error it fixed.
Ok, I will add changelog.
- %x(git -C ~/.am/#{repo} pull --rebase)
- %x(cd ~/.am/#{repo} && git shortlog -ens --no-merges --since "#{days} days ago" -- #{files}).each_line do |line|
No need change the above 2 lines?
Ok, I got it.
Thanks, Baijing
- %x(cd #{ENV['HOME']}/.am/ && git clone file:///c/#{repo}.git) unless File.exist?("#{ENV['HOME']}/.am/#{repo}")
- %x(git -C #{ENV['HOME']}/.am/#{repo} pull --rebase 2>&1)
- file = %x(cd #{ENV['HOME']}/.am/#{repo} && git shortlog -ens --no-merges --since "#{days} days ago" -- #{files})
- file.each_line do |line| if line =~ /(\d+)\t(.*) <(.*)>/ count = $1.to_i name = $2
-- 2.23.0
On Fri, Aug 21, 2020 at 01:40:52PM +0800, Bai Jing wrote:
On Fri, Aug 21, 2020 at 01:20:07PM +0800, Wu Fengguang wrote:
In title, "todo: " is too general. It's already todo repo.
Please mention the error it fixed.
Ok, I will add changelog.
- %x(git -C ~/.am/#{repo} pull --rebase)
- %x(cd ~/.am/#{repo} && git shortlog -ens --no-merges --since "#{days} days ago" -- #{files}).each_line do |line|
No need change the above 2 lines?
Ok, I got it.
- %x(cd #{ENV['HOME']}/.am/ && git clone file:///c/#{repo}.git) unless File.exist?("#{ENV['HOME']}/.am/#{repo}")
- %x(git -C #{ENV['HOME']}/.am/#{repo} pull --rebase 2>&1)
- file = %x(cd #{ENV['HOME']}/.am/#{repo} && git shortlog -ens --no-merges --since "#{days} days ago" -- #{files})
- file.each_line do |line|
I used rubocop to check this script. It shows this line is too long. So I used a variable. "%x(cd ~/.am/#{repo} && git shortlog -ens --no-merges --since "#{days} days ago" -- #{files}).each_line do |line|"
Thanks, Baijing
if line =~ /(\d+)\t(.*) <(.*)>/ count = $1.to_i name = $2
-- 2.23.0
- %x(cd #{ENV['HOME']}/.am/ && git clone file:///c/#{repo}.git) unless File.exist?("#{ENV['HOME']}/.am/#{repo}")
- %x(git -C #{ENV['HOME']}/.am/#{repo} pull --rebase 2>&1)
- file = %x(cd #{ENV['HOME']}/.am/#{repo} && git shortlog -ens --no-merges --since "#{days} days ago" -- #{files})
- file.each_line do |line|
I used rubocop to check this script. It shows this line is too long. So I used a variable. "%x(cd ~/.am/#{repo} && git shortlog -ens --no-merges --since "#{days} days ago" -- #{files}).each_line do |line|"
OK. Then tell the reason for that change, too.
Thanks, Fengguang