Skip to content

Commit ced38ea

Browse files
author
Junio C Hamano
committed
Merge branch 'maint'
* maint: Documentation: tighten dependency for git.{html,txt} Makefile: iconv() on Darwin has the old interface t5300-pack-object.sh: portability issue using /usr/bin/stat t3200-branch.sh: small language nit usermanual.txt: some capitalization nits Make builtin-branch.c handle the git config file rename_ref(): only print a warning when config-file update fails Distinguish branches by more than case in tests. Avoid composing too long "References" header. cvsimport: Improve formating consistency cvsimport: Reorder options in documentation for better understanding cvsimport: Improve usage error reporting cvsimport: Improve documentation of CVSROOT and CVS module determination cvsimport: sync usage lines with existing options Conflicts: Documentation/Makefile
2 parents 77e6f5b + d790739 commit ced38ea

File tree

11 files changed

+87
-67
lines changed

11 files changed

+87
-67
lines changed

Documentation/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,17 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
9090
cmds-purehelpers.txt \
9191
cmds-foreignscminterface.txt
9292

93-
$(cmds_txt): cmd-list.perl $(MAN1_TXT)
93+
$(cmds_txt): cmd-list.made
94+
95+
cmd-list.made: cmd-list.perl $(MAN1_TXT)
9496
perl ./cmd-list.perl
97+
date >$@
9598

9699
git.7 git.html: git.txt core-intro.txt
97100

