Module: tools
Branch: master
Commit: 8955bb1c995565c2123f67f78205563591cc6648
URL: http://source.winehq.org/git/tools.git/?a=commit;h=8955bb1c995565c2123f67f7…
Author: Alexandre Julliard <julliard(a)winehq.org>
Date: Thu Jun 14 16:52:14 2007 +0200
git-to-cvs: Allow pointing to the git directory with a .git symlink inside the CVS dir.
---
git-to-cvs | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/git-to-cvs b/git-to-cvs
index 8d8ab43..246fee3 100755
--- a/git-to-cvs
+++ b/git-to-cvs
@@ -18,7 +18,7 @@
# branch: where to get the git commits from, default is 'master'
#
# This script needs to be run from the root of the checked-out CVS tree,
-# with .git (or GIT_DIR) pointing to the git repository.
+# with CVS/.git (or GIT_DIR) pointing to the git repository.
#
use Unicode::String qw(latin1 utf8);
@@ -42,10 +42,6 @@ my %ignore_patterns =
my $last_commit = $ARGV[0] || "LAST_CVS_COMMIT";
my $branch = $ARGV[1] || "master";
-my $git_dir = `git-rev-parse --git-dir`;
-die "Cannot find git repository" if $?;
-chomp $git_dir;
--d "CVS" or die "Not in a CVS repository";
# run a shell command and die on error
sub shell(@)
@@ -385,9 +381,17 @@ sub read_tags()
close LIST;
}
+# if we have a .git symlink in CVS/ use that as GIT_DIR
+$ENV{"GIT_DIR"} = "CVS/.git" if -d "CVS/.git";
+
# use a tmp index file to avoid touching the main one
$ENV{"GIT_INDEX_FILE"} = "CVS/.git-index";
+# sanity checks
+-d "CVS" or die "Not in a CVS repository";
+-d $ENV{"GIT_DIR"} or die "Invalid git dir $ENV{GIT_DIR}";
+-w "." or die "No write access to current directory";
+
read_tags();
apply_commits();
Module: tools
Branch: master
Commit: e045280709c2c8f4ff5cd501721d4d59a4a5cb94
URL: http://source.winehq.org/git/tools.git/?a=commit;h=e045280709c2c8f4ff5cd501…
Author: Alexandre Julliard <julliard(a)winehq.org>
Date: Thu Jun 14 16:20:42 2007 +0200
git-to-cvs: Use git-for-each-ref to list tags in order to support packed refs.
---
git-to-cvs | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/git-to-cvs b/git-to-cvs
index bf587fc..8d8ab43 100755
--- a/git-to-cvs
+++ b/git-to-cvs
@@ -373,14 +373,16 @@ sub apply_commits()
# build a list of all commits that are pointed to by a tag
sub read_tags()
{
- opendir DIR, "$git_dir/refs/tags";
- foreach my $tag (grep /^wine/, readdir DIR )
+ open LIST, "-|" or exec "git-for-each-ref", "refs/tags/wine*" or die "cannot run git-for-each-ref";
+ while (<LIST>)
{
+ next unless /^[0-9a-f]{40} tag\trefs\/tags\/(.*)$/;
+ my $tag = $1;
my $commit = `git-rev-parse $tag^{commit}`;
chomp $commit;
$tags{$commit} = $tag;
}
- close DIR;
+ close LIST;
}
# use a tmp index file to avoid touching the main one