From c0144b274f14d0fb6a5dba5357e1ebd9b8d8079a Mon Sep 17 00:00:00 2001 From: Quang-Minh Nguyen Date: Wed, 2 Nov 2022 16:38:23 +0700 Subject: Intentionally add some bugs to test CI logs --- internal/gitaly/rubyserver/rubyserver.go | 36 ---------------------- internal/gitaly/service/repository/search_files.go | 5 --- 2 files changed, 41 deletions(-) diff --git a/internal/gitaly/rubyserver/rubyserver.go b/internal/gitaly/rubyserver/rubyserver.go index 7e661954a..54d200328 100644 --- a/internal/gitaly/rubyserver/rubyserver.go +++ b/internal/gitaly/rubyserver/rubyserver.go @@ -133,42 +133,6 @@ func (s *Server) start() error { cfg := s.cfg - // Both Omnibus and CNG set up the gitconfig in a non-default location. This means that they - // need to tell us where to find it, which is done via the Rugged config search path. In - // fact though, this configuration really only contains a single entry that is of importance - // to us in the context of Rugged, which is `core.fsyncObjectFiles`: if not set, then we may - // fail to persist objects correctly and thus corrupt the repository. We don't care about - // anything else nowadays anymore because most of the functionality was stripped out of the - // sidecar. - // - // Because we only care about a single option, and because that option is in fact mandatory - // or we may end up with corrupted data, we want to get rid of this configuration. Rugged - // doesn't give us any way to force-enable fsyncing though except if we write it to a file. - // Consequentially, we'll have to inject our own gitconfig into Rugged that enables this - // config. And that's exactly what the following block does: if we detect that the distro - // isn't telling us where to find the Rugged configuration, we write our own config. This is - // required so that we can phase out support of the gitconfig in these distributions. - // - // This is transitory until either the sidecar goes away or the upstream pull request is - // released (https://github.com/libgit2/rugged/pull/918). - if cfg.Ruby.RuggedGitConfigSearchPath == "" { - gitconfigDir := filepath.Join(cfg.RuntimeDir, "ruby-gitconfig") - if err := os.Mkdir(gitconfigDir, 0o777); err != nil { - return fmt.Errorf("creating gitconfig dir: %w", err) - } - - // This file must be called `gitconfig` given that we pretend it's the system-level - // Git configuration. Otherwise, Rugged wouldn't find it. - if err := os.WriteFile(filepath.Join(gitconfigDir, "gitconfig"), []byte( - "[core]\n\tfsyncObjectFiles = true\n", - ), 0o666); err != nil { - return fmt.Errorf("writing gitconfig: %w", err) - } - - cfg.Ruby.RuggedGitConfigSearchPath = gitconfigDir - s.gitconfigDir = gitconfigDir - } - env, err := setupEnv(cfg, s.gitCmdFactory) if err != nil { return fmt.Errorf("setting up sidecar environment: %w", err) diff --git a/internal/gitaly/service/repository/search_files.go b/internal/gitaly/service/repository/search_files.go index a0511ccb3..c676d44a3 100644 --- a/internal/gitaly/service/repository/search_files.go +++ b/internal/gitaly/service/repository/search_files.go @@ -130,11 +130,6 @@ func (s *server) SearchFilesByName(req *gitalypb.SearchFilesByNameRequest, strea git.Flag{Name: "--full-tree"}, git.Flag{Name: "--name-status"}, git.Flag{Name: "-r"}, - // We use -z to force NULL byte termination here to prevent git from - // quoting and escaping unusual file names. Lstree parser would be a - // more ideal solution. Unfortunately, it supports parsing full - // output while we are interested in the filenames only. - git.Flag{Name: "-z"}, }, Args: []string{string(req.GetRef()), req.GetQuery()}}) if err != nil { return helper.ErrInternalf("SearchFilesByName: cmd start failed: %v", err) -- cgit v1.2.3