From 1054dcd1652644f3a80cf6ce546d24c1fee4066a Mon Sep 17 00:00:00 2001 From: Martin Langhoff Date: Sat, 24 Jun 2006 21:41:25 +1200 Subject: [PATCH 1/4] git-repack -- respect -q and be quiet git-repack was passing the -q along to pack-objects but ignoring it itself. Correct the oversight. Signed-off-by: Martin Langhoff Signed-off-by: Junio C Hamano --- git-repack.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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" && From 0ec2f6b7392f8f041fd48f824bbf22c4dd13ac40 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 24 Jun 2006 04:20:39 -0700 Subject: [PATCH 2/4] diff --color: use reset sequence when we mean reset. Signed-off-by: Junio C Hamano --- diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diff.c b/diff.c index 1db0285cd7..f89224f75f 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); From acb70149bc5e9b9d99631a0cb59e7c2f80e92ddd Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 24 Jun 2006 05:19:30 -0700 Subject: [PATCH 3/4] repo-config: fix printing of bool When a bool variable appears without any value, it means true. However, replacing the NULL value with an empty string, an earlier commit f067a13745fbeae1aa357876348a00e5edd0a629 broke show-config. Signed-off-by: Junio C Hamano --- repo-config.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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", From 7ccd9009ac1fb4764ddf47a1a924ea917ff9468a Mon Sep 17 00:00:00 2001 From: Martin Langhoff Date: Sat, 24 Jun 2006 23:13:08 +1200 Subject: [PATCH 4/4] cvsimport: setup indexes correctly for ancestors and incremental imports Two bugs had slipped in the "keep one index per branch during import" patch. Both incremental imports and new branches would see an empty tree for their initial commit. Now we cover all the relevant cases, checking whether we actually need to setup the index before preparing the actual commit, and doing it. Signed-off-by: Martin Langhoff Signed-off-by: Junio C Hamano --- git-cvsimport.perl | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) mode change 100644 => 100755 git-cvsimport.perl 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;