Skip to content

Commit 35d4bb9

Browse files
committed
Update documentation for --git-prefixes
Assisted-by: Cursor
1 parent a7a04cc commit 35d4bb9

2 files changed

Lines changed: 58 additions & 2 deletions

File tree

doc/patchutils.xml

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,9 @@
870870
<listitem>
871871
<para>How to handle <literal>a/</literal> and <literal>b/</literal>
872872
prefixes in Git diff filenames. With <literal>strip</literal>, removes
873-
the prefixes for consistent output. With <literal>keep</literal> (default),
873+
the prefixes both for filename matching (when using <option>-i</option>
874+
and <option>-x</option> options) and for filename output (similar to
875+
<option>--strip</option>). With <literal>keep</literal> (default),
874876
preserves existing behavior. Applies to both Git-specific diffs (binary files,
875877
renames, mode changes) and traditional diffs when part of a Git patch.
876878
Note: Git rename operations use <literal>rename from/to</literal> headers
@@ -1383,6 +1385,23 @@ patch.file]]></screen></para>
13831385
</listitem>
13841386
</varlistentry>
13851387

1388+
<varlistentry>
1389+
<term><option>--git-prefixes</option>=<replaceable>strip|keep</replaceable></term>
1390+
<listitem>
1391+
<para>How to handle <literal>a/</literal> and <literal>b/</literal>
1392+
prefixes in Git diff filenames. With <literal>strip</literal>, removes
1393+
the prefixes both for filename matching (when using <option>-i</option>
1394+
and <option>-x</option> options) and for filename output (similar to
1395+
<option>--strip</option>). With <literal>keep</literal> (default),
1396+
preserves existing behavior. Applies to both Git-specific diffs (binary files,
1397+
renames, mode changes) and traditional diffs when part of a Git patch.
1398+
Note: Git rename operations use <literal>rename from/to</literal> headers
1399+
that contain literal filenames without <literal>a/</literal> or
1400+
<literal>b/</literal> prefixes, so this option does not affect renamed
1401+
filenames. The default will change to <literal>strip</literal> in version 0.5.0.</para>
1402+
</listitem>
1403+
</varlistentry>
1404+
13861405
<varlistentry>
13871406
<term><option>--addprefix</option>=<replaceable>PREFIX</replaceable></term>
13881407
<listitem>
@@ -1563,6 +1582,7 @@ done)]]></screen></para>
15631582
<arg>--strip-match=<replaceable>n</replaceable></arg>
15641583
</group>
15651584
<arg choice="opt">--strip=<replaceable>n</replaceable></arg>
1585+
<arg choice="opt">--git-prefixes=<replaceable>strip|keep</replaceable></arg>
15661586
<arg choice="opt">--addprefix=<replaceable>PREFIX</replaceable></arg>
15671587
<group choice="opt">
15681588
<arg>-s</arg>
@@ -1772,6 +1792,23 @@ will pipe patch of file #2 to vim - -R
17721792
</listitem>
17731793
</varlistentry>
17741794

1795+
<varlistentry>
1796+
<term><option>--git-prefixes</option>=<replaceable>strip|keep</replaceable></term>
1797+
<listitem>
1798+
<para>How to handle <literal>a/</literal> and <literal>b/</literal>
1799+
prefixes in Git diff filenames. With <literal>strip</literal>, removes
1800+
the prefixes both for filename matching (when using <option>-i</option>
1801+
and <option>-x</option> options) and for filename output (similar to
1802+
<option>--strip</option>). With <literal>keep</literal> (default),
1803+
preserves existing behavior. Applies to both Git-specific diffs (binary files,
1804+
renames, mode changes) and traditional diffs when part of a Git patch.
1805+
Note: Git rename operations use <literal>rename from/to</literal> headers
1806+
that contain literal filenames without <literal>a/</literal> or
1807+
<literal>b/</literal> prefixes, so this option does not affect renamed
1808+
filenames. The default will change to <literal>strip</literal> in version 0.5.0.</para>
1809+
</listitem>
1810+
</varlistentry>
1811+
17751812
<varlistentry>
17761813
<term><option>--addprefix</option>=<replaceable>PREFIX</replaceable></term>
17771814
<listitem>
@@ -2222,6 +2259,7 @@ will pipe patch of file #2 to vim - -R
22222259
<arg>--strip-match=<replaceable>n</replaceable></arg>
22232260
</group>
22242261
<arg choice="opt">--strip=<replaceable>n</replaceable></arg>
2262+
<arg choice="opt">--git-prefixes=<replaceable>strip|keep</replaceable></arg>
22252263
<arg choice="opt">--addprefix=<replaceable>PREFIX</replaceable></arg>
22262264
<arg choice="opt">--addoldprefix=<replaceable>PREFIX</replaceable></arg>
22272265
<arg choice="opt">--addnewprefix=<replaceable>PREFIX</replaceable></arg>
@@ -2373,6 +2411,23 @@ will pipe patch of file #2 to vim - -R
23732411
</listitem>
23742412
</varlistentry>
23752413

2414+
<varlistentry>
2415+
<term><option>--git-prefixes</option>=<replaceable>strip|keep</replaceable></term>
2416+
<listitem>
2417+
<para>How to handle <literal>a/</literal> and <literal>b/</literal>
2418+
prefixes in Git diff filenames. With <literal>strip</literal>, removes
2419+
the prefixes both for filename matching (when using <option>-i</option>
2420+
and <option>-x</option> options) and for filename output (similar to
2421+
<option>--strip</option>). With <literal>keep</literal> (default),
2422+
preserves existing behavior. Applies to both Git-specific diffs (binary files,
2423+
renames, mode changes) and traditional diffs when part of a Git patch.
2424+
Note: Git rename operations use <literal>rename from/to</literal> headers
2425+
that contain literal filenames without <literal>a/</literal> or
2426+
<literal>b/</literal> prefixes, so this option does not affect renamed
2427+
filenames. The default will change to <literal>strip</literal> in version 0.5.0.</para>
2428+
</listitem>
2429+
</varlistentry>
2430+
23762431
<varlistentry>
23772432
<term><option>--addprefix</option>=<replaceable>PREFIX</replaceable></term>
23782433
<listitem>

src/filterdiff.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1564,7 +1564,8 @@ const char * syntax_str =
15641564
" initial pathname components to ignore\n"
15651565
" --strip=N initial pathname components to strip\n"
15661566
" --git-prefixes=strip|keep\n"
1567-
" how to handle a/ and b/ prefixes in Git diffs (default: keep)\n"
1567+
" how to handle a/ and b/ prefixes in Git diffs for both filename\n"
1568+
" matching (-i/-x) and output (default: keep)\n"
15681569
" --addprefix=PREFIX\n"
15691570
" prefix pathnames with PREFIX\n"
15701571
" --addoldprefix=PREFIX\n"

0 commit comments

Comments
 (0)