Skip to content

Commit 97d7fee

Browse files
committed
Merge branch 'maint'
* 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()
2 parents 132c6e4 + 1f5a892 commit 97d7fee

File tree

10 files changed

+34
-31
lines changed

10 files changed

+34
-31
lines changed

builtin-init-db.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static void copy_templates_1(char *path, int baselen,
3737

3838
/* Note: if ".git/hooks" file exists in the repository being
3939
* re-initialized, /etc/core-git/templates/hooks/update would
40-
* cause git-init to fail here. I think this is sane but
40+
* cause "git init" to fail here. I think this is sane but
4141
* it means that the set of templates we ship by default, along
4242
* with the way the namespace under .git/ is organized, should
4343
* be really carefully chosen.

builtin-pack-objects.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#endif
2424

2525
static const char pack_usage[] = "\
26-
git-pack-objects [{ -q | --progress | --all-progress }] \n\
26+
git pack-objects [{ -q | --progress | --all-progress }] \n\
2727
[--max-pack-size=N] [--local] [--incremental] \n\
2828
[--window=N] [--window-memory=N] [--depth=N] \n\
2929
[--no-reuse-delta] [--no-reuse-object] [--delta-base-offset] \n\
@@ -1872,7 +1872,7 @@ static void mark_in_pack_object(struct object *object, struct packed_git *p, str
18721872

18731873
/*
18741874
* Compare the objects in the offset order, in order to emulate the
1875-
* "git-rev-list --objects" output that produced the pack originally.
1875+
* "git rev-list --objects" output that produced the pack originally.
18761876
*/
18771877
static int ofscmp(const void *a_, const void *b_)
18781878
{

builtin-read-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static void prime_cache_tree(void)
6464

6565
}
6666

67-
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>]])";
67+
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>]])";
6868

6969
static struct lock_file lock_file;
7070

