* [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen("/dev/null") to fopen("nul")
@ 2010-02-25 8:49 Johannes Sixt
2010-02-25 16:20 ` Larry D'Anna
2010-02-25 20:16 ` [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen("/dev/null") to fopen("nul") Junio C Hamano
0 siblings, 2 replies; 5+ messages in thread
From: Johannes Sixt @ 2010-02-25 8:49 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List, Larry D'Anna
From: Johannes Sixt <j6t@kdbg.org>
An instance of fopen("/dev/null",...) was added to the code base. On
Windows, we have to use "nul" instead. This implements a compatibility
wrapper of fopen() that checks for this particular condition.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
compat/mingw.c | 8 ++++++++
compat/mingw.h | 3 +++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index 5edf152..57aec93 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -140,6 +140,14 @@ int mingw_open (const char *filename, int oflags, ...)
return fd;
}
+#undef fopen
+FILE *mingw_fopen (const char *filename, const char *otype)
+{
+ if (!strcmp(filename, "/dev/null"))
+ filename = "nul";
+ return fopen(filename, otype);
+}
+
/*
* The unit of FILETIME is 100-nanoseconds since January 1, 1601, UTC.
* Returns the 100-nanoseconds ("hekto nanoseconds") since the epoch.
diff --git a/compat/mingw.h b/compat/mingw.h
index f53bcca..e187b04 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -170,6 +170,9 @@ int link(const char *oldpath, const char *newpath);
int mingw_open (const char *filename, int oflags, ...);
#define open mingw_open
+FILE *mingw_fopen (const char *filename, const char *otype);
+#define fopen mingw_fopen
+
char *mingw_getcwd(char *pointer, int len);
#define getcwd mingw_getcwd
--
1.7.0.1285.g1a907.dirty
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen("/dev/null") to fopen("nul")
2010-02-25 8:49 [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen("/dev/null") to fopen("nul") Johannes Sixt
@ 2010-02-25 16:20 ` Larry D'Anna
2010-02-25 17:03 ` Junio C Hamano
2010-02-25 20:16 ` [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen("/dev/null") to fopen("nul") Junio C Hamano
1 sibling, 1 reply; 5+ messages in thread
From: Larry D'Anna @ 2010-02-25 16:20 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Junio C Hamano, Git Mailing List
* Johannes Sixt (j.sixt@viscovery.net) [100225 03:49]:
> From: Johannes Sixt <j6t@kdbg.org>
>
> An instance of fopen("/dev/null",...) was added to the code base. On
> Windows, we have to use "nul" instead. This implements a compatibility
> wrapper of fopen() that checks for this particular condition.
Doesn't store_updated_refs do this too?
--larry
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen("/dev/null") to fopen("nul")
2010-02-25 16:20 ` Larry D'Anna
@ 2010-02-25 17:03 ` Junio C Hamano
2010-02-25 20:03 ` [PATCH maint] Windows: redirect f[re]open("/dev/null") to f[re]open("nul") Johannes Sixt
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2010-02-25 17:03 UTC (permalink / raw)
To: Larry D'Anna; +Cc: Johannes Sixt, Git Mailing List
Larry D'Anna <larry@elder-gods.org> writes:
> * Johannes Sixt (j.sixt@viscovery.net) [100225 03:49]:
>> From: Johannes Sixt <j6t@kdbg.org>
>>
>> An instance of fopen("/dev/null",...) was added to the code base. On
>> Windows, we have to use "nul" instead. This implements a compatibility
>> wrapper of fopen() that checks for this particular condition.
>
> Doesn't store_updated_refs do this too?
I think there is no problem, as the patch covers that case, too.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH maint] Windows: redirect f[re]open("/dev/null") to f[re]open("nul")
2010-02-25 17:03 ` Junio C Hamano
@ 2010-02-25 20:03 ` Johannes Sixt
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Sixt @ 2010-02-25 20:03 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Larry D'Anna, Git Mailing List
From: Johannes Sixt <j6t@kdbg.org>
On Windows, the equivalent of "/dev/null" is "nul". This implements
compatibility wrappers around fopen() and freopen() that check for this
particular file name.
The new tests exercise code paths where this is relevant.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
Junio C Hamano schrieb:
> Larry D'Anna <larry@elder-gods.org> writes:
>> Doesn't store_updated_refs do this too?
>
> I think there is no problem, as the patch covers that case, too.
Nevertheless, we should do this, but this is now not specific to
ld/maint-diff-quiet-w anymore.
-- Hannes
compat/mingw.c | 16 ++++++++++++++++
compat/mingw.h | 6 ++++++
t/t5510-fetch.sh | 7 +++++++
t/t6023-merge-file.sh | 4 ++++
4 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index 5edf152..02c6c07 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -140,6 +140,22 @@ int mingw_open (const char *filename, int oflags, ...)
return fd;
}
+#undef fopen
+FILE *mingw_fopen (const char *filename, const char *otype)
+{
+ if (!strcmp(filename, "/dev/null"))
+ filename = "nul";
+ return fopen(filename, otype);
+}
+
+#undef freopen
+FILE *mingw_freopen (const char *filename, const char *otype, FILE *stream)
+{
+ if (filename && !strcmp(filename, "/dev/null"))
+ filename = "nul";
+ return freopen(filename, otype, stream);
+}
+
/*
* The unit of FILETIME is 100-nanoseconds since January 1, 1601, UTC.
* Returns the 100-nanoseconds ("hekto nanoseconds") since the epoch.
diff --git a/compat/mingw.h b/compat/mingw.h
index f53bcca..3347362 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -170,6 +170,12 @@ int link(const char *oldpath, const char *newpath);
int mingw_open (const char *filename, int oflags, ...);
#define open mingw_open
+FILE *mingw_fopen (const char *filename, const char *otype);
+#define fopen mingw_fopen
+
+FILE *mingw_freopen (const char *filename, const char *otype, FILE *stream);
+#define freopen mingw_freopen
+
char *mingw_getcwd(char *pointer, int len);
#define getcwd mingw_getcwd
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 6659972..462fc64 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -342,6 +342,13 @@ test_expect_success 'fetch into the current branch with --update-head-ok' '
'
+test_expect_success 'fetch --dry-run' '
+
+ rm -f .git/FETCH_HEAD &&
+ git fetch --dry-run . &&
+ ! test -f .git/FETCH_HEAD
+'
+
test_expect_success "should be able to fetch with duplicate refspecs" '
mkdir dups &&
cd dups &&
diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh
index 6291307..d605024 100755
--- a/t/t6023-merge-file.sh
+++ b/t/t6023-merge-file.sh
@@ -64,6 +64,10 @@ cp new1.txt test.txt
test_expect_success "merge without conflict" \
"git merge-file test.txt orig.txt new2.txt"
+cp new1.txt test.txt
+test_expect_success "merge without conflict (--quiet)" \
+ "git merge-file --quiet test.txt orig.txt new2.txt"
+
cp new1.txt test2.txt
test_expect_success "merge without conflict (missing LF at EOF)" \
"git merge-file test2.txt orig.txt new2.txt"
--
1.7.0.1287.g50986
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen("/dev/null") to fopen("nul")
2010-02-25 8:49 [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen("/dev/null") to fopen("nul") Johannes Sixt
2010-02-25 16:20 ` Larry D'Anna
@ 2010-02-25 20:16 ` Junio C Hamano
1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2010-02-25 20:16 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Git Mailing List, Larry D'Anna
builtin-merge-file.c and daemon.c use freopen() on /dev/null; would it
also need to be wrapped?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-02-25 20:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-25 8:49 [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen("/dev/null") to fopen("nul") Johannes Sixt
2010-02-25 16:20 ` Larry D'Anna
2010-02-25 17:03 ` Junio C Hamano
2010-02-25 20:03 ` [PATCH maint] Windows: redirect f[re]open("/dev/null") to f[re]open("nul") Johannes Sixt
2010-02-25 20:16 ` [PATCH ld/maint-diff-quiet-w] Windows: redirect fopen("/dev/null") to fopen("nul") Junio C Hamano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.