GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — forbid-new-submodules is broken · Issue #609 · pre-commit/pre-commit-hooks

forbid-new-submodules is broken #609

New issue
Copy link
New issue
Copy link
Closed
Closed
forbid-new-submodules is broken#609
Copy link
Labels
question

Description

@m-khvoinitsky
m-khvoinitsky
opened on Jun 3, 2021
Issue body actions

The hook does not have an explicit types section.
Default types: [file] does not match submodules (which are directories). It works only if you commit some regular file together with committing new submodule.
Specifying types: [directory] helps but not much: it works as a pre-commit but doesn't as pre-push or any other way when you specify --from-ref and --to-ref.
I'd suggest stopping ignoring provided by pre-commit list of files and check git status for provided files instead of diff.

Activity

  1. asottile commented on Jun 3, 2021

    @asottile
    asottile
    on Jun 3, 2021
    Member
    More actions

    @m-khvoinitsky in order to add a submodule .gitmodules needs to be edited -- are you sure about your assertions? can you describe what you're seeing instead of prescribing a solution? I suspect you've got an XY problem

  2. asottile
    added
    question
    on Jun 3, 2021
  3. m-khvoinitsky commented on Jun 3, 2021

    @m-khvoinitsky
    m-khvoinitsky
    on Jun 3, 2021
    ContributorAuthor
    More actions

    in order to add a submodule .gitmodules needs to be edited

    That's correct if you're adding submodules intentionally. But if user tries to commit some another git repository inside current one by accident, git complains but obediently adds a "commit" (type 160000) entry in the tree. I was hoping that this hook would prevent such situations too.

    I suspect you've got an XY problem

    May be it is. If so, a separate hook which rejects type 160000 entries without corresponding records in .gitmodules suits my needs better. However, implementing proposed chages would make this hook useful in both usecases (which makes sense because rejecting "incomplete" submodule is still rejecting a submodule).
    And the (separate) problem with --from-ref and --to-ref is still a problem — current hook is useless in CI.

  4. asottile commented on Jun 3, 2021

    @asottile
    asottile
    on Jun 3, 2021
    Member
    More actions

    feel free to take a stab if you think it's worth it, I'm just not sure you're solving something that's actually a problem

  5. m-khvoinitsky
    added a commit that references this issue on Jun 23, 2021

    forbid-new-submodules: fix triggering failure when only a submodule i…

    This issue will close once commit 7e72488 is merged into the 'master' branch.
    7e72488
  6. m-khvoinitsky
    added a commit that references this issue on Jul 6, 2021

    forbid-new-submodules: fix triggering failure when only a submodule i…

    This issue will close once commit 4227f13 is merged into the 'master' branch.
    4227f13
  7. m-khvoinitsky
    added 3 commits that reference this issue on Jul 19, 2021

    forbid-new-submodules: fix triggering failure when only a submodule i…

    This issue will close once commit 1886f67 is merged into the 'master' branch.
    1886f67

    forbid-new-submodules: fix triggering failure when only a submodule i…

    This issue will close once commit fcf2962 is merged into the 'master' branch.
    fcf2962

    forbid-new-submodules: fix triggering failure when only a submodule i…

    This issue will close once commit 83ec0fb is merged into the 'master' branch.
    83ec0fb
  8. asottile
    added a commit that references this issue on Aug 2, 2021

    forbid-new-submodules: fix triggering failure when only a submodule i…

    This issue will close once commit e53e6ca is merged into the 'master' branch.
    e53e6ca
  9. m-khvoinitsky
    added a commit that references this issue on Aug 13, 2021

    forbid-new-submodules: fix triggering failure when only a submodule i…

    This issue will close once commit 10c5e4e is merged into the 'master' branch.
    10c5e4e
  10. asottile
    closed this as completedin 10c5e4eon Aug 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.