builtin-rev-list.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static void finish_object(struct object_array_entry *p)
178178
static void show_object(struct object_array_entry *p)
179179
{
180180
/* An object with name "foo\n0000000..." can be used to
181-
* confuse downstream git-pack-objects very badly.
181+
* confuse downstream "git pack-objects" very badly.
182182
*/
183183
const char *ep = strchr(p->name, '\n');
184184

builtin-rm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static int check_local_mod(unsigned char *head, int index_only)
104104
"from both the file and the HEAD\n"
105105
"(use -f to force removal)", name);
106106
else if (!index_only) {
107-
/* It's not dangerous to git-rm --cached a
107+
/* It's not dangerous to "git rm --cached" a
108108
* file if the index matches the file or the
109109
* HEAD, since it means the deleted content is
110110
* still available somewhere.

builtin-send-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static int pack_objects(int fd, struct ref *refs)
4343
po.out = fd;
4444
po.git_cmd = 1;
4545
if (start_command(&po))
46-
die("git-pack-objects failed (%s)", strerror(errno));
46+
die("git pack-objects failed (%s)", strerror(errno));
4747

4848
/*
4949
* We feed the pack-objects we just spawned with revision

builtin-tar-tree.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@
99

1010
static const char tar_tree_usage[] =
1111
"git tar-tree [--remote=<repo>] <tree-ish> [basedir]\n"
12-
"*** Note that this command is now deprecated; use git-archive instead.";
12+
"*** Note that this command is now deprecated; use \"git archive\" instead.";
1313

1414
int cmd_tar_tree(int argc, const char **argv, const char *prefix)
1515
{
1616
/*
17-
* git-tar-tree is now a wrapper around git-archive --format=tar
17+
* "git tar-tree" is now a wrapper around "git archive --format=tar"
1818
*
1919
* $0 --remote=<repo> arg... ==>
20-
* git-archive --format=tar --remote=<repo> arg...
20+
* git archive --format=tar --remote=<repo> arg...
2121
* $0 tree-ish ==>
22-
* git-archive --format=tar tree-ish
22+
* git archive --format=tar tree-ish
2323
* $0 tree-ish basedir ==>
24-
* git-archive --format-tar --prefix=basedir tree-ish
24+
* git archive --format-tar --prefix=basedir tree-ish
2525
*/
2626
int i;
2727
const char **nargv = xcalloc(sizeof(*nargv), argc + 2);
2828
char *basedir_arg;
2929
int nargc = 0;
3030

31-
nargv[nargc++] = "git-archive";
31+
nargv[nargc++] = "archive";
3232
nargv[nargc++] = "--format=tar";
3333

3434
if (2 <= argc && !prefixcmp(argv[1], "--remote=")) {
@@ -53,8 +53,8 @@ int cmd_tar_tree(int argc, const char **argv, const char *prefix)
5353
nargv[nargc] = NULL;
5454

5555
fprintf(stderr,
56-
"*** git-tar-tree is now deprecated.\n"
57-
"*** Running git-archive instead.\n***");
56+
"*** \"git tar-tree\" is now deprecated.\n"
57+
"*** Running \"git archive\" instead.\n***");
5858
for (i = 0; i < nargc; i++) {
5959
fputc(' ', stderr);
6060
sq_quote_print(stderr, nargv[i]);

builtin-unpack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "fsck.h"
1414

1515
static int dry_run, quiet, recover, has_errors, strict;
16-
static const char unpack_usage[] = "git-unpack-objects [-n] [-q] [-r] [--strict] < pack-file";
16+
static const char unpack_usage[] = "git unpack-objects [-n] [-q] [-r] [--strict] < pack-file";
1717

1818
/* We always read in 4kB chunks. */
1919
static unsigned char buffer[4096];

builtin-update-index.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Default to not allowing changes to the list of files. The
1515
* tool doesn't actually care, but this makes it harder to add
1616
* files to the revision control by mistake by doing something
17-
* like "git-update-index *" and suddenly having all the object
17+
* like "git update-index *" and suddenly having all the object
1818
* files be revision controlled.
1919
*/
2020
static int allow_add;
@@ -313,18 +313,18 @@ static void read_index_info(int line_termination)
313313
/* This reads lines formatted in one of three formats:
314314
*
315315
* (1) mode SP sha1 TAB path
316-
* The first format is what "git-apply --index-info"
316+
* The first format is what "git apply --index-info"
317317
* reports, and used to reconstruct a partial tree
318318
* that is used for phony merge base tree when falling
319319
* back on 3-way merge.
320320
*
321321
* (2) mode SP type SP sha1 TAB path
322-
* The second format is to stuff git-ls-tree output
322+
* The second format is to stuff "git ls-tree" output
323323
* into the index file.
324324
*
325325
* (3) mode SP sha1 SP stage TAB path
326326
* This format is to put higher order stages into the
327-
* index file and matches git-ls-files --stage output.
327+
* index file and matches "git ls-files --stage" output.
328328
*/
329329
errno = 0;
330330
ul = strtoul(buf.buf, &ptr, 8);

t/t9700/test.pl

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
use Cwd;
1111
use File::Basename;
12-
use File::Temp;
1312

1413
BEGIN { use_ok('Git') }
1514

@@ -35,7 +34,7 @@
3534
# Failure cases for config:
3635
# Save and restore STDERR; we will probably extract this into a
3736
# "dies_ok" method and possibly move the STDERR handling to Git.pm.
38-
open our $tmpstderr, ">&", STDERR or die "cannot save STDERR"; close STDERR;
37+
open our $tmpstderr, ">&STDERR" or die "cannot save STDERR"; close STDERR;
3938
eval { $r->config("test.dupstring") };
4039
ok($@, "config: duplicate entry in scalar context fails");
4140
eval { $r->config_bool("test.boolother") };
@@ -66,21 +65,25 @@
6665

6766
# objects and hashes
6867
ok(our $file1hash = $r->command_oneline('rev-parse', "HEAD:file1"), "(get file hash)");
69-
our $tmpfile = File::Temp->new;
70-
is($r->cat_blob($file1hash, $tmpfile), 15, "cat_blob: size");
68+
my $tmpfile = "file.tmp";
69+
open TEMPFILE, "+>$tmpfile" or die "Can't open $tmpfile: $!";
70+
is($r->cat_blob($file1hash, \*TEMPFILE), 15, "cat_blob: size");
7171
our $blobcontents;
72-
{ local $/; seek $tmpfile, 0, 0; $blobcontents = <$tmpfile>; }
72+
{ local $/; seek TEMPFILE, 0, 0; $blobcontents = <TEMPFILE>; }
7373
is($blobcontents, "changed file 1\n", "cat_blob: data");
74-
seek $tmpfile, 0, 0;
74+
close TEMPFILE or die "Failed writing to $tmpfile: $!";
7575
is(Git::hash_object("blob", $tmpfile), $file1hash, "hash_object: roundtrip");
76-
$tmpfile = File::Temp->new();
77-
print $tmpfile my $test_text = "test blob, to be inserted\n";
76+
open TEMPFILE, ">$tmpfile" or die "Can't open $tmpfile: $!";
77+
print TEMPFILE my $test_text = "test blob, to be inserted\n";
78+
close TEMPFILE or die "Failed writing to $tmpfile: $!";
7879
like(our $newhash = $r->hash_and_insert_object($tmpfile), qr/[0-9a-fA-F]{40}/,
7980
"hash_and_insert_object: returns hash");
80-
$tmpfile = File::Temp->new;
81-
is($r->cat_blob($newhash, $tmpfile), length $test_text, "cat_blob: roundtrip size");
82-
{ local $/; seek $tmpfile, 0, 0; $blobcontents = <$tmpfile>; }
81+
open TEMPFILE, "+>$tmpfile" or die "Can't open $tmpfile: $!";
82+
is($r->cat_blob($newhash, \*TEMPFILE), length $test_text, "cat_blob: roundtrip size");
83+
{ local $/; seek TEMPFILE, 0, 0; $blobcontents = <TEMPFILE>; }
8384
is($blobcontents, $test_text, "cat_blob: roundtrip data");
85+
close TEMPFILE;
86+
unlink $tmpfile;
8487

8588
# paths
8689
is($r->repo_path, "./.git", "repo_path");

0 commit comments

Comments
 (0)