aboutsummaryrefslogtreecommitdiff
path: root/git-svn.perl
Commit message (Collapse)AuthorAge
* git svn: fix authentication with 'branch'Hiroshi Shirosaki2017-03-07
| | | | | | | | | | | | | | | | | | | Authentication fails with svn branch while svn rebase and svn dcommit work fine without authentication failures. $ git svn branch v7_3 Copying https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx at r27519 to https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/v7_3... Can't create session: Unable to connect to a repository at URL 'https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': No more credentials or we tried too many times. Authentication failed at C:\Program Files\Git\mingw64/libexec/git-core\git-svn line 1200. We add auth configuration to SVN::Client->new() to fix the issue. Signed-off-by: Hiroshi Shirosaki <h.shirosaki@gmail.com> Signed-off-by: Eric Wong <e@80x24.org>
* git-svn: "git worktree" awarenessEric Wong2016-10-14
| | | | | | | | | | | git-svn internals were previously not aware of repository layout differences for users of the "git worktree" command. Introduce this awareness by using "git rev-parse --git-path" instead of relying on outdated uses of GIT_DIR and friends. Thanks-to: Duy Nguyen <pclouds@gmail.com> Reported-by: Mathieu Arnold <mat@freebsd.org> Signed-off-by: Eric Wong <e@80x24.org>
* git-svn: reduce scope of input record separator changeEric Wong2016-10-14
| | | | | | | | | | | | Reducing the scope of where we change the record separator ($/) avoids bugs in calls which rely on the input record separator further down, such as the 'chomp' usage in command_oneline. This is necessary for a future change to git-svn, but exists in Git.pm since it seems useful for gitweb and our other Perl scripts, too. Signed-off-by: Eric Wong <e@80x24.org>
* git-svn: allow --version to work anywhereEric Wong2016-07-22
| | | | | | | | | | | Checking the version of the installed SVN libraries should not require a git repository at all. This matches the behavior of "git --version". Add a test for "git svn help" for the same behavior while we're at it, too. Signed-off-by: Eric Wong <e@80x24.org>
* git-svn: clone: Fail on missing url argumentChristopher Layne2016-07-03
| | | | | | | | | cmd_clone should detect a missing $url arg before using it otherwise an uninitialized value error is emitted in even the simplest case of 'git svn clone' without arguments. Signed-off-by: Christopher Layne <clayne@anodized.com> Signed-off-by: Eric Wong <e@80x24.org>
* git-svn: fix URL canonicalization during init w/ SVN 1.7+Eric Wong2016-03-16
| | | | | | | | | | | | | | | | | | URL canonicalization when full URLs are passed became broken when using SVN::_Core::svn_dirent_canonicalize under SVN 1.7. Ensure we canonicalize paths and URLs with appropriate functions for each type from now on as the path/URL-agnostic SVN::_Core::svn_path_canonicalize function is deprecated in SVN. Tested with the following commands: git svn init -T svn://svn.code.sf.net/p/squirrelmail/code/trunk git svn init -b svn://svn.code.sf.net/p/squirrelmail/code/branches Reported-by: Adam Dinwoodie <adam@dinwoodie.org> http://mid.gmane.org/20160315162344.GM29016@dinwoodie.org Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: parse authors file more lenientlyMichael J Gruber2015-09-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, git-svn parses an authors file using the perl regex /^(.+?|\(no author\))\s*=\s*(.+?)\s*<(.+)>\s*$/ in order to extract svn user name, real name and e-mail. This does not match an empty e-mail field like "<>". On the other hand, the output of an authors-prog is parsed with the perl regex /^\s*(.+?)\s*<(.*)>\s*$/ in order to extract real name and e-mail. So, specifying a trivial file grep such as grep "$1" /tmp/authors | head -n 1 | cut -d'=' -f2 | cut -c'2-' as the authors prog gives different results compared to specifying /tmp/authors as the authors file directly. Instead, make git svn uses the perl regex /^(.+?|\(no author\))\s*=\s*(.+?)\s*<(.*)>\s*$/ for parsing the authors file so that the same (slightly more lenient) regex is used in both cases. Reported-by: Till Schäfer <till2.schaefer@tu-dortmund.de> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: lazy load some modulesEric Wong2015-02-26
| | | | | | | | | | | | | We can delay loading some modules until we need them for uncommon code paths. For example, persistent memoization is not often needed, so we can avoid loading the modules for it until we encounter svn::mergeinfo during fetch. This gives a tiny reduction in syscalls (from 15641 to 15305) when running "git svn info" and counting via "strace -fc". Further, more invasive work will be needed to noticeably improve performance. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: make it play nicely with submodulesRamkumar Ramachandra2015-01-15
| | | | | | | | | It's a simple matter of opening the directory specified in the gitfile. [ew: tweaked check to avoid open() on directories] Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: support for git-svn propsetAlfred Perlstein2014-12-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows git-svn to support setting subversion properties. It is useful for manually setting properties when committing to a subversion repo that *requires* properties to be set without requiring moving your changeset to separate subversion checkout in order to set props. This change is initially from David Fraser, appearing at: http://mid.gmane.org/1927112650.1281253084529659.JavaMail.root@klofta.sjsoft.com> They are now forward-ported to most recent git along with fixes to deal with files in subdirectories. Style and functional changes from Eric Wong have been taken in their entirety from: http://mid.gmane.org/20141201094911.GA13931@dcvr.yhbt.net There is a nit to point out: the code does not support adding props unless there are also content changes to the files as well. This is demonstrated in the testcase. [ew - simplify Git.pm usage for check-attr - improve shell portability for tests - minor phrasing changes in commit message] Signed-off-by: David Fraser <davidf@sjsoft.com> Signed-off-by: Alfred Perlstein <alfred@freebsd.org> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: delay term initializationEric Wong2014-09-14
| | | | | | | | | | | On my Debian 7 system, this fixes annoying warnings when the output of "git svn" commands are redirected: Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work. The COLUMNS and LINES environment variables didn't work. The resize program didn't work. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git svn: find-rev allows short switches for near matchesEric Wong2014-09-14
| | | | | | | | Allow -B and -A to act as short aliases for --before and --after options respectively. This reduces typing and hopefully allows reuse of muscle memory for grep(1) users. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git svn: info: correctly handle absolute path argsEric Wong2014-09-14
| | | | | | | | | | | | | | | | | | | | | | | | | Calling "git svn info $(pwd)" would hit: "Reading from filehandle failed at ..." errors due to improper prefixing and canonicalization. Strip the toplevel path from absolute filesystem paths to ensure downstream canonicalization routines are only exposed to paths tracked in git (or SVN). v2: Thanks to Andrej Manduch for originally noticing the issue and fixing my original version of this to handle more corner cases such as "/path/to/top/../top" and "/path/to/top/../top/file" as shown in the new test cases. v3: Fix pathname portability problems pointed out by Johannes Sixt with a hint from brian m. carlson. Cc: Johannes Sixt <j6t@kdbg.org> Cc: "brian m. carlson" <sandals@crustytoothpaste.net> Signed-off-by: Andrej Manduch <amanduch@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: branch: avoid systematic prompt for cert/passMonard Vong2014-09-14
| | | | | | | | | | | Commands such as "git svn init/fetch/dcommit" do not prompt for client certificate/password if they are stored in SVN config file. Make "git svn branch" consistent with the other commands, as SVN::Client is capable of building its own authentication baton from information in the SVN config directory. Signed-off-by: Monard Vong <travelingsoul86@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Git 2.0: git svn: Set default --prefix='origin/' if --prefix is not givenJohan Herland2014-04-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git-svn by default puts its Subversion-tracking refs directly in refs/remotes/*. This runs counter to Git's convention of using refs/remotes/$remote/* for storing remote-tracking branches. Furthermore, combining git-svn with regular git remotes run the risk of clobbering refs under refs/remotes (e.g. if you have a git remote called "tags" with a "v1" branch, it will overlap with the git-svn's tracking branch for the "v1" tag from Subversion. Even though the git-svn refs stored in refs/remotes/* are not "proper" remote-tracking branches (since they are not covered by a proper git remote's refspec), they clearly represent a similar concept, and would benefit from following the same convention. For example, if git-svn tracks Subversion branch "foo" at refs/remotes/foo, and you create a local branch refs/heads/foo to add some commits to be pushed back to Subversion (using "git svn dcommit), then it is clearly unhelpful of Git to throw warning: refname 'foo' is ambiguous. every time you checkout, rebase, or otherwise interact with the branch. The existing workaround for this is to supply the --prefix=quux/ to git svn init/clone, so that git-svn's tracking branches end up in refs/remotes/quux/* instead of refs/remotes/*. However, encouraging users to specify --prefix to work around a design flaw in git-svn is suboptimal, and not a long term solution to the problem. Instead, git-svn should default to use a non-empty prefix that saves unsuspecting users from the inconveniences described above. This patch will only affect newly created git-svn setups, as the --prefix option only applies to git svn init (and git svn clone). Existing git-svn setups will continue with their existing (lack of) prefix. Also, if anyone somehow prefers git-svn's old layout, they can recreate that by explicitly passing an empty prefix (--prefix "") on the git svn init/clone command line. The patch changes the default value for --prefix from "" to "origin/", updates the git-svn manual page, and fixes the fallout in the git-svn testcases. (Note that this patch might be easier to review using the --word-diff and --word-diff-regex=. diff options.) [ew: squashed description of <= 1.9 behavior into manpage] Suggested-by: Thomas Ferris Nicolaisen <tfnico@gmail.com> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: Warn about changing default for --prefix in Git v2.0Johan Herland2013-10-12
| | | | | | | | | | | | | | In Git v2.0, we will change the default --prefix for init/clone from none/empty to "origin/" (which causes SVN-tracking branches to be placed at refs/remotes/origin/* instead of refs/remotes/*). This patch warns users about the upcoming change, both in the git-svn manual page, and on stderr when running init/clone in the "multi-mode" without providing a --prefix. Cc: Eric Wong <normalperson@yhbt.net> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: fix signed commit parsingNicolas Vigier2013-10-10
| | | | | | | | | | | | | | | | | | When parsing a commit object, git-svn wrongly think that a line containing spaces means the end of headers and the start of the commit message. In case of signed commit, the gpgsig entry contains a line with one space, so "git svn dcommit" will include part of the signature in the commit message. An example of such problem : http://svnweb.mageia.org/treasurer?view=revision&revision=86 This commit changes the regex to only match an empty line as separator between the headers and the commit message. Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Merge branch 'vl/typofix'Junio C Hamano2013-06-26
|\ | | | | | | | | * vl/typofix: random typofixes (committed missing a 't', successful missing an 's')
| * random typofixes (committed missing a 't', successful missing an 's')Veres Lajos2013-06-19
| | | | | | | | | | Signed-off-by: Veres Lajos <vlajos@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Fix `git svn` `rebase` & `dcommit` if top-level HEAD directory existSlava Kardakov2013-06-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a file (or a directory) called HEAD exists in the working tree, internal calls git svn makes trigger "did you mean a revision or a path?" ambiguity check. $ git svn rebase fatal: ambiguous argument 'HEAD': both revision and filename Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' rev-list --first-parent --pretty=medium HEAD: command returned error: 128 Explicitly disambiguate by adding "--" after the revision. Signed-off-by: Slava Kardakov <ojab@ojab.ru> Reviewed-by: Jeff King <peff@peff.net> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-svn: introduce --parents parameter for commands branch and tagTobias Schulte2013-05-20
| | | | | | | | | | | | | | | | This parameter is equivalent to the parameter --parents on svn cp commands and is useful for non-standard repository layouts. Signed-off-by: Tobias Schulte <tobias.schulte@gliderpilot.de> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* | git-svn: added an --include-path flagPaul Walmsley2013-05-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SVN::Fetcher module is now able to filter for inclusion as well as exclusion (as used by --ignore-path). Also added tests, documentation changes and git completion script. If you have an SVN repository with many top level directories and you only want a git-svn clone of some of them then using --ignore-path is difficult as it requires a very long regexp. In this case it's much easier to filter for inclusion. [ew: remove trailing whitespace] Signed-off-by: Paul Walmsley <pjwhams@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* | git-svn: avoid self-referencing mergeinfoMichael Contreras2013-05-09
|/ | | | | | | | | | | | | | | | When svn.pushmergeinfo is set, the target branch is included in the mergeinfo if it was previously merged into one of the source branches. SVN does not do this. Remove merge target branch path from resulting mergeinfo when svn.pushmergeinfo is set to better match the behavior of SVN. Update the svn-mergeinfo-push test. [ew: 80 columns] Signed-off-by: Michael Contreras <michael@inetric.com> Reported-by: Avishay Lavie <avishay.lavie@gmail.com> Acked-by: Eric Wong <normalperson@yhbt.net>
* git-svn: use a lowercase "usage:" stringDavid Aguilar2013-02-24
| | | | | | | Make the usage string consistent with Git. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-svn: use a lowercase "usage:" stringDavid Aguilar2013-02-24
| | | | | | | | Make the usage string consistent with Git. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-svn: Simplify calculation of GIT_DIRBarry Wardell2013-01-24
| | | | | | | | | | | | | | | | Since git-rev-parse already checks for the $GIT_DIR environment variable and that it returns an actual git repository, there is no need to repeat the checks again here. This also fixes a problem where git-svn did not work in cases where .git was a file with a gitdir: link. [ew: squashed test case, delay setting GIT_DIR until after `git rev-parse --cdup` to fix t9101, (thanks to Junio)] Signed-off-by: Barry Wardell <barry.wardell@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: teach find-rev to find near matchesJohn Keeping2013-01-17
| | | | | | | | | | | | | | | | | | When a single SVN repository is split into multiple Git repositories many SVN revisions will exist in only one of the Git repositories created. For some projects the only way to build a working artifact is to check out corresponding versions of various repositories, with no indication of what those are in the Git world - in the SVN world the revision numbers are sufficient. By adding "--before" to "git-svn find-rev" we can say "tell me what this repository looked like when that other repository looked like this": git svn find-rev --before \ r$(git --git-dir=/over/there.git svn find-rev HEAD) Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: use path accessor for Git::SVN objectsEric Wong2012-10-05
| | | | | | | | The accessors should improve maintainability and enforce consistent access to Git::SVN objects. Signed-off-by: Eric Wong <normalperson@yhbt.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
* Merge branch 'ms/git-svn-1.7'Junio C Hamano2012-08-22
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A series by Michael Schwern via Eric to update git-svn to revamp the way URLs are internally passed around, to make it work with SVN 1.7. * ms/git-svn-1.7: git-svn: remove ad-hoc canonicalizations git-svn: canonicalize newly-minted URLs git-svn: introduce add_path_to_url function git-svn: canonicalize earlier git-svn: replace URL escapes with canonicalization git-svn: attempt to mimic SVN 1.7 URL canonicalization t9107: fix typo t9118: workaround inconsistency between SVN versions Git::SVN{,::Ra}: canonicalize earlier git-svn: path canonicalization uses SVN API Git::SVN::Utils: remove irrelevant comment git-svn: add join_paths() to safely concatenate paths git-svn: factor out _collapse_dotdot function git-svn: use SVN 1.7 to canonicalize when possible git-svn: move canonicalization to Git::SVN::Utils use Git::SVN{,::RA}->url accessor globally use Git::SVN->path accessor globally Git::SVN::Ra: use accessor for URLs Git::SVN: use accessor for URLs internally Git::SVN: use accessors internally for path
| * git-svn: remove ad-hoc canonicalizationsMichael G. Schwern2012-08-02
| | | | | | | | | | | | [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
| * git-svn: introduce add_path_to_url functionMichael G. Schwern2012-08-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the ad-hoc versions. This is mostly to normalize the process and ensure the URLs produced don't have double slashes or anything. Also provides a place to fix the corner case where a file path contains a percent sign. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
| * git-svn: canonicalize earlierMichael G. Schwern2012-08-02
| | | | | | | | | | | | | | | | | | Just a few things I noticed. Its good to canonicalize as early as possible. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
| * git-svn: replace URL escapes with canonicalizationMichael G. Schwern2012-08-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old hand-rolled URL escape functions were inferior to canonicalization functions. Continuing to move towards getting everything canonicalizing the same way. * Git::SVN->init_remote_config and Git::SVN::Ra->minimize_url both have to canonicalize the same way else init_remote_config will incorrectly think they're different URLs causing t9107-git-svn-migrate.sh to fail. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
| * git-svn: add join_paths() to safely concatenate pathsMichael G. Schwern2012-08-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise you might wind up with things like... my $path1 = undef; my $path2 = 'foo'; my $path = $path1 . '/' . $path2; creating '/foo'. Or this... my $path1 = 'foo/'; my $path2 = 'bar'; my $path = $path1 . '/' . $path2; creating 'foo//bar'. Could have used File::Spec, but I'm shying away from it due to SVN 1.7's pickiness about paths. Felt it would be better to have our own we can control completely. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
| * git-svn: move canonicalization to Git::SVN::UtilsMichael G. Schwern2012-08-02
| | | | | | | | | | | | | | | | | | | | | | | | | | So they can be used by others. I'd like to test them, but they're going to become SVN API wrappers shortly and those aren't predictable. No functional change. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
| * use Git::SVN{,::RA}->url accessor globallyMichael G. Schwern2012-08-02
| | | | | | | | | | | | | | | | | | | | | | | | | | Note: The structure returned from Git::SVN->read_all_remotes() does not appear to contain objects, so I'm leaving them alone. That's everything converted over to the url and path accessors. No functional change. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
| * use Git::SVN->path accessor globallyMichael G. Schwern2012-08-02
| | | | | | | | | | | | | | | | No functional change. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
* | git svn: handle errors and concurrent commits in dcommitRobert Luberda2012-08-10
|/ | | | | | | | | | | | | | | | | | | | | dcommit didn't handle errors returned by SVN and coped very poorly with concurrent commits that appear in SVN repository while dcommit was running. In both cases it left git repository in inconsistent state: index (which was reset with `git reset --mixed' after a successful commit to SVN) no longer matched the checkouted tree, when the following commit failed or needed to be rebased. See http://bugs.debian.org/676904 for examples. This patch fixes the issues by: - introducing error handler for dcommit. The handler will try to rebase or reset working tree before returning error to the end user. dcommit_rebase function was extracted out of cmd_dcommit to ensure consistency between cmd_dcommit and the error handler. - calling `git reset --mixed' only once after all patches are successfully committed to SVN. This ensures index is not touched for most of the time of dcommit run. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Extract Git::SVN::GlobSpec from git-svn.Michael G. Schwern2012-07-27
| | | | | | | | Straight cut & paste. That's the last class. * Make Git::SVN load it on its own, its the only thing that needs it. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Move Git::IndexInfo into its own file.Michael G. Schwern2012-07-27
| | | | | | Straight cut & paste. Didn't require any fixing. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Load all the modules in one place and before running code.Michael G. Schwern2012-07-27
| | | | | | | | Just makes the code easier to follow. No functional change. Also eliminate an unused lexical $SVN. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Extract Git::SVN::Migration from git-svn.Michael G. Schwern2012-07-27
| | | | | | Straight cut & paste. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Prepare Git::SVN::Migration for extraction from git-svn.Michael G. Schwern2012-07-27
| | | | | | | | | | | * Load Git command functions on its own. * Load Git::SVN modules on its own. Drive by refactorings... * Use our() instead of use vars. * Eliminate the auto loading of Git functions. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Extract Git::SVN::Log from git-svn.Michael G. Schwern2012-07-27
| | | | | | | | Straight cut & paste. Also noticed Git::SVN::Ra wasn't in the compile test. It is now. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Prepare Git::SVN::Log for extraction from git-svn.Michael G. Schwern2012-07-27
| | | | | | | | | | | | | * Load Git command functions itself. * Can't access the git-svn switch lexical any more, but its only used by Git::SVN::Log so turn it into a Git::SVN::Log global. * Load Git::SVN as needed. No need to load it always, its only used twice. * Moved a state variable to the routine it's used for. (Drive by refactoring) Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Move initialization of Git::SVN variables into Git::SVN.Michael G. Schwern2012-07-27
| | | | | | | Also it can compile on its own now, yay! Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Extract Git::SVN from git-svn into its own .pm file.Michael G. Schwern2012-07-27
| | | | | | | | | | Except for adding the 1; at the end, this is a straight copy & paste. Tests still pass, but its doubtful Git::SVN will compile on its own without git-svn being loaded. Next commit will fix that. Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Prepare Git::SVN for extraction into its own file.Michael G. Schwern2012-07-27
| | | | | | | | | | | | | | | | | | This means it should be able to load without git-svn being loaded. * Load Git.pm on its own and all the needed command functions. * It needs to grab at a git-svn lexical $_prefix representing the --prefix option. Provide opt_prefix() for that. This is a refactoring artifact. The prefix should really be passed into Git::SVN->new. * Unqualify unnecessarily fully qualified globals like $Git::SVN::default_repo_id. * Lexically isolate the class just to make sure nothing is leaking out. Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* Extract some utilities from git-svn to allow extracting Git::SVN.Michael G. Schwern2012-07-27
| | | | | | | | | | | | | | | | Put them in a new module called Git::SVN::Utils. Yeah, not terribly original and it will be a dumping ground. But its better than having them in the main git-svn program. At least they can be documented and tested. * fatal() is used by many classes. * Change the $can_compress lexical into a function. This should be enough to extract Git::SVN. Signed-off-by: Michael G. Schwern <schwern@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: don't create master if another head existsMarcin Owsiany2012-07-19
| | | | | | | | | | | | | | | | | | | | | | | | | | git-svn insists on creating the "master" head (unless it exists) on every "fetch". It is useful that it gets created initially, when no head exists - users expect this git convention of having a "master" branch on initial clone. However creating it when there already is another head does not provide any value - the ref is never updated, so it just gets stale after a while. Also, some users find it annoying that it gets recreated, especially when they would like the git branch names to follow SVN repository branch names. More background in http://thread.gmane.org/gmane.comp.version-control.git/115030 Make git-svn skip the "master" creation if HEAD already points at a valid head. This means "master" does get created on initial "clone" but does not get recreated once a user deletes it. Also, make post_fetch_checkout work with any head that is pointed to by HEAD, not just "master". Also, use fatal error handling consistent with the rest of the program for post_fetch_checkout. Signed-off-by: Marcin Owsiany <marcin@owsiany.pl> Signed-off-by: Eric Wong <normalperson@yhbt.net>