]> gitweb.fluxo.info Git - httruta.git/commitdiff
Use two levels of directories
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 2 Aug 2015 19:08:52 +0000 (16:08 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 2 Aug 2015 19:08:52 +0000 (16:08 -0300)
lib/httracker/functions

index 2a63ffa74d12f53a6acbb740fc3238162240fb68..2d3e35a41b2040d02e3f4b22a2dfe3cecd82438e 100644 (file)
@@ -21,11 +21,16 @@ function httracker_get {
   # Options
   local url="$1"
   local hash="`echo $1 | sha1sum | cut -d ' ' -f 1`"
+  local first="`echo $hash | cut -c 1-2`"
+  local second="`echo $hash | cut -c 3-4`"
 
   echo -n "Processing $url..."
 
   # Set target and make sure it exists
-  TARGET="$MIRRORS/$hash"
+  # We use two levels of directories used for hashing,
+  # to prevent too many things ending up in any one directory.
+  # See https://git-annex.branchable.com/internals/
+  TARGET="$MIRRORS/$first/$second/$hash"
   mkdir -p $TARGET
 
   # We already got this one