diff --git a/diff.c b/diff.c index 585be7e50d..ad7754363c 100644 --- a/diff.c +++ b/diff.c @@ -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); diff --git a/git-cvsimport.perl b/git-cvsimport.perl old mode 100644 new mode 100755 index f3daa6c059..3b892f9709 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -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() { 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; diff --git a/git-repack.sh b/git-repack.sh index 4fb3f26e83..eb75c8cda9 100755 --- a/git-repack.sh +++ b/git-repack.sh @@ -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" && diff --git a/repo-config.c b/repo-config.c index ab8f1afeea..743f02b7de 100644 --- a/repo-config.c +++ b/repo-config.c @@ -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",