buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject git commit: BUILDR-700 - Fix bug where buildr was truncating SNAPSHOT files that had not changed since last update check and HTTP was returning "HTTP Not Modified" status.
Date Thu, 03 Jul 2014 10:32:55 GMT
Repository: buildr
Updated Branches:
  refs/heads/master 983824724 -> 2aadee753


BUILDR-700 - Fix bug where buildr was truncating SNAPSHOT files
that had not changed since last update check and HTTP was returning
"HTTP Not Modified" status.


Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/2aadee75
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/2aadee75
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/2aadee75

Branch: refs/heads/master
Commit: 2aadee75352eb2ca913003e1ba725518ad11578e
Parents: 9838247
Author: Peter Donald <peter@realityforge.org>
Authored: Thu Jul 3 20:32:49 2014 +1000
Committer: Peter Donald <peter@realityforge.org>
Committed: Thu Jul 3 20:32:49 2014 +1000

----------------------------------------------------------------------
 CHANGELOG                     | 3 +++
 lib/buildr/core/transports.rb | 6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/2aadee75/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 85a8a2e..445e07c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,7 @@
 1.4.19 (Pending)
+* Fixed:  BUILDR-700 - Fix bug where buildr was truncating SNAPSHOT files
+          that had not changed since last update check and HTTP was returning
+          "HTTP Not Modified" status.
 * Fixed:  Fix bug introduced in 1.4.18 version of custom_pom addon where
           poms are created for artifacts that have a classifier.
 

http://git-wip-us.apache.org/repos/asf/buildr/blob/2aadee75/lib/buildr/core/transports.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/core/transports.rb b/lib/buildr/core/transports.rb
index 4d5d266..3e8def0 100644
--- a/lib/buildr/core/transports.rb
+++ b/lib/buildr/core/transports.rb
@@ -145,10 +145,12 @@ module URI
         modified = File.stat(target).mtime if File.exist?(target)
         temp = Tempfile.new(File.basename(target))
         temp.binmode
-        read({:progress=>verbose}.merge(options || {}).merge(:modified=>modified))
{ |chunk| temp.write chunk }
+        written = false
+        read({:progress=>verbose}.merge(options || {}).merge(:modified=>modified))
{ |chunk| written = true; temp.write chunk }
         temp.close
         mkpath File.dirname(target)
-        mv temp.path, target
+        # Only attempt to override file if it was actually written to, i.e. "HTTP Not Modified"
was not returned.
+        mv temp.path, target if written
       when File
         read({:progress=>verbose}.merge(options || {}).merge(:modified=>target.mtime))
{ |chunk| target.write chunk }
         target.flush


Mime
View raw message