Merge lp:~jelmer/brz/git-wt-reference into lp:brz

Proposed by Jelmer Vernooij on 2019-02-05
Status: Merged
Approved by: Jelmer Vernooij on 2019-02-14
Approved revision: 7268
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/git-wt-reference
Merge into: lp:brz
Diff against target: 75 lines (+37/-7)
3 files modified
breezy/git/tests/test_workingtree.py (+23/-0)
breezy/git/workingtree.py (+11/-7)
doc/en/release-notes/brz-3.0.txt (+3/-0)
To merge this branch: bzr merge lp:~jelmer/brz/git-wt-reference
Reviewer Review Type Date Requested Status
Martin Packman 2019-02-05 Approve on 2019-02-14
Review via email: mp+362710@code.launchpad.net

Commit message

Don't report .git files as unknown.

Description of the change

Don't report .git files as unknown.

.git files are used for referencing git locations, and commonly used in submodules.

To post a comment you must log in.
lp:~jelmer/brz/git-wt-reference updated on 2019-02-05
7268. By Jelmer Vernooij on 2019-02-05

Cope with non-utf8 characters.

Martin Packman (gz) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/git/tests/test_workingtree.py'
2--- breezy/git/tests/test_workingtree.py 2018-11-17 16:19:11 +0000
3+++ breezy/git/tests/test_workingtree.py 2019-02-05 04:00:59 +0000
4@@ -91,6 +91,29 @@
5 self.tree._ignoremanager = None
6 self.assertTrue(self.tree.is_ignored('a'))
7
8+ def test_add_submodule_dir(self):
9+ subtree = self.make_branch_and_tree('asub', format='git')
10+ subtree.commit('Empty commit')
11+ self.tree.add(['asub'])
12+ with self.tree.lock_read():
13+ entry = self.tree.index[b'asub']
14+ self.assertEqual(entry.mode, S_IFGITLINK)
15+ self.assertEqual([], list(subtree.unknowns()))
16+
17+ def test_add_submodule_file(self):
18+ os.mkdir('.git/modules')
19+ subbranch = self.make_branch('.git/modules/asub', format='git-bare')
20+ os.mkdir('asub')
21+ with open('asub/.git', 'w') as f:
22+ f.write('gitdir: ../.git/modules/asub\n')
23+ subtree = _mod_workingtree.WorkingTree.open('asub')
24+ subtree.commit('Empty commit')
25+ self.tree.add(['asub'])
26+ with self.tree.lock_read():
27+ entry = self.tree.index[b'asub']
28+ self.assertEqual(entry.mode, S_IFGITLINK)
29+ self.assertEqual([], list(subtree.unknowns()))
30+
31
32 class GitWorkingTreeFileTests(TestCaseWithTransport):
33
34
35=== modified file 'breezy/git/workingtree.py'
36--- breezy/git/workingtree.py 2018-11-21 03:20:30 +0000
37+++ breezy/git/workingtree.py 2019-02-05 04:00:59 +0000
38@@ -536,13 +536,17 @@
39 if not self._has_dir(relpath):
40 dirnames.remove(name)
41 for name in filenames:
42- if not self.mapping.is_special_file(name):
43- yp = os.path.join(dir_relpath, name)
44- try:
45- yield yp.decode(osutils._fs_enc)
46- except UnicodeDecodeError:
47- raise errors.BadFilenameEncoding(
48- yp, osutils._fs_enc)
49+ if self.mapping.is_special_file(name):
50+ continue
51+ if self.controldir.is_control_filename(
52+ name.decode(osutils._fs_enc, 'replace')):
53+ continue
54+ yp = os.path.join(dir_relpath, name)
55+ try:
56+ yield yp.decode(osutils._fs_enc)
57+ except UnicodeDecodeError:
58+ raise errors.BadFilenameEncoding(
59+ yp, osutils._fs_enc)
60
61 def extras(self):
62 """Yield all unversioned files in this WorkingTree.
63
64=== modified file 'doc/en/release-notes/brz-3.0.txt'
65--- doc/en/release-notes/brz-3.0.txt 2019-02-03 23:49:59 +0000
66+++ doc/en/release-notes/brz-3.0.txt 2019-02-05 04:00:59 +0000
67@@ -227,6 +227,9 @@
68 needed for backwards compatibility with Bazaar.
69 (Jelmer Vernooń≥, #1803845)
70
71+* Don't report .git files as unknown files.
72+ (Jelmer Vernooń≥, Debian Bug #921240)
73+
74 Documentation
75 *************
76

Subscribers

People subscribed via source and target branches