@@ -92,6 +92,26 @@ def test_diff_with_staged_file(self, rw_dir):
9292 "This should work, but doesn't right now ... it's OK" ,
9393 )
9494
95+ @with_rw_directory
96+ def test_patch_diff_ignores_mnemonic_prefix (self , rw_dir ):
97+ repo = Repo .init (rw_dir )
98+ filepath = osp .join (rw_dir , "file.txt" )
99+ with open (filepath , "w" ) as stream :
100+ stream .write ("initial\n " )
101+ repo .index .add ([filepath ])
102+ repo .index .commit ("initial" )
103+
104+ with open (filepath , "w" ) as stream :
105+ stream .write ("changed\n " )
106+ repo .git .config ("diff.mnemonicPrefix" , "true" )
107+
108+ self .assertEqual (len (repo .head .commit .diff (None , create_patch = True )), 1 )
109+ self .assertEqual (len (repo .index .diff (None , create_patch = True )), 1 )
110+
111+ repo .index .add ([filepath ])
112+ self .assertEqual (len (repo .index .diff (NULL_TREE , create_patch = True )), 1 )
113+ self .assertEqual (repo .git .config ("--get" , "diff.mnemonicPrefix" ), "true" )
114+
95115 def test_list_from_string_new_mode (self ):
96116 output = StringProcessAdapter (fixture ("diff_new_mode" ))
97117 diffs = Diff ._index_from_patch_format (self .rorepo , output )
0 commit comments