Access remote git repositories (ssh scheme url) without a raw file url.
Review Request #4910 — Created Nov. 6, 2013 and discarded — Latest diff uploaded
Access remote git repositories (ssh scheme url) without a raw file url.
Git-shell, as usually configured on ssh git servers, allows executing
arbitrary commands. This patch uses this feature to avoid having to setup
an http server for raw files.To use this feature:
1. Set both path and mirror path to the same ssh git url, without the .git
sufix.2. Leave raw file url mask empty.
3. Add the following script in ~/git-shell-commans/rb-cat-file:
------------
#!/usr/bin/env sh
git --git-dir="$1/.git" cat-file $2 $3
------------This assumes that ssh authentication is working, by having setup the
proper ssh authorization at the server.
This has been tested in release 1.7.16 (current Fedora rpm installation) with a remote git repo on a different server. It works for submitting and updating review requests from rbt and the web interface.
Tests with invalid setups are as follows:
Missing chsh to git-shell:
$ rbt post -g
ERROR:root:Error uploading diffOne or more fields had errors (HTTP 400, API Error 105)
path: bash: rb-cat-file: command not found
Your review request still exists, but the diff is not attached.
Not chmod-ing the script 755:
$ rbt post -g
ERROR:root:Error uploading diffOne or more fields had errors (HTTP 400, API Error 105)
path: fatal: unrecognized command 'rb-cat-file /path/to/repo -t pha7AhquZa7icohBeoPh2AjuuthaiNg4faiMi9oo'
Your review request still exists, but the diff is not attached.
Not having the script at all:
$ rbt post -g
ERROR:root:Error uploading diffOne or more fields had errors (HTTP 400, API Error 105)
path: fatal: unrecognized command 'rb-cat-file /path/to/repo -t pha7AhquZa7icohBeoPh2AjuuthaiNg4faiMi9oo'
Your review request still exists, but the diff is not attached.
- Any of the above from the web interface: the same error (i.e. the "path:" line) appears in red by the diff selector.
Corrupting the commit id fed to the script (this can only be done by changing the source code):
$ rbt post -g
ERROR:root:Error uploading diffThe file was not found in the repository (HTTP 400, API Error 207)
Your review request still exists, but the diff is not attached.
- Corrupting the commit id fed to the script in the web interface (this can only be done by changing the source code):
"The file 'README' (rd702173) could not be found in the repository" appears in red by the diff selector.