danhper / danhper/elixir-git-cli

Can't use -c in fetch and pull

Aperta
#17 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Elixir
Stelle
77
Fork
13
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Using the current API I'm not able to use -c configurations when I use fetch and pull.
For example:
```
...> Git.fetch(repo, ["-c", "credential.helper="])
...> {:error,
%Git.Error{
message: "error: unknown switch `c'\nusage: git fetch [] [ [...]]\n or: git fetch [] \n or: git fetch --multiple [] [( | )...]\n or: git fetch --all []\n\n -v, --[no-]verbose be more verbose\n -q, --[no-]quiet be more quiet\n --[no-]all fetch from all remotes\n --[no-]set-upstream set upstream for git pull/fetch\n -a, --[no-]append append to .git/FETCH_HEAD instead of overwriting\n --[no-]atomic use atomic transaction to update references\n --[no-]upload-pack \n path to upload pack on remote end\n -f, --[no-]force force overwrite of local reference\n -m, --[no-]multiple fetch from multiple remotes\n -t, --[no-]tags fetch all tags and associated objects\n -n do not fetch all tags (--no-tags)\n -j, --[no-]jobs number of submodules fetched in parallel\n --[no-]prefetch modify the refspec to place all refs within refs/prefetch/\n -p, --[no-]prune prune remote-tracking branches no longer on remote\n -P, --[no-]prune-tags prune local tags no longer on remote and clobber changed tags\n --[no-]recurse-submodules[=]\n control recursive fetching of submodules\n --[no-]dry-run dry run\n --[no-]porcelain machine-readable output\n --[no-]write-fetch-head\n write fetched references to the FETCH_HEAD file\n -k, --[no-]keep keep downloaded pack\n -u, --[no-]update-head-ok\n allow updating of HEAD ref\n --[no-]progress force progress reporting\n --[no-]depth deepen history of shallow clone\n --[no-]shallow-since

I can see that, using git in the terminal, this is valid:
`git -c credential.helper= fetch origin` :white_check_mark:
and this returns the same error as described at beginning of this issue:
`git fetch -c credential.helper= origin` :x:

It seems that git-cli is generating the latter command which does't work. Maybe there is a way to add dynamically the configs in the correct place

From `man git` it seems that there are two types of arguments to take in account: `git arguments` and `command arguments`:
```
SYNOPSIS
git [-v | --version] [-h | --help] [-C ] [-c =]
[--exec-path[=]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=] [--work-tree=] [--namespace=]
[--config-env==] []

One last thing to consider, git clone arguments supports --config; git fetch doesn't:
https://git-scm.com/docs/git-clone#Documentation/git-clone.txt-code--configcodeemltkeygtemcodecodeemltvaluegtem
But --config not found in:
https://www.git-scm.com/docs/git-fetch

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.