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

[PATCH v3 0/3] apply: support case-only renames in case-insensitive filesystems

From
Tao Klerks via GitGitGadget <gitgitgadget@gmail.com>
Date
May 28, 2023, 09:59 UTC
Message-ID
<pull.1257.v3.git.1685267999.gitgitgadget@gmail.com>
In-Reply-To
<pull.1257.v2.git.1655655027.gitgitgadget@gmail.com>

As suggested almost a year ago in thread CAPMMpojwV+f=z9sgc_GaUOTFBCUVdbrGW8WjatWWmC3WTcsoXw@mail.gmail.com, proposing a fix to git-apply for case-only renames on case-insensitive filesystems.

Changes in V3:
 * Rebased onto recent main
 * Renumbered now-duplicate-number test t4141 to t4142
 * Removed "RFC" prefix to officially submit; I don't see a better
   direction, and haven't received any corresponding feedback

As mentioned in V2, I'm not super-happy with the duplication of filename tracking tables, but I do think this bug needs to be fixed, and I don't see any other way to do so. The fundamental rule this change implements is that filesystem filename duplication checks should respect the core.ignorecase option, but index filename duplication checks should not.

Junio C Hamano (1):
  t4142: test "git apply" with core.ignorecase
Tao Klerks (2):
  reset: new failing test for reset of case-insensitive duplicate in
    index
  apply: support case-only renames in case-insensitive filesystems
 apply.c                |  81 +++++++++----
 apply.h                |   5 +-
 t/t4142-apply-icase.sh | 258 +++++++++++++++++++++++++++++++++++++++++
 t/t7104-reset-hard.sh  |  11 ++
 4 files changed, 334 insertions(+), 21 deletions(-)
 create mode 100755 t/t4142-apply-icase.sh
base-commit: 4a714b37029a4b63dbd22f7d7ed81f7a0d693680
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1257%2FTaoK%2Ftao-apply-case-insensitive-renames-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1257/TaoK/tao-apply-case-insensitive-renames-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/1257
Range-diff vs v2:
 1:  efd3bd4cdda ! 1:  8ad60943c66 t4141: test "git apply" with core.ignorecase
     @@ Metadata
      Author: Junio C Hamano <gitster@pobox.com>
      
       ## Commit message ##
     -    t4141: test "git apply" with core.ignorecase
     +    t4142: test "git apply" with core.ignorecase
      
          Signed-off-by: Junio C Hamano <gitster@pobox.com>
      
     - ## t/t4141-apply-icase.sh (new) ##
     + ## t/t4142-apply-icase.sh (new) ##
      @@
      +#!/bin/sh
      +
 2:  1226fbd3caf = 2:  ab1cdd95e03 reset: new failing test for reset of case-insensitive duplicate in index
 3:  04d83283716 ! 3:  52359738532 apply: support case-only renames in case-insensitive filesystems
     @@ Commit message
          account for case-insensitive filesystems yet.
      
          Because the index is inherently case-sensitive even on a
     -    case-insensitive filesystem, we actually need this mechanism to be
     +    case-insensitive filesystem, we actually need this mechanism to
          handle both requirements, lest we fail to account for conflicting
          files only in the index.
      
     @@ apply.c: void clear_apply_state(struct apply_state *state)
      +	 */
       }
       
     - static void mute_routine(const char *msg, va_list params)
     + static void mute_routine(const char *msg UNUSED, va_list params UNUSED)
      @@ apply.c: static int read_file_or_gitlink(const struct cache_entry *ce, struct strbuf *buf
       	return read_blob_object(buf, &ce->oid, ce->ce_mode);
       }
     @@ apply.h: struct apply_state {
       	/*
       	 * This is to save reporting routines before using
      
     - ## t/t4141-apply-icase.sh ##
     -@@ t/t4141-apply-icase.sh: test_expect_success setup '
     + ## t/t4142-apply-icase.sh ##
     +@@ t/t4142-apply-icase.sh: test_expect_success setup '
              git diff HEAD HEAD^ -- file1 >deletion-patch &&
              git diff --cached HEAD -- file1 file2 >rename-file1-to-file2-patch &&
              git diff --cached HEAD -- file1 File1 >rename-file1-to-File1-patch &&
     @@ t/t4141-apply-icase.sh: test_expect_success setup '
       '
       
       # Basic creation, deletion, modification and renaming.
     -@@ t/t4141-apply-icase.sh: test_expect_success 'creation and deletion' '
     +@@ t/t4142-apply-icase.sh: test_expect_success 'creation and deletion' '
              test_must_fail git rev-parse --verify :file1
       '
       
     @@ t/t4141-apply-icase.sh: test_expect_success 'creation and deletion' '
              # start at "initial" with file0 only
              git reset --hard initial &&
       
     -@@ t/t4141-apply-icase.sh: test_expect_success 'modificaiton' '
     +@@ t/t4142-apply-icase.sh: test_expect_success 'modificaiton' '
              test_cmp_rev :file0 "$file0blob"
       '
       
     @@ t/t4141-apply-icase.sh: test_expect_success 'modificaiton' '
              # start from file0 and file1
              git reset --hard current &&
       
     -@@ t/t4141-apply-icase.sh: test_expect_success 'rename file1 to file2' '
     +@@ t/t4142-apply-icase.sh: test_expect_success 'rename file1 to file2' '
              test_cmp_rev :file1 "$file1blob"
       '
       
     @@ t/t4141-apply-icase.sh: test_expect_success 'rename file1 to file2' '
              # start from file0 and file1
              git reset --hard current &&
       
     -@@ t/t4141-apply-icase.sh: test_expect_success 'rename file1 to file2' '
     +@@ t/t4142-apply-icase.sh: test_expect_success 'rename file1 to file2' '
              test_cmp_rev :file1 "$file1blob"
       '
       
-- 
gitgitgadget
Previous: Tao KlerksNext: Tao Klerks via GitGitGadget
Message 18 of 21 in “apply: support case-only renames in case-insensitive filesystems”
  1. apply: support case-only renames in case-insensitive filesystemsTao Klerks via GitGitGadget, Jun 11, 2022
  2. Junio C HamanoJun 11, 2022
  3. Junio C HamanoJun 12, 2022
  4. Tao KlerksJun 14, 2022
  5. Tao KlerksJun 15, 2022
  6. Tao KlerksJun 14, 2022
  7. Junio C HamanoJun 18, 2022
  8. Tao KlerksJun 18, 2022
  9. Junio C HamanoJun 12, 2022
  10. Junio C HamanoJun 13, 2022
  11. Tao KlerksJun 14, 2022
  12. Tao KlerksJun 14, 2022
  13. 0/3 RFC: apply: support case-only renames in case-insensitive filesystemsTao Klerks via GitGitGadget, Jun 19, 2022
  14. 2/3 reset: new failing test for reset of case-insensitive duplicate in indexTao Klerks via GitGitGadget, Jun 19, 2022
  15. 1/3 t4141: test "git apply" with core.ignorecaseJunio C Hamano via GitGitGadget, Jun 19, 2022
  16. 3/3 apply: support case-only renames in case-insensitive filesystemsTao Klerks via GitGitGadget, Jun 19, 2022
  17. Tao KlerksOct 10, 2022
  18. 0/3 apply: support case-only renames in case-insensitive filesystemsTao Klerks via GitGitGadget, May 28, 2023
  19. 2/3 reset: new failing test for reset of case-insensitive duplicate in indexTao Klerks via GitGitGadget, May 28, 2023
  20. 1/3 t4142: test "git apply" with core.ignorecaseJunio C Hamano via GitGitGadget, May 28, 2023
  21. 3/3 apply: support case-only renames in case-insensitive filesystemsTao Klerks via GitGitGadget, May 28, 2023

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.