yeonjuan/parse-git-diff

Support large diffs/binary files

Closed this issue · 6 comments

I have a pretty large diff and it appears that parse-git-diff is unable to process all of it.

https://gist.github.com/kentcdodds/4cbf74cfb232f798e71603d0deb91f4d

I included the JSON for the parsed output I get for this. It's missing a couple files. I'd also like to have the binary files represented as changed/added/deleted if possible.

I'm thinking this is one part bug report, and one part feature request 😅

I think it may be the data.db file. Because if I remove that before running the diff everything seems to display (except the other binary files).

I wonder if the issue is related to the binary files. Perhaps parse-git-diff stops processing the diff once it finds a binary file and that's why all the rest of the files aren't included in the parsed output?

@kentcdodds Thanks for the report. I'll take a look at it!!

It's fixed and released in v0.0.11

Thank you!

I tried the latest version and it isn't parsing things properly.

Here's the diff I passed:

diff --git var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.problem.outlet/bn604czq5nh/app/assets/img.png var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/app/assets/img.png
index d7077fa..84d259b 100644
Binary files var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.problem.outlet/bn604czq5nh/app/assets/img.png and var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/app/assets/img.png differ
diff --git var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/app/assets/img2.png var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/app/assets/img2.png
new file mode 100644
index 0000000..636c497
Binary files /dev/null and var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/app/assets/img2.png differ
diff --git var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.problem.outlet/bn604czq5nh/app/root.tsx var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/app/root.tsx
index f4fc7f7..703fce2 100644
--- var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.problem.outlet/bn604czq5nh/app/root.tsx
+++ var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/app/root.tsx
@@ -7,9 +7,10 @@ import {
 	Scripts,
 	ScrollRestoration,
 } from '@remix-run/react'
-import tailwindStylesheetUrl from './styles/tailwind.css'
 import { KCDShop } from './kcdshop.tsx'
 
+import tailwindStylesheetUrl from './styles/tailwind.css'
+
 export const links: LinksFunction = () => {
 	return [{ rel: 'stylesheet', href: tailwindStylesheetUrl }]
 }
diff --git var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.problem.outlet/bn604czq5nh/app/routes/deleted.tsx var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.problem.outlet/bn604czq5nh/app/routes/deleted.tsx
deleted file mode 100644
index 9080896..0000000
--- var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.problem.outlet/bn604czq5nh/app/routes/deleted.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import { json } from '@remix-run/node'
-
-export async function loader() {
-	return json({ iAm: 'deleted' })
-}
diff --git var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.problem.outlet/bn604czq5nh/app/routes/index.tsx var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/app/routes/index.tsx
index ceb48f8..c5f1b30 100644
--- var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.problem.outlet/bn604czq5nh/app/routes/index.tsx
+++ var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/app/routes/index.tsx
@@ -1,12 +1,7 @@
-import { Link } from '@remix-run/react'
-
 export default function Index() {
 	return (
-		<main className="relative min-h-screen bg-white">
+		<main className="relative min-h-screen bg-white sm:flex sm:items-center sm:justify-center">
 			<h1>Welcome to the app</h1>
-			<Link to="/whatever" className="text-blue-800 underline">
-				Go to "/whatever"
-			</Link>
 		</main>
 	)
 }
diff --git var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/app/routes/parent.tsx var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/app/routes/parent.tsx
new file mode 100644
index 0000000..9fd1945
--- /dev/null
+++ var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/app/routes/parent.tsx
@@ -0,0 +1,3 @@
+export default function Parent() {
+	return <p>I am a parent</p>
+}
diff --git var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.problem.outlet/bn604czq5nh/package.json var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/package.json
index 6aad87d..0a945ff 100644
--- var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.problem.outlet/bn604czq5nh/package.json
+++ var/folders/kt/zd3bfncd0c3gjx25hbcq483c0000gn/T/kcdshop/diff/example/exercises__sep__01.nested-routing__sep__01.solution.outlet/bn604czq5nh/package.json
@@ -1,19 +1,14 @@
 {
-  "name": "exercises.01.nested-routing.01.problem.outlet",
+  "name": "exercises.01.nested-routing.01.solution.outlet",
   "private": true,
   "sideEffects": false,
-  "kcd-workshop": {
-    "testRequiresApp": true,
-    "scripts": {
-      "test": "echo \"\\x1b[36mhello\\x1b[37mworld\" && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi && sleep 0.7 && echo hi"
-    }
-  },
   "type": "module",
   "scripts": {
     "build": "run-s build:*",
     "build:remix": "remix build",
     "build:server": "tsx ./other/build-server.ts",
     "dev": "remix dev -c \"tsx ./index.js\" --no-restart",
+    "test": "echo TODO",
     "format": "prettier --write .",
     "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
     "start": "cross-env NODE_ENV=production node .",

And here's the output:

{"type":"GitDiff","files":[]}