checkout: disallow bad paths on HFS HFS filesystems ignore some characters like U+200C. When these characters are included in a path, they will be ignored for the purposes of comparison with other paths. Thus, if you have a ".git" folder, a folder of ".git<U+200C>" will also match. Protect our ".git" folder by ensuring that ".git<U+200C>" and friends do not match it.
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 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
diff --git a/src/path.c b/src/path.c
index dbe193a..724d9ed 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1282,6 +1282,95 @@ GIT_INLINE(bool) verify_dospath(
component[last] != ':');
}
+GIT_INLINE(bool) verify_dotgit_hfs(const char *component, size_t len)
+{
+ const unsigned char *c;
+ int git = 0, ign = 0;
+ unsigned char one, two;
+
+ while (len) {
+ switch (*(c = (const unsigned char *)component++)) {
+ case '.':
+ if (ign || git++ != 0)
+ return true;
+ break;
+ case 'g':
+ case 'G':
+ if (ign || git++ != 1)
+ return true;
+ break;
+ case 'i':
+ case 'I':
+ if (ign || git++ != 2)
+ return true;
+ break;
+ case 't':
+ case 'T':
+ if (ign || git++ != 3)
+ return true;
+ break;
+
+ case 0xe2:
+ case 0xef:
+ if (ign++ != 0)
+ return true;
+ one = *c;
+ break;
+
+ case 0x80:
+ case 0x81:
+ if (ign++ != 1 || one != 0xe2)
+ return true;
+ two = *c;
+ break;
+
+ case 0xbb:
+ if (ign++ != 1 || one != 0xef)
+ return true;
+ two = *c;
+ break;
+
+ case 0x8c:
+ case 0x8d:
+ case 0x8e:
+ case 0x8f:
+ if (ign != 2 || two != 0x80)
+ return true;
+ ign = 0;
+ break;
+
+ case 0xaa:
+ case 0xab:
+ case 0xac:
+ case 0xad:
+ case 0xae:
+ if (ign != 2 || (two != 0x80 && two != 0x81))
+ return true;
+ ign = 0;
+ break;
+
+ case 0xaf:
+ if (ign != 2 || two != 0x81)
+ return true;
+ ign = 0;
+ break;
+
+ case 0xbf:
+ if (ign != 2 || two != 0xbb)
+ return true;
+ ign = 0;
+ break;
+
+ default:
+ return true;
+ }
+
+ len--;
+ }
+
+ return (ign || git != 4);
+}
+
GIT_INLINE(bool) verify_char(unsigned char c, unsigned int flags)
{
if ((flags & GIT_PATH_REJECT_BACKSLASH) && c == '\\')
@@ -1362,6 +1451,10 @@ static bool verify_component(
return false;
}
+ if (flags & GIT_PATH_REJECT_DOT_GIT_HFS &&
+ !verify_dotgit_hfs(component, len))
+ return false;
+
return true;
}
diff --git a/src/path.h b/src/path.h
index a97668a..4e25d93 100644
--- a/src/path.h
+++ b/src/path.h
@@ -472,6 +472,7 @@ extern int git_path_from_url_or_path(git_buf *local_path_out, const char *url_or
#define GIT_PATH_REJECT_DOS_GIT_SHORTNAME (1 << 6)
#define GIT_PATH_REJECT_DOS_PATHS (1 << 7)
#define GIT_PATH_REJECT_NT_CHARS (1 << 8)
+#define GIT_PATH_REJECT_DOT_GIT_HFS (1 << 9)
#ifdef GIT_WIN32
# define GIT_PATH_REJECT_DEFAULTS \
@@ -483,6 +484,10 @@ extern int git_path_from_url_or_path(git_buf *local_path_out, const char *url_or
GIT_PATH_REJECT_DOS_GIT_SHORTNAME | \
GIT_PATH_REJECT_DOS_PATHS | \
GIT_PATH_REJECT_NT_CHARS
+#elif __APPLE__
+# define GIT_PATH_REJECT_DEFAULTS \
+ GIT_PATH_REJECT_TRAVERSAL | \
+ GIT_PATH_REJECT_DOT_GIT_HFS
#else
# define GIT_PATH_REJECT_DEFAULTS GIT_PATH_REJECT_TRAVERSAL
#endif
diff --git a/tests/checkout/nasty.c b/tests/checkout/nasty.c
index 8bc98f3..a667dcd 100644
--- a/tests/checkout/nasty.c
+++ b/tests/checkout/nasty.c
@@ -249,3 +249,45 @@ void test_checkout_nasty__dot_git_colon_stuff(void)
#endif
}
+/* Trees that contains entries with a tree ".git" that contain
+ * byte sequences:
+ * { 0xe2, 0x80, 0x8c }
+ * { 0xe2, 0x80, 0x8d }
+ * { 0xe2, 0x80, 0x8e }
+ * { 0xe2, 0x80, 0x8f }
+ * { 0xe2, 0x80, 0xaa }
+ * { 0xe2, 0x80, 0xab }
+ * { 0xe2, 0x80, 0xac }
+ * { 0xe2, 0x80, 0xad }
+ * { 0xe2, 0x81, 0xae }
+ * { 0xe2, 0x81, 0xaa }
+ * { 0xe2, 0x81, 0xab }
+ * { 0xe2, 0x81, 0xac }
+ * { 0xe2, 0x81, 0xad }
+ * { 0xe2, 0x81, 0xae }
+ * { 0xe2, 0x81, 0xaf }
+ * { 0xef, 0xbb, 0xbf }
+ * Because these map to characters that HFS filesystems "ignore". Thus
+ * ".git<U+200C>" will map to ".git".
+ */
+void test_checkout_nasty__dot_git_hfs_ignorable(void)
+{
+#ifdef __APPLE__
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_1", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_2", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_3", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_4", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_5", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_6", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_7", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_8", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_9", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_10", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_11", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_12", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_13", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_14", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_15", ".git/foobar");
+ test_checkout_fails("refs/heads/dotgit_hfs_ignorable_16", ".git/foobar");
+#endif
+}
diff --git a/tests/path/core.c b/tests/path/core.c
index 7cc1118..528108b 100644
--- a/tests/path/core.c
+++ b/tests/path/core.c
@@ -223,7 +223,7 @@ void test_path_core__isvalid_dos_paths_withnum(void)
cl_assert_equal_b(true, git_path_isvalid(NULL, "com1\\foo", GIT_PATH_REJECT_DOS_PATHS));
}
-void test_core_path__isvalid_nt_chars(void)
+void test_path_core__isvalid_nt_chars(void)
{
cl_assert_equal_b(true, git_path_isvalid(NULL, "asdf\001foo", 0));
cl_assert_equal_b(true, git_path_isvalid(NULL, "asdf\037bar", 0));
@@ -245,3 +245,32 @@ void test_core_path__isvalid_nt_chars(void)
cl_assert_equal_b(false, git_path_isvalid(NULL, "asdf?bar", GIT_PATH_REJECT_NT_CHARS));
cl_assert_equal_b(false, git_path_isvalid(NULL, "asdf*bar", GIT_PATH_REJECT_NT_CHARS));
}
+
+void test_path_core__isvalid_dotgit_with_hfs_ignorables(void)
+{
+ cl_assert_equal_b(false, git_path_isvalid(NULL, ".git", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_isvalid(NULL, ".git\xe2\x80\x8c", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_isvalid(NULL, ".gi\xe2\x80\x8dT", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_isvalid(NULL, ".g\xe2\x80\x8eIt", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_isvalid(NULL, ".\xe2\x80\x8fgIt", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_isvalid(NULL, "\xe2\x80\xaa.gIt", GIT_PATH_REJECT_DOT_GIT_HFS));
+
+ cl_assert_equal_b(false, git_path_isvalid(NULL, "\xe2\x80\xab.\xe2\x80\xacG\xe2\x80\xadI\xe2\x80\xaet", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_isvalid(NULL, "\xe2\x81\xab.\xe2\x80\xaaG\xe2\x81\xabI\xe2\x80\xact", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_isvalid(NULL, "\xe2\x81\xad.\xe2\x80\xaeG\xef\xbb\xbfIT", GIT_PATH_REJECT_DOT_GIT_HFS));
+
+ cl_assert_equal_b(true, git_path_isvalid(NULL, ".", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_isvalid(NULL, ".g", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_isvalid(NULL, ".gi", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_isvalid(NULL, " .git", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_isvalid(NULL, "..git\xe2\x80\x8c", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_isvalid(NULL, ".gi\xe2\x80\x8dT.", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_isvalid(NULL, ".g\xe2\x80It", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_isvalid(NULL, ".\xe2gIt", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_isvalid(NULL, "\xe2\x80\xaa.gi", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_isvalid(NULL, ".gi\x80\x8dT", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_isvalid(NULL, ".gi\x8dT", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_isvalid(NULL, ".g\xe2i\x80T\x8e", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_isvalid(NULL, ".git\xe2\x80\xbf", GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_isvalid(NULL, ".git\xe2\xab\x81", GIT_PATH_REJECT_DOT_GIT_HFS));
+}
diff --git a/tests/resources/nasty/.gitted/objects/04/fab819d8388295cbe3496310e4e53ef8f4a115 b/tests/resources/nasty/.gitted/objects/04/fab819d8388295cbe3496310e4e53ef8f4a115
new file mode 100644
index 0000000..688b970
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/04/fab819d8388295cbe3496310e4e53ef8f4a115 differ
diff --git a/tests/resources/nasty/.gitted/objects/0b/8206dd72a3b3b932fb562f92d29199b9398390 b/tests/resources/nasty/.gitted/objects/0b/8206dd72a3b3b932fb562f92d29199b9398390
new file mode 100644
index 0000000..b063615
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/0b/8206dd72a3b3b932fb562f92d29199b9398390 differ
diff --git a/tests/resources/nasty/.gitted/objects/10/cb44a89d1a9e8bf74de3f11a2a61ee833f13b1 b/tests/resources/nasty/.gitted/objects/10/cb44a89d1a9e8bf74de3f11a2a61ee833f13b1
new file mode 100644
index 0000000..9d14298
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/10/cb44a89d1a9e8bf74de3f11a2a61ee833f13b1 differ
diff --git a/tests/resources/nasty/.gitted/objects/11/9f6cd3535de0e2a15654947a7b1a5affbf1406 b/tests/resources/nasty/.gitted/objects/11/9f6cd3535de0e2a15654947a7b1a5affbf1406
new file mode 100644
index 0000000..fb03b26
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/11/9f6cd3535de0e2a15654947a7b1a5affbf1406 differ
diff --git a/tests/resources/nasty/.gitted/objects/15/f7d9f9514eeb65b9588c49b10b1da145a729a2 b/tests/resources/nasty/.gitted/objects/15/f7d9f9514eeb65b9588c49b10b1da145a729a2
new file mode 100644
index 0000000..a7f3683
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/15/f7d9f9514eeb65b9588c49b10b1da145a729a2
@@ -0,0 +1,2 @@
+x10Es
+H(iںbae&q(5BܞpԺ*`wژѓ3C1epB>
HKzSKp+R7ys]cMӌK.{WsM?P)|?
\ No newline at end of file
diff --git a/tests/resources/nasty/.gitted/objects/16/35c47d80914f0abfa43dd4234a948db5bdb107 b/tests/resources/nasty/.gitted/objects/16/35c47d80914f0abfa43dd4234a948db5bdb107
new file mode 100644
index 0000000..f82b82b
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/16/35c47d80914f0abfa43dd4234a948db5bdb107
@@ -0,0 +1,2 @@
+x=!9&[+/gckW|/Q
+
gDd?*kRҋ+5wl+NO8㠿u[jԩ)Q>Q/q?Pc=?q
\ No newline at end of file
diff --git a/tests/resources/nasty/.gitted/objects/2b/4b774d8c5441b22786531f34ffc77800cda8cf b/tests/resources/nasty/.gitted/objects/2b/4b774d8c5441b22786531f34ffc77800cda8cf
new file mode 100644
index 0000000..b286daa
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/2b/4b774d8c5441b22786531f34ffc77800cda8cf differ
diff --git a/tests/resources/nasty/.gitted/objects/2d/23d51590ec2f53fe4b5bb3e5ca62e35e4ef85a b/tests/resources/nasty/.gitted/objects/2d/23d51590ec2f53fe4b5bb3e5ca62e35e4ef85a
new file mode 100644
index 0000000..5d47d82
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/2d/23d51590ec2f53fe4b5bb3e5ca62e35e4ef85a differ
diff --git a/tests/resources/nasty/.gitted/objects/35/ae236308929a536fb4e852278a9b98c42babb3 b/tests/resources/nasty/.gitted/objects/35/ae236308929a536fb4e852278a9b98c42babb3
new file mode 100644
index 0000000..b8633de
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/35/ae236308929a536fb4e852278a9b98c42babb3
@@ -0,0 +1 @@
+x;0}푐q !Z*.ZIa6!nS=M&QZ"x:z-aOؠB?cV"x-c guK:>%P~!Gq?PC=?
\ No newline at end of file
diff --git a/tests/resources/nasty/.gitted/objects/38/0b9e58872ccf1d858be4b0fc612514a080bc40 b/tests/resources/nasty/.gitted/objects/38/0b9e58872ccf1d858be4b0fc612514a080bc40
new file mode 100644
index 0000000..a911c3c
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/38/0b9e58872ccf1d858be4b0fc612514a080bc40 differ
diff --git a/tests/resources/nasty/.gitted/objects/3b/24e5c751ee9c7c89df32a0d959748aa3d0112c b/tests/resources/nasty/.gitted/objects/3b/24e5c751ee9c7c89df32a0d959748aa3d0112c
new file mode 100644
index 0000000..5adcd14
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/3b/24e5c751ee9c7c89df32a0d959748aa3d0112c
@@ -0,0 +1,2 @@
+x10Es
+Hm&bae&(1Bܞp)!ٱ#t)Y;#z4U*\қj*4a=D)'F;هg쿚/+5@Oc?
\ No newline at end of file
diff --git a/tests/resources/nasty/.gitted/objects/44/2894787eddb1e84a952f17a027590e2c6c02cd b/tests/resources/nasty/.gitted/objects/44/2894787eddb1e84a952f17a027590e2c6c02cd
new file mode 100644
index 0000000..c81b0e6
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/44/2894787eddb1e84a952f17a027590e2c6c02cd differ
diff --git a/tests/resources/nasty/.gitted/objects/46/fe10fa23259b089ab050788b06df979cd7d054 b/tests/resources/nasty/.gitted/objects/46/fe10fa23259b089ab050788b06df979cd7d054
new file mode 100644
index 0000000..6d1f52d
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/46/fe10fa23259b089ab050788b06df979cd7d054 differ
diff --git a/tests/resources/nasty/.gitted/objects/6b/7d8a5a48a3c753b75a8fe5196f9c8704ac64ad b/tests/resources/nasty/.gitted/objects/6b/7d8a5a48a3c753b75a8fe5196f9c8704ac64ad
new file mode 100644
index 0000000..121277f
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/6b/7d8a5a48a3c753b75a8fe5196f9c8704ac64ad differ
diff --git a/tests/resources/nasty/.gitted/objects/71/2ceb8eb3e57072447715bc4057c57aa50f629a b/tests/resources/nasty/.gitted/objects/71/2ceb8eb3e57072447715bc4057c57aa50f629a
new file mode 100644
index 0000000..9ed35d7
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/71/2ceb8eb3e57072447715bc4057c57aa50f629a differ
diff --git a/tests/resources/nasty/.gitted/objects/7a/0538bc4e20aecb36ef221f2077eb30ebe0bcb2 b/tests/resources/nasty/.gitted/objects/7a/0538bc4e20aecb36ef221f2077eb30ebe0bcb2
new file mode 100644
index 0000000..0c3ea26
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/7a/0538bc4e20aecb36ef221f2077eb30ebe0bcb2
@@ -0,0 +1,2 @@
+x1!E9&X!1+WMDF\9BMCc2WpaRԸsCz3Yc5
+n<Q/?
\ No newline at end of file
diff --git a/tests/resources/nasty/.gitted/objects/7a/e174dda8f105a582c593b52d74545a3565819d b/tests/resources/nasty/.gitted/objects/7a/e174dda8f105a582c593b52d74545a3565819d
new file mode 100644
index 0000000..17dec59
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/7a/e174dda8f105a582c593b52d74545a3565819d differ
diff --git a/tests/resources/nasty/.gitted/objects/80/24458e7ee49c456fd8c45d3591e9936bf613b3 b/tests/resources/nasty/.gitted/objects/80/24458e7ee49c456fd8c45d3591e9936bf613b3
new file mode 100644
index 0000000..d2074aa
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/80/24458e7ee49c456fd8c45d3591e9936bf613b3 differ
diff --git a/tests/resources/nasty/.gitted/objects/81/e2b84864f16ebd285b34a2b1e87ebb41f4c230 b/tests/resources/nasty/.gitted/objects/81/e2b84864f16ebd285b34a2b1e87ebb41f4c230
new file mode 100644
index 0000000..c28ad0a
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/81/e2b84864f16ebd285b34a2b1e87ebb41f4c230 differ
diff --git a/tests/resources/nasty/.gitted/objects/88/6c0f5f71057d846f71f05a05fdffad332bc070 b/tests/resources/nasty/.gitted/objects/88/6c0f5f71057d846f71f05a05fdffad332bc070
new file mode 100644
index 0000000..432eea2
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/88/6c0f5f71057d846f71f05a05fdffad332bc070 differ
diff --git a/tests/resources/nasty/.gitted/objects/96/156716851c0afb4702b0d2c4ac8c496a730e29 b/tests/resources/nasty/.gitted/objects/96/156716851c0afb4702b0d2c4ac8c496a730e29
new file mode 100644
index 0000000..57419bc
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/96/156716851c0afb4702b0d2c4ac8c496a730e29
@@ -0,0 +1 @@
+x;0sPKRqVRE"1W`)$uU0aich0lAWG1&,;deF襋47E&8qukjICzc8؏UaѦI|\@o
\ No newline at end of file
diff --git a/tests/resources/nasty/.gitted/objects/9a/b85e507899c19dca57778c9b6e5f1ec799b911 b/tests/resources/nasty/.gitted/objects/9a/b85e507899c19dca57778c9b6e5f1ec799b911
new file mode 100644
index 0000000..aa24a8f
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/9a/b85e507899c19dca57778c9b6e5f1ec799b911
@@ -0,0 +1,3 @@
+x=
+1Fs5 bckf' EIF>^=Z79N;i9[|
+h^P+3dƖrS.uƝ6a?
Ԑ+u.HDY2@%
\ No newline at end of file
diff --git a/tests/resources/nasty/.gitted/objects/9e/24726d64589ba02430da8cebb5712dad35593d b/tests/resources/nasty/.gitted/objects/9e/24726d64589ba02430da8cebb5712dad35593d
new file mode 100644
index 0000000..2cf9535
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/9e/24726d64589ba02430da8cebb5712dad35593d differ
diff --git a/tests/resources/nasty/.gitted/objects/a5/76a98d3279989226992610372035b76a01a3e9 b/tests/resources/nasty/.gitted/objects/a5/76a98d3279989226992610372035b76a01a3e9
new file mode 100644
index 0000000..75fa458
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/a5/76a98d3279989226992610372035b76a01a3e9 differ
diff --git a/tests/resources/nasty/.gitted/objects/b1/1df9aee97a65817e8904a74f5e6a1c62c7a275 b/tests/resources/nasty/.gitted/objects/b1/1df9aee97a65817e8904a74f5e6a1c62c7a275
new file mode 100644
index 0000000..b2e0eda
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/b1/1df9aee97a65817e8904a74f5e6a1c62c7a275 differ
diff --git a/tests/resources/nasty/.gitted/objects/bb/29ec85546d29b0bcc314242660d7772b0a3803 b/tests/resources/nasty/.gitted/objects/bb/29ec85546d29b0bcc314242660d7772b0a3803
new file mode 100644
index 0000000..00ab02c
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/bb/29ec85546d29b0bcc314242660d7772b0a3803 differ
diff --git a/tests/resources/nasty/.gitted/objects/c2/a2ddd339574e5cbfd9228be840eb1bf496de4e b/tests/resources/nasty/.gitted/objects/c2/a2ddd339574e5cbfd9228be840eb1bf496de4e
new file mode 100644
index 0000000..939cf55
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/c2/a2ddd339574e5cbfd9228be840eb1bf496de4e differ
diff --git a/tests/resources/nasty/.gitted/objects/c3/a70f8a376f17adccfb52b48e2831bfef2a2172 b/tests/resources/nasty/.gitted/objects/c3/a70f8a376f17adccfb52b48e2831bfef2a2172
new file mode 100644
index 0000000..b43d3f1
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/c3/a70f8a376f17adccfb52b48e2831bfef2a2172
@@ -0,0 +1,2 @@
+x=
+1`=d'n6"6V^ d87^W=n3@yĸ^{Ҙb0FhYMjr/)߮EpJCRиsCzq1%ثits]>P]?1
\ No newline at end of file
diff --git a/tests/resources/nasty/.gitted/objects/c8/f98a1762ec016c30f0d73512df399dedefc3fd b/tests/resources/nasty/.gitted/objects/c8/f98a1762ec016c30f0d73512df399dedefc3fd
new file mode 100644
index 0000000..85ddc7f
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/c8/f98a1762ec016c30f0d73512df399dedefc3fd
@@ -0,0 +1,3 @@
+x=
+1FsZy1%[Y+W|/qN<KD٠=8ŒCI
+_R5epaRԸ"g|jAݰ*&P+?
\ No newline at end of file
diff --git a/tests/resources/nasty/.gitted/objects/ce/22b3cd9a01efafc370879c1938e0c32fb6f195 b/tests/resources/nasty/.gitted/objects/ce/22b3cd9a01efafc370879c1938e0c32fb6f195
new file mode 100644
index 0000000..eb5acc3
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/ce/22b3cd9a01efafc370879c1938e0c32fb6f195
@@ -0,0 +1,3 @@
+x;
+B1E*$Zd+Hވ{< 2(v<jU5EF({H:7p)4
+pֹ8h; :"drv\ ᙸ}?F
\ No newline at end of file
diff --git a/tests/resources/nasty/.gitted/objects/e7/3a04f71f11ab9d7dde72ff793882757a03f16e b/tests/resources/nasty/.gitted/objects/e7/3a04f71f11ab9d7dde72ff793882757a03f16e
new file mode 100644
index 0000000..14144d7
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/e7/3a04f71f11ab9d7dde72ff793882757a03f16e differ
diff --git a/tests/resources/nasty/.gitted/objects/eb/82bf596b66f90e25f881ce9b92cb55bab4fdf5 b/tests/resources/nasty/.gitted/objects/eb/82bf596b66f90e25f881ce9b92cb55bab4fdf5
new file mode 100644
index 0000000..b886096
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/eb/82bf596b66f90e25f881ce9b92cb55bab4fdf5 differ
diff --git a/tests/resources/nasty/.gitted/objects/f2/c059dab35f6534b3f16d90b2f1de308615320c b/tests/resources/nasty/.gitted/objects/f2/c059dab35f6534b3f16d90b2f1de308615320c
new file mode 100644
index 0000000..c3580d3
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/f2/c059dab35f6534b3f16d90b2f1de308615320c differ
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_1 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_1
new file mode 100644
index 0000000..dc48bd6
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_1
@@ -0,0 +1 @@
+46fe10fa23259b089ab050788b06df979cd7d054
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_10 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_10
new file mode 100644
index 0000000..b3a9726
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_10
@@ -0,0 +1 @@
+9ab85e507899c19dca57778c9b6e5f1ec799b911
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_11 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_11
new file mode 100644
index 0000000..edf2798
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_11
@@ -0,0 +1 @@
+15f7d9f9514eeb65b9588c49b10b1da145a729a2
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_12 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_12
new file mode 100644
index 0000000..c4e682e
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_12
@@ -0,0 +1 @@
+c3a70f8a376f17adccfb52b48e2831bfef2a2172
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_13 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_13
new file mode 100644
index 0000000..76a155c
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_13
@@ -0,0 +1 @@
+c2a2ddd339574e5cbfd9228be840eb1bf496de4e
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_14 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_14
new file mode 100644
index 0000000..be2f835
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_14
@@ -0,0 +1 @@
+712ceb8eb3e57072447715bc4057c57aa50f629a
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_15 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_15
new file mode 100644
index 0000000..3fdeece
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_15
@@ -0,0 +1 @@
+3b24e5c751ee9c7c89df32a0d959748aa3d0112c
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_16 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_16
new file mode 100644
index 0000000..2739555
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_16
@@ -0,0 +1 @@
+c8f98a1762ec016c30f0d73512df399dedefc3fd
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_2 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_2
new file mode 100644
index 0000000..480832e
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_2
@@ -0,0 +1 @@
+35ae236308929a536fb4e852278a9b98c42babb3
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_3 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_3
new file mode 100644
index 0000000..8510ece
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_3
@@ -0,0 +1 @@
+96156716851c0afb4702b0d2c4ac8c496a730e29
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_4 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_4
new file mode 100644
index 0000000..754b55e
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_4
@@ -0,0 +1 @@
+7a0538bc4e20aecb36ef221f2077eb30ebe0bcb2
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_5 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_5
new file mode 100644
index 0000000..161ebc4
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_5
@@ -0,0 +1 @@
+1635c47d80914f0abfa43dd4234a948db5bdb107
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_6 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_6
new file mode 100644
index 0000000..f8a5fa3
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_6
@@ -0,0 +1 @@
+9e24726d64589ba02430da8cebb5712dad35593d
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_7 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_7
new file mode 100644
index 0000000..ad5ad1d
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_7
@@ -0,0 +1 @@
+ce22b3cd9a01efafc370879c1938e0c32fb6f195
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_8 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_8
new file mode 100644
index 0000000..4d10c40
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_8
@@ -0,0 +1 @@
+a576a98d3279989226992610372035b76a01a3e9
diff --git a/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_9 b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_9
new file mode 100644
index 0000000..a935018
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_9
@@ -0,0 +1 @@
+442894787eddb1e84a952f17a027590e2c6c02cd