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

Re: [PATCH] Teach git apply to respect core.fileMode settings

From
CPChandra Pratap <chandrapratap3519@gmail.com>
Date
Dec 19, 2023, 17:07 UTC
Message-ID
<CA+J6zkQVcSqpi8yRirEJn6Vbe9WkvhtWE5_YRZVzq7bNrFoFPA@mail.gmail.com>
In-Reply-To
<xmqqbkanfkjy.fsf@gitster.g>

Thanks for the review, Junio. I have considered your feedback and will adjust the patch as such. The mail formatting issues seem to have arisen from my invigilant use of GitGitGadget.

Show 14 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
> IOW, I am wondering if the above should look more like
>
>        if (!state->cached && !previous) {
>                if (!trust_executable_bit) {
>                        if (*ce)
>                                st_mode = (*ce)->ce_mode;
>                        else
>                                st_mode = patch->old_mode;
>                } else {
>                       st_mode = ce_mode_from_stat(*ce, st->st_mode);
>                }
>      }

You're right, we should prioritise the file mode info from the existing cache entry (if one exists) instead of blindly assigning the one from the incoming patch. It's more robust that way.

Show 8 quoted lines
> Perhaps we would want to check with "git ls-files -s script.sh" what
> its mode bits are (hopefully it would be executable).
>
> Similarly, check with "git ls-tree -r HEAD script.sh" what its mode>
> bits are?
>
> Check that the patch expects script.sh to have its executable bit
> here, too?

I assume we're doing all this filemode checking to ensure that the executable bit doesn't get lost due to any other git command?

Show 8 quoted lines
> The code change in this patch is primarily about making the code
> work better for folks without trustworthy filemode support.
> Emulating what happens by setting core.fileMode to false on a
> platform with capable filesystems may be a way to test the code, but
> we should have a test specific to folks without FILEMODE
> prerequisites and make sure it works well, no?
>
> IOW, shouldn't we drom FILEMODE prerequisite from this test?
I will keep that in mind.
Previous: Junio C HamanoNext: Chandra Pratap via GitGitGadget
Message 4 of 21 in “Teach git apply to respect core.fileMode settings”
  1. Teach git apply to respect core.fileMode settingsChandra Pratap via GitGitGadget, Dec 18, 2023
  2. Junio C HamanoDec 18, 2023
  3. Junio C HamanoDec 18, 2023
  4. Chandra PratapDec 19, 2023
  5. Teach git apply to respect core.fileMode settingsChandra Pratap via GitGitGadget, Dec 19, 2023
  6. Torsten BögershausenDec 19, 2023
  7. Junio C HamanoDec 19, 2023
  8. Teach git apply to respect core.fileMode settingsChandra Pratap via GitGitGadget, Dec 20, 2023
  9. Johannes SchindelinDec 24, 2023
  10. Junio C HamanoDec 26, 2023
  11. Johannes SchindelinDec 26, 2023
  12. Junio C HamanoDec 26, 2023
  13. Junio C HamanoDec 26, 2023
  14. Junio C HamanoDec 26, 2023
  15. 0/3 apply with core.filemode=falseJunio C Hamano, Dec 26, 2023
  16. 1/3 apply: ignore working tree filemode when !core.filemodeJunio C Hamano, Dec 26, 2023
  17. 2/3 apply: correctly reverse patch's pre- and post-image mode bitsJunio C Hamano, Dec 26, 2023
  18. 3/3 apply: code simplificationJunio C Hamano, Dec 26, 2023
  19. Junio C HamanoFeb 7, 2024
  20. Johannes SchindelinFeb 18, 2024
  21. Junio C HamanoFeb 19, 2024

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.