Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Tue, 16 Sep 2008 08:24:58 +0000 (01:24 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 16 Sep 2008 08:24:58 +0000 (01:24 -0700)
* maint:
Cosmetical command name fix
Start conforming code to "git subcmd" style part 3
t9700/test.pl: remove File::Temp requirement
t9700/test.pl: avoid bareword 'STDERR' in 3-argument open()

1  2 
builtin-read-tree.c
builtin-update-index.c
t/t9700/test.pl
diff --combined builtin-read-tree.c
index 362216b272f36afc625c97501c34bac6be813eb0,ac219ac2db3eafe8fc3363692e92fa7e1765138a..0706c958181c54aeb18d91f6e3dbe7c9f572b94d
@@@ -64,7 -64,7 +64,7 @@@ static void prime_cache_tree(void
  
  }
  
- static const char read_tree_usage[] = "git-read-tree (<sha> | [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] [--exclude-per-directory=<gitignore>] [--index-output=<file>] <sha1> [<sha2> [<sha3>]])";
+ static const char read_tree_usage[] = "git read-tree (<sha> | [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] [--exclude-per-directory=<gitignore>] [--index-output=<file>] <sha1> [<sha2> [<sha3>]])";
  
  static struct lock_file lock_file;
  
@@@ -206,7 -206,6 +206,7 @@@ int cmd_read_tree(int argc, const char 
                        break;
                case 2:
                        opts.fn = twoway_merge;
 +                      opts.initial_checkout = !active_nr;
                        break;
                case 3:
                default:
diff --combined builtin-update-index.c
index ce832247568de1b302395ce892f1433844fea187,9d19c51e8e68d5d4c92465699c58ef0acec70209..417f9724abdce3c49df316505eff1019126a5058
@@@ -14,7 -14,7 +14,7 @@@
   * Default to not allowing changes to the list of files. The
   * tool doesn't actually care, but this makes it harder to add
   * files to the revision control by mistake by doing something
-  * like "git-update-index *" and suddenly having all the object
+  * like "git update-index *" and suddenly having all the object
   * files be revision controlled.
   */
  static int allow_add;
@@@ -194,10 -194,6 +194,10 @@@ static int process_path(const char *pat
        int len;
        struct stat st;
  
 +      len = strlen(path);
 +      if (has_symlink_leading_path(len, path))
 +              return error("'%s' is beyond a symbolic link", path);
 +
        /*
         * First things first: get the stat information, to decide
         * what to do about the pathname!
        if (lstat(path, &st) < 0)
                return process_lstat_error(path, errno);
  
 -      len = strlen(path);
        if (S_ISDIR(st.st_mode))
                return process_directory(path, len, &st);
  
@@@ -313,18 -310,18 +313,18 @@@ static void read_index_info(int line_te
                /* This reads lines formatted in one of three formats:
                 *
                 * (1) mode         SP sha1          TAB path
-                * The first format is what "git-apply --index-info"
+                * The first format is what "git apply --index-info"
                 * reports, and used to reconstruct a partial tree
                 * that is used for phony merge base tree when falling
                 * back on 3-way merge.
                 *
                 * (2) mode SP type SP sha1          TAB path
-                * The second format is to stuff git-ls-tree output
+                * The second format is to stuff "git ls-tree" output
                 * into the index file.
                 *
                 * (3) mode         SP sha1 SP stage TAB path
                 * This format is to put higher order stages into the
-                * index file and matches git-ls-files --stage output.
+                * index file and matches "git ls-files --stage" output.
                 */
                errno = 0;
                ul = strtoul(buf.buf, &ptr, 8);
diff --combined t/t9700/test.pl
index 851cea4a4b7c36ff4b852616108bdaf481e2e9bc,504f95a47d733e10ca71d0a669cd51e1c6e3601c..697daf3ffd33c27654ce00f780acc2c6db5f9985
@@@ -9,12 -9,14 +9,11 @@@ use Test::More qw(no_plan)
  
  use Cwd;
  use File::Basename;
- use File::Temp;
  
  BEGIN { use_ok('Git') }
  
  # set up
 -our $repo_dir = "trash directory";
  our $abs_repo_dir = Cwd->cwd;
 -die "this must be run by calling the t/t97* shell script(s)\n"
 -    if basename(Cwd->cwd) ne $repo_dir;
  ok(our $r = Git->repository(Directory => "."), "open repository");
  
  # config
@@@ -35,7 -37,7 +34,7 @@@ is($r->get_color("color.test.slot1", "r
  # Failure cases for config:
  # Save and restore STDERR; we will probably extract this into a
  # "dies_ok" method and possibly move the STDERR handling to Git.pm.
- open our $tmpstderr, ">&", STDERR or die "cannot save STDERR"; close STDERR;
+ open our $tmpstderr, ">&STDERR" or die "cannot save STDERR"; close STDERR;
  eval { $r->config("test.dupstring") };
  ok($@, "config: duplicate entry in scalar context fails");
  eval { $r->config_bool("test.boolother") };
@@@ -66,21 -68,25 +65,25 @@@ is($r->ident_person("Name", "email", "1
  
  # objects and hashes
  ok(our $file1hash = $r->command_oneline('rev-parse', "HEAD:file1"), "(get file hash)");
- our $tmpfile = File::Temp->new;
- is($r->cat_blob($file1hash, $tmpfile), 15, "cat_blob: size");
+ my $tmpfile = "file.tmp";
+ open TEMPFILE, "+>$tmpfile" or die "Can't open $tmpfile: $!";
+ is($r->cat_blob($file1hash, \*TEMPFILE), 15, "cat_blob: size");
  our $blobcontents;
- { local $/; seek $tmpfile, 0, 0; $blobcontents = <$tmpfile>; }
+ { local $/; seek TEMPFILE, 0, 0; $blobcontents = <TEMPFILE>; }
  is($blobcontents, "changed file 1\n", "cat_blob: data");
seek $tmpfile, 0, 0;
close TEMPFILE or die "Failed writing to $tmpfile: $!";
  is(Git::hash_object("blob", $tmpfile), $file1hash, "hash_object: roundtrip");
- $tmpfile = File::Temp->new();
- print $tmpfile my $test_text = "test blob, to be inserted\n";
+ open TEMPFILE, ">$tmpfile" or die "Can't open $tmpfile: $!";
+ print TEMPFILE my $test_text = "test blob, to be inserted\n";
+ close TEMPFILE or die "Failed writing to $tmpfile: $!";
  like(our $newhash = $r->hash_and_insert_object($tmpfile), qr/[0-9a-fA-F]{40}/,
       "hash_and_insert_object: returns hash");
$tmpfile = File::Temp->new;
- is($r->cat_blob($newhash, $tmpfile), length $test_text, "cat_blob: roundtrip size");
- { local $/; seek $tmpfile, 0, 0; $blobcontents = <$tmpfile>; }
open TEMPFILE, "+>$tmpfile" or die "Can't open $tmpfile: $!";
+ is($r->cat_blob($newhash, \*TEMPFILE), length $test_text, "cat_blob: roundtrip size");
+ { local $/; seek TEMPFILE, 0, 0; $blobcontents = <TEMPFILE>; }
  is($blobcontents, $test_text, "cat_blob: roundtrip data");
+ close TEMPFILE;
+ unlink $tmpfile;
  
  # paths
  is($r->repo_path, "./.git", "repo_path");