{"record":{"id":"5bd6e6c807fa41f8","repo":"sds/overcommit","slug":"unable-to-access-git-index","errorCode":null,"errorMessage":"Unable to access git index","messagePattern":"Unable to access git index","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"lib/overcommit/hook/pre_commit/execute_permissions.rb","lineNumber":58,"sourceCode":"        )\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.\n    #\n    # Git tracks only execute permissions, not individual read/write/execute\n    # permissions for user, group, and other, since that concept does not exist\n    # on all operating systems. If any of the user/group/other permissions\n    # have the executable bit set, they all will. Thus we check the first bit.\n    def execute_permissions?(mode)\n      (mode.to_i(8) & 1) == 1\n    end\n  end\nend","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/sds/overcommit/blob/fee0cd74b26eb81f64b43b7fab17bbb541575cc4/lib/overcommit/hook/pre_commit/execute_permissions.rb#L40-L76","documentation":"Error \"Unable to access git index\" thrown in sds/overcommit.","triggerScenarios":"Thrown at lib/overcommit/hook/pre_commit/execute_permissions.rb:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the git index is readable (`.git/index` exists and is not locked); run `git status` to verify repository health.","Remove a stale `.git/index.lock` left by a crashed git process, then rerun the hook."],"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"}