aboutsummaryrefslogtreecommitdiff
path: root/lib/httracker/functions
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-08-02 16:08:52 -0300
committerSilvio Rhatto <rhatto@riseup.net>2015-08-02 16:08:52 -0300
commitcdd9d09f978d69ad207697f94289bfa14064c5ca (patch)
tree75f205cc9e9445f6839f9cdbf362633a9583949c /lib/httracker/functions
parentd7b06df279a50862b52c44a9db0a77b57a3b45cc (diff)
downloadhttruta-cdd9d09f978d69ad207697f94289bfa14064c5ca.tar.gz
httruta-cdd9d09f978d69ad207697f94289bfa14064c5ca.tar.bz2
Use two levels of directories
Diffstat (limited to 'lib/httracker/functions')
-rw-r--r--lib/httracker/functions7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/httracker/functions b/lib/httracker/functions
index 2a63ffa..2d3e35a 100644
--- a/lib/httracker/functions
+++ b/lib/httracker/functions
@@ -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