summaryrefslogtreecommitdiff
path: root/git-cvsexportcommit.perl
AgeCommit message (Collapse)AuthorFilesLines
2020-08-26cvsexportcommit: do not run git programs in dashed formLibravatar Junio C Hamano1-8/+8
This ancient script runs "git-foo" all over the place, which is OK for a scripted Porcelain in the Git suite, but asking "git" to dispatch to subcommands is the usual way these days. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-08-05git-cvsexportcommit: support Perl before 5.10.1Libravatar brian m. carlson1-1/+1
The change in 6e9c4d408d ("git-cvsexportcommit: port to SHA-256", 2020-06-22) added the use of a temporary directory for the index. However, the form we used doesn't work in versions of Perl before 5.10.1. For example, version 5.10.0 contains a version of File::Temp from 2007 that doesn't contain "newdir". In order to make the code work with 5.8.8, which we support, let's change to use the static method "tempdir" with the argument "CLEANUP", which provides the same behavior. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-22git-cvsexportcommit: port to SHA-256Libravatar brian m. carlson1-5/+9
When we apply a binary patch, we must have the full object ID in the header in order to apply it; without that, any attempt to apply it will fail. If we set GIT_DIR to empty, git apply does not know about the hash algorithm we're using, and consequently any attempt to apply a patch using SHA-256 will fail, since the object ID is the wrong length. The reason we set the GIT_DIR environment variable is because we don't want to modify the index; we just want to know whether the patch applies. Instead, let's just use a temporary file for the index, which will be cleaned up automatically when the object goes out of scope. Additionally, read the configuration for the repository and compute the length of an object ID based on it. Use that when matching object IDs with a regex or computing the all-zeros object ID. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Acked-by: Eric Wong <e@80x24.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-07cvsexportcommit: force crlf translationLibravatar Dustin Spicuzza1-0/+1
When using cvsnt + msys + git, it seems like the output of cvs status had \r\n in it, and caused the command to fail. This fixes that. Signed-off-by: Dustin Spicuzza <dustin@virtualroadside.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-24git-cvsexportcommit: use a lowercase "usage:" stringLibravatar David Aguilar1-1/+1
Make the usage string consistent with Git. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-11git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYSLibravatar Sebastian Schuberth1-0/+7
Due to MSYS path mangling GIT_DIR contains a Windows-style path when checked inside a Perl script even if GIT_DIR was previously set to an MSYS-style path in a shell script. So explicitly convert to an MSYS-style path before calling Perl's rel2abs() to make it work. This fix was inspired by a very similar patch in WebKit: http://trac.webkit.org/changeset/76255/trunk/Tools/Scripts/commit-log-editor Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com> Tested-by: Pat Thoyts <patthoyts@users.sourceforge.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27perl: use "use warnings" instead of -wLibravatar Ævar Arnfjörð Bjarmason1-1/+2
Change the Perl scripts to turn on lexical warnings instead of setting the global $^W variable via the -w switch. The -w sets warnings for all code that interpreter runs, while "use warnings" is lexically scoped. The former is probably not what the authors wanted. As an auxiliary benefit it's now possible to build Git with: PERL_PATH='/usr/bin/env perl' Which would previously result in failures, since "#!/usr/bin/env perl -w" doesn't work as a shebang. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27perl: bump the required Perl version to 5.8 from 5.6.[21]Libravatar Ævar Arnfjörð Bjarmason1-0/+1
Formalize our dependency on perl 5.8, bumped from 5.6.[12]. We already used the three-arg form of open() which was introduced in 5.6.1, but t/t9700/test.pl explicitly depended on 5.6.2. However git-add--interactive.pl has been failing on the 5.6 line since it was introduced in v1.5.0-rc0~12^2~2 back in 2006 due to this open syntax: sub run_cmd_pipe { my $fh = undef; open($fh, '-|', @_) or die; return <$fh>; } Which when executed dies on "Can't use an undefined value as filehandle reference". Several of our tests also fail on 5.6 (even more when compiled with NO_PERL_MAKEMAKER=1): t2016-checkout-patch.sh t3904-stash-patch.sh t3701-add-interactive.sh t7105-reset-patch.sh t7501-commit.sh t9700-perl-git.sh Our code is bitrotting on 5.6 with no-one interested in fixing it, and pinning us to such an ancient release of Perl is keeping us from using useful features introduced in the 5.8 release. The 5.6 series is now over 10 years old, and the 5.6.2 maintenance release almost 7. 5.8 on the other hand is more than 8 years old. All the modern Unix-like operating systems have now upgraded to it or a later version, and 5.8 packages are available for old IRIX, AIX Solaris and Tru64 systems. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Acked-by: Tor Arntsen <tor@spacetec.no> Acked-by: Randal L. Schwartz <merlyn@stonehenge.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-06Avoid generating a warning if $fullname{$file} is undefinedLibravatar Nick Woolley1-1/+2
Signed-off-by: Nick Woolley <git.wu-lee@noodlefactory.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-06Remove archaic use of regex capture \1 in favour of $1Libravatar Nick Woolley1-1/+1
Using it will generate a perl warning "\1 better written as $1". Signed-off-by: Nick Woolley <git.wu-lee@noodlefactory.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-18Add -k option to cvsexportcommit to revert expanded CVS keywords in CVS ↵Libravatar Alex Bennée1-3/+22
working tree before applying commit patch Depending on how your CVS->GIT conversion went you will have some unexpanded CVS keywords in your GIT repo. If any of your git commits touch these lines then the patch application will fail. This patch addresses that by adding an option that will revert and expanded CVS keywords to files in the working CVS directory that are affected by the commit being applied. Signed-off-by: Alex Bennée <alex@bennee.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-28git-cvsexportcommit can't commit files which have been removed from CVSLibravatar Nick Woolley1-14/+35
If a file X is removed from CVS, it goes into the Attic directory, and CVS reports it as 'no file X' but with status 'Up-to-date'. cvsexportcommit misinterprets this as an existing file and tries to commit a file with the same name. Correctly identify these files, so that new files with the same name can be committed. Add a test to t9200-git-cvsexportcommit.sh, which tests that we can re-commit a removed filename which remains in CVS's attic. This adds a file 'attic_gremlin' in CVS, then "removes" it, then tries to commit a file with the same name from git. Signed-off-by: Nick Woolley <git.wu-lee@noodlefactory.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13Make usage strings dash-lessLibravatar Stephan Beyer1-1/+1
When you misuse a git command, you are shown the usage string. But this is currently shown in the dashed form. So if you just copy what you see, it will not work, when the dashed form is no longer supported. This patch makes git commands show the dash-less version. For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh generates a dash-less usage string now. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-25Merge branch 'js/cvsexportcommit'Libravatar Junio C Hamano1-6/+32
* js/cvsexportcommit: cvsexportcommit: introduce -W for shared working trees (between Git and CVS) cvsexportcommit: chomp only removes trailing whitespace Conflicts: git-cvsexportcommit.perl
2008-05-21cvsexportcommit: Create config option for CVS dirLibravatar Trent Piepho1-0/+5
For a given project the directory used with the -w option is almost always the same each time. Let it be specified with 'cvsexportcommit.cvsdir' so it's not necessary to manually add it with -w each time. Signed-off-by: Trent Piepho <tpiepho@freescale.com> Acked-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-15cvsexportcommit: introduce -W for shared working trees (between Git and CVS)Libravatar Johannes Schindelin1-5/+30
If you have a CVS checkout, it is easy to import the CVS history by calling "git cvsimport". However, interacting with the CVS repository using "git cvsexportcommit" was cumbersome, since that script assumes separate working directories for Git and CVS. Now, you can call cvsexportcommit with the -W option. This will automatically discover the GIT_DIR, and it will check out the parent commit before exporting the commit. The intended workflow is this: $ CVSROOT=$URL cvs co module $ cd module $ git cvsimport hack, hack, hack, making two commits, cleaning them up using rebase -i. $ git cvsexportcommit -W -c -p -u HEAD^ $ git cvsexportcommit -W -c -p -u HEAD Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-15cvsexportcommit: chomp only removes trailing whitespaceLibravatar Johannes Schindelin1-1/+2
In commit fef3a7cc(cvsexportcommit: be graceful when "cvs status" reorders the arguments), caution was taken to get the status even for files with leading or trailing whitespace. However, the author of that commit missed that chomp() removes only trailing newlines. With help of the mailing list, the author realized his mistake and provided this patch. The idea is that we do not want to rely on a certain layout of the output of "cvs status". Therefore we only call it with files that are unambiguous after stripping leading and trailing whitespace. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-20Merge branch 'js/maint-cvsexport'Libravatar Junio C Hamano1-8/+32
* js/maint-cvsexport: cvsexportcommit: be graceful when "cvs status" reorders the arguments Conflicts: t/t9200-git-cvsexportcommit.sh
2008-02-19cvsexportcommit: be graceful when "cvs status" reorders the argumentsLibravatar Johannes Schindelin1-8/+32
In my use cases, "cvs status" sometimes reordered the passed filenames, which often led to a misdetection of a dirty state (when it was in reality a clean state). I finally tracked it down to two filenames having the same basename. So no longer trust the order of the results blindly, but actually check the file name. Since "cvs status" only returns the basename (and the complete path on the server which is useless for our purposes), run "cvs status" several times with lists consisting of files with unique (chomped) basenames. Be a bit clever about new files: these are reported as "no file <blabla>", so in order to discern it from existing files, prepend "no file " to the basename. In other words, one call to "cvs status" will not ask for two files "blabla" (which does not yet exist) and "no file blabla" (which exists). This patch makes cvsexportcommit slightly slower, when the list of changed files has non-unique basenames, but at least it is accurate now. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-12Fix 'git cvsexportcommit -w $cvsdir ...' when used with relative $GIT_DIRLibravatar Johan Herland1-6/+5
When using the '-w $cvsdir' option to cvsexportcommit, it will chdir into $cvsdir before executing several other git commands. If $GIT_DIR is set to a relative path (e.g. '.'), the git commands executed by cvsexportcommit will naturally fail. Therefore, ensure that $GIT_DIR is absolute before the chdir to $cvsdir. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14cvsexportcommit: fix massive commitsLibravatar Jeff King1-14/+23
Because we feed the changed filenames to CVS on the command line, it was possible for massive commits to overflow the system exec limits. Instead, we now do an xargs-like split of the arguments. This means that we lose some of the atomicity of calling CVS in one shot. Since CVS commits are not atomic, but the CVS protocol is, the possible effects of this are not clear; however, since CVS doesn't provide a different interface, this is our only option for large commits (short of writing a CVS client library). The argument size limit is arbitrarily set to 64kB. This should be high enough to trigger only in rare cases where it is necessary, so normal-sized commits are not affected by the atomicity change. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-01cvsexportcommit: Add switch to specify CVS workdirLibravatar Robin Rosenberg1-12/+27
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-01Merge branch 'bk/maint-cvsexportcommit'Libravatar Junio C Hamano1-3/+10
* bk/maint-cvsexportcommit: cvsexportcommit: fix for commits that do not have parents
2007-10-31cvsexportcommit: fix for commits that do not have parentsLibravatar Brad King1-3/+10
Previously commits without parents would fail to export with a message indicating that the commits had more than one parent. Instead we should use the --root option for git-diff-tree in place of a parent. Signed-off-by: Brad King <brad.king@kitware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-19Merge branch 'maint'Libravatar Shawn O. Pearce1-0/+11
* maint: Further 1.5.3.5 fixes described in release notes Avoid invoking diff drivers during git-stash attr: fix segfault in gitattributes parsing code Define NI_MAXSERV if not defined by operating system Ensure we add directories in the correct order Avoid scary errors about tagged trees/blobs during git-fetch
2007-10-18Ensure we add directories in the correct orderLibravatar Alex Bennee1-0/+11
CVS gets understandably upset if you try and add a subdirectory before it's parent directory. This patch fixes that. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-16git-cvsexportcommit.perl: git-apply no longer needs --binaryLibravatar Michael Witten1-2/+2
Signed-off-by: Michael Witten <mfwitten@mit.edu> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-16cvsexportcommit: get rid of temporary directoryLibravatar Johannes Schindelin1-5/+0
Since commit e86ad71fe5f53ae4434566bd09ea4256090e5a3a we do not use a temporary directory in cvsexportcommit. So there is no need to set one up. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-24cvsexportcommit: avoid racy CVS problem.Libravatar Robin Rosenberg1-0/+5
If git cvsexportcommit is executed fast enough in sequence, the CVS timestamps could end up being the same. CVS tries to fix this by sleeping until the CPU clock changes seconds. Unfortunately, the CPU clock and the file system clock are not necessarily the same, so the timestamps could be the same anyway. When that happens CVS may not recognize changed files and cvs will forget to commit some files. Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-07War on whitespaceLibravatar Junio C Hamano1-1/+1
This uses "git-apply --whitespace=strip" to fix whitespace errors that have crept in to our source files over time. There are a few files that need to have trailing whitespaces (most notably, test vectors). The results still passes the test, and build result in Documentation/ area is unchanged. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-05-24Add option to cvs update before exportLibravatar Robin Rosenberg1-2/+6
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-14Optimized cvsexportcommit: calling 'cvs status' once instead of once per ↵Libravatar Steffen Prohaska1-15/+30
touched file. Runtime is now independent of the number of modified files. The old implementation executed 'cvs status' for each file touched by the patch to be applied. The new code calls 'cvs status' only once with all touched files and parses cvs's output to collect all available status information. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-09cvsexportcommit -p : fix the usage of git-apply -C.Libravatar Tomash Brechko1-3/+8
Unlike 'patch --fuzz=NUM', which specifies the number of lines allowed to mismatch, 'git-apply -CNUM' requests the match of NUM lines of context. Omitting -C requests full context match, and that's what should be used for cvsexportcommit -p. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-28Merge branch 'maint'Libravatar Junio C Hamano1-1/+2
* maint: Start preparing Release Notes for 1.5.0.3 Documentation: git-remote add [-t <branch>] [-m <branch>] [-f] name url Include config.mak in doc/Makefile git.el: Set the default commit coding system from the repository config. git-archimport: support empty summaries, put summary on a single line. http-push.c::lock_remote(): validate all remote refs. git-cvsexportcommit: don't cleanup .msg if not yet committed to cvs.
2007-02-28git-cvsexportcommit: don't cleanup .msg if not yet committed to cvs.Libravatar Gerrit Pape1-1/+2
Unless the -c option is given, and the commit to cvs was successful, .msg shouldn't be deleted to be able to run the command suggested by git-cvsexportcommit. See http://bugs.debian.org/412732 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-20Allow passing of an alternative CVSROOT via -d.Libravatar Simon 'corecode' Schubert1-10/+17
This is necessary if using CVS in an asymmetric fashion, i.e. when the CVSROOT you are checking out from differs from the CVSROOT you have to commit to. Signed-off-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05Allow forcing of a parent commit, even if the parent is not a direct one.Libravatar Simon 'corecode' Schubert1-3/+3
This can be used to compress multiple changesets into one, for example like git cvsexportcommit -P cvshead mybranch without having to do so in git first. Signed-off-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-11Make cvsexportcommit work with filenames with spaces and non-ascii characters.Libravatar Robin Rosenberg1-138/+65
This patch uses git-apply to do the patching which simplifies the code a lot and also uses one pass to git-diff. git-apply gives information on added, removed files as well as which files are binary. Removed the test for checking for matching binary files when deleting them since git-apply happily deletes the file. This is matter of taste since we allow some fuzz for text patches also. Error handling was cleaned up, but not much tested. Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-04Set permissions of each new file before "cvs add"ing it.Libravatar Jim Meyering1-0/+13
Otherwise, an executable script in git would end up being checked into the CVS repository without the execute bit. [jc: with an additional test script from Robin Rosenberg.] Signed-off-by: Jim Meyering <jim@meyering.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-13Rework cvsexportcommit to handle binary files for all cases.Libravatar Robin Rosenberg1-20/+50
Also adds test cases for adding removing and deleting binary and text files plus two tests for the checks on binary files. Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-29Make cvsexportcommit remove files.Libravatar Robin Rosenberg1-1/+1
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-23cvsexportcommit - add -a (add author line) flag, cleanup warningsLibravatar Martin Langhoff1-12/+38
This patch adds support for -a which will add an "Author: " line, and possibly a "Committer: " line to the bottom of the commit message for CVS. The commit message parser is now a little bit better, and some warnings have been cleaned up. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-10Fix more typos, primarily in the codeLibravatar Pavel Roskin1-2/+2
The only visible change is that git-blame doesn't understand "--compability" anymore, but it does accept "--compatibility" instead, which is already documented. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-09git-cvsexportcommit can't handle merge commits correctlyLibravatar Peter Baumann1-2/+2
git-cvsexportcommit should check if the parent (supplied on the cmdline) to use for a merge commit is one of the real parents of the merge. But it errors out if the _first_ parent doesn't match and never checks the other parents. Signed-off-by: Peter Baumann <siprbaum@stud.informatik.uni-erlangen.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-17git-cvsexportcommit.perl: fix typoLibravatar Sven Verdoolaege1-1/+1
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-28Make cvsexportcommit create parent directories as needed.Libravatar Yann Dirson1-5/+32
This is a quick port of my initial patch for 1.0.7, that I had forgotten to post. Possibly needs some testing before applying to master. Signed-off-by: Yann Dirson <ydirson@altern.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-28Document current cvsexportcommit limitations.Libravatar Yann Dirson1-0/+7
Since there is no bugtracker that I know of, let's just use the scripts themselves to document their limitations. Signed-off-by: Yann Dirson <ydirson@altern.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-28Do not call 'cmp' with non-existant -q flag.Libravatar Yann Dirson1-1/+1
I cannot find when that flag was removed if it ever existed, I can find nothing about it in the ChangeLog and NEWS file of GNU diff. The current flag is -s aka --quiet aka --silent, so let's use -s, assuming it is a portable flag. Feel free to lart me with a POSIX bible if needed. Signed-off-by: Yann Dirson <ydirson@altern.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-26git-cvsexportcommit: Add -f(orce) and -m(essage prefix) flags, small cleanups.Libravatar Martin Langhoff1-7/+15
2006-01-29exportcommit: replace backticks with safe_pipe_capture() or system() - ↵Libravatar Martin Langhoff1-20/+33
initial pass Replaced backticks with potentially troublesome unescaped input with safe_pipe_capture(). Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>