Skip to content

"Resynchronize pre-receive, update and post-receive hooks" should explicitly set executable bit #6319

@SagePtr

Description

@SagePtr
  • Gitea version (or commit ref): 1.7.4
  • Git version: 2.17.1
  • Operating system: linux
  • Database (use [x]):
    • Not relevant
  • Can you reproduce the bug at https://try.gitea.io:
    • Not relevant
  • Log gist:

Description

If repositories directory is copied from Windows to Linux machine - hooks will lose executable permissions. It's also easy to forget this aspect when restoring from backup using Windows machine.

Function "Resynchronize pre-receive, update and post-receive hooks" are very handy when dealing with migration from one server to another, but the only problem is - it doesn't set executable bit explicitely if hook files already exist, it set it only for new files via WriteFile third parameter.

Would be nice if this function will also fix hook files permissions, not only overwrite hooks content with new path to gitea executable.

Or separate function "Fix executable permission on all hooks" which should recursively set +x on all files inside each repo hooks directory (hide this function from admin panel if os == 'windows')

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/enhancementAn improvement of existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions