[PATCH 0/2] Diff format documentation for git-format-patch

STALE2021d

3 messages, 1 author, 2021-03-24 · open the first message on its own page

[PATCH 0/2] Diff format documentation for git-format-patch

From: Bagas Sanjaya <hidden>
Date: 2021-03-24 12:31:19

git-format-patch generates diff, but the documentation for its
format is missing, so add it.

Bagas Sanjaya (2):
  git-format-patch: Include diff-generate-patch documentation
  git-format-patch: Document format for binary patch

 Documentation/git-format-patch.txt | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

-- 
2.25.1

[PATCH 1/2] git-format-patch: Include diff-generate-patch documentation

From: Bagas Sanjaya <hidden>
Date: 2021-03-24 12:31:53

diff-generate-patch explains format of generated patch for text files.

Signed-off-by: Bagas Sanjaya <redacted>
---
 Documentation/git-format-patch.txt | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 3e49bf2210..247033f8fc 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -718,6 +718,13 @@ use it only when you know the recipient uses Git to apply your patch.
 $ git format-patch -3
 ------------
 
+GENERATED DIFF FORMAT
+---------------------
+git-format-patch emits diff in generated patches. For text files, the
+diff format is described as below:
+
+include::diff-generate-patch.txt[]
+
 SEE ALSO
 --------
 linkgit:git-am[1], linkgit:git-send-email[1]
-- 
2.25.1

[PATCH 2/2] git-format-patch: Document format for binary patch

From: Bagas Sanjaya <hidden>
Date: 2021-03-24 12:31:53

Document binary file patch formats that are different from text file
patch.

Signed-off-by: Bagas Sanjaya <redacted>
---
 Documentation/git-format-patch.txt | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 247033f8fc..8de172b1f4 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -725,6 +725,28 @@ diff format is described as below:
 
 include::diff-generate-patch.txt[]
 
+Binary Files
+~~~~~~~~~~~~
+For binary files, the diff format have some differences compared to text
+files:
+
+1. Object hashes in index header line (`index <hash>..<hash> <mode>`)
+   are always given in full form, as binary patch is designed to be
+   applied only to an exact copy of original file. This is to ensure
+   that such patch don't apply to file with similar name but different
+   hash.
+
+2. There are additional extended header lines specific to binary files:
+
+        GIT binary patch
+        delta <bytes>
+        literal <bytes>
+
+3. The diff body can be either delta or full (literal) content,
+   whichever is the smallest size. It is encoded with base85 algorithm,
+   and emitted in 64 characters each line. All but the last line in
+   the body are prefixed with `z`.
+
 SEE ALSO
 --------
 linkgit:git-am[1], linkgit:git-send-email[1]
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help