summaryrefslogtreecommitdiffstats
path: root/git_command.py
diff options
context:
space:
mode:
authorSam Saccone <samccone@google.com>2022-11-15 14:59:39 -0800
committerSam Saccone <samccone@google.com>2022-11-16 18:26:49 +0000
commitd3cadf18569afa3918be4bbc3f502cd70b650d59 (patch)
tree09e7c7d15060d6f063b5ea165442041dd9b54164 /git_command.py
parentfa90f7a36f3137e28065cd1a463153c724930e01 (diff)
downloadgit-repo-d3cadf18569afa3918be4bbc3f502cd70b650d59.tar.gz
Do not set ALT object dirs when said path resolves to the same dir.
Due to symlink resolution git was treating this as two different directories even if the paths were the same. This mitigates the git core bug inside of repo (while the git core fix is being worked on). Bug: b/255376186 Bug: https://crbug.com/gerrit/16247 Change-Id: I12458ee04c307be916851dddd36231997bc8839e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/351836 Tested-by: Sam Saccone <samccone@google.com> Reviewed-by: LaMont Jones <lamontjones@google.com>
Diffstat (limited to 'git_command.py')
-rw-r--r--git_command.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/git_command.py b/git_command.py
index 56e18e02..01b9ecb3 100644
--- a/git_command.py
+++ b/git_command.py
@@ -207,10 +207,12 @@ class GitCommand(object):
207 if objdir: 207 if objdir:
208 # Set to the place we want to save the objects. 208 # Set to the place we want to save the objects.
209 env['GIT_OBJECT_DIRECTORY'] = objdir 209 env['GIT_OBJECT_DIRECTORY'] = objdir
210 if gitdir: 210
211 alt_objects = os.path.join(gitdir, 'objects') if gitdir else None
212 if alt_objects and os.path.realpath(alt_objects) != os.path.realpath(objdir):
211 # Allow git to search the original place in case of local or unique refs 213 # Allow git to search the original place in case of local or unique refs
212 # that git will attempt to resolve even if we aren't fetching them. 214 # that git will attempt to resolve even if we aren't fetching them.
213 env['GIT_ALTERNATE_OBJECT_DIRECTORIES'] = gitdir + '/objects' 215 env['GIT_ALTERNATE_OBJECT_DIRECTORIES'] = alt_objects
214 216
215 command = [GIT] 217 command = [GIT]
216 if bare: 218 if bare: