git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] get_authors.sh, author.rb: use -s option of git shortlog.

From
Adeodato Simó <dato@net.com.org.es>
Date
Jan 5, 2009, 22:52 UTC
Message-ID
<1231195946-20967-1-git-send-email-dato@net.com.org.es>
In-Reply-To
<20090105185737.GV21154@genesis.frugalware.org>
Suggested by Miklos Vajna <vmiklos@frugalware.org>.
---
 app/models/author.rb  |   26 ++++++++++++--------------
 script/get_authors.sh |    2 +-
 2 files changed, 13 insertions(+), 15 deletions(-)
> I suppose fixing up the ruby part after this is not that hard, sadly I
> don't speak Ruby myself, so I have no idea where and what to touch. ;-)
Done.

Btw, I don't think authors.txt should be in the repo at all, since it's automatically generated, but it's your choice. :-)

diff --git a/app/models/author.rb b/app/models/author.rb
index 8fafc15..6bf069a 100644
--- a/app/models/author.rb
+++ b/app/models/author.rb
@@ -1,22 +1,20 @@
 class Author
-	
-	def self.all
-		authors =  File.join(RAILS_ROOT, 'config/authors.txt')
+  def self.all
+    authors = File.join(RAILS_ROOT, 'config/authors.txt')
     if File.exists?(authors)
       authors = File.readlines(authors)
       @authors = {:main => [], :contrib => []}
       authors.each do |author|
-        data = author.split(' ')
-        number = data.pop.gsub('(', '').gsub(')', '').chomp
-        name = data.join(' ')
-        if(number.to_i > 50)
-          @authors[:main] << [name, number.to_i]
-        else
-          @authors[:contrib] << [name, number.to_i]
+        if author =~ /(\d+)\s+(.+)/
+          name, number = $2, $1.to_i
+          if number > 50
+            @authors[:main] << [name, number]
+          else
+            @authors[:contrib] << [name, number]
+          end
         end
       end
+      @authors
     end
-		@authors
-	end
-	
-end
\ No newline at end of file
+  end
+end
diff --git a/script/get_authors.sh b/script/get_authors.sh
index 9aa8c6b..028a354 100755
--- a/script/get_authors.sh
+++ b/script/get_authors.sh
@@ -1,3 +1,3 @@
 export GIT_DIR=/Users/schacon/projects/git/.git
 cd /Users/schacon/projects/git
-git log --pretty=short --no-merges | git shortlog -n | grep -v -e '^ ' | grep ':' > ../gitscm/config/authors.txt
+git shortlog --no-merges -sn > ../gitscm/config/authors.txt
-- 
1.6.1.62.g677ca
Previous: Miklos VajnaNext: Miklos Vajna
Message 5 of 21 in “Re: git-scm.com transition”
  1. Petr BaudisDec 16, 2008
  2. [ANNOUNCE] Git homepage changePetr Baudis, Jan 5, 2009
  3. Miklos VajnaJan 5, 2009
  4. Miklos VajnaJan 5, 2009
  5. get_authors.sh, author.rb: use -s option of git shortlog.Adeodato Simó, Jan 5, 2009
  6. Miklos VajnaJan 5, 2009
  7. Mike HommeyJan 5, 2009
  8. David BrysonJan 5, 2009
  9. Scott ChaconJan 6, 2009
  10. BazJan 6, 2009
  11. BazJan 6, 2009
  12. Miklos VajnaJan 6, 2009
  13. Boyd Lynn GerberJan 6, 2009
  14. Miklos VajnaJan 6, 2009
  15. Boyd Lynn GerberJan 6, 2009
  16. Miklos VajnaJan 6, 2009
  17. Adeodato SimóJan 6, 2009
  18. Felipe Oliveira CarvalhoJan 5, 2009
  19. Scott ChaconJan 5, 2009
  20. Boyd Lynn GerberJan 5, 2009
  21. Ted PavlicJan 5, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.