File tree Expand file tree Collapse file tree 3 files changed +107
-6
lines changed Expand file tree Collapse file tree 3 files changed +107
-6
lines changed Original file line number Diff line number Diff line change @@ -209,12 +209,13 @@ pub fn find_all_workspaces_and_subdirectories(
209
209
let _trace_s = span ! ( Level :: TRACE , "find_all_workspaces_and_subdirectories" ) ;
210
210
let mut hs = std:: collections:: HashSet :: new ( ) ;
211
211
tree. walk ( git2:: TreeWalkMode :: PreOrder , |root, entry| {
212
- if entry. name ( ) == Some ( "workspace.josh" ) {
213
- hs. insert ( format ! ( ":workspace={}" , root. trim_matches( '/' ) ) ) ;
214
- }
215
212
if root. is_empty ( ) {
216
213
return 0 ;
217
214
}
215
+
216
+ if entry. name ( ) == Some ( "workspace.josh" ) {
217
+ hs. insert ( format ! ( ":workspace={}" , root. trim_matches( '/' ) ) ) ;
218
+ }
218
219
let v = format ! ( "::{}/" , root. trim_matches( '/' ) ) ;
219
220
if v. chars ( ) . filter ( |x| * x == '/' ) . count ( ) < 3 {
220
221
hs. insert ( v) ;
Original file line number Diff line number Diff line change @@ -233,9 +233,6 @@ fn run_filter(args: Vec<String>) -> josh::JoshResult<i32> {
233
233
let r = repo. revparse_single ( & input_ref) ?;
234
234
let hs = josh:: housekeeping:: find_all_workspaces_and_subdirectories ( & r. peel_to_tree ( ) ?) ?;
235
235
for i in hs {
236
- if i. contains ( ":workspace=" ) {
237
- continue ;
238
- }
239
236
let ( mut updated_refs, _) = josh:: filter_refs (
240
237
& transaction,
241
238
josh:: filter:: parse ( & i) ?,
Original file line number Diff line number Diff line change
1
+ $ export TERM= dumb
2
+ $ export RUST_LOG_STYLE= never
3
+
4
+ $ git init -q real_repo 1 > / dev/ null
5
+ $ cd real_repo
6
+
7
+ $ mkdir sub1
8
+ $ echo contents1 > sub1/ file1
9
+ $ echo contents1 > sub1/ file2
10
+ $ chmod + x sub1/ file2
11
+ $ git add sub1
12
+ $ git commit -m " add file1" 1 > / dev/ null
13
+ $ git ls-tree -r HEAD
14
+ 100644 blob a024003ee1acc6bf70318a46e7b6df651b9dc246\tsub1/ file1 (esc)
15
+ 100755 blob a024003ee1acc6bf70318a46e7b6df651b9dc246\tsub1/ file2 (esc)
16
+
17
+ $ mkdir -p sub2/ subsub
18
+ $ echo contents1 > sub2/ subsub/ file2
19
+ $ git add sub2
20
+ $ git commit -m " add file2" 1 > / dev/ null
21
+
22
+ $ mkdir ws
23
+ $ cat > ws/ workspace. josh << EOF
24
+ > :/ sub1::file1
25
+ > :/ sub1::file2
26
+ > ::sub2/ subsub/
27
+ > EOF
28
+ $ git add ws
29
+ $ git commit -m " add ws" 1 > / dev/ null
30
+
31
+ $ mkdir ws2
32
+ $ cat > ws2/ workspace. josh << EOF
33
+ > :/ sub1::file1
34
+ > :/ sub1::file2
35
+ > ::sub2/ subsub
36
+ > EOF
37
+ $ git add ws2
38
+ $ git commit -m " add ws2" 1 > / dev/ null
39
+
40
+ $ josh-filter -s
41
+ $ josh-filter -d -s
42
+ [1 ] :/ sub1
43
+ [1 ] :/ subsub
44
+ [1 ] : prefix= sub1
45
+ [1 ] : prefix= sub2
46
+ [1 ] : prefix= subsub
47
+ [1 ] : prefix= ws
48
+ [1 ] : prefix= ws2
49
+ [2 ] :/ sub2
50
+ [2 ] :/ ws
51
+ [2 ] :/ ws2
52
+ [2 ] : [
53
+ :/ sub1: [
54
+ ::file1
55
+ ::file2
56
+ ]
57
+ ::sub2/ subsub
58
+ ]
59
+ [2 ] : [
60
+ :/ sub1: [
61
+ ::file1
62
+ ::file2
63
+ ]
64
+ ::sub2/ subsub/
65
+ ]
66
+ [2 ] : workspace= ws
67
+ [2 ] : workspace= ws2
68
+
69
+ $ cat > workspace. josh << EOF
70
+ > :/ sub1::file1
71
+ > :/ sub1::file2
72
+ > ::sub2/ subsub
73
+ > EOF
74
+ $ git add .
75
+ $ git commit -m " add root ws" 1 > / dev/ null
76
+
77
+ $ josh-filter -d -s
78
+ [1 ] :/ sub1
79
+ [1 ] :/ subsub
80
+ [1 ] : prefix= sub1
81
+ [1 ] : prefix= sub2
82
+ [1 ] : prefix= subsub
83
+ [1 ] : prefix= ws
84
+ [1 ] : prefix= ws2
85
+ [2 ] :/ sub2
86
+ [2 ] :/ ws
87
+ [2 ] :/ ws2
88
+ [2 ] : [
89
+ :/ sub1: [
90
+ ::file1
91
+ ::file2
92
+ ]
93
+ ::sub2/ subsub
94
+ ]
95
+ [2 ] : [
96
+ :/ sub1: [
97
+ ::file1
98
+ ::file2
99
+ ]
100
+ ::sub2/ subsub/
101
+ ]
102
+ [2 ] : workspace= ws
103
+ [2 ] : workspace= ws2
You can’t perform that action at this time.
0 commit comments