Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 883 by anfedorov: GitDiffParser parses file additions badly (fix  
patch enclosed in description)
http://code.google.com/p/reviewboard/issues/detail?id=883

What's the URL of the page containing the problem?

http://localhost:8000/r/11/diff/#index_header

What steps will reproduce the problem?
1. Submit patch with new added files using post-review.py
2. Go to diff page
3. Notice that first two letters of the file name are cut off

What is the expected output? What do you see instead?

Expected:

-- quote --
Files Changed:

    1. test.post: 1 change [ new content ]
-- endquote --

Saw:

-- quote --
Files Changed:
    1. st.post: 1 change [ new content ]
-- endquote --

What operating system are you using? What browser?

Ubuntu 8.10
Firefox 3.0.5
Python 2.5.2 on server

Please provide any additional information below.

This patch fixes things:

Index: scmtools/git.py
===================================================================
--- scmtools/git.py     (revision 1768)
+++ scmtools/git.py     (working copy)
@@ -105,8 +105,9 @@
              diffLine = self.lines[i].split()
              try:
                  # Need to remove the "a/" and "b/" prefix
-                file.origFile = diffLine[-2][2:]
-                file.newFile = diffLine[-1][2:]
+                remPrefix = re.compile("^[a|b]/");
+                file.origFile = remPrefix.sub("", diffLine[-2])
+                file.newFile = remPrefix.sub("", diffLine[-1])
              except ValueError:
                  raise DiffParserError(
                      "The diff file is missing revision information",

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To post to this group, send email to reviewboard-issues@googlegroups.com
To unsubscribe from this group, send email to 
reviewboard-issues+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard-issues?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to