mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
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
This commit is contained in:
commit
ced38ea252
|
@ -90,14 +90,17 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
|
|||
cmds-purehelpers.txt \
|
||||
cmds-foreignscminterface.txt
|
||||
|
||||
$(cmds_txt): cmd-list.perl $(MAN1_TXT)
|
||||
$(cmds_txt): cmd-list.made
|
||||
|
||||
cmd-list.made: cmd-list.perl $(MAN1_TXT)
|
||||
perl ./cmd-list.perl
|
||||
date >$@
|
||||
|
||||
git.7 git.html: git.txt core-intro.txt
|
||||
|
||||
clean:
|
||||
rm -f *.xml *.xml+ *.html *.html+ *.1 *.7 howto-index.txt howto/*.html doc.dep
|
||||
rm -f $(cmds_txt)
|
||||
rm -f $(cmds_txt) *.made
|
||||
|
||||
%.html : %.txt
|
||||
rm -f $@+ $@
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use File::Compare qw(compare);
|
||||
|
||||
sub format_one {
|
||||
my ($out, $name) = @_;
|
||||
my ($state, $description);
|
||||
$state = 0;
|
||||
open I, '<', "$name.txt" or die "No such file $name.txt";
|
||||
while (<I>) {
|
||||
if (/^NAME$/) {
|
||||
|
@ -55,7 +58,14 @@ sub format_one {
|
|||
format_one(\*O, $_);
|
||||
}
|
||||
close O;
|
||||
rename "$out+", "$out";
|
||||
|
||||
if (-f "$out" && compare("$out", "$out+") == 0) {
|
||||
unlink "$out+";
|
||||
}
|
||||
else {
|
||||
print STDERR "$out\n";
|
||||
rename "$out+", "$out";
|
||||
}
|
||||
}
|
||||
|
||||
__DATA__
|
||||
|
|
|
@ -9,9 +9,11 @@ git-cvsimport - Salvage your data out of another SCM people love to hate
|
|||
SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
'git-cvsimport' [-o <branch-for-HEAD>] [-h] [-v] [-d <CVSROOT>] [-s <subst>]
|
||||
[-p <options-for-cvsps>] [-C <git_repository>] [-i] [-P <file>]
|
||||
[-m] [-M regex] [<CVS_module>]
|
||||
'git-cvsimport' [-o <branch-for-HEAD>] [-h] [-v] [-d <CVSROOT>]
|
||||
[-A <author-conv-file>] [-p <options-for-cvsps>] [-P <file>]
|
||||
[-C <git_repository>] [-z <fuzz>] [-i] [-k] [-u] [-s <subst>]
|
||||
[-a] [-m] [-M <regex>] [-S <regex>] [-L <commitlimit>]
|
||||
[<CVS_module>]
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -30,28 +32,25 @@ any CVS branches, yourself.
|
|||
|
||||
OPTIONS
|
||||
-------
|
||||
-v::
|
||||
Verbosity: let 'cvsimport' report what it is doing.
|
||||
|
||||
-d <CVSROOT>::
|
||||
The root of the CVS archive. May be local (a simple path) or remote;
|
||||
currently, only the :local:, :ext: and :pserver: access methods
|
||||
are supported.
|
||||
are supported. If not given, git-cvsimport will try to read it
|
||||
from `CVS/Root`. If no such file exists, it checks for the
|
||||
`CVSROOT` environment variable.
|
||||
|
||||
<CVS_module>::
|
||||
The CVS module you want to import. Relative to <CVSROOT>.
|
||||
If not given, git-cvsimport tries to read it from
|
||||
`CVS/Repository`.
|
||||
|
||||
-C <target-dir>::
|
||||
The git repository to import to. If the directory doesn't
|
||||
exist, it will be created. Default is the current directory.
|
||||
|
||||
-i::
|
||||
Import-only: don't perform a checkout after importing. This option
|
||||
ensures the working directory and index remain untouched and will
|
||||
not create them if they do not exist.
|
||||
|
||||
-k::
|
||||
Kill keywords: will extract files with -kk from the CVS archive
|
||||
to avoid noisy changesets. Highly recommended, but off by default
|
||||
to preserve compatibility with early imported trees.
|
||||
|
||||
-u::
|
||||
Convert underscores in tag and branch names to dots.
|
||||
|
||||
-o <branch-for-HEAD>::
|
||||
The 'HEAD' branch from CVS is imported to the 'origin' branch within
|
||||
the git repository, as 'HEAD' already has a special meaning for git.
|
||||
|
@ -60,12 +59,32 @@ OPTIONS
|
|||
Use '-o master' for continuing an import that was initially done by
|
||||
the old cvs2git tool.
|
||||
|
||||
-i::
|
||||
Import-only: don't perform a checkout after importing. This option
|
||||
ensures the working directory and index remain untouched and will
|
||||
not create them if they do not exist.
|
||||
|
||||
-k::
|
||||
Kill keywords: will extract files with '-kk' from the CVS archive
|
||||
to avoid noisy changesets. Highly recommended, but off by default
|
||||
to preserve compatibility with early imported trees.
|
||||
|
||||
-u::
|
||||
Convert underscores in tag and branch names to dots.
|
||||
|
||||
-s <subst>::
|
||||
Substitute the character "/" in branch names with <subst>
|
||||
|
||||
-p <options-for-cvsps>::
|
||||
Additional options for cvsps.
|
||||
The options '-u' and '-A' are implicit and should not be used here.
|
||||
+
|
||||
If you need to pass multiple options, separate them with a comma.
|
||||
|
||||
-z <fuzz>::
|
||||
Pass the timestamp fuzz factor to cvsps, in seconds. If unset,
|
||||
cvsps defaults to 300s.
|
||||
|
||||
-P <cvsps-output-file>::
|
||||
Instead of calling cvsps, read the provided cvsps output file. Useful
|
||||
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.
|
|||
|
||||
-M <regex>::
|
||||
Attempt to detect merges based on the commit message with a custom
|
||||
regex. It can be used with -m to also see the default regexes.
|
||||
regex. It can be used with '-m' to also see the default regexes.
|
||||
You must escape forward slashes.
|
||||
|
||||
-v::
|
||||
Verbosity: let 'cvsimport' report what it is doing.
|
||||
|
||||
<CVS_module>::
|
||||
The CVS module you want to import. Relative to <CVSROOT>.
|
||||
|
||||
-h::
|
||||
Print a short usage message and exit.
|
||||
|
||||
-z <fuzz>::
|
||||
Pass the timestamp fuzz factor to cvsps, in seconds. If unset,
|
||||
cvsps defaults to 300s.
|
||||
|
||||
-s <subst>::
|
||||
Substitute the character "/" in branch names with <subst>
|
||||
-S <regex>::
|
||||
Skip paths matching the regex.
|
||||
|
||||
-a::
|
||||
Import all commits, including recent ones. cvsimport by default
|
||||
skips commits that have a timestamp less than 10 minutes ago.
|
||||
|
||||
-S <regex>::
|
||||
Skip paths matching the regex.
|
||||
|
||||
-L <limit>::
|
||||
Limit the number of commits imported. Workaround for cases where
|
||||
cvsimport leaks memory.
|
||||
|
@ -122,14 +125,17 @@ git-cvsimport will make it appear as those authors had
|
|||
their GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL set properly
|
||||
all along.
|
||||
+
|
||||
For convenience, this data is saved to $GIT_DIR/cvs-authors
|
||||
each time the -A option is provided and read from that same
|
||||
For convenience, this data is saved to `$GIT_DIR/cvs-authors`
|
||||
each time the '-A' option is provided and read from that same
|
||||
file each time git-cvsimport is run.
|
||||
+
|
||||
It is not recommended to use this feature if you intend to
|
||||
export changes back to CVS again later with
|
||||
gitlink:git-cvsexportcommit[1].
|
||||
|
||||
-h::
|
||||
Print a short usage message and exit.
|
||||
|
||||
OUTPUT
|
||||
------
|
||||
If '-v' is specified, the script reports what it is doing.
|
||||
|
|
|
@ -1015,7 +1015,7 @@ $ git commit
|
|||
-------------------------------------------------
|
||||
|
||||
[[how-to-make-a-commit]]
|
||||
how to make a commit
|
||||
How to make a commit
|
||||
--------------------
|
||||
|
||||
Creating a new commit takes three steps:
|
||||
|
@ -1109,7 +1109,7 @@ $ git diff # difference between the index file and your
|
|||
$ git status # a brief per-file summary of the above.
|
||||
-------------------------------------------------
|
||||
|
||||
creating good commit messages
|
||||
Creating good commit messages
|
||||
-----------------------------
|
||||
|
||||
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
|
|||
the first line on the Subject line and the rest of the commit in the
|
||||
body.
|
||||
|
||||
how to merge
|
||||
How to merge
|
||||
------------
|
||||
|
||||
You can rejoin two diverging branches of development using
|
||||
|
@ -1298,7 +1298,7 @@ the different stages of that file will be "collapsed", after which
|
|||
git-diff will (by default) no longer show diffs for that file.
|
||||
|
||||
[[undoing-a-merge]]
|
||||
undoing a merge
|
||||
Undoing a merge
|
||||
---------------
|
||||
|
||||
If you get stuck and decide to just give up and throw the whole mess
|
||||
|
|
1
Makefile
1
Makefile
|
@ -385,6 +385,7 @@ endif
|
|||
ifeq ($(uname_S),Darwin)
|
||||
NEEDS_SSL_WITH_CRYPTO = YesPlease
|
||||
NEEDS_LIBICONV = YesPlease
|
||||
OLD_ICONV = UnfortunatelyYes
|
||||
NO_STRLCPY = YesPlease
|
||||
endif
|
||||
ifeq ($(uname_S),SunOS)
|
||||
|
|
|
@ -493,6 +493,7 @@ static void rename_branch(const char *oldname, const char *newname, int force)
|
|||
{
|
||||
char oldref[PATH_MAX], newref[PATH_MAX], logmsg[PATH_MAX*2 + 100];
|
||||
unsigned char sha1[20];
|
||||
char oldsection[PATH_MAX], newsection[PATH_MAX];
|
||||
|
||||
if (!oldname)
|
||||
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)
|
|||
/* no need to pass logmsg here as HEAD didn't really move */
|
||||
if (!strcmp(oldname, head) && create_symref("HEAD", newref, NULL))
|
||||
die("Branch renamed to %s, but HEAD is not updated!", newname);
|
||||
|
||||
snprintf(oldsection, sizeof(oldsection), "branch.%s", oldref + 11);
|
||||
snprintf(newsection, sizeof(newsection), "branch.%s", newref + 11);
|
||||
if (git_config_rename_section(oldsection, newsection) < 0)
|
||||
die("Branch is renamed, but update of config-file failed");
|
||||
}
|
||||
|
||||
int cmd_branch(int argc, const char **argv, const char *prefix)
|
||||
|
|
|
@ -32,12 +32,15 @@
|
|||
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);
|
||||
my (%conv_author_name, %conv_author_email);
|
||||
|
||||
sub usage() {
|
||||
sub usage(;$) {
|
||||
my $msg = shift;
|
||||
print(STDERR "Error: $msg\n") if $msg;
|
||||
print STDERR <<END;
|
||||
Usage: ${\basename $0} # fetch/update GIT from CVS
|
||||
[-o branch-for-HEAD] [-h] [-v] [-d CVSROOT] [-A author-conv-file]
|
||||
[-p opts-for-cvsps] [-C GIT_repository] [-z fuzz] [-i] [-k] [-u]
|
||||
[-s subst] [-a] [-m] [-M regex] [-S regex] [CVS_module]
|
||||
[-p opts-for-cvsps] [-P file] [-C GIT_repository] [-z fuzz] [-i] [-k]
|
||||
[-u] [-s subst] [-a] [-m] [-M regex] [-S regex] [-L commitlimit]
|
||||
[CVS_module]
|
||||
END
|
||||
exit(1);
|
||||
}
|
||||
|
@ -116,7 +119,7 @@ sub read_repo_config {
|
|||
getopts($opts) or usage();
|
||||
usage if $opt_h;
|
||||
|
||||
@ARGV <= 1 or usage();
|
||||
@ARGV <= 1 or usage("You can't specify more than one CVS module");
|
||||
|
||||
if ($opt_d) {
|
||||
$ENV{"CVSROOT"} = $opt_d;
|
||||
|
@ -129,7 +132,7 @@ sub read_repo_config {
|
|||
} elsif ($ENV{"CVSROOT"}) {
|
||||
$opt_d = $ENV{"CVSROOT"};
|
||||
} else {
|
||||
die "CVSROOT needs to be set";
|
||||
usage("CVSROOT needs to be set");
|
||||
}
|
||||
$opt_o ||= "origin";
|
||||
$opt_s ||= "-";
|
||||
|
@ -148,7 +151,7 @@ sub read_repo_config {
|
|||
chomp $cvs_tree;
|
||||
close $f;
|
||||
} else {
|
||||
usage();
|
||||
usage("CVS module has to be specified");
|
||||
}
|
||||
|
||||
our @mergerx = ();
|
||||
|
|
|
@ -595,7 +595,7 @@ sub send_message
|
|||
if ($chain_reply_to || !defined $reply_to || length($reply_to) == 0) {
|
||||
$reply_to = $message_id;
|
||||
if (length $references > 0) {
|
||||
$references .= " $message_id";
|
||||
$references .= "\n $message_id";
|
||||
} else {
|
||||
$references = "$message_id";
|
||||
}
|
||||
|
|
10
refs.c
10
refs.c
|
@ -828,16 +828,6 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)
|
|||
goto rollback;
|
||||
}
|
||||
|
||||
if (!prefixcmp(oldref, "refs/heads/") &&
|
||||
!prefixcmp(newref, "refs/heads/")) {
|
||||
char oldsection[1024], newsection[1024];
|
||||
|
||||
snprintf(oldsection, 1024, "branch.%s", oldref + 11);
|
||||
snprintf(newsection, 1024, "branch.%s", newref + 11);
|
||||
if (git_config_rename_section(oldsection, newsection) < 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
rollback:
|
||||
|
|
|
@ -11,7 +11,7 @@ handled. Specifically, that a bogus branch is not created.
|
|||
. ./test-lib.sh
|
||||
|
||||
test_expect_success \
|
||||
'prepare an trivial repository' \
|
||||
'prepare a trivial repository' \
|
||||
'echo Hello > A &&
|
||||
git-update-index --add A &&
|
||||
git-commit -m "Initial commit." &&
|
||||
|
@ -85,9 +85,9 @@ test_expect_failure \
|
|||
|
||||
mv .git/config .git/config-saved
|
||||
|
||||
test_expect_success 'git branch -m q Q without config should succeed' '
|
||||
git-branch -m q Q &&
|
||||
git-branch -m Q q
|
||||
test_expect_success 'git branch -m q q2 without config should succeed' '
|
||||
git-branch -m q q2 &&
|
||||
git-branch -m q2 q
|
||||
'
|
||||
|
||||
mv .git/config-saved .git/config
|
||||
|
|
|
@ -123,11 +123,12 @@ test_expect_success \
|
|||
done'
|
||||
cd "$TRASH"
|
||||
|
||||
test_expect_success \
|
||||
'compare delta flavors' \
|
||||
'size_2=`stat -c "%s" test-2-${packname_2}.pack` &&
|
||||
size_3=`stat -c "%s" test-3-${packname_3}.pack` &&
|
||||
test $size_2 -gt $size_3'
|
||||
test_expect_success 'compare delta flavors' '
|
||||
perl -e '\''
|
||||
defined($_ = -s $_) or die for @ARGV;
|
||||
exit 1 if $ARGV[0] <= $ARGV[1];
|
||||
'\'' test-2-$packname_2.pack test-3-$packname_3.pack
|
||||
'
|
||||
|
||||
rm -fr .git2
|
||||
mkdir .git2
|
||||
|
|
Loading…
Reference in a new issue