Skip to content

Hooks installed in my home directory #131

@BBaoVanC

Description

@BBaoVanC

I don't have the time/knowledge to debug this fully but hoping you guys might have some insight.

A while back I cloned the-via/app and must've run some npm build command or something. It wasn't until a few weeks later that I noticed a git hook installed in my home directory (which I have a git repo at), in ~/.git/hooks/pre-commit. I see that a dependency of the-via/app, the-via/keyboards, uses simple-git-hooks to put the exact hook (npm run prettify-staged) that I found in my home dir, and the file creation date lines up. So I suspect this is how that hook got created.

Could it have to do with how getProjectRootDirectoryFromNodeModules walks up the directory tree to try and find the actual root of the project simple-git-hooks is being run in? I looked at that function and proceeded to check if my home dir has any of .pnpm, .deno, .store, or node_modules but it does not. It has a .yarn but it didn't look like that function was relying on that dir name.

If it helps, my home dir is exactly 2 dirs above where I clone repos to.

$ grep -C 3 simple ~/projects/via-app/node_modules/via-keyboards/package.json 
    "@types/node": "^18.14.0",
    "prettier": "^2.8.4",
    "pretty-quick": "^3.1.3",
    "simple-git-hooks": "^2.8.1"
  },
  "dependencies": {
    "@the-via/reader": "^1.9.0",
--
    "ts-node": "10.9.1",
    "typescript": "^4.9.5"
  },
  "simple-git-hooks": {
    "pre-commit": "npm run prettify-staged"
  }
}

Also, I had a little trouble following what parts of the code in simple-git-hooks could've been run from the build in the-via/app, but is it possible that getGitProjectRoot doesn't work right, since I do have a .git in my home directory? I can't tell if that function is used for the setting hooks logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions