summaryrefslogtreecommitdiffstats
path: root/git_refs.py
diff options
context:
space:
mode:
authorLaMont Jones <lamontjones@google.com>2022-11-08 00:54:56 +0000
committerLaMont Jones <lamontjones@google.com>2022-11-08 00:54:56 +0000
commit5fb9c6a5b35220e27b3acd5861318584588cd0d8 (patch)
treed3d3a7d6d021e1547d9f22875aea57a717540f92 /git_refs.py
parent859d3d958057e35b618e8cca209a85317d49a974 (diff)
downloadgit-repo-5fb9c6a5b35220e27b3acd5861318584588cd0d8.tar.gz
v2.29.7: Revert back to v2.29.5v2.29.7
This change reverts stable to v2.29.5, to fix clients that received v2.29.6, and keep future updates simpler. Change-Id: I2f5c52c466b7321665c9699ccdbf98f928483fee
Diffstat (limited to 'git_refs.py')
-rw-r--r--git_refs.py57
1 files changed, 29 insertions, 28 deletions
diff --git a/git_refs.py b/git_refs.py
index 300d2b30..2d4a8090 100644
--- a/git_refs.py
+++ b/git_refs.py
@@ -67,37 +67,38 @@ class GitRefs(object):
67 self._LoadAll() 67 self._LoadAll()
68 68
69 def _NeedUpdate(self): 69 def _NeedUpdate(self):
70 with Trace(': scan refs %s', self._gitdir): 70 Trace(': scan refs %s', self._gitdir)
71 for name, mtime in self._mtime.items(): 71
72 try: 72 for name, mtime in self._mtime.items():
73 if mtime != os.path.getmtime(os.path.join(self._gitdir, name)): 73 try:
74 return True 74 if mtime != os.path.getmtime(os.path.join(self._gitdir, name)):
75 except OSError:
76 return True 75 return True
77 return False 76 except OSError:
77 return True
78 return False
78 79
79 def _LoadAll(self): 80 def _LoadAll(self):
80 with Trace(': load refs %s', self._gitdir): 81 Trace(': load refs %s', self._gitdir)
81 82
82 self._phyref = {} 83 self._phyref = {}
83 self._symref = {} 84 self._symref = {}
84 self._mtime = {} 85 self._mtime = {}
85 86
86 self._ReadPackedRefs() 87 self._ReadPackedRefs()
87 self._ReadLoose('refs/') 88 self._ReadLoose('refs/')
88 self._ReadLoose1(os.path.join(self._gitdir, HEAD), HEAD) 89 self._ReadLoose1(os.path.join(self._gitdir, HEAD), HEAD)
89 90
90 scan = self._symref 91 scan = self._symref
91 attempts = 0 92 attempts = 0
92 while scan and attempts < 5: 93 while scan and attempts < 5:
93 scan_next = {} 94 scan_next = {}
94 for name, dest in scan.items(): 95 for name, dest in scan.items():
95 if dest in self._phyref: 96 if dest in self._phyref:
96 self._phyref[name] = self._phyref[dest] 97 self._phyref[name] = self._phyref[dest]
97 else: 98 else:
98 scan_next[name] = dest 99 scan_next[name] = dest
99 scan = scan_next 100 scan = scan_next
100 attempts += 1 101 attempts += 1
101 102
102 def _ReadPackedRefs(self): 103 def _ReadPackedRefs(self):
103 path = os.path.join(self._gitdir, 'packed-refs') 104 path = os.path.join(self._gitdir, 'packed-refs')