We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Problem with --checkout reclone
The message should ask me about recloning `/Users/audreyr/.cookiecutters/cookiecutter-pypackage`, not `/Users/audreyr/.cookiecutters`.

```
$ cookiecutter https://github.com/eliasdorneles/cookiecutter-pypackage/ -c adding-travis-setup-for-pypi-deployment
You've cloned /Users/audreyr/.cookiecutters before. Is it okay to delete and re-clone it? [yes]: 
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cookiecutter/vcs.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 """
5 cookiecutter.vcs
6 ----------------
7 
8 Helper functions for working with version control systems.
9 """
10 
11 from __future__ import unicode_literals
12 import logging
13 import os
14 import subprocess
15 import sys
16 
17 from whichcraft import which
18 
19 from .exceptions import UnknownRepoType, VCSNotInstalled
20 from .prompt import read_user_yes_no
21 from .utils import make_sure_path_exists, rmtree
22 
23 
24 def prompt_and_delete_repo(repo_dir, no_input=False):
25     """
26     Asks the user whether it's okay to delete the previously-cloned repo.
27     If yes, deletes it. Otherwise, Cookiecutter exits.
28 
29     :param repo_dir: Directory of previously-cloned repo.
30     :param no_input: Suppress prompt to delete repo and just delete it.
31     """
32 
33     # Suppress prompt if called via API
34     if no_input:
35         ok_to_delete = True
36     else:
37         question = (
38             "You've cloned {0} before. "
39             'Is it okay to delete and re-clone it?'
40         ).format(repo_dir)
41 
42         ok_to_delete = read_user_yes_no(question, 'yes')
43 
44     if ok_to_delete:
45         rmtree(repo_dir)
46     else:
47         sys.exit()
48 
49 
50 def identify_repo(repo_url):
51     """
52     Determines if `repo_url` should be treated as a URL to a git or hg repo.
53     Repos can be identified prepeding "hg+" or "git+" to repo URL.
54 
55     :param repo_url: Repo URL of unknown type.
56     :returns: ("git", repo_url), ("hg", repo_url), or None.
57     """
58     repo_url_values = repo_url.split('+')
59     if len(repo_url_values) == 2:
60         repo_type = repo_url_values[0]
61         if repo_type in ["git", "hg"]:
62             return repo_type, repo_url_values[1]
63         else:
64             raise UnknownRepoType
65     else:
66         if "git" in repo_url:
67             return "git", repo_url
68         elif "bitbucket" in repo_url:
69             return "hg", repo_url
70         else:
71             raise UnknownRepoType
72 
73 
74 def is_vcs_installed(repo_type):
75     """
76     Check if the version control system for a repo type is installed.
77 
78     :param repo_type:
79     """
80     return bool(which(repo_type))
81 
82 
83 def clone(repo_url, checkout=None, clone_to_dir=".", no_input=False):
84     """
85     Clone a repo to the current directory.
86 
87     :param repo_url: Repo URL of unknown type.
88     :param checkout: The branch, tag or commit ID to checkout after clone.
89     :param clone_to_dir: The directory to clone to.
90                          Defaults to the current directory.
91     :param no_input: Suppress all user prompts when calling via API.
92     """
93 
94     # Ensure that clone_to_dir exists
95     clone_to_dir = os.path.expanduser(clone_to_dir)
96     make_sure_path_exists(clone_to_dir)
97 
98     # identify the repo_type
99     repo_type, repo_url = identify_repo(repo_url)
100 
101     # check that the appropriate VCS for the repo_type is installed
102     if not is_vcs_installed(repo_type):
103         msg = "'{0}' is not installed.".format(repo_type)
104         raise VCSNotInstalled(msg)
105 
106     tail = os.path.split(repo_url)[1]
107     if repo_type == 'git':
108         repo_dir = os.path.normpath(os.path.join(clone_to_dir,
109                                                  tail.rsplit('.git')[0]))
110     elif repo_type == 'hg':
111         repo_dir = os.path.normpath(os.path.join(clone_to_dir, tail))
112     logging.debug('repo_dir is {0}'.format(repo_dir))
113 
114     if os.path.isdir(repo_dir):
115         prompt_and_delete_repo(repo_dir, no_input=no_input)
116 
117     if repo_type in ['git', 'hg']:
118         subprocess.check_call([repo_type, 'clone', repo_url], cwd=clone_to_dir)
119         if checkout is not None:
120             subprocess.check_call([repo_type, 'checkout', checkout],
121                                   cwd=repo_dir)
122 
123     return repo_dir
124
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cookiecutter/vcs.py b/cookiecutter/vcs.py
--- a/cookiecutter/vcs.py
+++ b/cookiecutter/vcs.py
@@ -103,6 +103,7 @@
         msg = "'{0}' is not installed.".format(repo_type)
         raise VCSNotInstalled(msg)
 
+    repo_url = repo_url.rstrip('/')
     tail = os.path.split(repo_url)[1]
     if repo_type == 'git':
         repo_dir = os.path.normpath(os.path.join(clone_to_dir,

{"golden_diff": "diff --git a/cookiecutter/vcs.py b/cookiecutter/vcs.py\n--- a/cookiecutter/vcs.py\n+++ b/cookiecutter/vcs.py\n@@ -103,6 +103,7 @@\n         msg = \"'{0}' is not installed.\".format(repo_type)\n         raise VCSNotInstalled(msg)\n \n+    repo_url = repo_url.rstrip('/')\n     tail = os.path.split(repo_url)[1]\n     if repo_type == 'git':\n         repo_dir = os.path.normpath(os.path.join(clone_to_dir,\n", "issue": "Problem with --checkout reclone\nThe message should ask me about recloning `/Users/audreyr/.cookiecutters/cookiecutter-pypackage`, not `/Users/audreyr/.cookiecutters`.\n\n```\n$ cookiecutter https://github.com/eliasdorneles/cookiecutter-pypackage/ -c adding-travis-setup-for-pypi-deployment\nYou've cloned /Users/audreyr/.cookiecutters before. Is it okay to delete and re-clone it? [yes]: \n```\n\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ncookiecutter.vcs\n----------------\n\nHelper functions for working with version control systems.\n\"\"\"\n\nfrom __future__ import unicode_literals\nimport logging\nimport os\nimport subprocess\nimport sys\n\nfrom whichcraft import which\n\nfrom .exceptions import UnknownRepoType, VCSNotInstalled\nfrom .prompt import read_user_yes_no\nfrom .utils import make_sure_path_exists, rmtree\n\n\ndef prompt_and_delete_repo(repo_dir, no_input=False):\n    \"\"\"\n    Asks the user whether it's okay to delete the previously-cloned repo.\n    If yes, deletes it. Otherwise, Cookiecutter exits.\n\n    :param repo_dir: Directory of previously-cloned repo.\n    :param no_input: Suppress prompt to delete repo and just delete it.\n    \"\"\"\n\n    # Suppress prompt if called via API\n    if no_input:\n        ok_to_delete = True\n    else:\n        question = (\n            \"You've cloned {0} before. \"\n            'Is it okay to delete and re-clone it?'\n        ).format(repo_dir)\n\n        ok_to_delete = read_user_yes_no(question, 'yes')\n\n    if ok_to_delete:\n        rmtree(repo_dir)\n    else:\n        sys.exit()\n\n\ndef identify_repo(repo_url):\n    \"\"\"\n    Determines if `repo_url` should be treated as a URL to a git or hg repo.\n    Repos can be identified prepeding \"hg+\" or \"git+\" to repo URL.\n\n    :param repo_url: Repo URL of unknown type.\n    :returns: (\"git\", repo_url), (\"hg\", repo_url), or None.\n    \"\"\"\n    repo_url_values = repo_url.split('+')\n    if len(repo_url_values) == 2:\n        repo_type = repo_url_values[0]\n        if repo_type in [\"git\", \"hg\"]:\n            return repo_type, repo_url_values[1]\n        else:\n            raise UnknownRepoType\n    else:\n        if \"git\" in repo_url:\n            return \"git\", repo_url\n        elif \"bitbucket\" in repo_url:\n            return \"hg\", repo_url\n        else:\n            raise UnknownRepoType\n\n\ndef is_vcs_installed(repo_type):\n    \"\"\"\n    Check if the version control system for a repo type is installed.\n\n    :param repo_type:\n    \"\"\"\n    return bool(which(repo_type))\n\n\ndef clone(repo_url, checkout=None, clone_to_dir=\".\", no_input=False):\n    \"\"\"\n    Clone a repo to the current directory.\n\n    :param repo_url: Repo URL of unknown type.\n    :param checkout: The branch, tag or commit ID to checkout after clone.\n    :param clone_to_dir: The directory to clone to.\n                         Defaults to the current directory.\n    :param no_input: Suppress all user prompts when calling via API.\n    \"\"\"\n\n    # Ensure that clone_to_dir exists\n    clone_to_dir = os.path.expanduser(clone_to_dir)\n    make_sure_path_exists(clone_to_dir)\n\n    # identify the repo_type\n    repo_type, repo_url = identify_repo(repo_url)\n\n    # check that the appropriate VCS for the repo_type is installed\n    if not is_vcs_installed(repo_type):\n        msg = \"'{0}' is not installed.\".format(repo_type)\n        raise VCSNotInstalled(msg)\n\n    tail = os.path.split(repo_url)[1]\n    if repo_type == 'git':\n        repo_dir = os.path.normpath(os.path.join(clone_to_dir,\n                                                 tail.rsplit('.git')[0]))\n    elif repo_type == 'hg':\n        repo_dir = os.path.normpath(os.path.join(clone_to_dir, tail))\n    logging.debug('repo_dir is {0}'.format(repo_dir))\n\n    if os.path.isdir(repo_dir):\n        prompt_and_delete_repo(repo_dir, no_input=no_input)\n\n    if repo_type in ['git', 'hg']:\n        subprocess.check_call([repo_type, 'clone', repo_url], cwd=clone_to_dir)\n        if checkout is not None:\n            subprocess.check_call([repo_type, 'checkout', checkout],\n                                  cwd=repo_dir)\n\n    return repo_dir\n", "path": "cookiecutter/vcs.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ncookiecutter.vcs\n----------------\n\nHelper functions for working with version control systems.\n\"\"\"\n\nfrom __future__ import unicode_literals\nimport logging\nimport os\nimport subprocess\nimport sys\n\nfrom whichcraft import which\n\nfrom .exceptions import UnknownRepoType, VCSNotInstalled\nfrom .prompt import read_user_yes_no\nfrom .utils import make_sure_path_exists, rmtree\n\n\ndef prompt_and_delete_repo(repo_dir, no_input=False):\n    \"\"\"\n    Asks the user whether it's okay to delete the previously-cloned repo.\n    If yes, deletes it. Otherwise, Cookiecutter exits.\n\n    :param repo_dir: Directory of previously-cloned repo.\n    :param no_input: Suppress prompt to delete repo and just delete it.\n    \"\"\"\n\n    # Suppress prompt if called via API\n    if no_input:\n        ok_to_delete = True\n    else:\n        question = (\n            \"You've cloned {0} before. \"\n            'Is it okay to delete and re-clone it?'\n        ).format(repo_dir)\n\n        ok_to_delete = read_user_yes_no(question, 'yes')\n\n    if ok_to_delete:\n        rmtree(repo_dir)\n    else:\n        sys.exit()\n\n\ndef identify_repo(repo_url):\n    \"\"\"\n    Determines if `repo_url` should be treated as a URL to a git or hg repo.\n    Repos can be identified prepeding \"hg+\" or \"git+\" to repo URL.\n\n    :param repo_url: Repo URL of unknown type.\n    :returns: (\"git\", repo_url), (\"hg\", repo_url), or None.\n    \"\"\"\n    repo_url_values = repo_url.split('+')\n    if len(repo_url_values) == 2:\n        repo_type = repo_url_values[0]\n        if repo_type in [\"git\", \"hg\"]:\n            return repo_type, repo_url_values[1]\n        else:\n            raise UnknownRepoType\n    else:\n        if \"git\" in repo_url:\n            return \"git\", repo_url\n        elif \"bitbucket\" in repo_url:\n            return \"hg\", repo_url\n        else:\n            raise UnknownRepoType\n\n\ndef is_vcs_installed(repo_type):\n    \"\"\"\n    Check if the version control system for a repo type is installed.\n\n    :param repo_type:\n    \"\"\"\n    return bool(which(repo_type))\n\n\ndef clone(repo_url, checkout=None, clone_to_dir=\".\", no_input=False):\n    \"\"\"\n    Clone a repo to the current directory.\n\n    :param repo_url: Repo URL of unknown type.\n    :param checkout: The branch, tag or commit ID to checkout after clone.\n    :param clone_to_dir: The directory to clone to.\n                         Defaults to the current directory.\n    :param no_input: Suppress all user prompts when calling via API.\n    \"\"\"\n\n    # Ensure that clone_to_dir exists\n    clone_to_dir = os.path.expanduser(clone_to_dir)\n    make_sure_path_exists(clone_to_dir)\n\n    # identify the repo_type\n    repo_type, repo_url = identify_repo(repo_url)\n\n    # check that the appropriate VCS for the repo_type is installed\n    if not is_vcs_installed(repo_type):\n        msg = \"'{0}' is not installed.\".format(repo_type)\n        raise VCSNotInstalled(msg)\n\n    repo_url = repo_url.rstrip('/')\n    tail = os.path.split(repo_url)[1]\n    if repo_type == 'git':\n        repo_dir = os.path.normpath(os.path.join(clone_to_dir,\n                                                 tail.rsplit('.git')[0]))\n    elif repo_type == 'hg':\n        repo_dir = os.path.normpath(os.path.join(clone_to_dir, tail))\n    logging.debug('repo_dir is {0}'.format(repo_dir))\n\n    if os.path.isdir(repo_dir):\n        prompt_and_delete_repo(repo_dir, no_input=no_input)\n\n    if repo_type in ['git', 'hg']:\n        subprocess.check_call([repo_type, 'clone', repo_url], cwd=clone_to_dir)\n        if checkout is not None:\n            subprocess.check_call([repo_type, 'checkout', checkout],\n                                  cwd=repo_dir)\n\n    return repo_dir\n", "path": "cookiecutter/vcs.py"}]}