Re: [PATCH 07/15] remote.c: report error on failure to fopen()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 20.04.2017 um 13:26 schrieb Nguyễn Thái Ngọc Duy:
@@ -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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]