Merge branch 'ml/cvsimport' into next

* ml/cvsimport:
  cvsimport: setup indexes correctly for ancestors and incremental imports
  repo-config: fix printing of bool
  diff --color: use reset sequence when we mean reset.
  git-repack -- respect -q and be quiet
This commit is contained in:
Junio C Hamano
2006-06-24 05:30:15 -07:00
4 changed files with 30 additions and 27 deletions

2
diff.c
View File

@@ -616,7 +616,7 @@ static void builtin_diff(const char *name_a,
const char *lbl[2];
char *a_one, *b_two;
const char *set = get_color(o->color_diff, DIFF_METAINFO);
const char *reset = get_color(o->color_diff, DIFF_PLAIN);
const char *reset = get_color(o->color_diff, DIFF_RESET);
a_one = quote_two("a/", name_a);
b_two = quote_two("b/", name_b);

41
git-cvsimport.perl Normal file → Executable file
View File

@@ -17,7 +17,7 @@ use strict;
use warnings;
use Getopt::Std;
use File::Spec;
use File::Temp qw(tempfile);
use File::Temp qw(tempfile tmpnam);
use File::Path qw(mkpath);
use File::Basename qw(basename dirname);
use Time::Local;
@@ -467,12 +467,8 @@ my $orig_git_index;
$orig_git_index = $ENV{GIT_INDEX_FILE} if exists $ENV{GIT_INDEX_FILE};
my %index; # holds filenames of one index per branch
{ # init with an index for origin
my ($fh, $fn) = tempfile('gitXXXXXX', SUFFIX => '.idx',
DIR => File::Spec->tmpdir());
close ($fh);
$index{$opt_o} = $fn;
}
$index{$opt_o} = tmpnam();
$ENV{GIT_INDEX_FILE} = $index{$opt_o};
unless(-d $git_dir) {
system("git-init-db");
@@ -502,10 +498,7 @@ unless(-d $git_dir) {
# populate index
unless ($index{$last_branch}) {
my ($fh, $fn) = tempfile('gitXXXXXX', SUFFIX => '.idx',
DIR => File::Spec->tmpdir());
close ($fh);
$index{$last_branch} = $fn;
$index{$last_branch} = tmpnam();
}
$ENV{GIT_INDEX_FILE} = $index{$last_branch};
system('git-read-tree', $last_branch);
@@ -818,16 +811,28 @@ while(<CVS>) {
if(($ancestor || $branch) ne $last_branch) {
print "Switching from $last_branch to $branch\n" if $opt_v;
unless ($index{$branch}) {
my ($fh, $fn) = tempfile('gitXXXXXX', SUFFIX => '.idx',
DIR => File::Spec->tmpdir());
close ($fh);
$index{$branch} = $fn;
$index{$branch} = tmpnam();
$ENV{GIT_INDEX_FILE} = $index{$branch};
}
if ($ancestor) {
system("git-read-tree", $ancestor);
die "read-tree failed: $?\n" if $?;
} else {
unless ($index{$branch}) {
$index{$branch} = tmpnam();
$ENV{GIT_INDEX_FILE} = $index{$branch};
system("git-read-tree", $branch);
die "read-tree failed: $?\n" if $?;
}
}
} else {
# just in case
unless ($index{$branch}) {
$index{$branch} = tmpnam();
$ENV{GIT_INDEX_FILE} = $index{$branch};
system("git-read-tree", $branch);
die "read-tree failed: $?\n" if $?;
} else {
$ENV{GIT_INDEX_FILE} = $index{$branch};
}
}
}
$last_branch = $branch if $branch ne $last_branch;
$state = 9;

View File

@@ -49,8 +49,9 @@ name=$(git-rev-list --objects --all $rev_list 2>&1 |
if [ -z "$name" ]; then
echo Nothing new to pack.
else
echo "Pack pack-$name created."
if test "$quiet" != '-q'; then
echo "Pack pack-$name created."
fi
mkdir -p "$PACKDIR" || exit
mv .tmp-pack-$name.pack "$PACKDIR/pack-$name.pack" &&

View File

@@ -29,16 +29,13 @@ static int show_config(const char* key_, const char* value_)
const char *vptr = value;
int dup_error = 0;
if (value_ == NULL)
value_ = "";
if (!use_key_regexp && strcmp(key_, key))
return 0;
if (use_key_regexp && regexec(key_regexp, key_, 0, NULL, 0))
return 0;
if (regexp != NULL &&
(do_not_match ^
regexec(regexp, value_, 0, NULL, 0)))
regexec(regexp, (value_?value_:""), 0, NULL, 0)))
return 0;
if (show_keys)
@@ -46,11 +43,11 @@ static int show_config(const char* key_, const char* value_)
if (seen && !do_all)
dup_error = 1;
if (type == T_INT)
sprintf(value, "%d", git_config_int(key_, value_));
sprintf(value, "%d", git_config_int(key_, value_?value_:""));
else if (type == T_BOOL)
vptr = git_config_bool(key_, value_) ? "true" : "false";
else
vptr = value_;
vptr = value_?value_:"";
seen++;
if (dup_error) {
error("More than one value for the key %s: %s",