How can we improve SQL Source Control?

SQL Source Control Git Hook Support

Sql Source Control can be made better by adding support for git hooks in the Sql Management Studio Source Control interface.

Example: Create a pre-commit hook to stop outgoing commits if tsqlt tests do not pass.

Expected outcome: A commit that fails the pre-commit hook should not be created. This is the behavior of the git command line.

Current outcome: Sql Source Control does not respect the git hook and bypasses it allowing the commit to be made.

36 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Anonymous shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    3 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Aaron Templeton commented  ·   ·  Flag as inappropriate

        Upon further research this appears to be a failing of the libgit2 API which you are using. Microsoft suffered the same failing with Visual Studio until they converted over to directly running the git.exe shell as of VS 2017. I would ask that you take a similar initiative. For now, we are catching the failings in a bare repository pre-receive hook which then forces the user to repair their local repository through either a "git commit --amend" or else an interactive rebase. This gets especially messy if they have already done any branch merging. Please see for reference: https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/4321705-enable-client-side-hooks-when-committing-code-to-a

      • Aaron Templeton commented  ·   ·  Flag as inappropriate

        I could almost swear that SQL Source Control used to honor the hook, or at least ran it even if it didn't honor the return code to abort. Now I'm finding it doesn't run the hook at all. I altered my hook to create a file, which is never created from Redgate, and had it append a constant to the message, which never gets appended, before exiting with a zero return code. So it isn't that SQL Source Control is not honoring the hook, it simply isn't even running that code any longer. Or perhaps ever, but I'm 99.99% sure it used to at least run the hook allowing content to be appended to the message. So it appears to have recently went from "broken" to "really broken".

      • Sam Blowes commented  ·   ·  Flag as inappropriate

        This is very important for audit purposes.

        Often a user should reference a ticket for each change.

      Feedback and Knowledge Base