diff options
author | Remy Bohmer <github@bohmer.net> | 2020-11-21 10:57:52 +0100 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2020-11-23 09:17:32 +0000 |
commit | 169b0218b384f04426d7509757a8684f957967bf (patch) | |
tree | a1bf75fce87a110ce0e5c2a74107aefb978da13d /project.py | |
parent | 44bc9643ed1b53ef72a0f4089c80ca8ef7310c7a (diff) | |
download | git-repo-169b0218b384f04426d7509757a8684f957967bf.tar.gz |
Fix --reference option under Windows
When intializing a new repo with the --reference option on Windows 10
the objects/info/alternates in each git repository is created with
Windows line endings (\r\n), leading to the following error:
error: object directory C:/<PATH_TO_MIRROR>/<REPO_NAME>.git/objects?
does not exist; check .git/objects/info/alternates
This can be fixed by simply using unix line endings on both
Windows and unix platforms.
Reported-by: Francisco Javier Alvarez Garcia <javier.alvarez.garcia.17@gmail.com>
Follow-up-from: I268fe029ede68802c21037b0f2ae8a95afb85e48
Bug: https://crbug.com/gerrit/13208
Change-Id: I6da60c4ca957778b3c42ab6b9ad85c40483f0042
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/289431
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Remy Bohmer <oss@bohmer.net>
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -62,7 +62,8 @@ RETRY_JITTER_PERCENT = 0.1 | |||
62 | def _lwrite(path, content): | 62 | def _lwrite(path, content): |
63 | lock = '%s.lock' % path | 63 | lock = '%s.lock' % path |
64 | 64 | ||
65 | with open(lock, 'w') as fd: | 65 | # Maintain Unix line endings on all OS's to match git behavior. |
66 | with open(lock, 'w', newline='\n') as fd: | ||
66 | fd.write(content) | 67 | fd.write(content) |
67 | 68 | ||
68 | try: | 69 | try: |