aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-10-10 10:08:40 -0700
committerJunio C Hamano <gitster@pobox.com>2022-10-10 10:08:40 -0700
commitdc6dd55f70f2491ac999e5823949854e13ed7bfb (patch)
tree33d10c095f47645135a5c06bbada3e0938464805
parent20a5dd670c957fa59b420facf63abe61b6b2438a (diff)
parent630a6429a71118332ec3bc5aa58fce66df6ca5fa (diff)
downloadgit-dc6dd55f70f2491ac999e5823949854e13ed7bfb.tar.gz
Merge branch 'mc/cred-helper-ignore-unknown'
Most credential helpers ignored unknown entries in a credential description, but a few died upon seeing them. The latter were taught to ignore them, too * mc/cred-helper-ignore-unknown: osxkeychain: clarify that we ignore unknown lines netrc: ignore unknown lines (do not die) wincred: ignore unknown lines (do not die)
-rwxr-xr-xcontrib/credential/netrc/git-credential-netrc.perl5
-rw-r--r--contrib/credential/osxkeychain/git-credential-osxkeychain.c5
-rw-r--r--contrib/credential/wincred/git-credential-wincred.c7
3 files changed, 14 insertions, 3 deletions
diff --git a/contrib/credential/netrc/git-credential-netrc.perl b/contrib/credential/netrc/git-credential-netrc.perl
index bc57cc6588..9fb998ae09 100755
--- a/contrib/credential/netrc/git-credential-netrc.perl
+++ b/contrib/credential/netrc/git-credential-netrc.perl
@@ -356,7 +356,10 @@ sub read_credential_data_from_stdin {
next unless m/^([^=]+)=(.+)/;
my ($token, $value) = ($1, $2);
- die "Unknown search token $token" unless exists $q{$token};
+
+ # skip any unknown tokens
+ next unless exists $q{$token};
+
$q{$token} = $value;
log_debug("We were given search token $token and value $value");
}
diff --git a/contrib/credential/osxkeychain/git-credential-osxkeychain.c b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
index bf77748d60..e29cc28779 100644
--- a/contrib/credential/osxkeychain/git-credential-osxkeychain.c
+++ b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
@@ -159,6 +159,11 @@ static void read_credential(void)
username = xstrdup(v);
else if (!strcmp(buf, "password"))
password = xstrdup(v);
+ /*
+ * Ignore other lines; we don't know what they mean, but
+ * this future-proofs us when later versions of git do
+ * learn new lines, and the helpers are updated to match.
+ */
}
}
diff --git a/contrib/credential/wincred/git-credential-wincred.c b/contrib/credential/wincred/git-credential-wincred.c
index 5091048f9c..ead6e267c7 100644
--- a/contrib/credential/wincred/git-credential-wincred.c
+++ b/contrib/credential/wincred/git-credential-wincred.c
@@ -278,8 +278,11 @@ static void read_credential(void)
wusername = utf8_to_utf16_dup(v);
} else if (!strcmp(buf, "password"))
password = utf8_to_utf16_dup(v);
- else
- die("unrecognized input");
+ /*
+ * Ignore other lines; we don't know what they mean, but
+ * this future-proofs us when later versions of git do
+ * learn new lines, and the helpers are updated to match.
+ */
}
}