improve back-compat of post-receive hook

* init: Improve generated post-receive hook, so it won't fail when
  run on a system whose git-annex is too old to support git-annex post-receive
* init: Update the post-receive hook when re-run in an existing repository.

This commit was sponsored by Jack Hill on Patreon.
This commit is contained in:
Joey Hess 2018-09-25 15:02:12 -04:00
parent fc8be1980c
commit 177e45517f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 74 additions and 30 deletions

View file

@ -65,3 +65,5 @@ tai@trasa:~$
I did not hit enter, the script just failed on me during tab-complete and exited.
Thanks, I look forward to any response from the community this might get.
> [[fixed|done]] --[[Joey]]

View file

@ -0,0 +1,22 @@
[[!comment format=mdwn
username="joey"
subject="""comment 1"""
date="2018-09-25T18:17:59Z"
content="""
> When I try to use that drive with my raspberry pi, however, there are some new git hooks (or at least one) that the older version of git annex (still the latest available in the Pi's repos, 2016, which is really old :/).
Ok, that sentance no verb. But I'll make a guess what you meant to say..
The old post-receive hook installed by the new version of git-annex runs
"git-annex post-receive", which fails on the old version of git-annex.
Yes, it's fine to delete the hook in this situation.
The fist version of git-annex to support that is 6.20170228.
The latest raspbian release is tracking debian stable AFAICS, which has
6.20170101, just slightly too old.
I agree this is a backwards compatability problem that should have been avoided.
I've made `git annex init` generate a better hook script that won't fail
with an older git-annex version. You can re-run `git annex init` in
your repository and it will update the hook script.
"""]]