-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow process-specific Git config with "-c" arguments. #452
Comments
All calls to |
In any case, it might make sense to generate the |
My thought is that we could collect a diff --git a/Scalar.Common/Git/GitProcess.cs b/Scalar.Common/Git/GitProcess.cs
index 3a6191bb..65142c3b 100644
--- a/Scalar.Common/Git/GitProcess.cs
+++ b/Scalar.Common/Git/GitProcess.cs
@@ -38,6 +38,13 @@ public static string ExpireTimeDateString
}
}
+ public static void AddCustomConfig(string keyEqualsValue)
+ {
+ customConfig.Add(keyEqualsValue);
+ }
+
+ private static List<string> customConfig = new List<string>();
+
private static string expireTimeDateString;
private const int HResultEHANDLE = -2147024890; // 0x80070006 E_HANDLE
@@ -737,6 +744,11 @@ public Result MultiPackIndexRepack(string gitObjectDirectory, string batchSize)
processInfo.EnvironmentVariables["GIT_OBJECT_DIRECTORY"] = gitObjectsDirectory;
}
+ foreach (string keyEqualsValue in customConfig)
+ {
+ command = $"-c {keyEqualsValue} {command}";
+ }
+
if (!fetchMissingObjects)
{
command = $"-c {ScalarConstants.GitConfig.UseGvfsHelper}=false {command}"; The issue I'm currently struggling with is how to get multi-valued options using the |
I was wrong, exclamation marks are also escaped: https://github.com/git/git/blob/v2.29.0/quote.c#L12-L41 EDIT: I was even wronger. Backslashes are indeed escaped via backslashes, but single quotes as well as exclamation marks are not only escaped, but surrounded by single-quotes (which end and re-start the single-quoting, respectively). The comment above /* Help to copy the thing properly quoted for the shell safety.
* any single quote is replaced with '\'', any exclamation point
* is replaced with '\!', and the whole thing is enclosed in a
* single quote pair.
*
* E.g.
* original sq_quote result
* name ==> name ==> 'name'
* a b ==> a b ==> 'a b'
* a'b ==> a'\''b ==> 'a'\''b'
* a!b ==> a'\!'b ==> 'a'\!'b'
*/ EDIT 2: And even wronger. Backslashes are not treated specially inside single-quoted text at all. |
Is there a compelling reason to use a |
You should use
This is not the first time this idea has come up. It's just actually non-trivial (due to how our code is organized AND a bug in the command-line parser library we use). That's why this issue will not be fast-tracked into the release this week. |
For what it's worth, I know the |
There is a bug where you can try using a multiple-repeat option, but it must be at the end, after any "positional" arguments because it tries to parse it as |
Labeling this issue as stale. There has been no activity for 30 days. Remove stale label or comment or this issue will be closed in 7 days. |
See git-ecosystem/git-credential-manager#190 for some context.
To solve the problem, we could allow users to specify config the way they could with Git, using
scalar [-c config=value] <verb>
and having those arguments pass down into all Git commands. The distance between those two steps is a bit tricky, but perhaps there is a way to do it simply.The other option would be to do one-off options like
scalar clone <url> --access-token "***"
for this specific credential issue.At minimum, the root problem that needs to be solved is: allow a user to specify custom credentials during
scalar clone
.The text was updated successfully, but these errors were encountered: