Improvements to git-lfs behavior
Summary:
- (performance) Return a TTL from git-lfs-authenticate.
- (compliance) Return HTTP 401 for unauthenticated git-lfs requests.
- (future) Relax the requirement that the target be a Git repository.
- (future) Don't double up '/' in `getGitLFSURI()` for non-git repository types.
These improve the push speed of Git when using git-lfs, improve spec
compliance, and make it possible to support git-lfs for other repository types
in the future.
See Q168 for a little background.
Test Plan:
- Spin up new phorge install w/ ssh configured.
- Create a git repository, and enable git-lfs in config.
- Clone the repository over ssh, add some file content to be tracked with git-lfs.
- Track some content with LFS: `git lfs track '*.png'`.
- Add (created by `git lfs track`) and commit `.gitattributes`
- Add favorite memes
- Commit
- Push and observe that git receives a token with expiry, and caches it.
- Update some LFS content and push again. Observe git directly push to LFS with no extra SSH roundtrip.
- Clone a second copy, ensure that LFS content is downloaded, update a meme and push.
- Pull the content from the first copy and see again no additional roundtrip to get a new token.
Additionally confirm:
- All other normal git operations continue working
- Ensure that users w/o push access still can't push anything (LFS or otherwise.)
Reviewers: O1 Blessed Committers, aklapper, valerio.bozzolan
Reviewed By: O1 Blessed Committers, aklapper, valerio.bozzolan
Subscribers: aklapper, mainframe98, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Differential Revision: https://we.phorge.it/D26190