prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Can't use ruby 2.7.1 on MacOS
  Hi, 
  
  Bumping my ruby hooks to version 2.7.1 worked fine for me on Ubuntu but doesn't work for my colleagues using MacOS, is there something to do about bumping rbenv archives ? 
  
  Thanks
  
  </issue>
  <code>
  [start of pre_commit/make_archives.py]
  1 import argparse
  2 import os.path
  3 import tarfile
  4 from typing import Optional
  5 from typing import Sequence
  6 
  7 from pre_commit import output
  8 from pre_commit.util import cmd_output_b
  9 from pre_commit.util import rmtree
  10 from pre_commit.util import tmpdir
  11 
  12 
  13 # This is a script for generating the tarred resources for git repo
  14 # dependencies.  Currently it's just for "vendoring" ruby support packages.
  15 
  16 
  17 REPOS = (
  18     ('rbenv', 'git://github.com/rbenv/rbenv', 'a3fa9b7'),
  19     ('ruby-build', 'git://github.com/rbenv/ruby-build', '1a902f3'),
  20     (
  21         'ruby-download',
  22         'git://github.com/garnieretienne/rvm-download',
  23         '09bd7c6',
  24     ),
  25 )
  26 
  27 
  28 def make_archive(name: str, repo: str, ref: str, destdir: str) -> str:
  29     """Makes an archive of a repository in the given destdir.
  30 
  31     :param text name: Name to give the archive.  For instance foo.  The file
  32     that is created will be called foo.tar.gz.
  33     :param text repo: Repository to clone.
  34     :param text ref: Tag/SHA/branch to check out.
  35     :param text destdir: Directory to place archives in.
  36     """
  37     output_path = os.path.join(destdir, f'{name}.tar.gz')
  38     with tmpdir() as tempdir:
  39         # Clone the repository to the temporary directory
  40         cmd_output_b('git', 'clone', repo, tempdir)
  41         cmd_output_b('git', 'checkout', ref, cwd=tempdir)
  42 
  43         # We don't want the '.git' directory
  44         # It adds a bunch of size to the archive and we don't use it at
  45         # runtime
  46         rmtree(os.path.join(tempdir, '.git'))
  47 
  48         with tarfile.open(output_path, 'w|gz') as tf:
  49             tf.add(tempdir, name)
  50 
  51     return output_path
  52 
  53 
  54 def main(argv: Optional[Sequence[str]] = None) -> int:
  55     parser = argparse.ArgumentParser()
  56     parser.add_argument('--dest', default='pre_commit/resources')
  57     args = parser.parse_args(argv)
  58     for archive_name, repo, ref in REPOS:
  59         output.write_line(f'Making {archive_name}.tar.gz for {repo}@{ref}')
  60         make_archive(archive_name, repo, ref, args.dest)
  61     return 0
  62 
  63 
  64 if __name__ == '__main__':
  65     exit(main())
  66
  [end of pre_commit/make_archives.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/pre_commit/make_archives.py b/pre_commit/make_archives.py
  --- a/pre_commit/make_archives.py
  +++ b/pre_commit/make_archives.py
  @@ -15,8 +15,8 @@
   
   
   REPOS = (
  -    ('rbenv', 'git://github.com/rbenv/rbenv', 'a3fa9b7'),
  -    ('ruby-build', 'git://github.com/rbenv/ruby-build', '1a902f3'),
  +    ('rbenv', 'git://github.com/rbenv/rbenv', '0843745'),
  +    ('ruby-build', 'git://github.com/rbenv/ruby-build', '258455e'),
       (
           'ruby-download',
           'git://github.com/garnieretienne/rvm-download',
  
verification_info: {"golden_diff": "diff --git a/pre_commit/make_archives.py b/pre_commit/make_archives.py\n--- a/pre_commit/make_archives.py\n+++ b/pre_commit/make_archives.py\n@@ -15,8 +15,8 @@\n \n \n REPOS = (\n-    ('rbenv', 'git://github.com/rbenv/rbenv', 'a3fa9b7'),\n-    ('ruby-build', 'git://github.com/rbenv/ruby-build', '1a902f3'),\n+    ('rbenv', 'git://github.com/rbenv/rbenv', '0843745'),\n+    ('ruby-build', 'git://github.com/rbenv/ruby-build', '258455e'),\n     (\n         'ruby-download',\n         'git://github.com/garnieretienne/rvm-download',\n", "issue": "Can't use ruby 2.7.1 on MacOS\nHi, \r\n\r\nBumping my ruby hooks to version 2.7.1 worked fine for me on Ubuntu but doesn't work for my colleagues using MacOS, is there something to do about bumping rbenv archives ? \r\n\r\nThanks\n", "before_files": [{"content": "import argparse\nimport os.path\nimport tarfile\nfrom typing import Optional\nfrom typing import Sequence\n\nfrom pre_commit import output\nfrom pre_commit.util import cmd_output_b\nfrom pre_commit.util import rmtree\nfrom pre_commit.util import tmpdir\n\n\n# This is a script for generating the tarred resources for git repo\n# dependencies.  Currently it's just for \"vendoring\" ruby support packages.\n\n\nREPOS = (\n    ('rbenv', 'git://github.com/rbenv/rbenv', 'a3fa9b7'),\n    ('ruby-build', 'git://github.com/rbenv/ruby-build', '1a902f3'),\n    (\n        'ruby-download',\n        'git://github.com/garnieretienne/rvm-download',\n        '09bd7c6',\n    ),\n)\n\n\ndef make_archive(name: str, repo: str, ref: str, destdir: str) -> str:\n    \"\"\"Makes an archive of a repository in the given destdir.\n\n    :param text name: Name to give the archive.  For instance foo.  The file\n    that is created will be called foo.tar.gz.\n    :param text repo: Repository to clone.\n    :param text ref: Tag/SHA/branch to check out.\n    :param text destdir: Directory to place archives in.\n    \"\"\"\n    output_path = os.path.join(destdir, f'{name}.tar.gz')\n    with tmpdir() as tempdir:\n        # Clone the repository to the temporary directory\n        cmd_output_b('git', 'clone', repo, tempdir)\n        cmd_output_b('git', 'checkout', ref, cwd=tempdir)\n\n        # We don't want the '.git' directory\n        # It adds a bunch of size to the archive and we don't use it at\n        # runtime\n        rmtree(os.path.join(tempdir, '.git'))\n\n        with tarfile.open(output_path, 'w|gz') as tf:\n            tf.add(tempdir, name)\n\n    return output_path\n\n\ndef main(argv: Optional[Sequence[str]] = None) -> int:\n    parser = argparse.ArgumentParser()\n    parser.add_argument('--dest', default='pre_commit/resources')\n    args = parser.parse_args(argv)\n    for archive_name, repo, ref in REPOS:\n        output.write_line(f'Making {archive_name}.tar.gz for {repo}@{ref}')\n        make_archive(archive_name, repo, ref, args.dest)\n    return 0\n\n\nif __name__ == '__main__':\n    exit(main())\n", "path": "pre_commit/make_archives.py"}]}