Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix directory reported wrong

  • Loading branch information...
commit e4c57d7aa026eaead8883e160bec94caf8962009 1 parent 0b1afaf
@larsklevan larsklevan authored
Showing with 8 additions and 8 deletions.
  1. +8 −8 bin/git-reviewrequest
View
16 bin/git-reviewrequest
@@ -51,18 +51,18 @@ end
short_description = description.split("\n").first(5).join("\n")
changes = `git diff --stat master...#{branch}`.split("\n")
-file_changes = changes.pop
-if file_changes.length > 5
- dirs = file_changes.map do |file_change|
- filename = "/#{file_change.split.first}"
- dir = filename.gsub(/\/[^\/]+$/, '')}
+stats = changes.pop
+if changes.length > 0
+ dirs = changes.map do |file_change|
+ filename = "#{file_change.split.first}"
+ dir = filename.gsub(/\/[^\/]+$/, '')
dir
end
dir_counts = Hash.new(0)
dirs.each {|dir| dir_counts[dir] += 1 }
- changes = dir_counts.to_a.sort_by {|k,v| v}.reverse.first(5).map {|k,v| "#{k} (#{v})"}
+ changes = dir_counts.to_a.sort_by {|k,v| v}.reverse.first(5).map {|k,v| "#{k} (#{v} file)"}
end
-stats = (changes + [file_changes]).join("\n")
+change_summary = (changes + [stats]).join("\n")
repo = `git config -z --get remote.origin.url`.strip
# ex: git@github.com:socialcast/socialcast-git-extensions.git
@@ -70,7 +70,7 @@ repo = repo.scan(/:(.+\/.+)\./).first.first
url = create_pull_request username, password, branch, repo, description
if url
- review_message = ["@SocialcastDevelopers #reviewrequest for #{branch} #scgitx", short_description, stats].join("\n\n")
+ review_message = ["@SocialcastDevelopers #reviewrequest for #{branch} #scgitx", short_description, change_summary].join("\n\n")
share review_message, {:url => url, :message_type => 'review_request'}
else
HighLine.say "Skipping socialcast announcement"
Please sign in to comment.
Something went wrong with that request. Please try again.