diff --git a/git-ftp.py b/git-ftp.py index f4453ee..2548b84 100755 --- a/git-ftp.py +++ b/git-ftp.py @@ -145,7 +145,15 @@ def main(): raise FtpSslNotSupported("Python is too old for FTP SSL. Try using Python 2.7 or later.") else: ftp = ftplib.FTP(options.ftp.hostname, options.ftp.username, options.ftp.password) - ftp.cwd(base) + + # Make the base directory an absolute path - it is required for the subsequent steps + if base[0] != '/': + base = os.path.join(ftp.pwd(), base) + + try: + ftp.cwd(base) + except ftplib.error_perm: + raise ValueError("FTP base directory '%s' does not exist on this server (note: the server session starts at '%s')" % (base, ftp.pwd())) # Check revision hash = options.revision