{"thread":{"id":"22816","subject":"[PATCH ld/maint-diff-quiet-w] Windows: redirect fopen(\"/dev/null\") to fopen(\"nul\")","startedAt":"2010-02-25T08:49:34Z","lastAt":"2010-02-25T20:16:16Z","messageCount":5,"participants":["Johannes Sixt","Larry D'Anna","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"135660","messageId":"4B86399E.3090508@viscovery.net","threadId":"22816","inReplyTo":null,"subject":"[PATCH ld/maint-diff-quiet-w] Windows: redirect fopen(\"/dev/null\") to fopen(\"nul\")","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-02-25T08:49:34Z","receivedAt":"2010-02-25T08:49:34Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"From: Johannes Sixt <j6t@kdbg.org>\n\nAn instance of fopen(\"/dev/null\",...) was added to the code base. On\nWindows, we have to use \"nul\" instead. This implements a compatibility\nwrapper of fopen() that checks for this particular condition.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n compat/mingw.c |    8 ++++++++\n compat/mingw.h |    3 +++\n 2 files changed, 11 insertions(+), 0 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 5edf152..57aec93 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -140,6 +140,14 @@ int mingw_open (const char *filename, int oflags, ...)\n \treturn fd;\n }\n\n+#undef fopen\n+FILE *mingw_fopen (const char *filename, const char *otype)\n+{\n+\tif (!strcmp(filename, \"/dev/null\"))\n+\t\tfilename = \"nul\";\n+\treturn fopen(filename, otype);\n+}\n+\n /*\n  * The unit of FILETIME is 100-nanoseconds since January 1, 1601, UTC.\n  * Returns the 100-nanoseconds (\"hekto nanoseconds\") since the epoch.\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex f53bcca..e187b04 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -170,6 +170,9 @@ int link(const char *oldpath, const char *newpath);\n int mingw_open (const char *filename, int oflags, ...);\n #define open mingw_open\n\n+FILE *mingw_fopen (const char *filename, const char *otype);\n+#define fopen mingw_fopen\n+\n char *mingw_getcwd(char *pointer, int len);\n #define getcwd mingw_getcwd\n\n-- \n1.7.0.1285.g1a907.dirty\n"},{"id":"135678","messageId":"20100225162032.GA3527@cthulhu","threadId":"22816","inReplyTo":"4B86399E.3090508@viscovery.net","subject":"Re: [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen(\"/dev/null\") to fopen(\"nul\")","fromName":"Larry D'Anna","fromEmail":"larry@elder-gods.org","sentAt":"2010-02-25T16:20:32Z","receivedAt":"2010-02-25T16:20:32Z","isPatch":true,"sender":{"key":"larry@elder-gods.org","avatar":"https://avatars.githubusercontent.com/u/3013304?v=4"},"body":"* Johannes Sixt (j.sixt@viscovery.net) [100225 03:49]:\n> From: Johannes Sixt <j6t@kdbg.org>\n> \n> An instance of fopen(\"/dev/null\",...) was added to the code base. On\n> Windows, we have to use \"nul\" instead. This implements a compatibility\n> wrapper of fopen() that checks for this particular condition.\n\nDoesn't store_updated_refs do this too?\n\n        --larry\n"},{"id":"135680","messageId":"7vtyt59rjg.fsf@alter.siamese.dyndns.org","threadId":"22816","inReplyTo":"20100225162032.GA3527@cthulhu","subject":"Re: [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen(\"/dev/null\") to fopen(\"nul\")","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-25T17:03:15Z","receivedAt":"2010-02-25T17:03:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Larry D'Anna <larry@elder-gods.org> writes:\n\n> * Johannes Sixt (j.sixt@viscovery.net) [100225 03:49]:\n>> From: Johannes Sixt <j6t@kdbg.org>\n>> \n>> An instance of fopen(\"/dev/null\",...) was added to the code base. On\n>> Windows, we have to use \"nul\" instead. This implements a compatibility\n>> wrapper of fopen() that checks for this particular condition.\n>\n> Doesn't store_updated_refs do this too?\n\nI think there is no problem, as the patch covers that case, too.\n"},{"id":"135689","messageId":"4B86D7A0.2010007@viscovery.net","threadId":"22816","inReplyTo":"7vtyt59rjg.fsf@alter.siamese.dyndns.org","subject":"[PATCH maint] Windows: redirect f[re]open(\"/dev/null\") to f[re]open(\"nul\")","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-02-25T20:03:44Z","receivedAt":"2010-02-25T20:03:44Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"From: Johannes Sixt <j6t@kdbg.org>\n\nOn Windows, the equivalent of \"/dev/null\" is \"nul\". This implements\ncompatibility wrappers around fopen() and freopen() that check for this\nparticular file name.\n\nThe new tests exercise code paths where this is relevant.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\nJunio C Hamano schrieb:\n> Larry D'Anna <larry@elder-gods.org> writes:\n>> Doesn't store_updated_refs do this too?\n> \n> I think there is no problem, as the patch covers that case, too.\n\nNevertheless, we should do this, but this is now not specific to\nld/maint-diff-quiet-w anymore.\n\n-- Hannes\n\n  compat/mingw.c        |   16 ++++++++++++++++\n  compat/mingw.h        |    6 ++++++\n  t/t5510-fetch.sh      |    7 +++++++\n  t/t6023-merge-file.sh |    4 ++++\n  4 files changed, 33 insertions(+), 0 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 5edf152..02c6c07 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -140,6 +140,22 @@ int mingw_open (const char *filename, int oflags, ...)\n  \treturn fd;\n  }\n\n+#undef fopen\n+FILE *mingw_fopen (const char *filename, const char *otype)\n+{\n+\tif (!strcmp(filename, \"/dev/null\"))\n+\t\tfilename = \"nul\";\n+\treturn fopen(filename, otype);\n+}\n+\n+#undef freopen\n+FILE *mingw_freopen (const char *filename, const char *otype, FILE *stream)\n+{\n+\tif (filename && !strcmp(filename, \"/dev/null\"))\n+\t\tfilename = \"nul\";\n+\treturn freopen(filename, otype, stream);\n+}\n+\n  /*\n   * The unit of FILETIME is 100-nanoseconds since January 1, 1601, UTC.\n   * Returns the 100-nanoseconds (\"hekto nanoseconds\") since the epoch.\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex f53bcca..3347362 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -170,6 +170,12 @@ int link(const char *oldpath, const char *newpath);\n  int mingw_open (const char *filename, int oflags, ...);\n  #define open mingw_open\n\n+FILE *mingw_fopen (const char *filename, const char *otype);\n+#define fopen mingw_fopen\n+\n+FILE *mingw_freopen (const char *filename, const char *otype, FILE *stream);\n+#define freopen mingw_freopen\n+\n  char *mingw_getcwd(char *pointer, int len);\n  #define getcwd mingw_getcwd\n\ndiff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh\nindex 6659972..462fc64 100755\n--- a/t/t5510-fetch.sh\n+++ b/t/t5510-fetch.sh\n@@ -342,6 +342,13 @@ test_expect_success 'fetch into the current branch with --update-head-ok' '\n\n  '\n\n+test_expect_success 'fetch --dry-run' '\n+\n+\trm -f .git/FETCH_HEAD &&\n+\tgit fetch --dry-run . &&\n+\t! test -f .git/FETCH_HEAD\n+'\n+\n  test_expect_success \"should be able to fetch with duplicate refspecs\" '\n          mkdir dups &&\n          cd dups &&\ndiff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh\nindex 6291307..d605024 100755\n--- a/t/t6023-merge-file.sh\n+++ b/t/t6023-merge-file.sh\n@@ -64,6 +64,10 @@ cp new1.txt test.txt\n  test_expect_success \"merge without conflict\" \\\n  \t\"git merge-file test.txt orig.txt new2.txt\"\n\n+cp new1.txt test.txt\n+test_expect_success \"merge without conflict (--quiet)\" \\\n+\t\"git merge-file --quiet test.txt orig.txt new2.txt\"\n+\n  cp new1.txt test2.txt\n  test_expect_success \"merge without conflict (missing LF at EOF)\" \\\n  \t\"git merge-file test2.txt orig.txt new2.txt\"\n-- \n1.7.0.1287.g50986\n"},{"id":"135691","messageId":"7vfx4p2hrj.fsf@alter.siamese.dyndns.org","threadId":"22816","inReplyTo":"4B86399E.3090508@viscovery.net","subject":"Re: [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen(\"/dev/null\") to fopen(\"nul\")","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-25T20:16:16Z","receivedAt":"2010-02-25T20:16:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"builtin-merge-file.c and daemon.c use freopen() on /dev/null; would it\nalso need to be wrapped?\n"}]}