Dulwich.io dulwich / e67d176
Properly handle files that are just executable for the current user. Fixes #734 Jelmer Vernooń≥ a month ago
3 changed file(s) with 15 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
00 0.19.15 UNRELEASED
1
2 * Properly handle files that are just executable for the
3 current user. (Jelmer Vernooń≥, #734)
14
25 0.19.14 2019-11-30
36
206206 elif S_ISGITLINK(mode):
207207 return S_IFGITLINK
208208 ret = stat.S_IFREG | 0o644
209 ret |= (mode & 0o111)
209 if mode & 0o100:
210 ret |= 0o111
210211 return ret
211212
212213
325326 """
326327 def lookup_entry(path):
327328 entry = self[path]
328 return entry.sha, entry.mode
329 return entry.sha, cleanup_mode(entry.mode)
329330 for (name, mode, sha) in changes_from_tree(
330331 self._byname.keys(), lookup_entry, object_store, tree,
331332 want_unchanged=want_unchanged):
228228
229229 class CleanupModeTests(TestCase):
230230
231 def assertModeEqual(self, expected, got):
232 self.assertEqual(expected, got, '%o != %o' % (expected, got))
233
231234 def test_file(self):
232 self.assertEqual(0o100644, cleanup_mode(0o100000))
235 self.assertModeEqual(0o100644, cleanup_mode(0o100000))
233236
234237 def test_executable(self):
235 self.assertEqual(0o100755, cleanup_mode(0o100711))
238 self.assertModeEqual(0o100755, cleanup_mode(0o100711))
239 self.assertModeEqual(0o100755, cleanup_mode(0o100700))
236240
237241 def test_symlink(self):
238 self.assertEqual(0o120000, cleanup_mode(0o120711))
242 self.assertModeEqual(0o120000, cleanup_mode(0o120711))
239243
240244 def test_dir(self):
241 self.assertEqual(0o040000, cleanup_mode(0o40531))
245 self.assertModeEqual(0o040000, cleanup_mode(0o40531))
242246
243247 def test_submodule(self):
244 self.assertEqual(0o160000, cleanup_mode(0o160744))
248 self.assertModeEqual(0o160000, cleanup_mode(0o160744))
245249
246250
247251 class WriteCacheTimeTests(TestCase):