X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=ssh-upload.c;h=2da66618fcdd6a0f5af35c9f30554a65eb427427;hb=ce0bd64299ae148ef61a63edcac635de41254cb5;hp=10a36873391b727a75e5f1d3a42d78acb62ed502;hpb=215a7ad1ef790467a4cd3f0dcffbd6e5f04c38f7;p=git.git diff --git a/ssh-upload.c b/ssh-upload.c index 10a36873..2da66618 100644 --- a/ssh-upload.c +++ b/ssh-upload.c @@ -1,3 +1,13 @@ +#ifndef COUNTERPART_ENV_NAME +#define COUNTERPART_ENV_NAME "GIT_SSH_FETCH" +#endif +#ifndef COUNTERPART_PROGRAM_NAME +#define COUNTERPART_PROGRAM_NAME "git-ssh-fetch" +#endif +#ifndef MY_PROGRAM_NAME +#define MY_PROGRAM_NAME "git-ssh-upload" +#endif + #include "cache.h" #include "rsh.h" #include "refs.h" @@ -97,7 +107,7 @@ static void service(int fd_in, int fd_out) { } static const char ssh_push_usage[] = - "git-ssh-upload [-c] [-t] [-a] [-w ref] commit-id url"; + MY_PROGRAM_NAME " [-c] [-t] [-a] [-w ref] commit-id url"; int main(int argc, char **argv) { @@ -109,8 +119,11 @@ int main(int argc, char **argv) unsigned char sha1[20]; char hex[41]; - prog = getenv("GIT_SSH_PULL"); - if (!prog) prog = "git-ssh-fetch"; + prog = getenv(COUNTERPART_ENV_NAME); + if (!prog) prog = COUNTERPART_PROGRAM_NAME; + + setup_git_directory(); + while (arg < argc && argv[arg][0] == '-') { if (argv[arg][1] == 'w') arg++; @@ -121,7 +134,7 @@ int main(int argc, char **argv) commit_id = argv[arg]; url = argv[arg + 1]; if (get_sha1(commit_id, sha1)) - usage(ssh_push_usage); + die("Not a valid object name %s", commit_id); memcpy(hex, sha1_to_hex(sha1), sizeof(hex)); argv[arg] = hex;