From 794739b4c0827dfba4eab78f639418f7d4da1f44 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Fri, 28 Jul 2017 11:13:14 +0200 Subject: 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 --- core/git-access.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/git-access.c') diff --git a/core/git-access.c b/core/git-access.c index bfb3659bb..fc2c1223a 100644 --- a/core/git-access.c +++ b/core/git-access.c @@ -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. -- cgit v1.2.3-70-g09d2