return path instead of gitDir, parseURL TODO

This commit is contained in:
Jarrad Hope 2019-02-25 14:05:36 +07:00
parent 3c1e9d6394
commit 3f272674b8
No known key found for this signature in database
GPG Key ID: D549F0EF6ACE1FE7
1 changed files with 5 additions and 4 deletions

View File

@ -4,7 +4,7 @@ const
gitEnv = "GIT_DIR"
protocol = "crvc"
proc setup(gitEnv: string, protocol: string): (string, string, string, string) =
proc setup(gitEnv: string, protocol: string): (string, string, string) =
# Checks the Environment and returns the git Working directory, the protocol, the remote and url
if paramCount() < 2:
@ -24,15 +24,16 @@ proc setup(gitEnv: string, protocol: string): (string, string, string, string) =
raise newException(OSError, fmt"{gitDir} does not appear to be a git repository")
# Create our Working Directory if it doesn't exist
let path = joinPath(gitDir, protocol, remote)
let path = joinPath(gitDir, remote)
if not existsDir(path):
createDir(path)
return (gitDir, protocol, remote, url) # I don't like result, too immutable
# TODO process url and pass to processStdio parseUrl?
return (path, remote, url)
proc processStdio (env: tuple): void =
# Supports the Git Remote Helper stdio protocol
# https://git-scm.com/docs/git-remote-helpers
let (gitDir, protocol, remote, url) = env
let (path, remote, url) = env
while true:
var