Re: [PATCH 07/15] remote.c: report error on failure to fopen()
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Apr 26, 2017, 16:59 UTC
- Message-ID
- <3a2686c2-6766-1235-001f-1b5283b5f408@kdbg.org>
- In-Reply-To
- <20170420112609.26089-8-pclouds@gmail.com>
Am 20.04.2017 um 13:26 schrieb Nguyễn Thái Ngọc Duy:
Show 14 quoted lines
> @@ -279,8 +283,12 @@ static void read_branches_file(struct remote *remote)
> struct strbuf buf = STRBUF_INIT;
> FILE *f = fopen(git_path("branches/%s", remote->name), "r");
>
> - if (!f)
> + if (!f) {
> + if (errno != ENOENT)
> + warn_on_inaccessible(git_path("branches/%s",
> + remote->name));
> return;
> + }
>
> strbuf_getline_lf(&buf, f);
> fclose(f);This hunk causes a new failure in t5512.10 'confuses pattern as remote when no remote specified' on Windows:
+++ diff -u exp actual --- exp Wed Apr 26 08:16:10 2017 +++ actual Wed Apr 26 08:16:10 2017
@@ -1,5 +1,19 @@ +++ case "$1" in +++ _test_ok= +++ git ls-remote 'refs*master' +warning: unable to access '.git/branches/refs*master': Invalid argument fatal: 'refs*master' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. +++ exit_code=128 On Windows, it is not allowed to pass a file name with an asterisk to the OS. The test case contains this comment: # We could just as easily have used "master"; the "*" emphasizes its # role as a pattern. So, can we replace the name with a simple "master", our would this miss the goal of the test case? Should we make it conditional on the MINGW prerequisite? -- Hannes