{"thread":{"id":"387","subject":"[PATCH] cogito: honour SHA1_FILE_DIRECTORY env var","startedAt":"2005-04-29T12:57:31Z","lastAt":"2005-04-29T12:57:31Z","messageCount":1,"participants":["Rene Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"2127","messageId":"20050429125731.GA23018@lsrfire.ath.cx","threadId":"387","inReplyTo":null,"subject":"[PATCH] cogito: honour SHA1_FILE_DIRECTORY env var","fromName":"Rene Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2005-04-29T12:57:31Z","receivedAt":"2005-04-29T12:57:31Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Three scripts have their object store directory hardcoded to\n.git/objects/.  This patch makes them honour the environment variable\nSHA1_FILE_DIRECTORY like core GIT.\n\nSigned-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>\n\nIndex: cg-admin-lsobj\n===================================================================\n--- c3aa1e6b53cc59d5fbe261f3f859584904ae3a63/cg-admin-lsobj  (mode:100755 sha1:c68d9176d843700df17b109389102ae84eab3888)\n+++ 4e32eadd27409a1352f17cb43703aa33420ac1fd/cg-admin-lsobj  (mode:100755 sha1:8410960a067f93a9457b250fea7b3636fb0eab42)\n@@ -21,7 +21,7 @@\n target=$1\n \n \n-subdir=.git/objects/\n+subdir=${SHA1_FILE_DIRECTORY:-.git/objects}\n \n for high in 0 1 2 3 4 5 6 7 8 9 a b c d e f ; do\n \tfor low in 0 1 2 3 4 5 6 7 8 9 a b c d e f ; do\nIndex: cg-pull\n===================================================================\n--- c3aa1e6b53cc59d5fbe261f3f859584904ae3a63/cg-pull  (mode:100755 sha1:5cd67519fc5399886f22e8758d6d34e0e3014cbb)\n+++ 4e32eadd27409a1352f17cb43703aa33420ac1fd/cg-pull  (mode:100755 sha1:52d686091f2d04a0d532a3ea1d622d6da4bad14c)\n@@ -94,8 +94,9 @@\n fi\n [ \"$rsyncerr\" ] && die \"unable to get the head pointer of branch $rembranch\"\n \n-[ -d .git/objects ] || mkdir -p .git/objects\n-$fetch -s -u -d \"$uri/objects\" \".git/objects\" || die \"rsync error\"\n+sha1_dir=${SHA1_FILE_DIRECTORY:-.git/objects}\n+[ -d \"$sha1_dir\" ] || mkdir -p \"$sha1_dir\"\n+$fetch -s -u -d \"$uri/objects\" \"$sha1_dir\" || die \"rsync error\"\n \n # FIXME: Warn about conflicting tag names?\n # XXX: We now throw stderr to /dev/null since not all repositories\nIndex: commit-id\n===================================================================\n--- c3aa1e6b53cc59d5fbe261f3f859584904ae3a63/commit-id  (mode:100755 sha1:4efcb6bdfdb2b2c5744f5d4d47d92beb7777ed59)\n+++ 4e32eadd27409a1352f17cb43703aa33420ac1fd/commit-id  (mode:100755 sha1:7f04b10cf8805cf2eb950a5dc3d451882e9d4929)\n@@ -23,8 +23,9 @@\n \n idpref=$(echo \"$id\" | cut -c -2)\n idpost=$(echo \"$id\" | cut -c 3-)\n-if [ $(find \".git/objects/$idpref\" -name \"$idpost*\" 2>/dev/null | wc -l) -eq 1 ]; then\n-\tid=$idpref$(basename $(echo .git/objects/$idpref/$idpost*))\n+sha1_dir=${SHA1_FILE_DIRECTORY:-.git/objects}\n+if [ $(find \"$sha1_dir/$idpref\" -name \"$idpost*\" 2>/dev/null | wc -l) -eq 1 ]; then\n+\tid=$idpref$(basename $(echo \"$sha1_dir/$idpref/$idpost\"*))\n fi\n \n if echo $id | egrep -vq \"$SHA1ONLY\"; then\n"}]}