Re: [PATCH 07/12] Fixed text file auto-detection: treat EOF character 032 at the end of file as printable

5 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 07/12] Fixed text file auto-detection: treat EOF character 032 at the end of file as printable

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:52

Steffen Prohaska [off-list ref] writes:
quoted hunk
From: Dmitry Kakurin <redacted>

Signed-off-by: Dmitry Kakurin <redacted>
Signed-off-by: Steffen Prohaska <redacted>
---
 convert.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/convert.c b/convert.c
index 1c66844..f24ac25 100644
--- a/convert.c
+++ b/convert.c
@@ -61,6 +61,10 @@ static void gather_stats(const char *buf, unsigned long size, struct text_stat *
 		else
 			stats->printable++;
 	}
+
+	// If file ends with EOF then don't count this EOF as non-printable
+	if ( size >= 1 && buf[size-1] == '\032' )
+		stats->nonprintable--;
Style.

I debated for 5 seconds with myself if this should be inside #ifdef, but
doing this everywhere would give us reproducibility --- otherwise the
resulting project won't be cross platform, so I think the intention of
this change is good.

[PATCH] Fixed text file auto-detection: treat EOF character 032 at the end of file as printable

From: Steffen Prohaska <hidden>
Date: 2016-06-15 22:44:55

From: Dmitry Kakurin <redacted>

Signed-off-by: Dmitry Kakurin <redacted>
Signed-off-by: Steffen Prohaska <redacted>
---
 convert.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/convert.c b/convert.c
index 352b69d..78efed8 100644
--- a/convert.c
+++ b/convert.c
@@ -61,6 +61,10 @@ static void gather_stats(const char *buf, unsigned long size, struct text_stat *
 		else
 			stats->printable++;
 	}
+
+	/* If file ends with EOF then don't count this EOF as non-printable. */
+	if (size >= 1 && buf[size-1] == '\032')
+		stats->nonprintable--;
 }
 
 /*
-- 
1.5.6.1.282.gd8a0d

Re: [PATCH] Fixed text file auto-detection: treat EOF character 032 at the end of file as printable

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:44:55

Hi,

On Fri, 11 Jul 2008, Steffen Prohaska wrote:
quoted hunk
From: Dmitry Kakurin <redacted>

Signed-off-by: Dmitry Kakurin <redacted>
Signed-off-by: Steffen Prohaska <redacted>
---
 convert.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/convert.c b/convert.c
index 352b69d..78efed8 100644
--- a/convert.c
+++ b/convert.c
@@ -61,6 +61,10 @@ static void gather_stats(const char *buf, unsigned long size, struct text_stat *
 		else
 			stats->printable++;
 	}
+
+	/* If file ends with EOF then don't count this EOF as non-printable. */
+	if (size >= 1 && buf[size-1] == '\032')
+		stats->nonprintable--;
This is one of the things that are very specific to Windows and should not 
affect other people.

Ciao,
Dscho

P.S.: this is one of the examples why I would like to discuss things that 
are Windows-only on the msysGit list, until we have a consensus there.  We 
have a few Git experts there, you and Hannes in particular, which cover 
that side, but also some Windows experts such as Peter and Marius, and we 
should not need to have that discussion on a list where people are not 
expected to care about Windows _at all_.

Re: [PATCH] Fixed text file auto-detection: treat EOF character 032 at the end of file as printable

From: Steffen Prohaska <hidden>
Date: 2016-06-15 22:44:55

On Jul 11, 2008, at 8:42 PM, Johannes Schindelin wrote:
On Fri, 11 Jul 2008, Steffen Prohaska wrote:
quoted
From: Dmitry Kakurin <redacted>

Signed-off-by: Dmitry Kakurin <redacted>
Signed-off-by: Steffen Prohaska <redacted>
---
convert.c |    4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/convert.c b/convert.c
index 352b69d..78efed8 100644
--- a/convert.c
+++ b/convert.c
@@ -61,6 +61,10 @@ static void gather_stats(const char *buf,  
unsigned long size, struct text_stat *
		else
			stats->printable++;
	}
+
+	/* If file ends with EOF then don't count this EOF as non- 
printable. */
+	if (size >= 1 && buf[size-1] == '\032')
+		stats->nonprintable--;
This is one of the things that are very specific to Windows and  
should not
affect other people.
Does this mean you are opposed to this change?

Junio thinks that "the intention of this change is good" [1].  Hence,
I cleaned up the style and re-send the patch.

[1] http://article.gmane.org/gmane.comp.version-control.git/87122

	Steffen

Re: [PATCH] Fixed text file auto-detection: treat EOF character 032 at the end of file as printable

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:44:55

Hi,

On Fri, 11 Jul 2008, Steffen Prohaska wrote:
On Jul 11, 2008, at 8:42 PM, Johannes Schindelin wrote:
quoted
On Fri, 11 Jul 2008, Steffen Prohaska wrote:
quoted
From: Dmitry Kakurin <redacted>

Signed-off-by: Dmitry Kakurin <redacted>
Signed-off-by: Steffen Prohaska <redacted>
---
convert.c |    4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/convert.c b/convert.c
index 352b69d..78efed8 100644
--- a/convert.c
+++ b/convert.c
@@ -61,6 +61,10 @@ static void gather_stats(const char *buf, unsigned long
size, struct text_stat *
 else
		stats->printable++;
}
+
+	/* If file ends with EOF then don't count this EOF as non-printable.
*/
+	if (size >= 1 && buf[size-1] == '\032')
+		stats->nonprintable--;
This is one of the things that are very specific to Windows and should not
affect other people.
Does this mean you are opposed to this change?
Hrm.  Thinking about it again, this _could_ help Unix people who 
collaborate with DOS people.

OTOH it will just hide the fact that text files were committed that 
contain silly characters.

On the third hand, this code path affects only people who set autocrlf.

Well, I guess they asked for it, kind of.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help