forked from mojombo/grit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3c5139
commit 6ce0e43
Showing
25 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 @@ | ||
good patch |
This file contains 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 @@ | ||
ref: refs/heads/master |
This file contains 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,6 @@ | ||
[core] | ||
repositoryformatversion = 0 | ||
filemode = true | ||
bare = false | ||
logallrefupdates = true | ||
ignorecase = true |
This file contains 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 @@ | ||
Unnamed repository; edit this file 'description' to name the repository. |
Binary file not shown.
This file contains 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,6 @@ | ||
# git ls-files --others --exclude-from=.git/info/exclude | ||
# Lines that start with '#' are comments. | ||
# For a project mostly in C, the following would be a good set of | ||
# exclude patterns (uncomment them if you want to use them): | ||
# *.[oa] | ||
# *~ |
This file contains 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,8 @@ | ||
0000000000000000000000000000000000000000 5da862ffd84e42b687b65605788f4158f4610400 rick <technoweenie@gmail.com> 1294902968 -0800 commit (initial): initial | ||
5da862ffd84e42b687b65605788f4158f4610400 5da862ffd84e42b687b65605788f4158f4610400 rick <technoweenie@gmail.com> 1294902973 -0800 checkout: moving from master to bad | ||
5da862ffd84e42b687b65605788f4158f4610400 f252f9a68245f465d27b31fcdbf63ab55de58b06 rick <technoweenie@gmail.com> 1294902998 -0800 commit: bad patch | ||
f252f9a68245f465d27b31fcdbf63ab55de58b06 5da862ffd84e42b687b65605788f4158f4610400 rick <technoweenie@gmail.com> 1294902999 -0800 checkout: moving from bad to master | ||
5da862ffd84e42b687b65605788f4158f4610400 cf75ecfce82fb2a8723f86b140980994f0065ecd rick <technoweenie@gmail.com> 1294903011 -0800 commit: update | ||
cf75ecfce82fb2a8723f86b140980994f0065ecd cf75ecfce82fb2a8723f86b140980994f0065ecd rick <technoweenie@gmail.com> 1294903013 -0800 checkout: moving from master to good | ||
cf75ecfce82fb2a8723f86b140980994f0065ecd f3c031e78b368d1b9b03c3eb1b90d8a122277e67 rick <technoweenie@gmail.com> 1294903038 -0800 commit: good patch | ||
f3c031e78b368d1b9b03c3eb1b90d8a122277e67 cf75ecfce82fb2a8723f86b140980994f0065ecd rick <technoweenie@gmail.com> 1294903041 -0800 checkout: moving from good to master |
This file contains 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,2 @@ | ||
0000000000000000000000000000000000000000 5da862ffd84e42b687b65605788f4158f4610400 rick <technoweenie@gmail.com> 1294902973 -0800 branch: Created from HEAD | ||
5da862ffd84e42b687b65605788f4158f4610400 f252f9a68245f465d27b31fcdbf63ab55de58b06 rick <technoweenie@gmail.com> 1294902998 -0800 commit: bad patch |
This file contains 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,2 @@ | ||
0000000000000000000000000000000000000000 cf75ecfce82fb2a8723f86b140980994f0065ecd rick <technoweenie@gmail.com> 1294903013 -0800 branch: Created from HEAD | ||
cf75ecfce82fb2a8723f86b140980994f0065ecd f3c031e78b368d1b9b03c3eb1b90d8a122277e67 rick <technoweenie@gmail.com> 1294903038 -0800 commit: good patch |
This file contains 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,2 @@ | ||
0000000000000000000000000000000000000000 5da862ffd84e42b687b65605788f4158f4610400 rick <technoweenie@gmail.com> 1294902968 -0800 commit (initial): initial | ||
5da862ffd84e42b687b65605788f4158f4610400 cf75ecfce82fb2a8723f86b140980994f0065ecd rick <technoweenie@gmail.com> 1294903011 -0800 commit: update |
Binary file not shown.
This file contains 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,2 @@ | ||
x��] | ||
B!@�]�l���'�K�ө;tU����[����)�50!�d�}����9��->�!�5<,z�)TJ�1���}L�\ް ���/Qg��Z��RF����^*�YG�ժk'�7T�Y8�̓5� |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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 @@ | ||
f252f9a68245f465d27b31fcdbf63ab55de58b06 |
This file contains 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 @@ | ||
f3c031e78b368d1b9b03c3eb1b90d8a122277e67 |
This file contains 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 @@ | ||
cf75ecfce82fb2a8723f86b140980994f0065ecd |
This file contains 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
This file contains 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,39 @@ | ||
require File.dirname(__FILE__) + '/helper' | ||
|
||
class TestGitPatching < Test::Unit::TestCase | ||
def setup | ||
@testdir = File.dirname(__FILE__) | ||
@patchdir = File.join(@testdir, 'patch') | ||
@clonedir = File.join(@testdir, 'patch_clone.git') | ||
@git = Git.new(@patchdir) | ||
end | ||
|
||
def teardown | ||
Grit.debug = false | ||
FileUtils.rm_rf(@clonedir) | ||
end | ||
|
||
def test_gets_a_valid_patch | ||
assert_match /\-patchme/, @git.get_patch("good") | ||
assert_match /\-initial/, @git.get_patch("bad") | ||
end | ||
|
||
def test_checks_patch_applies | ||
assert_equal 0, @git.check_applies("master", "good") | ||
assert_equal 1, @git.check_applies("master", "bad") | ||
end | ||
|
||
def test_applies_patch | ||
repo = Grit::Repo.new(@patchdir, :is_bare => true) | ||
clone = repo.fork_bare(@clonedir) | ||
assert_equal 'patchme', (clone.tree / 'patchme').data.strip | ||
|
||
badpatch = clone.git.get_patch('bad') | ||
assert !clone.git.apply_patch('master', badpatch) | ||
assert_equal 'patchme', (clone.tree / 'patchme').data.strip | ||
|
||
goodpatch = clone.git.get_patch('good') | ||
sha = clone.git.apply_patch('master', goodpatch) | ||
assert_equal 'patched', (clone.tree(sha) / 'patchme').data.strip | ||
end | ||
end |