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

Closed
opened 2025-11-02 04:58:41 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @SagePtr on GitHub (Mar 13, 2019).

  • 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')

Originally created by @SagePtr on GitHub (Mar 13, 2019). - Gitea version (or commit ref): 1.7.4 - Git version: 2.17.1 - Operating system: linux - Database (use `[x]`): - [x] Not relevant - Can you reproduce the bug at https://try.gitea.io: - [x] 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')
GiteaMirror added the issue/confirmedtype/enhancement labels 2025-11-02 04:58:41 -06:00
Author
Owner

@stale[bot] commented on GitHub (May 19, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (May 19, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@zeripath commented on GitHub (May 19, 2019):

So looking at:

8de76b6e64/models/repo.go (L953-L990)

The gitea hooks should be being recreated with their executable bit set.

@zeripath commented on GitHub (May 19, 2019): So looking at: https://github.com/go-gitea/gitea/blob/8de76b6e646e91c41143242dc0a8d3ae05b35023/models/repo.go#L953-L990 The gitea hooks should be being recreated with their executable bit set.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3043