Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add diff #122

Open
davidak opened this issue Sep 18, 2021 · 3 comments · May be fixed by #124
Open

Add diff #122

davidak opened this issue Sep 18, 2021 · 3 comments · May be fixed by #124

Comments

@davidak
Copy link
Contributor

davidak commented Sep 18, 2021

i thought what the smallest possible (git) diff would be

the answer would fit greatly in this repo

@TPS
Copy link

TPS commented Sep 18, 2021

Solved via #123 merge?

@davidak
Copy link
Contributor Author

davidak commented Sep 18, 2021

I think we can also add a .diff file.

@davidak
Copy link
Contributor Author

davidak commented Sep 19, 2021

Some research:

I created a patch from the empty commit (63a7f20) which resulted in an empty file. I tried to apply it, but got an error. So that is not a valid patch.

[davidak@gaming:~/code/small]$ git format-patch dfbd9249a766f67e1a142b2becd41dcb1f8b3447
0001-Add-smallest-possible-git-commit-empty.patch
0002-Add-link-to-smallest-git-commit.patch

[davidak@gaming:~/code/small]$ cat 0001-Add-smallest-possible-git-commit-empty.patch

[davidak@gaming:~/code/small]$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.

[davidak@gaming:~/code/small]$ git checkout -b test
Switched to a new branch 'test'

[davidak@gaming:~/code/small]$ git am 0001-Add-smallest-possible-git-commit-empty.patch
Patch format detection failed.

So i actually changed a file with a short name ('c.c') by adding one character.

[davidak@gaming:~/code/small]$ git diff > c.patch

[davidak@gaming:~/code/small]$ cat c.patch
diff --git a/c.c b/c.c
index f7fb591..c61f0be 100644
--- a/c.c
+++ b/c.c
@@ -1 +1 @@
-int main;
+lint main;

[davidak@gaming:~/code/small]$ git diff --no-prefix > c.patch

[davidak@gaming:~/code/small]$ cat c.patch
diff --git c.c c.c
index f7fb591..c61f0be 100644
--- c.c
+++ c.c
@@ -1 +1 @@
-int main;
+lint main;

The patch can be sucessfully applied with: patch -p0 < c.patch

@davidak davidak linked a pull request Sep 19, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants