From e26f7f19b6c7485f04234946a59ab8f4fd21d6d1 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Fri, 19 Jan 2018 04:18:25 +0000 Subject: repository: pre-initialize hash algo pointer There are various git subcommands (among them, clone) which don't set up the repository (that is, they lack RUN_SETUP or RUN_SETUP_GENTLY) but end up needing to have information about the hash algorithm in use. Because the hash algorithm is part of struct repository and it's only initialized in repository setup, we can end up dereferencing a NULL pointer in some cases if we call one of these subcommands and look up the empty blob or empty tree values. A "git clone" of a project that has two paths that differ only in case suffers from this if it is run on a case insensitive platform. When the command attempts to check out one of these two paths after checking out the other one, the checkout codepath needs to see if the version that is already on the filesystem (which should not happen if the FS were case sensitive) is dirty, and it needs to exercise the hashing code at that point. In the future, we can add a command line option for this or read it from the configuration, but until we're ready to expose that functionality to the user, simply initialize the repository structure to use the current hash algorithm, SHA-1. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- repository.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repository.c b/repository.c index 998413b8b..f66fcb134 100644 --- a/repository.c +++ b/repository.c @@ -5,7 +5,7 @@ /* The main repository */ static struct repository the_repo = { - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &the_index, NULL, 0, 0 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &the_index, &hash_algos[GIT_HASH_SHA1], 0, 0 }; struct repository *the_repository = &the_repo; -- cgit v1.2.1 From b6947af2294ea0c814f5b4cb8737c782895519b2 Mon Sep 17 00:00:00 2001 From: Eric Sunshine Date: Sun, 21 Jan 2018 03:07:28 -0500 Subject: t5601-clone: test case-conflicting files on case-insensitive filesystem A recently introduced regression caused a segfault at clone time on case-insensitive filesystems when filenames differing only in case are present. This bug has already been fixed (repository: pre-initialize hash algo pointer, 2018-01-18), but it's not the first time similar problems have arisen. Therefore, introduce a test to catch this case and protect against future regressions. Signed-off-by: Eric Sunshine Signed-off-by: brian m. carlson Signed-off-by: Eric Sunshine Signed-off-by: Junio C Hamano --- t/t5601-clone.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 50e40abb1..55df602ae 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -573,4 +573,21 @@ test_expect_success 'GIT_TRACE_PACKFILE produces a usable pack' ' git -C replay.git index-pack -v --stdin Date: Sun, 21 Jan 2018 21:14:25 -0800 Subject: Git 2.16.1 Signed-off-by: Junio C Hamano --- Documentation/RelNotes/2.16.1.txt | 11 +++++++++++ GIT-VERSION-GEN | 2 +- RelNotes | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 Documentation/RelNotes/2.16.1.txt diff --git a/Documentation/RelNotes/2.16.1.txt b/Documentation/RelNotes/2.16.1.txt new file mode 100644 index 000000000..66e64361f --- /dev/null +++ b/Documentation/RelNotes/2.16.1.txt @@ -0,0 +1,11 @@ +Git v2.16.1 Release Notes +========================= + +Fixes since v2.16 +----------------- + + * "git clone" segfaulted when cloning a project that happens to + track two paths that differ only in case on a case insensitive + filesystem. + +Does not contain any other documentation updates or code clean-ups. diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index e4c858d35..470f7b7b8 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v2.16.0 +DEF_VER=v2.16.1 LF=' ' diff --git a/RelNotes b/RelNotes index bec73d676..0172894cc 120000 --- a/RelNotes +++ b/RelNotes @@ -1 +1 @@ -Documentation/RelNotes/2.16.0.txt \ No newline at end of file +Documentation/RelNotes/2.16.1.txt \ No newline at end of file -- cgit v1.2.1