{"record":{"id":"7eef798c30a203ea","repo":"sds/overcommit","slug":"unable-to-access-git-tree","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/execute_permissions.rb","lineNumber":48,"sourceCode":"      extract_from_git_index(file_modes)\n\n      file_modes.map do |file, mode|\n        next unless execute_permissions?(mode)\n\n        Overcommit::Hook::Message.new(\n          :error,\n          file,\n          nil,\n          \"File #{file} has unnecessary execute permissions\",\n        )\n      end.compact\n    end\n\n    private\n\n    def extract_from_git_tree(file_modes)\n      result = execute(%w[git ls-tree HEAD --], args: applicable_files)\n      raise 'Unable to access git tree' unless result.success?\n\n      result.stdout.split(\"\\n\").each do |line|\n        mode, _type, _hash, file = line.split(/\\s+/, 4)\n        file_modes[file] = mode\n      end\n    end\n\n    def extract_from_git_index(file_modes)\n      result = execute(%w[git diff --raw --cached --no-color --], args: applicable_files)\n      raise 'Unable to access git index' unless result.success?\n\n      result.stdout.split(\"\\n\").each do |line|\n        _old_mode, new_mode, _old_hash, _new_hash, _status, file = line.split(/\\s+/, 6)\n        file_modes[file] = new_mode\n      end\n    end\n\n    # Check if the 1st bit is toggled, indicating execute permissions.","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/sds/overcommit/blob/fee0cd74b26eb81f64b43b7fab17bbb541575cc4/lib/overcommit/hook/pre_commit/execute_permissions.rb#L30-L66","documentation":"Error \"Unable to access git tree\" thrown in sds/overcommit.","triggerScenarios":"Thrown at lib/overcommit/hook/pre_commit/execute_permissions.rb:48 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 ExecutePermissions 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"}