torsocks fails to set socks5h proxy for curl, git, ... - Not resolving .onion address (RFC 7686)

this fails: wrapping curl and git with torsocks 2.4.0 (305e42c6)

$ torsocks curl http://gg6zxtreajiijztyy5g6bt5o6l3qu32nrg7eulyemlhxwwl6enk6ghad.onion
curl: (6) Not resolving .onion address (RFC 7686)
$ torsocks git clone --depth=1 http://gg6zxtreajiijztyy5g6bt5o6l3qu32nrg7eulyemlhxwwl6enk6ghad.onion/milahu/alchi
Cloning into 'alchi'...
fatal: unable to access 'http://gg6zxtreajiijztyy5g6bt5o6l3qu32nrg7eulyemlhxwwl6enk6ghad.onion/milahu/alchi/': Not resolving .onion address (RFC 7686)

this works: passing tor's socks5h proxy to curl and git directly with a proxy argument

$ curl --proxy socks5h://127.0.0.1:9050 http://gg6zxtreajiijztyy5g6bt5o6l3qu32nrg7eulyemlhxwwl6enk6ghad.onion
$ git -c remote.origin.proxy=socks5h://127.0.0.1:9050 clone --depth=1 http://gg6zxtreajiijztyy5g6bt5o6l3qu32nrg7eulyemlhxwwl6enk6ghad.onion/milahu/alchi
$ cd alchi
$ git config --add remote.origin.proxy socks5h://127.0.0.1:9050
$ git pull

related issues: