summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2014-12-10 19:12:16 -0500
committerEdward Thomson <ethomson@microsoft.com>2014-12-17 14:59:18 -0600
commit65f43057a2d8316f15a233fe345524ef6dbcac08 (patch)
tree2da63af88e5dd6c5f938f36c16120ed5e3034a16
parent492bcd082539e83acf8bb301761e3f0bb51d397e (diff)
downloadlibgit2-65f43057a2d8316f15a233fe345524ef6dbcac08.tar.gz
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.
-rw-r--r--src/path.c93
-rw-r--r--src/path.h5
-rw-r--r--tests/checkout/nasty.c42
-rw-r--r--tests/path/core.c31
-rw-r--r--tests/resources/nasty/.gitted/objects/04/fab819d8388295cbe3496310e4e53ef8f4a115bin0 -> 49 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/0b/8206dd72a3b3b932fb562f92d29199b9398390bin0 -> 50 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/10/cb44a89d1a9e8bf74de3f11a2a61ee833f13b1bin0 -> 50 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/11/9f6cd3535de0e2a15654947a7b1a5affbf1406bin0 -> 50 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/15/f7d9f9514eeb65b9588c49b10b1da145a729a22
-rw-r--r--tests/resources/nasty/.gitted/objects/16/35c47d80914f0abfa43dd4234a948db5bdb1072
-rw-r--r--tests/resources/nasty/.gitted/objects/2b/4b774d8c5441b22786531f34ffc77800cda8cfbin0 -> 50 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/2d/23d51590ec2f53fe4b5bb3e5ca62e35e4ef85abin0 -> 49 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/35/ae236308929a536fb4e852278a9b98c42babb31
-rw-r--r--tests/resources/nasty/.gitted/objects/38/0b9e58872ccf1d858be4b0fc612514a080bc40bin0 -> 49 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/3b/24e5c751ee9c7c89df32a0d959748aa3d0112c2
-rw-r--r--tests/resources/nasty/.gitted/objects/44/2894787eddb1e84a952f17a027590e2c6c02cdbin0 -> 137 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/46/fe10fa23259b089ab050788b06df979cd7d054bin0 -> 137 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/6b/7d8a5a48a3c753b75a8fe5196f9c8704ac64adbin0 -> 50 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/71/2ceb8eb3e57072447715bc4057c57aa50f629abin0 -> 138 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/7a/0538bc4e20aecb36ef221f2077eb30ebe0bcb22
-rw-r--r--tests/resources/nasty/.gitted/objects/7a/e174dda8f105a582c593b52d74545a3565819dbin0 -> 51 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/80/24458e7ee49c456fd8c45d3591e9936bf613b3bin0 -> 50 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/81/e2b84864f16ebd285b34a2b1e87ebb41f4c230bin0 -> 49 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/88/6c0f5f71057d846f71f05a05fdffad332bc070bin0 -> 50 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/96/156716851c0afb4702b0d2c4ac8c496a730e291
-rw-r--r--tests/resources/nasty/.gitted/objects/9a/b85e507899c19dca57778c9b6e5f1ec799b9113
-rw-r--r--tests/resources/nasty/.gitted/objects/9e/24726d64589ba02430da8cebb5712dad35593dbin0 -> 136 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/a5/76a98d3279989226992610372035b76a01a3e9bin0 -> 136 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/b1/1df9aee97a65817e8904a74f5e6a1c62c7a275bin0 -> 50 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/bb/29ec85546d29b0bcc314242660d7772b0a3803bin0 -> 50 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/c2/a2ddd339574e5cbfd9228be840eb1bf496de4ebin0 -> 137 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/c3/a70f8a376f17adccfb52b48e2831bfef2a21722
-rw-r--r--tests/resources/nasty/.gitted/objects/c8/f98a1762ec016c30f0d73512df399dedefc3fd3
-rw-r--r--tests/resources/nasty/.gitted/objects/ce/22b3cd9a01efafc370879c1938e0c32fb6f1953
-rw-r--r--tests/resources/nasty/.gitted/objects/e7/3a04f71f11ab9d7dde72ff793882757a03f16ebin0 -> 50 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/eb/82bf596b66f90e25f881ce9b92cb55bab4fdf5bin0 -> 50 bytes
-rw-r--r--tests/resources/nasty/.gitted/objects/f2/c059dab35f6534b3f16d90b2f1de308615320cbin0 -> 50 bytes
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_11
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_101
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_111
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_121
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_131
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_141
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_151
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_161
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_21
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_31
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_41
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_51
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_61
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_71
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_81
-rw-r--r--tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_91
53 files changed, 207 insertions, 1 deletions
diff --git a/src/path.c b/src/path.c
index dbe193acb..724d9ede2 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 7efcc1c8c..752f59bd3 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 8bc98f3d6..a667dcd8f 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 7cc111800..528108bea 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 000000000..688b970c2
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/04/fab819d8388295cbe3496310e4e53ef8f4a115
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/0b/8206dd72a3b3b932fb562f92d29199b9398390 b/tests/resources/nasty/.gitted/objects/0b/8206dd72a3b3b932fb562f92d29199b9398390
new file mode 100644
index 000000000..b06361552
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/0b/8206dd72a3b3b932fb562f92d29199b9398390
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/10/cb44a89d1a9e8bf74de3f11a2a61ee833f13b1 b/tests/resources/nasty/.gitted/objects/10/cb44a89d1a9e8bf74de3f11a2a61ee833f13b1
new file mode 100644
index 000000000..9d14298d5
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/10/cb44a89d1a9e8bf74de3f11a2a61ee833f13b1
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/11/9f6cd3535de0e2a15654947a7b1a5affbf1406 b/tests/resources/nasty/.gitted/objects/11/9f6cd3535de0e2a15654947a7b1a5affbf1406
new file mode 100644
index 000000000..fb03b26b0
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/11/9f6cd3535de0e2a15654947a7b1a5affbf1406
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/15/f7d9f9514eeb65b9588c49b10b1da145a729a2 b/tests/resources/nasty/.gitted/objects/15/f7d9f9514eeb65b9588c49b10b1da145a729a2
new file mode 100644
index 000000000..a7f3683e4
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/15/f7d9f9514eeb65b9588c49b10b1da145a729a2
@@ -0,0 +1,2 @@
+x10 Es
+H(iںbae&q(5BܞpԺ*`wژѓ3C”1epB> 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 000000000..f82b82be7
--- /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 000000000..b286daa0c
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/2b/4b774d8c5441b22786531f34ffc77800cda8cf
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/2d/23d51590ec2f53fe4b5bb3e5ca62e35e4ef85a b/tests/resources/nasty/.gitted/objects/2d/23d51590ec2f53fe4b5bb3e5ca62e35e4ef85a
new file mode 100644
index 000000000..5d47d827e
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/2d/23d51590ec2f53fe4b5bb3e5ca62e35e4ef85a
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/35/ae236308929a536fb4e852278a9b98c42babb3 b/tests/resources/nasty/.gitted/objects/35/ae236308929a536fb4e852278a9b98c42babb3
new file mode 100644
index 000000000..b8633de0a
--- /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 000000000..a911c3ca8
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/38/0b9e58872ccf1d858be4b0fc612514a080bc40
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/3b/24e5c751ee9c7c89df32a0d959748aa3d0112c b/tests/resources/nasty/.gitted/objects/3b/24e5c751ee9c7c89df32a0d959748aa3d0112c
new file mode 100644
index 000000000..5adcd1446
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/3b/24e5c751ee9c7c89df32a0d959748aa3d0112c
@@ -0,0 +1,2 @@
+x10 Es
+Hm&bae&(1Bܞp) !ٱ#t)Y;#z4U*\қj*4a=D)'F;هg쿚/+5@O c? \ 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 000000000..c81b0e67a
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/44/2894787eddb1e84a952f17a027590e2c6c02cd
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/46/fe10fa23259b089ab050788b06df979cd7d054 b/tests/resources/nasty/.gitted/objects/46/fe10fa23259b089ab050788b06df979cd7d054
new file mode 100644
index 000000000..6d1f52df9
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/46/fe10fa23259b089ab050788b06df979cd7d054
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/6b/7d8a5a48a3c753b75a8fe5196f9c8704ac64ad b/tests/resources/nasty/.gitted/objects/6b/7d8a5a48a3c753b75a8fe5196f9c8704ac64ad
new file mode 100644
index 000000000..121277fdf
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/6b/7d8a5a48a3c753b75a8fe5196f9c8704ac64ad
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/71/2ceb8eb3e57072447715bc4057c57aa50f629a b/tests/resources/nasty/.gitted/objects/71/2ceb8eb3e57072447715bc4057c57aa50f629a
new file mode 100644
index 000000000..9ed35d78a
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/71/2ceb8eb3e57072447715bc4057c57aa50f629a
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/7a/0538bc4e20aecb36ef221f2077eb30ebe0bcb2 b/tests/resources/nasty/.gitted/objects/7a/0538bc4e20aecb36ef221f2077eb30ebe0bcb2
new file mode 100644
index 000000000..0c3ea2694
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/7a/0538bc4e20aecb36ef221f2077eb30ebe0bcb2
@@ -0,0 +1,2 @@
+x1!E9&X!1 +WMDF\9BMCc—2WpaRԸ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 000000000..17dec5920
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/7a/e174dda8f105a582c593b52d74545a3565819d
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/80/24458e7ee49c456fd8c45d3591e9936bf613b3 b/tests/resources/nasty/.gitted/objects/80/24458e7ee49c456fd8c45d3591e9936bf613b3
new file mode 100644
index 000000000..d2074aaed
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/80/24458e7ee49c456fd8c45d3591e9936bf613b3
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/81/e2b84864f16ebd285b34a2b1e87ebb41f4c230 b/tests/resources/nasty/.gitted/objects/81/e2b84864f16ebd285b34a2b1e87ebb41f4c230
new file mode 100644
index 000000000..c28ad0a63
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/81/e2b84864f16ebd285b34a2b1e87ebb41f4c230
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/88/6c0f5f71057d846f71f05a05fdffad332bc070 b/tests/resources/nasty/.gitted/objects/88/6c0f5f71057d846f71f05a05fdffad332bc070
new file mode 100644
index 000000000..432eea283
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/88/6c0f5f71057d846f71f05a05fdffad332bc070
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/96/156716851c0afb4702b0d2c4ac8c496a730e29 b/tests/resources/nasty/.gitted/objects/96/156716851c0afb4702b0d2c4ac8c496a730e29
new file mode 100644
index 000000000..57419bc77
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/96/156716851c0afb4702b0d2c4ac8c496a730e29
@@ -0,0 +1 @@
+x;0sPKRqVRE"1W`)$uU0aich0lAWG1&,;deF襋47 E&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 000000000..aa24a8fc7
--- /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 000000000..2cf9535ae
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/9e/24726d64589ba02430da8cebb5712dad35593d
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/a5/76a98d3279989226992610372035b76a01a3e9 b/tests/resources/nasty/.gitted/objects/a5/76a98d3279989226992610372035b76a01a3e9
new file mode 100644
index 000000000..75fa458e7
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/a5/76a98d3279989226992610372035b76a01a3e9
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/b1/1df9aee97a65817e8904a74f5e6a1c62c7a275 b/tests/resources/nasty/.gitted/objects/b1/1df9aee97a65817e8904a74f5e6a1c62c7a275
new file mode 100644
index 000000000..b2e0eda1a
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/b1/1df9aee97a65817e8904a74f5e6a1c62c7a275
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/bb/29ec85546d29b0bcc314242660d7772b0a3803 b/tests/resources/nasty/.gitted/objects/bb/29ec85546d29b0bcc314242660d7772b0a3803
new file mode 100644
index 000000000..00ab02c21
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/bb/29ec85546d29b0bcc314242660d7772b0a3803
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/c2/a2ddd339574e5cbfd9228be840eb1bf496de4e b/tests/resources/nasty/.gitted/objects/c2/a2ddd339574e5cbfd9228be840eb1bf496de4e
new file mode 100644
index 000000000..939cf5576
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/c2/a2ddd339574e5cbfd9228be840eb1bf496de4e
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/c3/a70f8a376f17adccfb52b48e2831bfef2a2172 b/tests/resources/nasty/.gitted/objects/c3/a70f8a376f17adccfb52b48e2831bfef2a2172
new file mode 100644
index 000000000..b43d3f165
--- /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 000000000..85ddc7f9b
--- /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 000000000..eb5acc34b
--- /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 000000000..14144d736
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/e7/3a04f71f11ab9d7dde72ff793882757a03f16e
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/eb/82bf596b66f90e25f881ce9b92cb55bab4fdf5 b/tests/resources/nasty/.gitted/objects/eb/82bf596b66f90e25f881ce9b92cb55bab4fdf5
new file mode 100644
index 000000000..b886096ce
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/eb/82bf596b66f90e25f881ce9b92cb55bab4fdf5
Binary files differ
diff --git a/tests/resources/nasty/.gitted/objects/f2/c059dab35f6534b3f16d90b2f1de308615320c b/tests/resources/nasty/.gitted/objects/f2/c059dab35f6534b3f16d90b2f1de308615320c
new file mode 100644
index 000000000..c3580d334
--- /dev/null
+++ b/tests/resources/nasty/.gitted/objects/f2/c059dab35f6534b3f16d90b2f1de308615320c
Binary files 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 000000000..dc48bd6fc
--- /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 000000000..b3a972629
--- /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 000000000..edf27988a
--- /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 000000000..c4e682e10
--- /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 000000000..76a155c20
--- /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 000000000..be2f83551
--- /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 000000000..3fdeecea6
--- /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 000000000..2739555f7
--- /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 000000000..480832e01
--- /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 000000000..8510ece13
--- /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 000000000..754b55edd
--- /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 000000000..161ebc43b
--- /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 000000000..f8a5fa3f7
--- /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 000000000..ad5ad1d70
--- /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 000000000..4d10c4009
--- /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 000000000..a935018fa
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/dotgit_hfs_ignorable_9
@@ -0,0 +1 @@
+442894787eddb1e84a952f17a027590e2c6c02cd