Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork939
Fix diff patch parser for paths with unsafe chars#415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
2 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
50 changes: 37 additions & 13 deletionsgit/diff.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletionsgit/test/fixtures/diff_patch_unsafe_paths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
diff --git a/path/ starting with a space b/path/ starting with a space | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94d8859a54 | ||
--- /dev/null | ||
+++ b/path/ starting with a space | ||
@@ -0,0 +1 @@ | ||
+dummy content | ||
diff --git "a/path/\"with-quotes\"" "b/path/\"with-quotes\"" | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94d8859a54 | ||
--- /dev/null | ||
+++ "b/path/\"with-quotes\"" | ||
@@ -0,0 +1 @@ | ||
+dummy content | ||
diff --git a/path/'with-single-quotes' b/path/'with-single-quotes' | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94d8859a54 | ||
--- /dev/null | ||
+++ b/path/'with-single-quotes' | ||
@@ -0,0 +1 @@ | ||
+dummy content | ||
diff --git a/path/ending in a space b/path/ending in a space | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94d8859a54 | ||
--- /dev/null | ||
+++ b/path/ending in a space | ||
@@ -0,0 +1 @@ | ||
+dummy content | ||
diff --git "a/path/with\ttab" "b/path/with\ttab" | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94d8859a54 | ||
--- /dev/null | ||
+++ "b/path/with\ttab" | ||
@@ -0,0 +1 @@ | ||
+dummy content | ||
diff --git "a/path/with\nnewline" "b/path/with\nnewline" | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94d8859a54 | ||
--- /dev/null | ||
+++ "b/path/with\nnewline" | ||
@@ -0,0 +1 @@ | ||
+dummy content | ||
diff --git a/path/with spaces b/path/with spaces | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94d8859a54 | ||
--- /dev/null | ||
+++ b/path/with spaces | ||
@@ -0,0 +1 @@ | ||
+dummy content | ||
diff --git a/path/with-question-mark? b/path/with-question-mark? | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94d8859a54 | ||
--- /dev/null | ||
+++ b/path/with-question-mark? | ||
@@ -0,0 +1 @@ | ||
+dummy content | ||
diff --git "a/path/¯\\_(ツ)_|¯" "b/path/¯\\_(ツ)_|¯" | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94d8859a54 | ||
--- /dev/null | ||
+++ "b/path/¯\\_(ツ)_|¯" | ||
@@ -0,0 +1 @@ | ||
+dummy content | ||
diff --git a/a/with spaces b/b/with some spaces | ||
similarity index 100% | ||
rename from a/with spaces | ||
rename to b/with some spaces | ||
diff --git a/a/ending in a space b/b/ending with space | ||
similarity index 100% | ||
rename from a/ending in a space | ||
rename to b/ending with space | ||
diff --git "a/a/\"with-quotes\"" "b/b/\"with even more quotes\"" | ||
similarity index 100% | ||
rename from "a/\"with-quotes\"" | ||
rename to "b/\"with even more quotes\"" |
29 changes: 27 additions & 2 deletionsgit/test/test_diff.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.