git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 1/1] convert_to_git(): checksafe becomes int conv_flags

From
Lars Schneider <larsxschneider@gmail.com>
Date
Jan 5, 2018, 19:00 UTC
Message-ID
<B45F57FC-E798-4C8F-9C40-200944D86029@gmail.com>
In-Reply-To
<20180101215959.1460-1-tboegi@web.de>
Show 32 quoted lines
> On 01 Jan 2018, at 22:59, tboegi@web.de wrote:
> 
> From: Torsten Bögershausen <tboegi@web.de>
> 
> When calling convert_to_git(), the checksafe parameter has been used to
> check if commit would give a non-roundtrip conversion of EOL.
> 
> When checksafe was introduced, 3 values had been in use:
> SAFE_CRLF_FALSE: no warning
> SAFE_CRLF_FAIL:  reject the commit if EOL do not roundtrip
> SAFE_CRLF_WARN:  warn the user if EOL do not roundtrip
> 
> Already today the integer value 0 is passed as the parameter checksafe
> instead of the correct enum value SAFE_CRLF_FALSE.
> 
> Turn the whole call chain to use an integer with single bits, which
> can be extended in the next commits:
> - The global configuration variable safe_crlf is now conv_flags_eol.
> - The parameter checksafe is renamed into conv_flags.
> 
> Helped-By: Lars Schneider <larsxschneider@gmail.com>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
> ---
> This is my suggestion.
> (1) The flag bits had been renamed.
> (2) The (theoretical ?) mix of WARN/FAIL is still there,
>    I am not sure if this is a real problem.
> 
> (3) There are 2 reasons that CONV_EOL_RENORMALIZE is set.
>    Either in a renormalizing merge, or by running
>    git add --renormalize .
>    Therefor HASH_RENORMALIZE is not the same as CONV_EOL_RENORMALIZE.
Can you elaborate a bit? I am diving into the code but I am still confused.

I also noticed that the "flags" integer is potentially double booked with the following values (see read-cache.c:add_to_index()):

#define ADD_CACHE_VERBOSE 1 #define ADD_CACHE_PRETEND 2 #define ADD_CACHE_IGNORE_ERRORS 4

#define HASH_WRITE_OBJECT 1 #define HASH_FORMAT_CHECK 2 #define HASH_RENORMALIZE 4

Is this intentional? 

Thanks, Lars

More context:
  https://public-inbox.org/git/96B6CD4C-0A0C-47F5-922D-B8BAFB832FD1@gmail.com/
  (3) We kind of replicate some flags defined in cache.h:
     #define HASH_WRITE_OBJECT 1
     #define HASH_RENORMALIZE  4
Previous: Lars SchneiderNext: Torsten Bögershausen
Message 21 of 26 in “convert: add support for different encodings”
  1. 0/5 convert: add support for different encodingslars.schneider@autodesk.com, Dec 29, 2017
  2. 1/5 strbuf: add xstrdup_toupper()lars.schneider@autodesk.com, Dec 29, 2017
  3. Torsten BögershausenDec 29, 2017
  4. Lars SchneiderDec 29, 2017
  5. 2/5 utf8: add function to detect prohibited UTF-16/32 BOMlars.schneider@autodesk.com, Dec 29, 2017
  6. 5/5 convert: add tracing for checkout-encodinglars.schneider@autodesk.com, Dec 29, 2017
  7. 4/5 convert: add support for 'checkout-encoding' attributelars.schneider@autodesk.com, Dec 29, 2017
  8. Torsten BögershausenDec 29, 2017
  9. Lars SchneiderDec 30, 2017
  10. 3/5 utf8: add function to detect a missing UTF-16/32 BOMlars.schneider@autodesk.com, Dec 29, 2017
  11. 0/5 V2B: simplify convert.c/htboegi@web.de, Dec 31, 2017
  12. 5/5 convert: add support for 'checkout-encoding' attributetboegi@web.de, Dec 31, 2017
  13. Johannes SchindelinJan 5, 2018
  14. 3/5 utf8: add function to detect prohibited UTF-16/32 BOMtboegi@web.de, Dec 31, 2017
  15. 1/5 convert_to_git(): checksafe becomes an integertboegi@web.de, Dec 31, 2017
  16. Lars SchneiderDec 31, 2017
  17. 1/1 convert_to_git(): checksafe becomes int conv_flagstboegi@web.de, Jan 1, 2018
  18. Lars SchneiderJan 2, 2018
  19. Torsten BögershausenJan 3, 2018
  20. Lars SchneiderJan 3, 2018
  21. Lars SchneiderJan 5, 2018
  22. Torsten BögershausenJan 5, 2018
  23. Junio C HamanoJan 5, 2018
  24. Lars SchneiderJan 6, 2018
  25. 2/5 strbuf: add xstrdup_toupper()tboegi@web.de, Dec 31, 2017
  26. 4/5 utf8: add function to detect a missing UTF-16/32 BOMtboegi@web.de, Dec 31, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.