ezbz / gitlabber

Gitlabber - clones or pulls entire groups tree from gitlab
MIT License
472 stars 78 forks source link

-r/--recursive fails, builds invalid git clone command #63

Closed lehy closed 3 years ago

lehy commented 3 years ago

Thank you for gitlabber. Passing either "-r" or "--recursive" fails. It passes '-', '-', 'r', 'e', 'c', 'u', 'r', 's', 'i', 'v', 'e' to git clone, see below.

> gitlabber --version
1.1.7
gitlabber -t XXX --url https://XXX -r -a exclude -i '/XXX/**,/YYY/**' --verbose .

Excerpt from the verbose log:

2021-03-19 09:45:36,114 - gitlabber.git - DEBUG - cloning new project ./XXX/YYY
2021-03-19 09:45:36,114 - git.cmd - DEBUG - Popen(['git', 'clone', '-v', '-', '-', 'r', 'e', 'c', 'u', 'r', 's', 'i', 'v', 'e', 'git@XXX:XXX/YYY.git', './XXX/YYY'], cwd=/ZZZ, universal_newlines=True, shell=None, istream=None)
2021-03-19 09:45:36,116 - git.repo.base - DEBUG - Cmd(['git', 'clone', '-v', '-', '-', 'r', 'e', 'c', 'u', 'r', 's', 'i', 'v', 'e', 'git@XXX:XXX/YYY.git', './XXX/YYY'])'s unused stdout: 
2021-03-19 09:45:36,116 - git.cmd - DEBUG - AutoInterrupt wait stderr: b"fatal: Too many arguments.\n\nusage: git clone [<options>] [--] <repo> [<dir>]\n\n    -v, --verbose         be more verbose\n    -q, --quiet           be more quiet\n    --progress            force progress reporting\n    -n, --no-checkout     don't create a checkout\n    --bare                create a bare repository\n    --mirror              create a mirror repository (implies bare)\n    -l, --local           to clone from a local repository\n    --no-hardlinks        don't use local hardlinks, always copy\n    -s, --shared          setup as shared repository\n    --recurse-submodules[=<pathspec>]\n                          initialize submodules in the clone\n    --recursive ...       alias of --recurse-submodules\n    -j, --jobs <n>        number of submodules cloned in parallel\n    --template <template-directory>\n                          directory from which templates will be used\n    --reference <repo>    reference repository\n    --reference-if-able <repo>\n                          reference repository\n    --dissociate          use --reference only while cloning\n    -o, --origin <name>   use <name> instead of 'origin' to track upstream\n    -b, --branch <branch>\n                          checkout <branch> instead of the remote's HEAD\n    -u, --upload-pack <path>\n                          path to git-upload-pack on the remote\n    --depth <depth>       create a shallow clone of that depth\n    --shallow-since <time>\n                          create a shallow clone since a specific time\n    --shallow-exclude <revision>\n                          deepen history of shallow clone, excluding rev\n    --single-branch       clone only one branch, HEAD or --branch\n    --no-tags             don't clone any tags, and make later fetches not to follow them\n    --shallow-submodules  any cloned submodules will be shallow\n    --separate-git-dir <gitdir>\n                          separate git dir from working tree\n    -c, --config <key=value>\n                          set config inside the new repository\n    --server-option <server-specific>\n                          option to transmit\n    -4, --ipv4            use IPv4 addresses only\n    -6, --ipv6            use IPv6 addresses only\n    --filter <args>       object filtering\n    --remote-submodules   any cloned submodules will use their remote-tracking branch\n    --sparse              initialize sparse-checkout file to include only files at root\n\n"
2021-03-19 09:45:36,116 - gitlabber.git - DEBUG - Error cloning project ./XXX/YYY
Traceback (most recent call last):
  File "/XXX/.direnv/python-3.8.6/lib/python3.8/site-packages/gitlabber/git.py", line 76, in clone_or_pull_project
    git.Repo.clone_from(action.node.url, action.path, multi_options='--recursive')
  File "/XXX/.direnv/python-3.8.6/lib/python3.8/site-packages/git/repo/base.py", line 1032, in clone_from
    return cls._clone(git, url, to_path, GitCmdObjectDB, progress, multi_options, **kwargs)
  File "/XXX/.direnv/python-3.8.6/lib/python3.8/site-packages/git/repo/base.py", line 973, in _clone
    finalize_process(proc, stderr=stderr)
  File "/XXX/.direnv/python-3.8.6/lib/python3.8/site-packages/git/util.py", line 329, in finalize_process
    proc.wait(**kwargs)
  File "/XXX/.direnv/python-3.8.6/lib/python3.8/site-packages/git/cmd.py", line 408, in wait
    raise GitCommandError(self.args, status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(129)
  cmdline: git clone -v - - r e c u r s i v e git@XXX:XXX/YYY.git ./XXX/YYY
darraghjones commented 3 years ago

same issue for me :(