<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -99,11 +99,15 @@ end
 
 def get_size s
   scales = {'k' =&gt; 1024, 'M' =&gt; 1024*1024}
-  scale = s[-1..-1]
-  if not scales[scale] then
-    return Integer(s)
+  begin
+    Integer(s)
+  rescue ArgumentError
+    scale = s[-1..-1]
+    if not scales[scale]
+      raise &quot;Can't parse value to integer: #{s}&quot;
+    end
+    Integer(s[0..-2]) * scales[scale]
   end
-  return Integer(s[0..-2]) * scales[scale]
 end
 
 def curl url, *args
@@ -132,10 +136,12 @@ def curl url, *args
         end
         line = line.split
 
-        # setup progress bar if total size already known
-        if not bar then
-          total = get_size(line[1])
-          next if not total &gt; 0
+        # setup progress bar if:
+        total = get_size(line[1])
+        next if not total &gt; 0 # - total size already known
+        # - there is no bar
+        # - or bar total is less the current total (redirect happened)
+        if not bar or total &gt; bar.total then
           title = url.split('/')[-1]
           bar = ProgressBar.new(title, total)
           bar.file_transfer_mode</diff>
      <filename>Library/Homebrew/utils.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8e113a6641a7912b109f70caf08f294009f4fc1c</id>
    </parent>
  </parents>
  <author>
    <name>Alexander Solovyov</name>
    <email>piranha@piranha.org.ua</email>
  </author>
  <url>http://github.com/piranha/homebrew/commit/bc478119352f650642b484bc591090c90825f337</url>
  <id>bc478119352f650642b484bc591090c90825f337</id>
  <committed-date>2009-11-12T04:25:01-08:00</committed-date>
  <authored-date>2009-11-05T03:02:01-08:00</authored-date>
  <message>progress bar: fix dealing with redirects</message>
  <tree>ee30d2d41981596500d5bfa5292d366bf197e1bc</tree>
  <committer>
    <name>Alexander Solovyov</name>
    <email>piranha@piranha.org.ua</email>
  </committer>
</commit>
