Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git-svn: Separate it from git #87241

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions Formula/git-svn.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
class GitSvn < Formula
desc "Bidirectional operation between a Subversion repository and Git"
homepage "https://git-scm.com"
# NOTE: Please keep these values in sync with git.rb when updating.
moonfruit marked this conversation as resolved.
Show resolved Hide resolved
url "https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.33.1.tar.xz"
sha256 "e054a6e6c2b088bd1bff5f61ed9ba5aa91c9a3cd509539a4b41c5ddf02201f2f"
license "GPL-2.0-only"
head "https://github.com/git/git.git", branch: "master"

livecheck do
formula "git"
end

depends_on "git"
depends_on "subversion"
moonfruit marked this conversation as resolved.
Show resolved Hide resolved

uses_from_macos "perl"

def install
perl = DevelopmentTools.locate("perl")
perl_version, perl_short_version = Utils.safe_popen_read(perl, "-e", "print $^V")
.match(/v((\d+\.\d+)(?:\.\d+)?)/).captures

ENV["PERL_PATH"] = perl
ENV["PERLLIB_EXTRA"] = Formula["subversion"].opt_lib/"perl5/site_perl"/perl_version/"darwin-thread-multi-2level"
if OS.mac?
ENV["PERLLIB_EXTRA"] += ":" + %W[
#{MacOS.active_developer_dir}
/Library/Developer/CommandLineTools
/Applications/Xcode.app/Contents/Developer
].uniq.map do |p|
"#{p}/Library/Perl/#{perl_short_version}/darwin-thread-multi-2level"
end.join(":")
end
Comment on lines +26 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the intention here to use system subversion modules in some cases? Because the depends_on "subversion" prevents that from ever happening.

Copy link
Contributor Author

@moonfruit moonfruit Oct 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, here I just want to be the same with git's other perl commands.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was to make use of system SVN Perl bindings and the directory does not exist anymore.


args = %W[
prefix=#{prefix}
perllibdir=#{Formula["git"].opt_share}/perl5
SCRIPT_PERL=git-svn.perl
iMichka marked this conversation as resolved.
Show resolved Hide resolved
]

mkdir libexec/"git-core"
system "make", "install-perl-script", *args

bin.install_symlink libexec/"git-core/git-svn"
end

test do
system "svnadmin", "create", "repo"

url = "file://#{testpath}/repo"
text = "I am the text."
log = "Initial commit"

system "svn", "checkout", url, "svn-work"
(testpath/"svn-work").cd do |current|
(current/"text").write text
system "svn", "add", "text"
system "svn", "commit", "-m", log
end

system "git", "svn", "clone", url, "git-work"
(testpath/"git-work").cd do |current|
assert_equal text, (current/"text").read
assert_match log, pipe_output("git log --oneline")
end
end
end
6 changes: 5 additions & 1 deletion Formula/git.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
class Git < Formula
desc "Distributed revision control system"
homepage "https://git-scm.com"
# NOTE: Please keep these values in sync with git-gui.rb when updating.
# NOTE: Please keep these values in sync with git-gui.rb, git-svn.rb and
# git-credential-libsecret.rb when updating.
url "https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.33.1.tar.xz"
sha256 "e054a6e6c2b088bd1bff5f61ed9ba5aa91c9a3cd509539a4b41c5ddf02201f2f"
license "GPL-2.0-only"
revision 1
head "https://github.com/git/git.git"

livecheck do
Expand Down Expand Up @@ -94,6 +96,7 @@ def install
system "make", "install", *args

git_core = libexec/"git-core"
rm git_core/"git-svn"
moonfruit marked this conversation as resolved.
Show resolved Hide resolved

# Install the macOS keychain credential helper
if OS.mac?
Expand Down Expand Up @@ -168,6 +171,7 @@ def install
def caveats
<<~EOS
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.
Subversion interoperability (git-svn) is now in the `git-svn` formula.
EOS
end

Expand Down