98101
clean:
99102
rm -f *.xml *.xml+ *.html *.html+ *.1 *.7 howto-index.txt howto/*.html doc.dep
100-
rm -f $(cmds_txt)
103+
rm -f $(cmds_txt) *.made
101104

102105
%.html : %.txt
103106
rm -f $@+ $@

Documentation/cmd-list.perl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
#
1+
#!/usr/bin/perl -w
2+
3+
use File::Compare qw(compare);
24

35
sub format_one {
46
my ($out, $name) = @_;
57
my ($state, $description);
8+
$state = 0;
69
open I, '<', "$name.txt" or die "No such file $name.txt";
710
while (<I>) {
811
if (/^NAME$/) {
@@ -55,7 +58,14 @@ sub format_one {
5558
format_one(\*O, $_);
5659
}
5760
close O;
58-
rename "$out+", "$out";
61+
62+
if (-f "$out" && compare("$out", "$out+") == 0) {
63+
unlink "$out+";
64+
}
65+
else {
66+
print STDERR "$out\n";
67+
rename "$out+", "$out";
68+
}
5969
}
6070

6171
__DATA__

Documentation/git-cvsimport.txt

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ git-cvsimport - Salvage your data out of another SCM people love to hate
99
SYNOPSIS
1010
--------
1111
[verse]
12-
'git-cvsimport' [-o <branch-for-HEAD>] [-h] [-v] [-d <CVSROOT>] [-s <subst>]
13-
[-p <options-for-cvsps>] [-C <git_repository>] [-i] [-P <file>]
14-
[-m] [-M regex] [<CVS_module>]
12+
'git-cvsimport' [-o <branch-for-HEAD>] [-h] [-v] [-d <CVSROOT>]
13+
[-A <author-conv-file>] [-p <options-for-cvsps>] [-P <file>]
14+
[-C <git_repository>] [-z <fuzz>] [-i] [-k] [-u] [-s <subst>]
15+
[-a] [-m] [-M <regex>] [-S <regex>] [-L <commitlimit>]
16+
[<CVS_module>]
1517

1618

1719
DESCRIPTION
@@ -30,42 +32,59 @@ any CVS branches, yourself.
3032

3133
OPTIONS
3234
-------
35+
-v::
36+
Verbosity: let 'cvsimport' report what it is doing.
37+
3338
-d <CVSROOT>::
3439
The root of the CVS archive. May be local (a simple path) or remote;
3540
currently, only the :local:, :ext: and :pserver: access methods
36-
are supported.
41+
are supported. If not given, git-cvsimport will try to read it
42+
from `CVS/Root`. If no such file exists, it checks for the
43+
`CVSROOT` environment variable.
44+
45+
<CVS_module>::
46+
The CVS module you want to import. Relative to <CVSROOT>.
47+
If not given, git-cvsimport tries to read it from
48+
`CVS/Repository`.
3749

3850
-C <target-dir>::
3951
The git repository to import to. If the directory doesn't
4052
exist, it will be created. Default is the current directory.
4153

54+
-o <branch-for-HEAD>::
55+
The 'HEAD' branch from CVS is imported to the 'origin' branch within
56+
the git repository, as 'HEAD' already has a special meaning for git.
57+
Use this option if you want to import into a different branch.
58+
+
59+
Use '-o master' for continuing an import that was initially done by
60+
the old cvs2git tool.
61+
4262
-i::
4363
Import-only: don't perform a checkout after importing. This option
4464
ensures the working directory and index remain untouched and will
4565
not create them if they do not exist.
4666

4767
-k::
48-
Kill keywords: will extract files with -kk from the CVS archive
68+
Kill keywords: will extract files with '-kk' from the CVS archive
4969
to avoid noisy changesets. Highly recommended, but off by default
5070
to preserve compatibility with early imported trees.
5171

5272
-u::
5373
Convert underscores in tag and branch names to dots.
5474

55-
-o <branch-for-HEAD>::
56-
The 'HEAD' branch from CVS is imported to the 'origin' branch within
57-
the git repository, as 'HEAD' already has a special meaning for git.
58-
Use this option if you want to import into a different branch.
59-
+
60-
Use '-o master' for continuing an import that was initially done by
61-
the old cvs2git tool.
75+
-s <subst>::
76+
Substitute the character "/" in branch names with <subst>
6277

6378
-p <options-for-cvsps>::
6479
Additional options for cvsps.
6580
The options '-u' and '-A' are implicit and should not be used here.
6681
+
6782
If you need to pass multiple options, separate them with a comma.
6883

84+
-z <fuzz>::
85+
Pass the timestamp fuzz factor to cvsps, in seconds. If unset,
86+
cvsps defaults to 300s.
87+
6988
-P <cvsps-output-file>::
7089
Instead of calling cvsps, read the provided cvsps output file. Useful
7190
for debugging or when cvsps is being handled outside cvsimport.
@@ -77,32 +96,16 @@ If you need to pass multiple options, separate them with a comma.
7796

7897
-M <regex>::
7998
Attempt to detect merges based on the commit message with a custom
80-
regex. It can be used with -m to also see the default regexes.
99+
regex. It can be used with '-m' to also see the default regexes.
81100
You must escape forward slashes.
82101

83-
-v::
84-
Verbosity: let 'cvsimport' report what it is doing.
85-
86-
<CVS_module>::
87-
The CVS module you want to import. Relative to <CVSROOT>.
88-
89-
-h::
90-
Print a short usage message and exit.
91-
92-
-z <fuzz>::
93-
Pass the timestamp fuzz factor to cvsps, in seconds. If unset,
94-
cvsps defaults to 300s.
95-
96-
-s <subst>::
97-
Substitute the character "/" in branch names with <subst>
102+
-S <regex>::
103+
Skip paths matching the regex.
98104

99105
-a::
100106
Import all commits, including recent ones. cvsimport by default
101107
skips commits that have a timestamp less than 10 minutes ago.
102108

103-
-S <regex>::
104-
Skip paths matching the regex.
105-
106109
-L <limit>::
107110
Limit the number of commits imported. Workaround for cases where
108111
cvsimport leaks memory.
@@ -122,14 +125,17 @@ git-cvsimport will make it appear as those authors had
122125
their GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL set properly
123126
all along.
124127
+
125-
For convenience, this data is saved to $GIT_DIR/cvs-authors
126-
each time the -A option is provided and read from that same
128+
For convenience, this data is saved to `$GIT_DIR/cvs-authors`
129+
each time the '-A' option is provided and read from that same
127130
file each time git-cvsimport is run.
128131
+
129132
It is not recommended to use this feature if you intend to
130133
export changes back to CVS again later with
131134
gitlink:git-cvsexportcommit[1].
132135

136+
-h::
137+
Print a short usage message and exit.
138+
133139
OUTPUT
134140
------
135141
If '-v' is specified, the script reports what it is doing.

Documentation/user-manual.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ $ git commit
10151015
-------------------------------------------------
10161016

10171017
[[how-to-make-a-commit]]
1018-
how to make a commit
1018+
How to make a commit
10191019
--------------------
10201020

10211021
Creating a new commit takes three steps:
@@ -1109,7 +1109,7 @@ $ git diff # difference between the index file and your
11091109
$ git status # a brief per-file summary of the above.
11101110
-------------------------------------------------
11111111

1112-
creating good commit messages
1112+
Creating good commit messages
11131113
-----------------------------
11141114

11151115
Though not required, it's a good idea to begin the commit message
@@ -1119,7 +1119,7 @@ description. Tools that turn commits into email, for example, use
11191119
the first line on the Subject line and the rest of the commit in the
11201120
body.
11211121

1122-
how to merge
1122+
How to merge
11231123
------------
11241124

11251125
You can rejoin two diverging branches of development using
@@ -1298,7 +1298,7 @@ the different stages of that file will be "collapsed", after which
12981298
git-diff will (by default) no longer show diffs for that file.
12991299

13001300
[[undoing-a-merge]]
1301-
undoing a merge
1301+
Undoing a merge
13021302
---------------
13031303

13041304
If you get stuck and decide to just give up and throw the whole mess

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ endif
385385
ifeq ($(uname_S),Darwin)
386386
NEEDS_SSL_WITH_CRYPTO = YesPlease
387387
NEEDS_LIBICONV = YesPlease
388+
OLD_ICONV = UnfortunatelyYes
388389
NO_STRLCPY = YesPlease
389390
endif
390391
ifeq ($(uname_S),SunOS)

builtin-branch.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ static void rename_branch(const char *oldname, const char *newname, int force)
493493
{
494494
char oldref[PATH_MAX], newref[PATH_MAX], logmsg[PATH_MAX*2 + 100];
495495
unsigned char sha1[20];
496+
char oldsection[PATH_MAX], newsection[PATH_MAX];
496497

497498
if (!oldname)
498499
die("cannot rename the current branch while not on any.");
@@ -521,6 +522,11 @@ static void rename_branch(const char *oldname, const char *newname, int force)
521522
/* no need to pass logmsg here as HEAD didn't really move */
522523
if (!strcmp(oldname, head) && create_symref("HEAD", newref, NULL))
523524
die("Branch renamed to %s, but HEAD is not updated!", newname);
525+
526+
snprintf(oldsection, sizeof(oldsection), "branch.%s", oldref + 11);
527+
snprintf(newsection, sizeof(newsection), "branch.%s", newref + 11);
528+
if (git_config_rename_section(oldsection, newsection) < 0)
529+
die("Branch is renamed, but update of config-file failed");
524530
}
525531

