[ARVADOS] updated: 02156d71070b21872d2dac3c5912c9a1ccd8d684

git at public.curoverse.com git at public.curoverse.com
Wed Jun 10 09:40:19 EDT 2015


Summary of changes:
 services/api/app/models/collection.rb     | 2 +-
 services/api/test/unit/collection_test.rb | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

  discards  5c80d2974917a4f14da471c84923b3f8d721fd1f (commit)
  discards  7d838bbf3337b2600fecb93322e6466b9a690a42 (commit)
       via  02156d71070b21872d2dac3c5912c9a1ccd8d684 (commit)
       via  a46c4dd42c265a8bbbb25ea258f683571f82c0ca (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (5c80d2974917a4f14da471c84923b3f8d721fd1f)
            \
             N -- N -- N (02156d71070b21872d2dac3c5912c9a1ccd8d684)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 02156d71070b21872d2dac3c5912c9a1ccd8d684
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Jun 8 10:10:26 2015 -0400

    6203: Accept (and discard) hints in client-provided portable_data_hash.

diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 9407186..bbced41 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -128,8 +128,8 @@ class Collection < ArvadosModel
       true
     elsif portable_data_hash.nil? or not portable_data_hash_changed?
       self.portable_data_hash = computed_pdh
-    elsif portable_data_hash !~ /^[0-9a-f]{32}(\+\d+)?$/
-      errors.add(:portable_data_hash, "is not a valid hash or hash+size")
+    elsif portable_data_hash !~ Keep::Locator::LOCATOR_REGEXP
+      errors.add(:portable_data_hash, "is not a valid locator")
       false
     elsif portable_data_hash[0..31] != computed_pdh[0..31]
       errors.add(:portable_data_hash,

commit a46c4dd42c265a8bbbb25ea258f683571f82c0ca
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Jun 8 03:11:22 2015 -0400

    6203: Remove unused vars. Remove unnecessary newline manipulation.

diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 4b9d568..9407186 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -218,9 +218,8 @@ class Collection < ArvadosModel
     new_lines = []
     manifest.each_line do |line|
       line.rstrip!
-      words = line.split(' ')
       new_words = []
-      words.each do |word|
+      line.split(' ').each do |word|
         if match = Keep::Locator::LOCATOR_REGEXP.match(word)
           new_words << yield(match)
         else
@@ -229,17 +228,16 @@ class Collection < ArvadosModel
       end
       new_lines << new_words.join(' ')
     end
-
-    manifest = new_lines.join("\n") + "\n"
+    new_lines.join("\n") + "\n"
   end
 
   def self.each_manifest_locator manifest
     # Given a manifest text and a block, yield the regexp match object
     # for each locator.
     manifest.each_line do |line|
-      line.rstrip!
-      words = line.split(' ')
-      words.each do |word|
+      # line will have a trailing newline, but the last token is never
+      # a locator, so it's harmless here.
+      line.split(' ').each do |word|
         if match = Keep::Locator::LOCATOR_REGEXP.match(word)
           yield(match)
         end
diff --git a/services/api/test/unit/collection_test.rb b/services/api/test/unit/collection_test.rb
index ca19da6..42748ac 100644
--- a/services/api/test/unit/collection_test.rb
+++ b/services/api/test/unit/collection_test.rb
@@ -140,7 +140,8 @@ class CollectionTest < ActiveSupport::TestCase
    [true, pdhmd5],
    [true, pdhmd5+'+12345'],
    [true, pdhmd5+'+'+pdhmanifest.length.to_s],
-   [false, pdhmd5+'+Foo'],
+   [true, pdhmd5+'+12345+Foo'],
+   [true, pdhmd5+'+Foo'],
    [false, Digest::MD5.hexdigest(pdhmanifest.strip)],
    [false, Digest::MD5.hexdigest(pdhmanifest.strip)+'+'+pdhmanifest.length.to_s],
    [false, pdhmd5[0..30]],

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list