forked from GitoxideLabs/gitoxide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmany.sh
More file actions
executable file
·353 lines (298 loc) · 7.58 KB
/
Copy pathmany.sh
File metadata and controls
executable file
·353 lines (298 loc) · 7.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
#!/usr/bin/env bash
set -eu -o pipefail
# Nothing here may use symlinks so these fixtures can be used on windows as well.
git init with-nested-dot-git
(cd with-nested-dot-git
mkdir -p dir/.git/subdir
touch dir/.git/config dir/.git/subdir/bar
)
git init with-nested-capitalized-dot-git
(cd with-nested-capitalized-dot-git
mkdir -p dir/.GIT/subdir
touch dir/.GIT/config dir/.GIT/subdir/bar
)
git init dir-with-file
(cd dir-with-file
mkdir dir
touch dir/file
)
git init dir-with-tracked-file
(cd dir-with-tracked-file
mkdir dir
touch dir/file
git add .
git commit -m "init"
)
git init repo-with-submodule
(cd repo-with-submodule
git submodule add ../dir-with-tracked-file submodule
git commit -m "add submodule"
touch submodule/untracked
)
git init ignored-dir
(cd ignored-dir
mkdir dir
touch dir/file
echo "dir/" > .gitignore
)
cp -R ignored-dir ignored-dir-with-nested-repository
(cd ignored-dir-with-nested-repository
echo "*.o" >> .gitignore
git add .
mkdir dir/subdir objs
(cd dir/subdir
touch a
git init nested
)
>objs/a.o
)
cp -R ignored-dir ignored-dir-with-nested-bare-repository
(cd ignored-dir-with-nested-bare-repository
mkdir dir/subdir
(cd dir/subdir
git init --bare nested-bare
)
git init --bare bare
)
cp -R ignored-dir-with-nested-bare-repository ignored-dir-nested-minimal
(cd ignored-dir-nested-minimal
(cd bare
rm -Rf hooks config description
)
(cd dir/subdir/nested-bare
rm -Rf refs hooks config description
)
)
mkdir untracked-hidden-bare
(cd untracked-hidden-bare
mkdir subdir
git init --bare subdir/hidden-bare
>subdir/file
)
git init tracked-is-ignored
(cd tracked-is-ignored
mkdir dir
touch dir/file
echo "dir/" > .gitignore
git add --force . && git commit -m "init"
)
git init nested-repository
(cd nested-repository
touch file
git add . && git commit -m "init"
git init nested
(cd nested
touch file
git add file && git commit -m "init"
)
)
git clone dir-with-tracked-file with-submodule
(cd with-submodule
git submodule add ../dir-with-tracked-file submodule
git commit -m "submodule added"
)
git init nonstandard-worktree
(cd nonstandard-worktree
mkdir dir-with-dot-git
touch dir-with-dot-git/inside
touch seemingly-outside
git add dir-with-dot-git/inside seemingly-outside
mv .git dir-with-dot-git
git -C dir-with-dot-git config core.worktree "$PWD"
git -C dir-with-dot-git commit -m "init"
)
git init nonstandard-worktree-untracked
(cd nonstandard-worktree-untracked
mkdir dir-with-dot-git
touch dir-with-dot-git/inside
touch seemingly-outside
git add dir-with-dot-git/inside seemingly-outside
mv .git dir-with-dot-git
git -C dir-with-dot-git config core.worktree "$PWD"
git -C dir-with-dot-git commit -m "init"
rm dir-with-dot-git/.git/index
)
git init partial-checkout-cone-mode
(cd partial-checkout-cone-mode
touch a b
mkdir c1
(cd c1 && touch a b && mkdir c2 && cd c2 && touch a b)
(cd c1 && mkdir c3 && cd c3 && touch a b)
mkdir d
(cd d && touch a b && mkdir c4 && cd c4 && touch a b c5)
git add .
git commit -m "init"
git sparse-checkout set c1/c2 --sparse-index
mkdir d && touch d/file-created-manually
)
git init partial-checkout-non-cone
(cd partial-checkout-non-cone
touch a b
mkdir c1
(cd c1 && touch a b && mkdir c2 && cd c2 && touch a b)
(cd c1 && mkdir c3 && cd c3 && touch a b)
mkdir d
(cd d && touch a b && mkdir c4 && cd c4 && touch a b c5)
git add .
git commit -m "init"
git sparse-checkout set c1/c2 --no-cone
mkdir d && touch d/file-created-manually
)
git init precious-nested-repository
(cd precious-nested-repository
echo '$precious*/' > .gitignore
git init precious-repo
git add .gitignore && git commit -m "init"
)
git init only-untracked
(cd only-untracked
>a
>b
mkdir d
>d/a
>d/b
mkdir d/d
>d/d/a
>c
)
git init ignored-with-empty
(cd ignored-with-empty
echo "/target/" >> .gitignore
git add .gitignore && git commit -m "init"
mkdir -p target/empty target/debug target/release
touch target/debug/a target/release/b
)
cp -R only-untracked subdir-untracked
(cd subdir-untracked
git add .
git rm --cached d/d/a
git commit -m "init"
)
cp -R subdir-untracked subdir-untracked-and-ignored
(cd subdir-untracked-and-ignored
>a.o
>b.o
>d/a.o
>d/b.o
>d/d/a.o
>d/d/b.o
>c.o
mkdir generated d/generated d/d/generated
touch generated/a generated/a.o d/generated/b d/d/generated/b
mkdir -p objs/sub
touch objs/a.o objs/b.o objs/sub/other.o
echo "*.o" > .gitignore
echo "generated/" >> .gitignore
)
mkdir untracked-and-ignored-for-collapse
(cd untracked-and-ignored-for-collapse
echo "ignored/" >> .gitignore
echo "*.o" >> .gitignore
mkdir -p untracked ignored/empty mixed ignored-inside
touch untracked/a ignored/b mixed/c mixed/c.o ignored-inside/d.o
)
git init untracked-and-precious
(cd untracked-and-precious
echo '*.o' >> .gitignore
echo '$*.precious' >> .gitignore
mkdir -p d/d
touch d/a d/b && git add .
touch a.o d/a.o d/b.o
touch d/d/new d/d/a.precious
git commit -m "init"
)
git init expendable-and-precious
(cd expendable-and-precious
echo "*.o" >> .gitignore
echo '$precious' >> .gitignore
echo '$/mixed/precious' >> .gitignore
echo '$/all-precious/' >> .gitignore
echo "/all-expendable/" >> .gitignore
echo '$*.precious' >> .gitignore
git add .gitignore
touch a.o
touch precious
mkdir mixed
touch mixed/precious mixed/b.o
(mkdir some-expendable && cd some-expendable
touch file.o file new && git add file
)
(mkdir some-precious && cd some-precious
touch file.precious file new && git add file
)
mkdir all-precious all-expendable all-precious-by-filematch all-expendable-by-filematch
touch all-precious/a all-precious/b all-expendable/c all-expendable/d
(cd all-precious-by-filematch
touch a.precious b.precious
)
(cd all-expendable-by-filematch
touch e.o f.o
)
git commit -m "init"
)
git init expendable-and-precious-nested-in-ignored-dir
(cd expendable-and-precious-nested-in-ignored-dir
echo 'ignored/' > .gitignore
git add .gitignore && git commit -m "init"
mkdir -p ignored/other
cp -Rv ../expendable-and-precious ignored/d
rm -Rf ignored/d/*-by-filematch ignored/d/some-*
mkdir -p other/ignored && >other/ignored/a
)
mkdir empty-and-untracked-dir
(cd empty-and-untracked-dir
mkdir empty untracked
>untracked/file
)
mkdir complex-empty
(cd complex-empty
mkdir empty-toplevel
mkdir -p only-dirs/sub/subsub only-dirs/other
mkdir -p dirs-and-files/sub dirs-and-files/dir
touch dirs-and-files/dir/file
)
git init type-mismatch
(cd type-mismatch
mkdir dir-is-file && >dir-is-file/a
>file-is-dir
git add .
rm -Rf dir-is-file
>dir-is-file
rm file-is-dir && mkdir file-is-dir && >file-is-dir/b
)
git init type-mismatch-icase
(cd type-mismatch-icase
mkdir dir-is-file && >dir-is-file/a
>file-is-dir
git add .
rm -Rf dir-is-file
>Dir-is-File
rm file-is-dir && mkdir File-is-Dir && >File-is-Dir/b
)
git init type-mismatch-icase-clash-dir-is-file
(cd type-mismatch-icase-clash-dir-is-file
empty_oid=$(git hash-object -w --stdin </dev/null)
git update-index --index-info <<EOF
100644 $empty_oid D/a
100644 $empty_oid d
EOF
>d
)
cp -R type-mismatch-icase-clash-dir-is-file type-mismatch-icase-clash-file-is-dir
(cd type-mismatch-icase-clash-file-is-dir
rm d
mkdir D && >D/a
)
mkdir empty
touch just-a-file
git init submodule
(cd submodule
touch empty && git add empty
git commit -m upstream
)
git clone submodule multiple-submodules
(cd multiple-submodules
git submodule add ../submodule submodule
git submodule add ../submodule a/b
git commit -m "add modules"
)