When a program is called via ssh's '-c' option, the login shell is called on the remote computer, with the given arguments. In the case that Git was specified as login shell in /etc/passwd, Git used to complain that it does not know the '-c' option and die. This commit assumes that '-c' indicates that Git was specified as a login shell, and hands off to git-shell. Noticed by Tommi Virtanen. Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> --- This should be pretty uncontroversial, as it turns a former error into something useful. However, I would not know where in the documentation (in addition to git-shell.txt, I guess), this change should be described. git.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/git.c b/git.c index 2fd74c4..b16736a 100644 --- a/git.c +++ b/git.c @@ -419,14 +419,23 @@ static void execv_dashed_external(const char **argv) int main(int argc, const char **argv) { const char *cmd = argv[0] && *argv[0] ? argv[0] : "git-help"; - char *slash = (char *)cmd + strlen(cmd); + char *slash; int done_alias = 0; /* + * When Git is called with "-c", it is either an error, or Git + * was specified as a login shell in /etc/passwd. Assuming the + * latter, we continue with git-shell. + */ + if (argc > 2 && !strcmp(argv[1], "-c")) + cmd = "git-shell"; + + /* * Take the basename of argv[0] as the command * name, and the dirname as the default exec_path * if we don't have anything better. */ + slash = (char *)cmd + strlen(cmd); while (cmd <= slash && !is_dir_sep(*slash)) slash--; if (slash < cmd) { -- 1.6.0.211.ga840e.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html