From edbe4466746e577418b48922003a2c8a9cb55bee Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Fri, 6 Apr 2007 23:52:39 +0200 Subject: [PATCH 01/14] cvsimport: sync usage lines with existing options Sync both the usage lines in the code and the asciidoc documentation with the real list of options. While all options seems to be documented in the asciidoc document, not all of them were listed in the usage line. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- Documentation/git-cvsimport.txt | 8 +++++--- git-cvsimport.perl | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt index 0d59c0613..8374d9047 100644 --- a/Documentation/git-cvsimport.txt +++ b/Documentation/git-cvsimport.txt @@ -9,9 +9,11 @@ git-cvsimport - Salvage your data out of another SCM people love to hate SYNOPSIS -------- [verse] -'git-cvsimport' [-o ] [-h] [-v] [-d ] [-s ] - [-p ] [-C ] [-i] [-P ] - [-m] [-M regex] [] +'git-cvsimport' [-o ] [-h] [-v] [-d ] + [-A ] [-p ] [-P ] + [-C ] [-z ] [-i] [-k] [-u] [-s ] + [-a] [-m] [-M ] [-S ] [-L ] + [] DESCRIPTION diff --git a/git-cvsimport.perl b/git-cvsimport.perl index 1a1ba7b1a..d3fbcbc15 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -36,8 +36,9 @@ () print STDERR < Date: Fri, 6 Apr 2007 23:52:40 +0200 Subject: [PATCH 02/14] cvsimport: Improve documentation of CVSROOT and CVS module determination Document the fact that git-cvsimport tries to find out CVSROOT from CVS/Root and $ENV{CVSROOT} and CVS_module from CVS/Repository. Also use ` ` syntax for all filenames for consistency. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- Documentation/git-cvsimport.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt index 8374d9047..6a0821a37 100644 --- a/Documentation/git-cvsimport.txt +++ b/Documentation/git-cvsimport.txt @@ -35,7 +35,9 @@ OPTIONS -d :: 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. -C :: The git repository to import to. If the directory doesn't @@ -87,6 +89,8 @@ If you need to pass multiple options, separate them with a comma. :: The CVS module you want to import. Relative to . + If not given, git-cvsimport tries to read it from + `CVS/Repository`. -h:: Print a short usage message and exit. @@ -124,7 +128,7 @@ 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 +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. + From 7bf77644e70d881f407c77e6d65ebe70c90916d6 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Fri, 6 Apr 2007 23:52:41 +0200 Subject: [PATCH 03/14] cvsimport: Improve usage error reporting Actually tell the user what he did wrong in case of usage errors instead of only printing the general usage information. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- git-cvsimport.perl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/git-cvsimport.perl b/git-cvsimport.perl index d3fbcbc15..ac74bc51b 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -32,7 +32,9 @@ 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 < Date: Fri, 6 Apr 2007 23:52:42 +0200 Subject: [PATCH 04/14] cvsimport: Reorder options in documentation for better understanding The current order the options are documented in makes no sense at all to me. Reorder them so that similar options are grouped together and also order them somehwhat by importance. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- Documentation/git-cvsimport.txt | 54 ++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt index 6a0821a37..a5276f776 100644 --- a/Documentation/git-cvsimport.txt +++ b/Documentation/git-cvsimport.txt @@ -32,6 +32,9 @@ any CVS branches, yourself. OPTIONS ------- +-v:: + Verbosity: let 'cvsimport' report what it is doing. + -d :: The root of the CVS archive. May be local (a simple path) or remote; currently, only the :local:, :ext: and :pserver: access methods @@ -39,10 +42,23 @@ OPTIONS from `CVS/Root`. If no such file exists, it checks for the `CVSROOT` environment variable. +:: + The CVS module you want to import. Relative to . + If not given, git-cvsimport tries to read it from + `CVS/Repository`. + -C :: The git repository to import to. If the directory doesn't exist, it will be created. Default is the current directory. +-o :: + The 'HEAD' branch from CVS is imported to the 'origin' branch within + the git repository, as 'HEAD' already has a special meaning for git. + Use this option if you want to import into a different branch. ++ +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 @@ -56,13 +72,8 @@ OPTIONS -u:: Convert underscores in tag and branch names to dots. --o :: - The 'HEAD' branch from CVS is imported to the 'origin' branch within - the git repository, as 'HEAD' already has a special meaning for git. - Use this option if you want to import into a different branch. -+ -Use '-o master' for continuing an import that was initially done by -the old cvs2git tool. +-s :: + Substitute the character "/" in branch names with -p :: Additional options for cvsps. @@ -70,6 +81,10 @@ the old cvs2git tool. + If you need to pass multiple options, separate them with a comma. +-z :: + Pass the timestamp fuzz factor to cvsps, in seconds. If unset, + cvsps defaults to 300s. + -P :: Instead of calling cvsps, read the provided cvsps output file. Useful for debugging or when cvsps is being handled outside cvsimport. @@ -84,31 +99,13 @@ If you need to pass multiple options, separate them with a comma. 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. - -:: - The CVS module you want to import. Relative to . - If not given, git-cvsimport tries to read it from - `CVS/Repository`. - --h:: - Print a short usage message and exit. - --z :: - Pass the timestamp fuzz factor to cvsps, in seconds. If unset, - cvsps defaults to 300s. - --s :: - Substitute the character "/" in branch names with +-S :: + 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 :: - Skip paths matching the regex. - -L :: Limit the number of commits imported. Workaround for cases where cvsimport leaks memory. @@ -136,6 +133,9 @@ 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. From 0e070f997b529e81f7daff79fea1b61bc9166f6b Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Fri, 6 Apr 2007 23:52:43 +0200 Subject: [PATCH 05/14] cvsimport: Improve formating consistency Use ' ' syntax for all commandline options mentioned in text. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- Documentation/git-cvsimport.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt index a5276f776..e0be85654 100644 --- a/Documentation/git-cvsimport.txt +++ b/Documentation/git-cvsimport.txt @@ -65,7 +65,7 @@ the old cvs2git tool. not create them if they do not exist. -k:: - Kill keywords: will extract files with -kk from the CVS archive + 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. @@ -96,7 +96,7 @@ If you need to pass multiple options, separate them with a comma. -M :: 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. -S :: @@ -126,7 +126,7 @@ 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 +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 From a925b89cea15c90ccf131a4ec9770ca1323e4a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?YOSHIFUJI=20Hideaki=20/=20=E5=90=89=E8=97=A4=E8=8B=B1?= =?UTF-8?q?=E6=98=8E?= Date: Fri, 6 Apr 2007 08:50:24 +0900 Subject: [PATCH 06/14] Avoid composing too long "References" header. The number of characters in a line MUST be no more than 998 characters, and SHOULD be no more than 78 characters (RFC2822). It is much safer to fold the header by ourselves. Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: Junio C Hamano --- git-send-email.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-send-email.perl b/git-send-email.perl index ae50990d0..1278fcba4 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -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"; } From 08b984fb5456c23b04c573f9021141ce27af707d Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Fri, 6 Apr 2007 01:42:04 -0400 Subject: [PATCH 07/14] Distinguish branches by more than case in tests. The renaming without config test changed a branch from q to Q, which fails on non-case sensitive file systems. Change the test to use q and q2. Signed-off-by: Junio C Hamano --- t/t3200-branch.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index ce2c5f41f..3ca1a325d 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -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 From d26f9fef470443dfb0d09c08341634208f4fb6f7 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Fri, 6 Apr 2007 10:33:06 +0200 Subject: [PATCH 08/14] rename_ref(): only print a warning when config-file update fails If git_config_rename_section() fails, rename_ref() used to return 1, which left HEAD pointing to an absent refs/heads file (since the actual renaming had already occurred). Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs.c b/refs.c index f471152bf..2ac638494 100644 --- a/refs.c +++ b/refs.c @@ -835,7 +835,7 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg) snprintf(oldsection, 1024, "branch.%s", oldref + 11); snprintf(newsection, 1024, "branch.%s", newref + 11); if (git_config_rename_section(oldsection, newsection) < 0) - return 1; + error("unable to update config-file"); } return 0; From 19eba1515a7d3b0dac6d4ee73492d978c3c2149b Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Fri, 6 Apr 2007 14:13:00 +0200 Subject: [PATCH 09/14] Make builtin-branch.c handle the git config file This moves the knowledge about .git/config usage out of refs.c and into builtin-branch.c instead, which allows git-branch to update HEAD to point at the moved branch before attempting to update the config file. It also allows git-branch to exit with an error code if updating the config file should fail. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- builtin-branch.c | 6 ++++++ refs.c | 10 ---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/builtin-branch.c b/builtin-branch.c index a4494ee33..740828505 100644 --- a/builtin-branch.c +++ b/builtin-branch.c @@ -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) diff --git a/refs.c b/refs.c index 2ac638494..d2b7b7fb5 100644 --- a/refs.c +++ b/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) - error("unable to update config-file"); - } - return 0; rollback: From ae25c67acae4971594b574e4fc02b131a3da156a Mon Sep 17 00:00:00 2001 From: Arjen Laarhoven Date: Sat, 7 Apr 2007 01:48:36 +0200 Subject: [PATCH 10/14] usermanual.txt: some capitalization nits Signed-off-by: Arjen Laarhoven Signed-off-by: Junio C Hamano --- Documentation/user-manual.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index 574e9c0e5..d43d2377e 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -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 From 4c84f0dcc630817aaf71049163ee63b96d543a38 Mon Sep 17 00:00:00 2001 From: Arjen Laarhoven Date: Sat, 7 Apr 2007 01:48:54 +0200 Subject: [PATCH 11/14] t3200-branch.sh: small language nit Signed-off-by: Junio C Hamano --- t/t3200-branch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 3ca1a325d..828d553a4 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -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." && From d93f7c1817f8b9e8bbb2e8ed70e87e84bc55b9f2 Mon Sep 17 00:00:00 2001 From: Arjen Laarhoven Date: Sat, 7 Apr 2007 01:49:03 +0200 Subject: [PATCH 12/14] t5300-pack-object.sh: portability issue using /usr/bin/stat In the test 'compare delta flavors', /usr/bin/stat is used to get file size. This isn't portable. There already is a dependency on Perl, use its '-s' operator to get the file size. Signed-off-by: Arjen Laarhoven Signed-off-by: Junio C Hamano --- t/t5300-pack-object.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index 35e036a86..083095f7f 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -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 From 63b4b7a7ed657f406eb274f88a7e2c61fd6fe958 Mon Sep 17 00:00:00 2001 From: Arjen Laarhoven Date: Sat, 7 Apr 2007 01:49:17 +0200 Subject: [PATCH 13/14] Makefile: iconv() on Darwin has the old interface The libiconv on Darwin uses the old iconv() interface (2nd argument is a const char **, instead of a char **). Add OLD_ICONV to the Darwin variable definitions to handle this. Signed-off-by: Arjen Laarhoven Acked-by: Brian Gernhardt Signed-off-by: Junio C Hamano --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 81dafe5ee..dcdaa02e4 100644 --- a/Makefile +++ b/Makefile @@ -356,6 +356,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) From d79073922fcb8c8a0bd57112817a2154f1ed05c1 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 5 Apr 2007 22:17:20 -0700 Subject: [PATCH 14/14] Documentation: tighten dependency for git.{html,txt} Every time _any_ documentation page changed, cmds-*.txt files were regenerated, which caused git.{html,txt} to be remade. Try not to update cmds-*.txt files if their new contents match the old ones. Signed-off-by: Junio C Hamano --- Documentation/Makefile | 7 +++++-- Documentation/cmd-list.perl | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Documentation/Makefile b/Documentation/Makefile index 7db3fb992..ad87736b0 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -85,14 +85,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 *.html *.1 *.7 howto-index.txt howto/*.html doc.dep - rm -f $(cmds_txt) + rm -f $(cmds_txt) *.made %.html : %.txt $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $< diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl index b54382b2b..0381590d3 100755 --- a/Documentation/cmd-list.perl +++ b/Documentation/cmd-list.perl @@ -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 () { 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__