526532
int cmd_branch(int argc, const char **argv, const char *prefix)

git-cvsimport.perl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@
3232
our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,$opt_M,$opt_A,$opt_S,$opt_L, $opt_a);
3333
my (%conv_author_name, %conv_author_email);
3434

35-
sub usage() {
35+
sub usage(;$) {
36+
my $msg = shift;
37+
print(STDERR "Error: $msg\n") if $msg;
3638
print STDERR <<END;
3739
Usage: ${\basename $0} # fetch/update GIT from CVS
3840
[-o branch-for-HEAD] [-h] [-v] [-d CVSROOT] [-A author-conv-file]
39-
[-p opts-for-cvsps] [-C GIT_repository] [-z fuzz] [-i] [-k] [-u]
40-
[-s subst] [-a] [-m] [-M regex] [-S regex] [CVS_module]
41+
[-p opts-for-cvsps] [-P file] [-C GIT_repository] [-z fuzz] [-i] [-k]
42+
[-u] [-s subst] [-a] [-m] [-M regex] [-S regex] [-L commitlimit]
43+
[CVS_module]
4144
END
4245
exit(1);
4346
}
@@ -116,7 +119,7 @@ sub read_repo_config {
116119
getopts($opts) or usage();
117120
usage if $opt_h;
118121

119-
@ARGV <= 1 or usage();
122+
@ARGV <= 1 or usage("You can't specify more than one CVS module");
120123

121124
if ($opt_d) {
122125
$ENV{"CVSROOT"} = $opt_d;
@@ -129,7 +132,7 @@ sub read_repo_config {
129132
} elsif ($ENV{"CVSROOT"}) {
130133
$opt_d = $ENV{"CVSROOT"};
131134
} else {
132-
die "CVSROOT needs to be set";
135+
usage("CVSROOT needs to be set");
133136
}
134137
$opt_o ||= "origin";
135138
$opt_s ||= "-";
@@ -148,7 +151,7 @@ sub read_repo_config {
148151
chomp $cvs_tree;
149152
close $f;
150153
} else {
151-
usage();
154+
usage("CVS module has to be specified");
152155
}
153156

154157
our @mergerx = ();

git-send-email.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ sub send_message
595595
if ($chain_reply_to || !defined $reply_to || length($reply_to) == 0) {
596596
$reply_to = $message_id;
597597
if (length $references > 0) {
598-
$references .= " $message_id";
598+
$references .= "\n $message_id";
599599
} else {
600600
$references = "$message_id";
601601
}

refs.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -828,16 +828,6 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)
828828
goto rollback;
829829
}
830830

831-
if (!prefixcmp(oldref, "refs/heads/") &&
832-
!prefixcmp(newref, "refs/heads/")) {
833-
char oldsection[1024], newsection[1024];
834-
835-
snprintf(oldsection, 1024, "branch.%s", oldref + 11);
836-
snprintf(newsection, 1024, "branch.%s", newref + 11);
837-
if (git_config_rename_section(oldsection, newsection) < 0)
838-
return 1;
839-
}
840-
841831
return 0;
842832

843833
rollback:

t/t3200-branch.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ handled. Specifically, that a bogus branch is not created.
1111
. ./test-lib.sh
1212

1313
test_expect_success \
14-
'prepare an trivial repository' \
14+
'prepare a trivial repository' \
1515
'echo Hello > A &&
1616
git-update-index --add A &&
1717
git-commit -m "Initial commit." &&
@@ -85,9 +85,9 @@ test_expect_failure \
8585

8686
mv .git/config .git/config-saved
8787

88-
test_expect_success 'git branch -m q Q without config should succeed' '
89-
git-branch -m q Q &&
90-
git-branch -m Q q
88+
test_expect_success 'git branch -m q q2 without config should succeed' '
89+
git-branch -m q q2 &&
90+
git-branch -m q2 q
9191
'
9292

9393
mv .git/config-saved .git/config

0 commit comments

Comments
 (0)