-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'git svn reset' to unwind 'git svn fetch'
Add a command to unwind the effects of fetch by moving the rev_map and refs/remotes/git-svn back to an old SVN revision. This allows revisions to be re-fetched. Ideally SVN revs would be immutable, but permissions changes in the SVN repository or indiscriminate use of '--ignore-paths' can create situations where fetch cannot make progress. Signed-off-by: Ben Jackson <ben@ben.com> Acked-by: Eric Wong <normalperson@yhbt.net>
- Loading branch information
Ben Jackson
authored and
Eric Wong
committed
Jun 25, 2009
1 parent
ca5e880
commit 195643f
Showing
3 changed files
with
164 additions
and
6 deletions.
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
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,66 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright (c) 2009 Ben Jackson | ||
# | ||
|
||
test_description='git svn reset' | ||
. ./lib-git-svn.sh | ||
|
||
test_expect_success 'setup test repository' ' | ||
svn_cmd co "$svnrepo" s && | ||
( | ||
cd s && | ||
mkdir vis && | ||
echo always visible > vis/vis.txt && | ||
svn_cmd add vis && | ||
svn_cmd commit -m "create visible files" && | ||
mkdir hid && | ||
echo initially hidden > hid/hid.txt && | ||
svn_cmd add hid && | ||
svn_cmd commit -m "create initially hidden files" && | ||
svn_cmd up && | ||
echo mod >> vis/vis.txt && | ||
svn_cmd commit -m "modify vis" && | ||
svn_cmd up | ||
) | ||
' | ||
|
||
test_expect_success 'clone SVN repository with hidden directory' ' | ||
git svn init "$svnrepo" g && | ||
( cd g && git svn fetch --ignore-paths="^hid" ) | ||
' | ||
|
||
test_expect_success 'modify hidden file in SVN repo' ' | ||
( cd s && | ||
echo mod hidden >> hid/hid.txt && | ||
svn_cmd commit -m "modify hid" && | ||
svn_cmd up | ||
) | ||
' | ||
|
||
test_expect_success 'fetch fails on modified hidden file' ' | ||
( cd g && | ||
git svn find-rev refs/remotes/git-svn > ../expect && | ||
! git svn fetch 2> ../errors && | ||
git svn find-rev refs/remotes/git-svn > ../expect2 ) && | ||
fgrep "not found in commit" errors && | ||
test_cmp expect expect2 | ||
' | ||
|
||
test_expect_success 'reset unwinds back to r1' ' | ||
( cd g && | ||
git svn reset -r1 && | ||
git svn find-rev refs/remotes/git-svn > ../expect2 ) && | ||
echo 1 >expect && | ||
test_cmp expect expect2 | ||
' | ||
|
||
test_expect_success 'refetch succeeds not ignoring any files' ' | ||
( cd g && | ||
git svn fetch && | ||
git svn rebase && | ||
fgrep "mod hidden" hid/hid.txt | ||
) | ||
' | ||
|
||
test_done |