{"record":{"id":"ef616fb943708bd9","repo":"sds/overcommit","slug":"unable-to-access-git-tree-ef616f","errorCode":null,"errorMessage":"Unable to access git tree","messagePattern":"Unable to access git tree","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"lib/overcommit/hook/pre_commit/line_endings.rb","lineNumber":55,"sourceCode":"        line.gsub!(/#{config['eol']}/, '')\n\n        # Detect any left over line-ending characters\n        next unless line.end_with?(\"\\n\", \"\\r\")\n\n        messages_for_file << Overcommit::Hook::Message.new(\n          :error,\n          file_name,\n          file.lineno,\n          \"#{file_name}:#{file.lineno}:#{line.inspect}\"\n        )\n      end\n\n      messages_for_file\n    end\n\n    def offending_files\n      result = execute(%w[git ls-files --eol -z --], args: applicable_files)\n      raise 'Unable to access git tree' unless result.success?\n\n      result.stdout.split(\"\\0\").map do |file_info|\n        info, path = file_info.split(\"\\t\")\n        i = info.split.first\n        next if i == 'l/-text' # ignore binary files\n        next if i == \"l/#{eol}\"\n\n        path\n      end.compact\n    end\n\n    def eol\n      @eol ||=  case config['eol']\n                when \"\\n\"\n                  'lf'\n                when \"\\r\\n\"\n                  'crlf'\n                else","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/sds/overcommit/blob/fee0cd74b26eb81f64b43b7fab17bbb541575cc4/lib/overcommit/hook/pre_commit/line_endings.rb#L37-L73","documentation":"Error \"Unable to access git tree\" thrown in sds/overcommit.","triggerScenarios":"Thrown at lib/overcommit/hook/pre_commit/line_endings.rb:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the hook runs inside a valid git repository with a readable HEAD tree; run `git ls-tree HEAD` to verify.","If HEAD does not exist yet (no commits), make an initial commit or disable the LineEndings hook until one exists."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fee0cd74b26eb81f64b43b7fab17bbb541575cc4","analyzedAt":"2026-08-23T04:07:28.153Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}