File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ diff --git a/somefile.c b/somefile.c
2+ deleted file mode 100644
3+ index abcdefbbb8..0000000000
4+ --- a/somefile.c
5+ +++ /dev/null
6+ @@ -1,10 +0,0 @@
7+ - /**
8+ - * @file somefile.c
9+ - */
10+ - #include <stdio.h>
11+ -
12+ - int main(int argc, cahr *argv[])
13+ - {
14+ - printf("Hello World\n");
15+ - return 0;
16+ - }
Original file line number Diff line number Diff line change @@ -325,6 +325,16 @@ def test_parse_filename_with_spaces(self):
325325 self .assertTrue (res [0 ].is_added_file )
326326 self .assertEqual (res [0 ].path , 'has spaces/t.sql' )
327327
328+ def test_deleted_file (self ):
329+ filename = os .path .join (self .samples_dir , 'samples/git_delete.diff' )
330+ with open (filename ) as f :
331+ res = PatchSet (f )
332+
333+ self .assertEqual (len (res ), 1 )
334+ self .assertEqual (res [0 ].source_file , 'a/somefile.c' )
335+ self .assertEqual (res [0 ].target_file , '/dev/null' )
336+ self .assertTrue (res [0 ].is_removed_file )
337+
328338 def test_diff_lines_linenos (self ):
329339 with open (self .sample_file , 'rb' ) as diff_file :
330340 res = PatchSet (diff_file , encoding = 'utf-8' )
Original file line number Diff line number Diff line change 4242 r'^diff --git (?P<source>[^\t\n]+) (?P<target>[^\t\n]+)' )
4343
4444# check diff git new file marker `deleted file mode 100644`
45- RE_DIFF_GIT_DELETED_FILE = re .compile (r'^deleted file mode \d+\n $' )
45+ RE_DIFF_GIT_DELETED_FILE = re .compile (r'^deleted file mode \d+$' )
4646
4747# check diff git new file marker `new file mode 100644`
48- RE_DIFF_GIT_NEW_FILE = re .compile (r'^new file mode \d+\n $' )
48+ RE_DIFF_GIT_NEW_FILE = re .compile (r'^new file mode \d+$' )
4949
5050
5151# @@ (source offset, length) (target offset, length) @@ (section header)
You can’t perform that action at this time.
0 commit comments