Mercurial > kallithea
annotate scripts/whitespacecleanup.sh @ 7633:1bafb2d07709 stable
hooks: make the Python interpreter for Git hooks configurable as 'git_hook_interpreter' (Issue #333)
Commit 5e501b6ee639 introduced the use of 'sys.executable' as interpreter
for git hooks instead of 'python2' with the following argument:
"Windows doesn't necessarily have "python2" available in $PATH, but we
still want to make sure we don't end up invoking a python3. Using the
absolute path seems more safe."
But, sys.executable does not necessarily point to Python. When Kallithea is
started under uWSGI, sys.executable points to the uwsgi executable. As a
result, the interpreter encoded in the git hooks on the server repositories
would be:
#!/path/to/uwsgi
And pushing to such repo would result in following client errors:
$ git push
Password for 'http://user@localhost:5050':
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 241 bytes | 241.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: unable to load configuration from hooks/pre-receive
To http://localhost:5050/gitrepo-new
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://user@localhost:5050/gitrepo-new'
Fix this problem by introducing a configuration setting 'git_hook_interpreter'
that allow administrators to specify which Python interpreter to use.
A subsequent commit will cause its value to be filled in automatically when
generating a new ini file, but an administrator can always override it.
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Mon, 08 Apr 2019 21:32:57 +0200 |
parents | f78aa989c9ff |
children | 5698307382de |
rev | line source |
---|---|
4727
9cf229b46e49
whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
1 #!/bin/bash -x |
9cf229b46e49
whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
2 |
9cf229b46e49
whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
3 # Enforce some consistency in whitespace - just to avoid spurious whitespaces changes |
9cf229b46e49
whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
4 |
7470
f78aa989c9ff
front-end: More clean-up after YUI is gone
Mads Kiilerich <mads@kiilerich.com>
parents:
7466
diff
changeset
|
5 files=`hg mani | egrep -v '/fontello/|/email_templates/|(/lockfiles.py|^LICENSE-MERGELY.html|^docs/Makefile|^scripts/whitespacecleanup.sh|/(graph|mergely|native.history)\.js|/test_dump_html_mails.ref.html|\.png|\.gif|\.ico|\.pot|\.po|\.mo|\.tar\.gz|\.diff)$'` |
5379
1949ece749ce
cleanup: fix whitespace in CONTRIBUTORS (and other forgotten files) too
Mads Kiilerich <madski@unity3d.com>
parents:
5378
diff
changeset
|
6 |
6390
6e952212bf06
scripts: ensure unix line endings
Mads Kiilerich <mads@kiilerich.com>
parents:
6370
diff
changeset
|
7 sed -i "s/`printf '\r'`//g" $files |
5378
bdfba68cdfea
cleanup: remove empty trailing lines
Mads Kiilerich <madski@unity3d.com>
parents:
5330
diff
changeset
|
8 sed -i -e "s,`printf '\t'`, ,g" $files |
bdfba68cdfea
cleanup: remove empty trailing lines
Mads Kiilerich <madski@unity3d.com>
parents:
5330
diff
changeset
|
9 sed -i -e "s, *$,,g" $files |
5598
edb24bc0f71a
cleanup: consistent space before line continuation backslash
Mads Kiilerich <madski@unity3d.com>
parents:
5517
diff
changeset
|
10 sed -i -e 's,\([^ ]\)\\$,\1 \\,g' -e 's,\(["'"'"']["'"'"']["'"'"']\) \\$,\1\\,g' $files |
5378
bdfba68cdfea
cleanup: remove empty trailing lines
Mads Kiilerich <madski@unity3d.com>
parents:
5330
diff
changeset
|
11 # ensure one trailing newline - remove empty last line and make last line include trailing newline: |
bdfba68cdfea
cleanup: remove empty trailing lines
Mads Kiilerich <madski@unity3d.com>
parents:
5330
diff
changeset
|
12 sed -i -e '$,${/^$/d}' -e '$a\' $files |
4727
9cf229b46e49
whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
13 |
5378
bdfba68cdfea
cleanup: remove empty trailing lines
Mads Kiilerich <madski@unity3d.com>
parents:
5330
diff
changeset
|
14 sed -i -e 's,\([^ /]\){,\1 {,g' `hg loc '*.css'` |
bdfba68cdfea
cleanup: remove empty trailing lines
Mads Kiilerich <madski@unity3d.com>
parents:
5330
diff
changeset
|
15 sed -i -e 's|^\([^ /].*,\)\([^ ]\)|\1 \2|g' `hg loc '*.css'` |
4727
9cf229b46e49
whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
16 |
5390
530bcb645d32
cleanup: set reasonable x bits
Mads Kiilerich <madski@unity3d.com>
parents:
5379
diff
changeset
|
17 hg mani | xargs chmod -x |
530bcb645d32
cleanup: set reasonable x bits
Mads Kiilerich <madski@unity3d.com>
parents:
5379
diff
changeset
|
18 hg loc 'set:!binary()&grep("^#!")&!(**_tmpl.py)&!(**/template**)' | xargs chmod +x |
530bcb645d32
cleanup: set reasonable x bits
Mads Kiilerich <madski@unity3d.com>
parents:
5379
diff
changeset
|
19 |
4727
9cf229b46e49
whitespacecleanup.sh - run regularly to ensure consistent spacing and avoid spurious changes
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
20 hg diff |