]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'fixes/2.45.1/2.40' into fixes/2.45.1/2.41
authorJunio C Hamano <gitster@pobox.com>
Fri, 24 May 2024 23:57:01 +0000 (16:57 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 May 2024 23:57:02 +0000 (16:57 -0700)
* fixes/2.45.1/2.40:
  Revert "fsck: warn about symlink pointing inside a gitdir"
  Revert "Add a helper function to compare file contents"
  clone: drop the protections where hooks aren't run
  tests: verify that `clone -c core.hooksPath=/dev/null` works again
  Revert "core.hooksPath: add some protection while cloning"
  init: use the correct path of the templates directory again
  hook: plug a new memory leak
  ci: stop installing "gcc-13" for osx-gcc
  ci: avoid bare "gcc" for osx-gcc job
  ci: drop mention of BREW_INSTALL_PACKAGES variable
  send-email: avoid creating more than one Term::ReadLine object
  send-email: drop FakeTerm hack

13 files changed:
1  2 
Makefile
builtin/clone.c
config.c
copy.c
copy.h
fsck.c
fsck.h
git-send-email.perl
hook.c
t/helper/test-path-utils.c
t/t0060-path-utils.sh
t/t1450-fsck.sh
t/t9001-send-email.sh

diff --cc Makefile
Simple merge
diff --cc builtin/clone.c
index d6545d036f8301ef034b78bf2776c4595d8bcf15,399b2d3f421ec5e8d05e106854824e9f01282efd..b7db074b7e3f10b3e8c29eb78b45f41c07e6fe0f
@@@ -958,9 -938,6 +958,7 @@@ int cmd_clone(int argc, const char **ar
        int err = 0, complete_refs_before_fetch = 1;
        int submodule_progress;
        int filter_submodules = 0;
-       const char *template_dir;
-       char *template_dir_dup = NULL;
 +      int hash_algo;
  
        struct transport_ls_refs_options transport_ls_refs_options =
                TRANSPORT_LS_REFS_OPTIONS_INIT;
diff --cc config.c
Simple merge
diff --cc copy.c
Simple merge
diff --cc copy.h
index 057259a3a7a726252d922f6a42161773e52f980a,0000000000000000000000000000000000000000..2af77cba8649b322151fa1b410e6a9522690cde9
mode 100644,000000..100644
--- 1/copy.h
--- /dev/null
+++ b/copy.h
@@@ -1,24 -1,0 +1,10 @@@
- /*
-  * Compare the file mode and contents of two given files.
-  *
-  * If both files are actually symbolic links, the function returns 1 if the link
-  * targets are identical or 0 if they are not.
-  *
-  * If any of the two files cannot be accessed or in case of read failures, this
-  * function returns 0.
-  *
-  * If the file modes and contents are identical, the function returns 1,
-  * otherwise it returns 0.
-  */
- int do_files_match(const char *path1, const char *path2);
 +#ifndef COPY_H
 +#define COPY_H
 +
 +#define COPY_READ_ERROR (-2)
 +#define COPY_WRITE_ERROR (-3)
 +int copy_fd(int ifd, int ofd);
 +int copy_file(const char *dst, const char *src, int mode);
 +int copy_file_with_time(const char *dst, const char *src, int mode);
 +
 +#endif /* COPY_H */
diff --cc fsck.c
Simple merge
diff --cc fsck.h
Simple merge
Simple merge
diff --cc hook.c
index 22a976c6d302fee3d8e81974c2a3075db50b917e,7981e081f54c600f5481c72c250fe6dd3379e1d0..8650ce8c4ead15584656cdf5af849f3944a873a5
--- 1/hook.c
--- 2/hook.c
+++ b/hook.c
@@@ -1,38 -1,7 +1,13 @@@
 -#include "cache.h"
 +#include "git-compat-util.h"
 +#include "advice.h"
 +#include "gettext.h"
  #include "hook.h"
 +#include "path.h"
  #include "run-command.h"
  #include "config.h"
- #include "copy.h"
- static int identical_to_template_hook(const char *name, const char *path)
- {
-       const char *env = getenv("GIT_CLONE_TEMPLATE_DIR");
-       const char *template_dir = get_template_dir(env && *env ? env : NULL);
-       struct strbuf template_path = STRBUF_INIT;
-       int found_template_hook, ret;
-       strbuf_addf(&template_path, "%s/hooks/%s", template_dir, name);
-       found_template_hook = access(template_path.buf, X_OK) >= 0;
- #ifdef STRIP_EXTENSION
-       if (!found_template_hook) {
-               strbuf_addstr(&template_path, STRIP_EXTENSION);
-               found_template_hook = access(template_path.buf, X_OK) >= 0;
-       }
- #endif
-       if (!found_template_hook)
-               return 0;
-       ret = do_files_match(template_path.buf, path);
-       strbuf_release(&template_path);
-       return ret;
- }
 +#include "strbuf.h"
 +#include "environment.h"
 +#include "setup.h"
  
  const char *find_hook(const char *name)
  {
Simple merge
Simple merge
diff --cc t/t1450-fsck.sh
index 21d65b207b15f0f4cde0823fc04932539e9ee276,fdb886dfe431f36dfc4ef6bcf24abf6827c2243d..8c442adb1ae8296a75e04e5a6b5b79482ec6ca35
@@@ -1020,71 -1023,4 +1020,34 @@@ test_expect_success 'fsck error on gita
        test_cmp expected actual
  '
  
- test_expect_success 'fsck warning on symlink target with excessive length' '
-       symlink_target=$(printf "pattern %032769d" 1 | git hash-object -w --stdin) &&
-       test_when_finished "remove_object $symlink_target" &&
-       tree=$(printf "120000 blob %s\t%s\n" $symlink_target symlink | git mktree) &&
-       test_when_finished "remove_object $tree" &&
-       cat >expected <<-EOF &&
-       warning in blob $symlink_target: symlinkTargetLength: symlink target too long
-       EOF
-       git fsck --no-dangling >actual 2>&1 &&
-       test_cmp expected actual
- '
- test_expect_success 'fsck warning on symlink target pointing inside git dir' '
-       gitdir=$(printf ".git" | git hash-object -w --stdin) &&
-       ntfs_gitdir=$(printf "GIT~1" | git hash-object -w --stdin) &&
-       hfs_gitdir=$(printf ".${u200c}git" | git hash-object -w --stdin) &&
-       inside_gitdir=$(printf "nested/.git/config" | git hash-object -w --stdin) &&
-       benign_target=$(printf "legit/config" | git hash-object -w --stdin) &&
-       tree=$(printf "120000 blob %s\t%s\n" \
-               $benign_target benign_target \
-               $gitdir gitdir \
-               $hfs_gitdir hfs_gitdir \
-               $inside_gitdir inside_gitdir \
-               $ntfs_gitdir ntfs_gitdir |
-               git mktree) &&
-       for o in $gitdir $ntfs_gitdir $hfs_gitdir $inside_gitdir $benign_target $tree
-       do
-               test_when_finished "remove_object $o" || return 1
-       done &&
-       printf "warning in blob %s: symlinkPointsToGitDir: symlink target points to git dir\n" \
-               $gitdir $hfs_gitdir $inside_gitdir $ntfs_gitdir |
-       sort >expected &&
-       git fsck --no-dangling >actual 2>&1 &&
-       sort actual >actual.sorted &&
-       test_cmp expected actual.sorted
- '
 +test_expect_success 'fsck detects problems in worktree index' '
 +      test_when_finished "git worktree remove -f wt" &&
 +      git worktree add wt &&
 +
 +      echo "this will be removed to break the worktree index" >wt/file &&
 +      git -C wt add file &&
 +      blob=$(git -C wt rev-parse :file) &&
 +      remove_object $blob &&
 +
 +      test_must_fail git fsck --name-objects >actual 2>&1 &&
 +      cat >expect <<-EOF &&
 +      missing blob $blob (.git/worktrees/wt/index:file)
 +      EOF
 +      test_cmp expect actual
 +'
 +
 +test_expect_success 'fsck reports problems in main index without filename' '
 +      test_when_finished "rm -f .git/index && git read-tree HEAD" &&
 +      echo "this object will be removed to break the main index" >file &&
 +      git add file &&
 +      blob=$(git rev-parse :file) &&
 +      remove_object $blob &&
 +
 +      test_must_fail git fsck --name-objects >actual 2>&1 &&
 +      cat >expect <<-EOF &&
 +      missing blob $blob (:file)
 +      EOF
 +      test_cmp expect actual
 +'
 +
  test_done
Simple merge