-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
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 [<options>] [<repository> [<refspec>...]]\n or: git fetch [<options>] <group>\n or: git fetch --multiple [<options>] [(<repository> | <group>)...]\n or: git fetch --all [<options>]\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 <path>\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 <n> 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[=<on-demand>]\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 <depth> deepen history of shallow clone\n --[no-]shallow-since <time>\n deepen history of shallow repository based on time\n --[no-]shallow-exclude <revision>\n deepen history of shallow clone, excluding rev\n --[no-]deepen <n> deepen history of shallow clone\n --unshallow convert to a complete repository\n --refetch re-fetch without negotiating common commits\n --[no-]update-shallow accept refs that update .git/shallow\n --refmap <refmap> specify fetch refmap\n -o, --[no-]server-option <server-specific>\n option to transmit\n -4, --ipv4 use IPv4 addresses only\n -6, --ipv6 use IPv6 addresses only\n --[no-]negotiation-tip <revision>\n report that we have only objects reachable from this object\n --[no-]negotiate-only do not fetch a packfile; instead, print ancestors of negotiation tips\n --[no-]filter <args> object filtering\n --[no-]auto-maintenance\n run 'maintenance --auto' after fetching\n --[no-]auto-gc run 'maintenance --auto' after fetching\n --[no-]show-forced-updates\n check for forced-updates on all updated branches\n --[no-]write-commit-graph\n write the commit-graph after fetching\n --[no-]stdin accept refspecs from stdin\n\n",
command: "fetch",
code: 129,
args: ["-c", "credential.helper="]
}}
This does not happen with clone:
...> Git.clone(["-c", "credential.helper=", "https://github.com/marcosboggia/testingrepo.git", "/tmp/a"])
...> {:ok, %Git.Repository{path: "/tmp/a"}}
I can see that, using git in the terminal, this is valid:
git -c credential.helper= fetch origin ✅
and this returns the same error as described at beginning of this issue:
git fetch -c credential.helper= origin ❌
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 <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
[--config-env=<name>=<envvar>] <command> [<args>]
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels