strstr is a case sensitive compare

strstr is a case sensitive compare and the string reported from
libgit2 reads "reference" and not "Reference". Further investigation
reveals commit 909d5494368a0080 of libgit2. Here, the change is
made from Reference to reference, breaking our rather poor way
of detecting something from an error string. So, to be future-proof
to more libgit2 oddities, it might be wise to use strcasestr
in this situation. But this seems a not fully supported variant of
strstr, so leave it at this point.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2017-07-28 11:13:14 +02:00 committed by Dirk Hohndel
parent 44e8d302ef
commit 794739b4c0

View file

@ -737,9 +737,9 @@ static git_repository *create_local_repo(const char *localdir, const char *remot
fprintf(stderr, "git storage: returned from git_clone() with error %d\n", error);
if (error) {
char *msg = giterr_last()->message;
int len = sizeof("Reference 'refs/remotes/origin/' not found") + strlen(branch);
int len = sizeof("reference 'refs/remotes/origin/' not found") + strlen(branch);
char *pattern = malloc(len);
snprintf(pattern, len, "Reference 'refs/remotes/origin/%s' not found", branch);
snprintf(pattern, len, "reference 'refs/remotes/origin/%s' not found", branch);
if (strstr(remote, prefs.cloud_git_url) && strstr(msg, pattern)) {
/* we're trying to open the remote branch that corresponds
* to our cloud storage and the branch doesn't exist.