path: root/perl
AgeCommit message (Collapse)Author
2007-08-22Fix git-remote for ActiveState PerlAlex Riesen
For reason unknown a package in ActiveState Perl 5.8.7 must implement READLINE method differently for scalar and array context. The code tested to work for more sane and recent version of perl (5.8.8 shipped with Ubuntu), so maybe it was always a requirement. Signed-off-by: Alex Riesen <> Signed-off-by: Junio C Hamano <>
2007-06-07War on whitespaceJunio C Hamano
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 <> config_boolean() -> config_bool()Petr Baudis
This patch renames config_boolean() to config_bool() for consistency with the commandline interface and because it is shorter but still obvious. ;-) It also changes the return value from some obscure string to real Perl boolean, allowing for clean user code. Signed-off-by: Petr Baudis <>
2007-05-04Allow PERL_PATH="/usr/bin/env perl"Bryan Larsen
There is a mechanism PERL_PATH in the Makefile to specify path to Perl binary, but sometimes it is convenient to let 'env' figure out where Perl comes from, with PERL_PATH="/usr/bin/env perl". Allowing this would make things easier to MacPorts, where we wish to work with the MacPorts perl if it is installed, but fall back to the system perl if it isn't. Signed-off-by: Bryan Larsen <> Signed-off-by: Junio C Hamano <>
2007-04-21perl: install private if the site version is older than our ownEric Wong
bdash (on IRC) had a problem with (via git-svn) when his site installation of was older than the version we package. Signed-off-by: Eric Wong <> Signed-off-by: Junio C Hamano <>
2007-03-14Do not output "GEN " when generating perl.makJohannes Schindelin
This fixes the same issue as 8bef6204, which became an issue again after 31d0399c. Besides, it is not really helpful to print just "GEN " (_without_ "perl.mak"). Signed-off-by: Johannes Schindelin <> Signed-off-by: Junio C Hamano <>
2007-03-07More build output cleaning upAlex Riesen
- print output file name for .c files - suppress output of the names of subdirectories when make changes into them - use GEN prefix for makefile generation in perl/ Signed-off-by: Alex Riesen <> Signed-off-by: Junio C Hamano <>
2007-03-06Make 'make' quiet by defaultShawn O. Pearce
Per Junio's suggestion we are setting 'make' to be quiet by default, with `make V=1` available to force GNU make back to its default behavior of showing each command it is running. Signed-off-by: Shawn O. Pearce <> Signed-off-by: Junio C Hamano <>
2007-03-06Make 'make' quieter while building gitShawn O. Pearce
I find it difficult to see compiler warnings amongst the massive spewing produced by GNU make as it works through our productions. This is especially true if CFLAGS winds up being rather long, due to a large number of -W options being enabled and due to a number of -D options being configured/required by my platform. By defining QUIET_MAKE (e.g. make QUIET_MAKE=YesPlease) during compilation users will get a less verbose output, such as: ... CC builtin-grep.c builtin-grep.c:187: warning: 'external_grep' defined but not used CC builtin-init-db.c CC builtin-log.c CC builtin-ls-files.c CC builtin-ls-tree.c ... The verbose (normal make) output is still the default. Signed-off-by: Shawn O. Pearce <> Signed-off-by: Junio C Hamano <>
2007-02-21Add config_boolean() method to the Git perl moduleTheodore Ts'o
Signed-off-by: "Theodore Ts'o" <> Signed-off-by: Junio C Hamano <>
2007-02-04Assorted typo fixesPavel Roskin
Signed-off-by: Junio C Hamano <>
2007-01-29[PATCH] Rename git-repo-config to git-config.Tom Prince
Signed-off-by: Tom Prince <> Signed-off-by: Junio C Hamano <>
2007-01-22Cleanup uninitialized value in chompAlex Riesen
which happens if you use ActiveState Perl and a pipe workaround specially for it. Signed-off-by: Alex Riesen <> Signed-off-by: Junio C Hamano <>
2007-01-22Force Activestate Perl to tie git command pipe handle to a handle classAlex Riesen
Otherwise it tries to tie it to a scalar and complains about missing method. Dunno why, may be ActiveState brokenness again. Signed-off-by: Alex Riesen <> Acked-by: Petr Baudis <> Signed-off-by: Junio C Hamano <>
2007-01-22Insert ACTIVESTATE_STRING in Git.pmAlex Riesen
Also add "git" to the pipe parameters, otherwise it does not work at all, as no git commands are usable out of git context. Signed-off-by: Alex Riesen <> Signed-off-by: Junio C Hamano <>
2007-01-16Fix spurious compile errorJohannes Schindelin
From time to time, I would get this error: [...] sed: -e expression #8, char 41: Unterminated `s' command make: *** [git-add--interactive] Error 1 Turns out that the function WriteMakefile() called in Makefile.PL outputs the message "Writing perl.mak for Git" to stdout! Thus, the output of "make -C perl -s --no-print-directory instlibdir" would be prefixed by that message whenever Makefile.PL was newer than perl.mak. This is fixed by redirecting stdout to stderr in Makefile.PL. Signed-off-by: Johannes E. Schindelin <> Signed-off-by: Junio C Hamano <>
2007-01-12use 'init' instead of 'init-db' for shipped docs and toolsNicolas Pitre
While 'init-db' still is and probably will always remain a valid git command for obvious backward compatibility reasons, it would be a good idea to move shipped tools and docs to using 'init' instead. Signed-off-by: Nicolas Pitre <> Signed-off-by: Junio C Hamano <>
2006-12-08Fix perl/ build.Junio C Hamano
An earlier commit f848718a broke the build in perl/ directory by allowing the Makefile.PL to overwrite the now-tracked Makefile. Fix this by forcing Makefile.PL to produce its output in perl.mak as the broken commit originally intended. Signed-off-by: Junio C Hamano <>
2006-12-04Make perl/ build procedure ActiveState friendly.Alex Riesen
On Cygwin + ActivateState Perl, Makefile generated with MakeMaker is not usable because of line-endings and back-slashes. This teaches perl/Makefile to write a handcrafted equivalent perl.mak file with 'make NO_PERL_MAKEMAKER=NoThanks'. Signed-off-by: Alex Riesen <> Signed-off-by: Junio C Hamano <> Kill Git.xs for nowPetr Baudis
This patch removes Git.xs from the repository for the time being. This should hopefully enable to finally make its way to master. Git.xs is not going away forever. When the Git libification makes some progress, it will hopefully return (but most likely as an optional component, due to the portability woes) since the performance boosts are really important for applications like Gitweb or Cogito. It needs to go away now since it is not really reliable in case you use it for several repositories in the scope of a single process, and that is not possible to fix without some either very ugly or very intrusive core changes. Rest in peace. (While you can.) Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <>
2006-09-03Revert "Make it possible to set up libgit directly (instead of from the ↵Junio C Hamano
environment)" This reverts commit 0270083ded143fd49841e3d3d0cac5eb06081d2a.
2006-09-03Revert " Introduce fast get_object() method"Junio C Hamano
This reverts commit 3c479c37f8651d09e1d08b8d6ea9757164ee1235.
2006-08-13pass DESTDIR to the generated perl/MakefileEric Wong
Makes life for binary packagers easier, as the Perl modules will be installed inside DESTDIR. Signed-off-by: Eric Wong <> Signed-off-by: Junio C Hamano <>
2006-07-26Eliminate Scalar::Util usage from private-Error.pmPetr Baudis
We used just the blessed() routine so steal it from Scalar/ Unfortunately, Scalar::Util is not bundled with older Perl versions. This is a newer much saner blessed() version by Randal L. Schwarz. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Introduce fast get_object() methodPetr Baudis
Direct .xs routine. Note that it does not work 100% correctly when you juggle multiple repository objects, but it is not that bad either. The trouble is that we might reuse packs information for another Git project; that is not an issue since Git depends on uniqueness of SHA1 ids so if we have found the object somewhere else, it is nevertheless going to be the same object. It merely makes object existence detection through this method unreliable; it is duly noted in the documentation. At least that's how I see it, I hope I didn't overlook any other potential problem. I tested it for memory leaks and it appears to be doing ok. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <>
2006-07-09Make it possible to set up libgit directly (instead of from the environment)Petr Baudis
This introduces a setup_git() function which is essentialy a (public) backend for setup_git_env() which lets anyone specify custom sources for the various paths instead of environment variables. Since the repositories may get switched on the fly, this also updates code that caches paths to invalidate them properly; I hope neither of those is a sweet spot. It is used by Git.xs' xs__call_gate() to set up per-repository data for libgit's consumption. No code actually takes advantage of it yet but get_object() will in the next patches. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Introduce ident() and ident_person() methodsPetr Baudis
These methods can retrieve/parse the author/committer ident. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Add config() methodPetr Baudis
This accessor will retrieve value(s) of the given configuration variable. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Don't #define around diePetr Baudis
Back in the old days, we called Git's die() from the .xs code, but we had to hijack Perl's die() for that. Now we don't call Git's die() so no need to do the hijacking and it silences a compiler warning. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <>
2006-07-03Git.xs: older perl do not know const char *Johannes Schindelin
Both of these casts _should_ be safe, since you do not want to muck around with the version or the path anyway. Signed-off-by: Johannes Schindelin <> Signed-off-by: Junio C Hamano <> Avoid ppport.hPetr Baudis
This makes us not include ppport.h which seems not to give us anything real anyway; it is useful for checking for portability warts but since Devel::PPPort is a portability wart itself, we shouldn't require it for build. You can check for portability problems by calling make check in perl/. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Remove PerlIO usage from Git.xsPetr Baudis
PerlIO_*() is not portable before 5.7.3, according to ppport.h, and it's more clear what is going on when we do it in the Perl part of the Git module anyway. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <>
2006-07-03Fix probing for already installed Error.pmPavel Roskin
The syntax for 'require' was wrong, and it was always failing, which resulted in installing our own version of anyways. Now we used to ship our own in the same directory, so after fixing the syntax, 'require' always succeeds, but it does not test if the platform has module installed anymore. So rename the source we ship to, and install that as when the platform does not have one already. Signed-off-by: Pavel Roskin <> Signed-off-by: Junio C Hamano <>
2006-07-03Perly git: work around buggy make implementations.Junio C Hamano
FC4 uses gnumake 3.80 whose annoying "Entering directory..." messages are not silenced with -s alone. Signed-off-by: Junio C Hamano <> Fix Git->repository("/somewhere/totally/elsewhere")Petr Baudis
Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Swap hash_object() parametersPetr Baudis
I'm about to introduce get_object() and it will be better for consistency if the object type always goes first. And writing 'blob' there explicitly is not much bother. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Try to support ActiveState output pipePetr Baudis
The code is stolen from git-annotate and completely untested since I don't have access to any Microsoft operating system now. Someone ActiveState-savvy should look at it anyway and try to implement the input pipe as well, if it is possible at all; also, the implementation seems to be horribly whitespace-unsafe. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> assorted build related fixes.Petr Baudis
- We passed our own *.a archives as LIBS to the submake that runs in perl/; separate LIBS and EXTLIBS and pass the latter which tells what the system libraries are used. - The quoting of preprocesor symbol definitions passed down to perl/ submake was loose and we lost double quotes around include directives. Use *_SQ to quote them properly. - The installation location of perl/ submake is not architecture neutral anymore, so use SITEARCH instead of SITELIB. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Add support for subdirectories inside of working copiesPetr Baudis
This patch adds support for subdirectories inside of working copies; you can specify them in the constructor either as the Directory option (it will just get autodetected using rev-parse) or explicitly using the WorkingSubdir option. This makes Git->repository() do the exact same path setup and repository lookup as the Git porcelain does. This patch also introduces repo_path(), wc_path() and wc_subdir() accessor methods and wc_chdir() mutator. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Implement options for the command interfacePetr Baudis
This gives the user a way to easily pass options to the command routines. Currently only the STDERR option is implemented and can be used to adjust what shall be done with error output of the called command (most usefully, it can be used to silence it). Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Enhance the command_pipe() mechanismPetr Baudis
Rename command_pipe() to command_output_pipe(), outsource the functionality to _command_common_pipe(). Add command_input_pipe(). Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Handle failed commands' outputPetr Baudis
Currently if an external command returns error exit code, a generic exception is thrown and there is no chance for the caller to retrieve the command's output. This patch introduces a Git::Error::Command exception class which is thrown in this case and contains both the error code and the captured command output. You can use the new git_cmd_try statement to fatally catch the exception while producing a user-friendly message. It also adds command_close_pipe() for easier checking of exit status of a command we have just a pipe handle of. It has partial forward dependency on the next patch, but basically only in the area of documentation. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Better error handlingPetr Baudis
So far, errors just killed the whole program and in case of an error inside of libgit it would be totally uncatchable. This patch makes throw standard Perl exceptions instead. In the future we might subclass Error to Git::Error or something but for now Error::Simple is more than enough. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <>
2006-07-03Add to the distributionPetr Baudis
I have been thinking about how to do the error reporting the best way and after scraping various overcomplicated concepts, I have decided that by far the most elegant way is to throw Error exceptions; the closest sane alternative is to catch the dies in by enclosing the calls in eval{}s and that's really _quite_ ugly. The only "small" trouble is that turns out sadly not to be part of the standard distribution, and installation from CPAN is a bother, especially if you can't install it system-wide. But since it is very small, I've decided to just bundle it. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Implement Git::version()Petr Baudis
Git::version() returns the Git version string. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Call external commands using execv_git_cmd()Petr Baudis
Instead of explicitly using the git wrapper to call external commands, use the execv_git_cmd() function which will directly call whatever needs to be called. GitBin option becomes useless so drop it. This actually means the exec_path() thing I planned to use worthless internally, but Jakub wants it in anyway and I don't mind, so... Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <> Implement Git::exec_path()Petr Baudis
This patch implements Git::exec_path() (as a direct XS call). Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <>
2006-07-03Introduce (v4)Petr Baudis
This patch introduces a very basic and barebone module with a sketch of how the generic interface would look like; most functions are missing, but this should give some good base. I will continue expanding it. Most desirable now is more careful error reporting, generic_in() for feeding input to Git commands and the repository() constructor doing some poking with git-rev-parse to get the git directory and subdirectory prefix. Those three are basically the prerequisities for converting git-mv. I will send them as follow-ups to this patch. Currently just wraps up exec()s of Git commands, but even that is not trivial to get right and various Git perl scripts do it in various inconsistent ways. In addition to, there is now also Git.xs which provides barebone Git.xs for directly interfacing with libgit.a, and as an example providing the hash_object() function using libgit. This adds the Git module, integrates it to the build system and as an example converts the git-fmt-merge-msg.perl script to it (the result is not very impressive since its advantage is not quite apparent in this one, but I just picked up the simplest Git user around). Compared to v3, only very minor things were fixed in this patch (some whitespaces, a missing export, tiny bug in git-fmt-merge-msg.perl); at first I wanted to post them as a separate patch but since this is still only in pu, I decided that it will be cleaner to just resend the patch. My current working state is available all the time at and an irregularily updated API documentation is at Many thanks to Jakub Narebski, Junio and others for their feedback. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <>