| | |
| | | /* |
| | | * Copyright (C) 2009 The Android Open Source Project |
| | | * Copyright 2014 gitblit.com. |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | |
| | | import com.gitblit.transport.ssh.SshDaemonClient; |
| | | import com.gitblit.transport.ssh.commands.BaseCommand; |
| | | |
| | | /** |
| | | * @author Eric Myhre |
| | | * |
| | | */ |
| | | abstract class BaseGitCommand extends BaseCommand { |
| | | @Argument(index = 0, metaVar = "REPOSITORY", required = true, usage = "repository name") |
| | | protected String repository; |
| | |
| | | repository = repository.replace('\\', '/'); |
| | | // ssh://git@thishost/path should always be name="/path" here |
| | | // |
| | | if (!repository.startsWith("/")) { |
| | | throw new Failure(1, "fatal: '" + repository + "': not starts with / character"); |
| | | if (repository.startsWith("/")) { |
| | | repository = repository.substring(1); |
| | | } |
| | | repository = repository.substring(1); |
| | | try { |
| | | return repositoryResolver.open(getContext().getClient(), repository); |
| | | } catch (Exception e) { |