[PATCH v2] SQUASH convert: add tracing for 'working-tree-encoding' attribute

2018-01-23 Thread lars . schneider
From: Lars Schneider 

Hi Junio,

I overlooked a typo pointed out in Simon's review. Here is a new patch
for squashing. Sorry for the trouble!

@Eric: Thanks for spotting this!

Cheers,
Lars


 convert.c| 8 ++--
 t/t0028-working-tree-encoding.sh | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/convert.c b/convert.c
index 13fad490ce..dce2f6e201 100644
--- a/convert.c
+++ b/convert.c
@@ -1165,8 +1165,12 @@ static struct encoding *git_path_check_encoding(struct 
attr_check_item *check)
if (!strcasecmp(value, default_encoding))
return NULL;

-   enc = xcalloc(1, sizeof(struct convert_driver));
-   enc->name = xstrdup_toupper(value);  /* aways use upper case names! */
+   enc = xcalloc(1, sizeof(*enc));
+   /*
+* Ensure encoding names are always upper case (e.g. UTF-8) to
+* simplify subsequent string comparisons.
+*/
+   enc->name = xstrdup_toupper(value);
*encoding_tail = enc;
encoding_tail = &(enc->next);

diff --git a/t/t0028-working-tree-encoding.sh b/t/t0028-working-tree-encoding.sh
index 0f36d4990a..a6da61280d 100755
--- a/t/t0028-working-tree-encoding.sh
+++ b/t/t0028-working-tree-encoding.sh
@@ -22,6 +22,8 @@ test_expect_success 'setup test repo' '
 test_expect_success 'ensure UTF-8 is stored in Git' '
git cat-file -p :test.utf16 >test.utf16.git &&
test_cmp_bin test.utf8.raw test.utf16.git &&
+
+   # cleanup
rm test.utf8.raw test.utf16.git
 '


base-commit: 21f4dac5aba07a6109285c57a0478bf502e09009
--
2.16.0



Re: SQUASH convert: add tracing for 'working-tree-encoding' attribute

2018-01-22 Thread Eric Sunshine
On Mon, Jan 22, 2018 at 1:00 PM,   wrote:
> diff --git a/convert.c b/convert.c
> @@ -1165,8 +1165,9 @@ static struct encoding *git_path_check_encoding(struct 
> attr_check_item *check)
> -   enc = xcalloc(1, sizeof(struct convert_driver));
> -   enc->name = xstrdup_toupper(value);  /* aways use upper case names! */
> +   enc = xcalloc(1, sizeof(*enc));
> +   /* Aways use upper case names to simplify subsequent string 
> comparison. */

s/Aways/Always/

https://public-inbox.org/git/2018012114.ga10...@ruderich.org/

> +   enc->name = xstrdup_toupper(value);
> *encoding_tail = enc;
> encoding_tail = &(enc->next);


SQUASH convert: add tracing for 'working-tree-encoding' attribute

2018-01-22 Thread lars . schneider
From: Lars Schneider 

Hi Junio,

this attached patch addresses Simon's review comments.

Can you squash the patch if you apply "[PATCH v4 5/6] convert: add
'working-tree-encoding' attribute"?

https://public-inbox.org/git/20180120152418.52859-6-lars.schnei...@autodesk.com/

Thanks,
Lars


 convert.c| 5 +++--
 t/t0028-working-tree-encoding.sh | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/convert.c b/convert.c
index 13fad490ce..f5e0cfc352 100644
--- a/convert.c
+++ b/convert.c
@@ -1165,8 +1165,9 @@ static struct encoding *git_path_check_encoding(struct 
attr_check_item *check)
if (!strcasecmp(value, default_encoding))
return NULL;

-   enc = xcalloc(1, sizeof(struct convert_driver));
-   enc->name = xstrdup_toupper(value);  /* aways use upper case names! */
+   enc = xcalloc(1, sizeof(*enc));
+   /* Aways use upper case names to simplify subsequent string comparison. 
*/
+   enc->name = xstrdup_toupper(value);
*encoding_tail = enc;
encoding_tail = &(enc->next);

diff --git a/t/t0028-working-tree-encoding.sh b/t/t0028-working-tree-encoding.sh
index 0f36d4990a..a6da61280d 100755
--- a/t/t0028-working-tree-encoding.sh
+++ b/t/t0028-working-tree-encoding.sh
@@ -22,6 +22,8 @@ test_expect_success 'setup test repo' '
 test_expect_success 'ensure UTF-8 is stored in Git' '
git cat-file -p :test.utf16 >test.utf16.git &&
test_cmp_bin test.utf8.raw test.utf16.git &&
+
+   # cleanup
rm test.utf8.raw test.utf16.git
 '


base-commit: 21f4dac5aba07a6109285c57a0478bf502e09009
--
2.16.0