The installation rules wanted to differentiate between a template_dir that
is given as an absolute path (e.g. /usr/share/git-core/templates) and a
relative one (e.g. share/git-core/templates) but it was done by checking
if $(abspath $(template_dir)) and $(template_dir) yield the same string.
This was wrong in at least two ways.
* The user can give template_dir with a trailing slash from the command
line to invoke make or from the included config.mak. A directory path
ought to mean the same thing with or without such a trailing slash but
use of $(abspath) means an absolute path with a trailing slash fails
the test.
* Versions of GNU make older than 3.81 do not have $(abspath) to begin
with.
This changes the detection logic to see if the given path begins with a
slash.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
User-manual: "git stash <comment>" form is long gone
add test-dump-cache-tree in Makefile
fix typo in Documentation
apply: fix access to an uninitialized mode variable, found by valgrind
Conflicts:
Makefile
* maint-1.6.0:
User-manual: "git stash <comment>" form is long gone
add test-dump-cache-tree in Makefile
fix typo in Documentation
apply: fix access to an uninitialized mode variable, found by valgrind
5c5ba73 (Makefile: Use generic rule to build test programs,
2007-05-31) tried to use generic rule to build test programs, but it
misses the file 'dump-cache-tree.c', since its name is not prefixed by
'test-'. This commit solves this little problem by renaming this file
instead of carrying out an explicit rule in Makefile.
Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* sp/runtime-prefix:
Windows: Revert to default paths and convert them by RUNTIME_PREFIX
Compute prefix at runtime if RUNTIME_PREFIX is set
Modify setup_path() to only add git_exec_path() to PATH
Add calls to git_extract_argv0_path() in programs that call git_config_*
git_extract_argv0_path(): Move check for valid argv0 from caller to callee
Refactor git_set_argv0_path() to git_extract_argv0_path()
Move computation of absolute paths from Makefile to runtime (in preparation for RUNTIME_PREFIX)
* jk/signal-cleanup:
t0005: use SIGTERM for sigchain test
pager: do wait_for_pager on signal death
refactor signal handling for cleanup functions
chain kill signals for cleanup functions
diff: refactor tempfile cleanup handling
Windows: Fix signal numbers
While the configure script sets the EXPATDIR environment variable to
whatever value was passed to its option --with-expat as the prefix of
the location of the expat library and headers, the Makefile ignored it.
This patch fixes this bug.
Signed-off-by: Serge van den Boom <svdb@stack.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
As discussed in
http://lists.apple.com/archives/Unix-porting/2005/Mar/msg00019.html
the Mac OS X C standard library is always thread safe and always
includes the pthread library. So explicitly using -pthread causes an
'unrecognized option' compiler warning.
This patch clears PTHREAD_LIBS if Darwin is detected.
Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The RUNTIME_PREFIX mechanism allows us to use the default paths on
Windows too. Defining RUNTIME_PREFIX explicitly requests for
translation of paths relative to the executable at runtime.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit adds support for relocatable binaries (called
RUNTIME_PREFIX). Such binaries can be moved together with the
system configuration files to a different directory, as long as the
relative paths from the binary to the configuration files is
preserved. This functionality is essential on Windows where we
deliver git binaries with an installer that allows to freely choose
the installation location.
If RUNTIME_PREFIX is unset we use the static prefix. This will be
the default on Unix. Thus, the behavior on Unix will remain
identical to the old implementation, which used to add the prefix
in the Makefile.
If RUNTIME_PREFIX is set the prefix is computed from the location
of the executable. In this case, system_path() tries to strip
known directories that executables can be located in from the path
of the executable. If the path is successfully stripped it is used
as the prefix. For example, if the executable is
"/msysgit/bin/git" and BINDIR is "bin", then the prefix computed is
"/msysgit".
If the runtime prefix computation fails, we fall back to the static
prefix specified in the makefile. This can be the case if the
executable is not installed at a known location. Note that our
test system sets GIT_CONFIG_NOSYSTEM to tell git to ignore global
configuration files during testing. Hence testing does not trigger
the fall back.
Note that RUNTIME_PREFIX only works on Windows, though adding
support on Unix should not be too hard. The implementation
requires argv0_path to be set to an absolute path. argv0_path must
point to the directory of the executable. We use assert() to
verify this in debug builds. On Windows, the wrapper for main()
(see compat/mingw.h) guarantees that argv0_path is correctly
initialized. On Unix, further work is required before
RUNTIME_PREFIX can be enabled.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit prepares the Makefile for relocatable binaries (called
RUNTIME_PREFIX). Such binaries will be able to be moved together
with the system configuration files to a different directory,
requiring to compute the prefix at runtime.
In a first step, we make all paths relative in the Makefile and
teach system_path() to add the prefix instead. We used to compute
absolute paths in the Makefile and passed them to C as defines. We
now pass relative paths to C and call system_path() to add the
prefix at runtime.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
If a piece of code wanted to do some cleanup before exiting
(e.g., cleaning up a lockfile or a tempfile), our usual
strategy was to install a signal handler that did something
like this:
do_cleanup(); /* actual work */
signal(signo, SIG_DFL); /* restore previous behavior */
raise(signo); /* deliver signal, killing ourselves */
For a single handler, this works fine. However, if we want
to clean up two _different_ things, we run into a problem.
The most recently installed handler will run, but when it
removes itself as a handler, it doesn't put back the first
handler.
This patch introduces sigchain, a tiny library for handling
a stack of signal handlers. You sigchain_push each handler,
and use sigchain_pop to restore whoever was before you in
the stack.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The install target uses a foreach loop to generate a single long shell
command line to handle installation of the built-in git commands. The
maximum length of the argument list varies by platform, and this use of
foreach quickly grows the length of the argument list. Current git can
exceed the default maximum argument list length on IRIX 6.5 of 20480
depending on the installation path.
Rather than using make's foreach loop to pre-generate the shell command
line, use a shell for-loop and allow the shell to iterate through each of
the built-in commands.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Manipulating the character class table in ctype.c by hand is error prone.
To ensure that typos are found quickly, add a test program and script.
test-ctype checks the output of the character class macros isspace() et.
al. by applying them on all possible char values and consulting a list of
all characters in the particular class. It doesn't check tolower() and
toupper(); this could be added later.
The test script t0070-fundamental.sh is created because there is no good
place for the ctype test, yet -- except for t0000-basic.sh perhaps, but
it doesn't run well on Windows, yet.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
We try to keep lines under 80 characters, not to mention
that sticking a bunch of stuff on one line makes diffs
messier.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit teaches Git to produce diff output using the patience diff
algorithm with the diff option '--patience'.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The script 'git notes' allows you to edit and show commit notes, by
calling either
git notes show <commit>
or
git notes edit <commit>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commit notes are blobs which are shown together with the commit
message. These blobs are taken from the notes ref, which you can
configure by the config variable core.notesRef, which in turn can
be overridden by the environment variable GIT_NOTES_REF.
The notes ref is a branch which contains "files" whose names are
the names of the corresponding commits (i.e. the SHA-1).
The rationale for putting this information into a ref is this: we
want to be able to fetch and possibly union-merge the notes,
maybe even look at the date when a note was introduced, and we
want to store them efficiently together with the other objects.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Use dblatex in order to create a pdf version of the git user manual. No
existing Makefile targets (including "all") are touched, so you need to
explicitly say
make pdf
sudo make install-pdf
to get user-manual.pdf created and installed.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Earlier the plan was to eventually eradicate git-foo executables from the
filesystem for all the built-in commands, but when we released 1.6.0 we
decided not to do so. Instead, it has been promised that by prepending
the output from $(git --exec-path) to your $PATH, you can keep using the
dashed form of commands.
This also allows "git stage" to appear in the autogenerated command list,
which is used to offer man pages by "git help" command.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This introduces make variable NO_PTHREADS for platforms that lack the
support for pthreads library or people who do not want to use it for
whatever reason. When defined, it makes the multi-threaded index
preloading into a no-op, and also disables threaded delta searching by
pack-objects.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
Tested-by: Johannes Sixt <j6t@kdbg.org> (AIX 4.3.x)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* rs/strbuf-expand:
remove the unused files interpolate.c and interpolate.h
daemon: deglobalize variable 'directory'
daemon: inline fill_in_extra_table_entries()
daemon: use strbuf_expand() instead of interpolate()
merge-recursive: use strbuf_expand() instead of interpolate()
add strbuf_expand_dict_cb(), a helper for simple cases
This can do the lstat() storm in parallel, giving potentially much
improved performance for cold-cache cases or things like NFS that have
weak metadata caching.
Just use "read_cache_preload()" instead of "read_cache()" to force an
optimistic preload of the index stat data. The function takes a
pathspec as its argument, allowing us to preload only the relevant
portion of the index.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* 'ds/uintmax-config' (early part):
Add autoconf tests for pthreads
Make Pthread link flags configurable
Add Makefile check for FreeBSD 4.9-SECURITY
Build: add NO_UINTMAX_T to support ancient systems
Conflicts:
Makefile
* maint:
Fix non-literal format in printf-style calls
git-submodule: Avoid printing a spurious message.
git ls-remote: make usage string match manpage
Makefile: help people who run 'make check' by mistake
The target to run self test is 'make test', but there are people who try
'make check' and worse yet do not have sparse installed.
Suggest 'make test' target when they do not have 'sparse'.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
FreeBSD 4.x systems use the linker flags `-pthread' instead of the
linker flags `-lpthread' when linking against the pthread library.
Signed-off-by: David M. Syzdek <david.syzdek@acsalaska.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
We used to have non-POSIX comformant BRE in our code, and linked with GNU
regexp library on a few platforms (Darwin, FreeBSD and AIX) to work it
around. This was backwards.
We've fixed the broken regexps to use ERE that native regexp libraries on
these platforms can handle just fine. There is no need to link with GNU
regexp library on these platforms anymore.
Tested-on-AIX-by: Mike Ralphson <mike@abacus.co.uk>
Tested-on-FreeBSD-by: Jeff King <peff@peff.net>
Tested-on-Darwin-by: Arjen Laarhoven <arjen@yaph.org>
Tested-on-Darwin-by: Pieter de Bie <pieter@frim.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
If the system is FreeBSD 4.9, then NO_UINTMAX_T and NO_STRTOUMAX is defined.
Signed-off-by: David M. Syzdek <david.syzdek@acsalaska.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This adds NO_UINTMAX_T for ancient systems, such as FreeBSD 4.9-SECURITY.
If NO_UINTMAX_T is defined, then uintmax_t is defined as uint32_t.
Signed-off-by: David M. Syzdek <david.syzdek@acsalaska.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
It is one of the server side programs and needs to be found on usual $PATH.
Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
/etc/passwd shell field must be something execable, you can't enter
"/usr/bin/git shell" there. git-shell must be present as a separate
executable, or it is useless.
Signed-off-by: Tommi Virtanen <tv@eagain.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Both sets of code assume that one specifies a diff profile
as a gitattribute via the "diff=foo" attribute. They then
pull information about that profile from the config as
diff.foo.*.
The code for each is currently completely separate from the
other, which has several disadvantages:
- there is duplication as we maintain code to create and
search the separate lists of external drivers and
funcname patterns
- it is difficult to add new profile options, since it is
unclear where they should go
- the code is difficult to follow, as we rely on the
"check if this file is binary" code to find the funcname
pattern as a side effect. This is the first step in
refactoring the binary-checking code.
This patch factors out these diff profiles into "userdiff"
drivers. A file with "diff=foo" uses the "foo" driver, which
is specified by a single struct.
Note that one major difference between the two pieces of
code is that the funcname patterns are always loaded,
whereas external drivers are loaded only for the "git diff"
porcelain; the new code takes care to retain that situation.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* maint:
builtin-apply: fix typo leading to stack corruption
git-stash.sh: fix flawed fix of invalid ref handling (commit da65e7c1)
builtin-merge.c: allocate correct amount of memory
Makefile: do not set NEEDS_LIBICONV for Solaris 8
rebase -i: remove leftover debugging
rebase -i: proper prepare-commit-msg hook argument when squashing
This breaks my build on Solaris 8, as there is no separate
libiconv.
The history of this line is somewhat convoluted. In 2fd955c
(in November 2005), NEEDS_LIBICONV was turned on for all
Solaris builds, claiming to "fix an error in Solaris 10 by
setting NEEDS_LIBICONV".
Later, e15f545 (in February of 2006) claimed that "Solaris
9+ don't need iconv", and moved NEEDS_LIBICONV into a
section for Solaris 8.
Furthermore, Brandon Casey claims in
<5A1KxlhmUIHe8iXPxnXYuNXsq0Yjlbwkz2eBin3z7ELuL9nK-4tSpw@cipher.nrlssc.navy.mil>
that he does not set NEEDS_LIBICONV for Solaris 7.
So either one of those commits is totally wrong, or there is
some other magic going on where some Solaris installs need
it and others don't.
Given Brandon's statement and my problems on Solaris 8 with
NEEDS_LIBICONV, I am inclined to think the first commit was
bogus, and that NEEDS_LIBICONV shouldn't be set for Solaris
at all by default. If somebody wants to use iconv and has
installed it manually, they can set it in their config.mak.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* maint:
gitweb: Add path_info tests to t/t9500-gitweb-standalone-no-errors.sh
gitweb: Fix two 'uninitialized value' warnings in git_tree()
Solaris: Use OLD_ICONV to avoid compile warnings
gitweb: remove PATH_INFO from $my_url and $my_uri
Solaris systems use the old styled iconv(3) call and therefore
the OLD_ICONV variable should be set. Otherwise we get annoying compile
warnings.
Signed-off-by: David Soria Parra <dsp@php.net>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
lstat/stat functions in Cygwin are very slow, because they try to emulate
some *nix things that Git does not actually need. This patch adds Win32
specific implementation of these functions for Cygwin.
This implementation handles most situation directly but in some rare cases
it falls back on the implementation provided for Cygwin. This is necessary
for two reasons:
- Cygwin has its own file hierarchy, so absolute paths used in Cygwin is
not suitable to be used Win32 API. cygwin_conv_to_win32_path can not be
used because it automatically dereference Cygwin symbol links, also it
causes extra syscall. Fortunately Git rarely use absolute paths, so we
always use Cygwin implementation for absolute paths.
- Support of symbol links. Cygwin stores symbol links as ordinary using
one of two possible formats. Therefore, the fast implementation falls
back to Cygwin functions if it detects potential use of symbol links.
The speed of this implementation should be the same as mingw_lstat for
common cases, but it is considerable slower when the specified file name
does not exist.
Despite all efforts to make the fast implementation as robust as possible,
it may not work well for some very rare situations. I am aware only one
situation: use Cygwin mount to bind unrelated paths inside repository
together. Therefore, the core.ignoreCygwinFSTricks configuration option is
provided, which controls whether native or Cygwin version of stat is used.
Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* mv/merge-recursive:
builtin-merge: release the lockfile in try_merge_strategy()
merge-recursive: get rid of virtual_id
merge-recursive: move current_{file,directory}_set to struct merge_options
merge-recursive: move the global obuf to struct merge_options
merge-recursive: get rid of the index_only global variable
merge-recursive: move call_depth to struct merge_options
cherry-pick/revert: make direct internal call to merge_tree()
builtin-merge: avoid run_command_v_opt() for recursive and subtree
merge-recursive: introduce merge_options
merge-recursive.c: Add more generic merge_recursive_generic()
Split out merge_recursive() to merge-recursive.c
* jc/alternate-push:
push: receiver end advertises refs from alternate repositories
push: prepare sender to receive extended ref information from the receiver
receive-pack: make it a builtin
is_directory(): a generic helper function
Commit 3632cfc24 makes the same change for Darwin; however, the problem
also exists on FreeBSD.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This augments 3632cfc24 (Use compatibility regex library on Darwin,
2008-09-07), which already carries a "Tested-by" statement for AIX,
but that test was actually done with this patch included.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Tested-by: Mike Ralphson <mike@abacus.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
It is one of the server side programs and needs to be found on usual $PATH.
Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This introduces new build targets "man" and "html" which allow building
the documentation in the respective formats separately. This helps
people with a partial documentation build chain: html pages can be built
without xmlto.
This is documented in INSTALL now, together with corrections: Before,
instructions in INSTALL would build man+html but install man only. Now
the instructions build and install both, and new and pre-existing
targets are explained.
Note that build targets "doc" and "man" correspond to install targets
"install-doc install-html" and "install-doc" respectively. This
inconsistency is not changed, in order to keep everyone's build scripts
from breaking.
Signed-off-by: Michael J Gruber <michaeljgruber+gmane@fastmail.fm>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This patch introduces a make target "quick-install-html" which installs
the html documentation from the branch origin/html, without the need for
asciidoc/xmlto. This is analogous to the existing "quick-install-doc"
target for the man pages.
We advertise these targets in the INSTALL file now.
Signed-off-by: Michael J Gruber <michaeljgruber+gmane@fastmail.fm>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
Update draft release notes for 1.6.0.2
Use compatibility regex library for OSX/Darwin
git-svn: Fixes my() parameter list syntax error in pre-5.8 Perl
Git.pm: Use File::Temp->tempfile instead of ->new
t7501: always use test_cmp instead of diff
Conflicts:
Makefile
The standard libc regex library on OSX does not support alternation
in POSIX Basic Regular Expression mode. This breaks the diff.funcname
functionality on OSX.
To fix this, we use the GNU regex library which is already present in
the compat/ diretory for the MinGW port. However, simply adding compat/
to the COMPAT_CFLAGS variable causes a conflict between the system
fnmatch.h and the one present in compat/. To remedy this, move the
regex and fnmatch functionality to their own subdirectories in compat/
so they can be included seperately.
Signed-off-by: Arjen Laarhoven <arjen@yaph.org>
Tested-by: Mike Ralphson <mike@abacus.co.uk> (AIX)
Tested-by: Johannes Sixt <johannes.sixt@telecom.at> (MinGW)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
It is a good thing to do in general, but more importantly, transport
routines can only be used by built-ins, which is what I'll be adding next.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The reason that git-shell was excluded from the Windows build was that
our compatibility layer needed stuff that was removed when we tried to
link less of the git library into git-shell. Since 4cfc24a (shell: do
not play duplicated definition games to shrink the executable,
2008-08-19) the complete library is linked again, so we can build
git-shell on Windows as well. (This fixes 'make install', which depends
on that git-shell is always built.)
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
Makefile: add merge_recursive.h to LIB_H
Improve documentation for --dirstat diff option
Bring local clone's origin URL in line with that of a remote clone
Documentation: minor cleanup in a use case in 'git stash' manual
Documentation: fix disappeared lines in 'git stash' manpage
Documentation: fix reference to a for-each-ref option
When modifying merge-recursive.h, for example builtin-merge-recursive.c
have to be recompiled which was not true till now, causing various
runtime errors using an incremental build.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This patch introduces a modified Damerau-Levenshtein algorithm into
Git's code base, and uses it with the following penalties to show some
similar commands when an unknown command was encountered:
swap = 0, insertion = 1, substitution = 2, deletion = 4
A typical output would now look like this:
$ git sm
git: 'sm' is not a git-command. See 'git --help'.
Did you mean one of these?
am
rm
The cut-off is at similarity rating 6, which was empirically determined
to give sensible results.
As a convenience, if there is only one candidate, Git continues under
the assumption that the user mistyped it. Example:
$ git reabse
WARNING: You called a Git program named 'reabse', which does
not exist.
Continuing under the assumption that you meant 'rebase'
[...]
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Move most of the of code from builtin-merge-recursive.c to a new file
merge-recursive.c and introduce merge_recursive_setup() in there so that
builtin-merge-recursive and other builtins call it.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
gitattributes: -crlf is not binary
git-apply: Loosen "match_beginning" logic
Fix example in git-name-rev documentation
shell: do not play duplicated definition games to shrink the executable
Fix use of hardlinks in "make install"
pack-objects: Allow missing base objects when creating thin packs
Playing with linker games to shrink git-shell did not go well with various
other platforms and compilers.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The code failed to filter-out git-add properly on platforms were $X is
not empty (ATM there is only one such a platform).
Than it tried to create a hardlink to the file ($execdir/git-add) it just
removed (because git-add is first in the BUILT_INS), so ln failed (but
because stderr was redirected into /dev/null the error was never seen), and
the whole install ended up using "ln -s" instead.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* mv/merge-custom:
t7606: fix custom merge test
Fix "git-merge -s bogo" help text
Update .gitignore to ignore git-help
Builtin git-help.
builtin-help: always load_command_list() in cmd_help()
Add a second testcase for handling invalid strategies in git-merge
Add a new test for using a custom merge strategy
builtin-merge: allow using a custom strategy
builtin-help: make some internal functions available to other builtins
Conflicts:
help.c
We make hardlinks from "git" to "git-<cmd>" built-ins and have been
careful to avoid cross-device links when linking "git-<cmd>" to
gitexecdir.
However, we were not prepared to deal with a build directory that is
incapable of making hard links within itself. This patch corrects it.
Instead of temporarily linking "git" to gitexecdir, directly link "git-
add", falling back to "cp". Try hardlinking that as "git-<cmd>", falling
back to symlinks or "cp" on error.
While at it, avoid 100+ error messages from hardlink failures when we are
going to fall back to symlinks or "cp" by redirecting the standard error
to /dev/null.
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This reverts commit daa0cc9a92.
It was a stupid idea to do this; when run as a log-in shell,
it is spawned with argv[0] set to "-git-shell", so the usual
name-based dispatch would not work to begin with.
/etc/passwd shell field must be something execable, you can't enter
"/usr/bin/git shell" there. git-shell must be present as a separate
executable, or it is useless.
Signed-off-by: Tommi Virtanen <tv@eagain.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In 81cc66a, customization has been added to Makefile for supporting
HP-UX, but git commit is still problematic. This should fix the issue.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Acked-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This trivially makes "git-shell" a built-in. It makes the executable even
fatter, though.
And MinGW removed git-shell only because of the funny dependencies; there
is no reason to do so anymore.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tested-on-MinGW-by: Johannes Sixt <johannes.sixt@telecom.at>
* rs/imap:
Documentation: Improve documentation for git-imap-send(1)
imap-send.c: more style fixes
imap-send.c: style fixes
git-imap-send: Support SSL
git-imap-send: Allow the program to be run from subdirectories of a git tree
Playing with linker games to shrink git-shell did not go well with various
other platforms and compilers.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Some platforms do not have st_blocks member in "struct stat"; mingw
already emulates it by rounding it up to closest 512-byte blocks (even
though it could overcount when a file has holes).
The reason to use the member is only to figure out how many kilobytes the
files occupy on-disk, so give a helper function in git-compat-util.h to
compute this value.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
Current Makefile does not allow config.mak to override CC_LD_DYNPATH; it
only lets it affect indirectly via NO_R_TO_GCC_LINKER.
If the command line, config.mak or config.mak.autogen wants to set
CC_LD_DYNPATH differently, we should just allow it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
On platforms with $X, make removes any leftover scripts 'a' from
earlier builds if a new binary 'a.exe' is now built. However, on
cygwin 1.7.0, 'git' and 'git.exe' now consistently name the same file.
Test for file equality before attempting a remove, in order to avoid
nuking just-built binaries.
Signed-off-by: Eric Blake <ebb9@byu.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This adds a make target which can be used to try to execute certain shell
constructs which are required for compiling and running git.
This patch provides a test for the $() notation for command substition
which is used in the Makefile and extensively in the git scripts.
The make target is named in such a way as to be a hint to the user that
SHELL_PATH should be set to an appropriate shell. If the shell command
fails, the user should receive a message similar to the following:
make: *** [please_set_SHELL_PATH_to_a_more_modern_shell] Error 2
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This patch splits out git-help's functions to builtin-help.c and leaves
only functions used by other builtins in help.c.
First this removes git-help's functions from libgit which are not
interesting for other builtins, second this makes 'git help help' work
again.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Make load_command_list() capable of filtering for a given prefix and
loading into a pair of "struct cmdnames" supplied by the caller.
Make the static add_cmdname(), exclude_cmds() and is_in_cmdlist()
functions non-static.
Make list_commands() accept a custom title, and work from a pair of
"struct cmdnames" supplied by the caller.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In an earlier commit c70a8d9 (Makefile: Do not install a copy of 'git' in
$(gitexecdir), 2008-07-21), we tried to avoid installing two git, one in
/usr/bin/git and the other in /usr/libexec/git-core/git. It mistakenly
removed the only copy of git when gitexecdir and bindir are set to the
same directory, i.e. the traditional layout.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This is a follow-up patch to 49fa65a (Allow the built-in exec path to be
relative to the command invocation path, 2008-07-23). Without specific
gitexecdir passed from the command line, git-gui's build procedure would
try to figure out the value for it by running an installed git.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Allow SSL to be used when a imaps:// URL is used for the host name.
Also, automatically use TLS when not using imaps:// by using the IMAP
STARTTLS command, if the server supports it.
Tested with Courier and Gimap IMAP servers.
Signed-off-by: Robert Shearman <robertshearman@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
If GIT_EXEC_PATH (the macro that is defined in the Makefile) is relative,
it is interpreted relative to the command's invocation path, which usually
is $(bindir).
The Makefile rules were written with the assumption that $(gitexecdir) is
an absolute path. We introduce a separate variable that names the
(absolute) installation directory.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
$(gitexecdir) (as defined in the Makefile) has gained another path
component, but the relative paths in the MINGW section of the Makefile,
which are interpreted relative to it, do not account for it.
Instead of adding another ../ in front of the path, we change the code that
constructs the absolute paths to do it relative to the command's directory,
which is essentially $(bindir). We do it this way because we will also
allow a relative $(gitexecdir) later.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The install target needs to check whether the user has opted to make
$(gitexecdir) equal to $(bindir). It did so by a straight string
comparison. Since we are going to allow a relative $(gitexecdir), we have
to normalize paths before comparison, which we do with $(cd there && pwd).
The normalized paths are stored in shell variables. These we can now
reuse in the subsequent install statements, which conveniently shortens
the lines a bit.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
There is already a copy in $(bindir). A subsequent patch will enable git
to derive the exec-path from its invocation path. If git is invoked
recursively, the first invocation puts the exec-path into PATH, so that
the recursive invocation would find the instance in the exec-path. This
second instance would again try to derive an exec-path from its invocation
path, but would base its result on the wrong "bindir".
We do install the copy of git first, but remove it later, so that we can
use it as the source of the hardlinks for the builtins.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
launch_editor() is declared in strbuf.h but defined in builtin-tag.c.
This patch moves launch_editor() into a new source file editor.c,
but keeps the declaration in strbuf.h.
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile records paths to a few programs in GIT-BUILD-OPTIONS file. These
paths need to be quoted twice: once to protect specials from the shell
that runs the generated GIT-BUILD-OPTIONS file, and again to protect them
(and the first level of quoting itself) from the shell that runs the
"echo" inside the Makefile.
You can test this by trying:
$ ln -s /bin/tar "$HOME/Tes' program/tar"
$ make TAR="$HOME/Tes' program/tar" test
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The name path_list was correct for the first usage of that data structure,
but it really is a general-purpose string list.
$ perl -i -pe 's/path-list/string-list/g' $(git grep -l path-list)
$ perl -i -pe 's/path_list/string_list/g' $(git grep -l path_list)
$ git mv path-list.h string-list.h
$ git mv path-list.c string-list.c
$ perl -i -pe 's/has_path/has_string/g' $(git grep -l has_path)
$ perl -i -pe 's/path/string/g' string-list.[ch]
$ git mv Documentation/technical/api-path-list.txt \
Documentation/technical/api-string-list.txt
$ perl -i -pe 's/strdup_paths/strdup_strings/g' $(git grep -l strdup_paths)
... and then fix all users of string-list to access the member "string"
instead of "path".
Documentation/technical/api-string-list.txt needed some rewrapping, too.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This in the short term will break on platforms that use compat implemenations
that call outside compat layer, but that is exactly what we want. To give
incentive to fix things for people who are affected and more importantly have
environment to test their fixes.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This adds only the minimum necessary to keep git pull/merge's diffstat from
wrapping. Notably absent is support for the K (erase) operation, and support
for POSIX write.
Signed-off-by: Peter Harris <git@peter.is-a-geek.org>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commit 5b8e6f85 introduced stubs for three functions that make no sense
for git-shell. But those stubs defined libgit.a functions a second time
so that a linker can complain.
Now git-shell is only linked to a subset of libgit.a.
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* mv/dashless:
make remove-dashes: apply to scripts and programs as well, not just to builtins
git-bisect: use dash-less form on git bisect log
t1007-hash-object.sh: use quotes for the test description
t0001-init.sh: change confusing directory name
* mv/merge-in-c:
reduce_heads(): protect from duplicate input
reduce_heads(): thinkofix
Add a new test for git-merge-resolve
t6021: add a new test for git-merge-resolve
Teach merge.log to "git-merge" again
Build in merge
Fix t7601-merge-pull-config.sh on AIX
git-commit-tree: make it usable from other builtins
Add new test case to ensure git-merge prepends the custom merge message
Add new test case to ensure git-merge reduces octopus parents when possible
Introduce reduce_heads()
Introduce get_merge_bases_many()
Add new test to ensure git-merge handles more than 25 refs.
Introduce get_octopus_merge_bases() in commit.c
git-fmt-merge-msg: make it usable from other builtins
Move read_cache_unmerged() to read-cache.c
Add new test to ensure git-merge handles pull.twohead and pull.octopus
Move parse-options's skip_prefix() to git-compat-util.h
Move commit_list_count() to commit.c
Move split_cmdline() to alias.c
Conflicts:
Makefile
parse-options.c
All programs and scripts are now moved outside PATH, so it's a good idea
not to use the dashed forms for them, either.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This patch moves rerere()-related functions into a newly created
rerere.c file.
The setup_rerere() function is needed by both rerere() and cmd_rerere(),
so this function is moved to rerere.c and declared non-static (and "extern")
in newly created rerere.h file.
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Mentored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* dr/ceiling:
Eliminate an unnecessary chdir("..")
Add support for GIT_CEILING_DIRECTORIES
Fold test-absolute-path into test-path-utils
Implement normalize_absolute_path
Conflicts:
cache.h
setup.c
As pointed out by Linus, this strategy tries to take the best merge
base, but 'recursive' just does it better. If one needs something more
than 'resolve' then he/she should really use 'recursive' and not
'stupid'.
Cf. Message-ID: <alpine.LFD.1.10.0807030947360.18105@woody.linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* j6t/mingw: (38 commits)
compat/pread.c: Add a forward declaration to fix a warning
Windows: Fix ntohl() related warnings about printf formatting
Windows: TMP and TEMP environment variables specify a temporary directory.
Windows: Make 'git help -a' work.
Windows: Work around an oddity when a pipe with no reader is written to.
Windows: Make the pager work.
When installing, be prepared that template_dir may be relative.
Windows: Use a relative default template_dir and ETC_GITCONFIG
Windows: Compute the fallback for exec_path from the program invocation.
Turn builtin_exec_path into a function.
Windows: Use a customized struct stat that also has the st_blocks member.
Windows: Add a custom implementation for utime().
Windows: Add a new lstat and fstat implementation based on Win32 API.
Windows: Implement a custom spawnve().
Windows: Implement wrappers for gethostbyname(), socket(), and connect().
Windows: Work around incompatible sort and find.
Windows: Implement asynchronous functions as threads.
Windows: Disambiguate DOS style paths from SSH URLs.
Windows: A rudimentary poll() emulation.
Windows: Implement start_command().
...
A lot of modules that have nothing to do with git-shell functionality
were linked in, bloating git-shell more than 8 times.
This patch cuts off redundant dependencies by:
1. providing stubs for three functions that make no sense for git-shell;
2. moving quote_path_fully from environment.c to quote.c to make the
later self sufficient;
3. moving make_absolute_path into a new separate file.
The following numbers have been received with the default optimization
settings on master using GCC 4.1.2:
Before:
text data bss dec hex filename
143915 1348 93168 238431 3a35f git-shell
After:
text data bss dec hex filename
17670 788 8232 26690 6842 git-shell
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Since the Makefile in the template/ subdirectory is only used to install
the templates, we do not simply pass down the setting of template_dir
when it is relative, but construct the intended destination in a new
variable: A relative template_dir is relative to gitexecdir.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
With this definition the templates and system config file will be found
irrespective of the installation location.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
* jh/clone-packed-refs:
Teach "git clone" to pack refs
Prepare testsuite for a "git clone" that packs refs
Move pack_refs() and friends into libgit
Incorporate fetched packs in future object traversal
Otherwise remote executions directly over ssh won't find them as they used
to. --upload-pack and --receive-pack options _could_ be used on the
client side, but things should keep working out-of-box for older clients.
Later versions of clients (fetch-pack and send-pack) probably could start
asking for these programs with dashless form, but that is a different
topic.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Before we can successfully parse a builtin command from the program name
we must strip off unneeded parts, that is, the file extension.
Furthermore, we must take Windows style path names into account when we
parse the program name.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
So I was looking at the disgusting size of the git binary, and even with
the debugging removed, and using -Os instead of -O2, the size of the text
section was pretty high. In this day and age I guess almost a megabyte of
text isn't really all that surprising, but it still doesn't exactly make
me think "lean and mean".
With -Os, a surprising amount of text space is wasted on inline functions
that end up just being replicated multiple times, and where performance
really isn't a valid reason to inline them. In particular, the trivial
wrapper functions like "xmalloc()" are used _everywhere_, and making them
inline just duplicates the text (and the string we use to 'die()' on
failure) unnecessarily.
So this just moves them into a "wrapper.c" file, getting rid of a tiny bit
of unnecessary bloat. The following numbers are both with "CFLAGS=-Os":
Before:
[torvalds@woody git]$ size git
text data bss dec hex filename
700460 15160 292184 1007804 f60bc git
After:
[torvalds@woody git]$ size git
text data bss dec hex filename
670540 15160 292184 977884 eebdc git
so it saves almost 30k of text-space (it actually saves more than that
with the default -O2, but I don't think that's necessarily a very relevant
number from a "try to shrink git" standpoint).
It might conceivably have a performance impact, but none of this should be
_that_ performance critical. The real cost is not generally in the wrapper
anyway, but in the code it wraps (ie the cost of "xread()" is all in the
read itself, not in the trivial wrapping of it).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
With this change GIT can be compiled and linked using MinGW. Builtins
that only read the repository such as the log family and grep already
work.
Simple stubs are provided for a number of functions that the Windows C
runtime does not offer. They will be completed in later patches.
However, a fix for the snprintf/vsnprintf replacement is applied here
to avoid buffer overflows.
Dmitry Kakurin pointed out that access(..., X_OK) would always fails on
Vista and suggested the -D__USE_MINGW_ACCESS workaround.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
These programs depend on difficult to emulate POSIX functionality.
On Windows, we won't compile them.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
This makes it possible to install html documents from the top level
directory. Previously such target was only in Documentation/Makefile.
Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This moves pack_refs() and underlying functionality into the library,
to make pack-refs functionality easily available to all git programs.
Most of builtin-pack-refs.c has been moved verbatim into a new file
pack-refs.c that is compiled into libgit.a. A corresponding header
file, pack-refs.h, has also been added, declaring pack_refs() and
the #defines associated with the flags parameter to pack_refs().
This patch introduces no other changes in functionality.
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Earlier series to rename documentation pages around did not update this
target and left check-docs broken. This should fix it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This patch adds support to compile and run git on 12 additional platforms.
The platforms are based on UNIX Systems Labs (USL)/Novell/SYS V code base.
The most common are Novell UnixWare 2.X.X, SCO UnixWare 7.X.X,
OpenServer 5.0.X, OpenServer 6.0.X, and SCO pre OSR 5 platforms.
Looking at the the various platform headers, I find:
#if defined(_KERNEL) || !defined(_POSIX_SOURCE) \
&& !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
which hides u_short and other typedefs that other header files on these
platforms depend on. WIth _XOPEN_SOURCE defined, sources that include
system header files that depend on the typedefs such as u_short cannot be
compiled on these platforms.
__USLC__ indicates UNIX System Labs Corperation (USLC), or a Novell-derived
compiler and/or some SysV based OS's.
__M_UNIX indicates XENIX/SCO UNIX/OpenServer 5.0.7 and prior releases
of the SCO OS's. It is used just like Apple and BSD, both of these
shouldn't have _XOPEN_SOURCE defined.
This is with suggestions and modifications from
Daniel Barkalow, Junio C Hamano, Thomas Harning, and Jeremy Maitin-Shepard.
Signed-off-by: Boyd Lynn Gerber <gerberb@zenez.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* jc/diff-no-no-index:
git diff --no-index: default to page like other diff frontends
git-diff: allow --no-index semantics a bit more
"git diff": do not ignore index without --no-index
diff-files: do not play --no-index games
tests: do not use implicit "git diff --no-index"
* db/clone-in-c:
Add test for cloning with "--reference" repo being a subset of source repo
Add a test for another combination of --reference
Test that --reference actually suppresses fetching referenced objects
clone: fall back to copying if hardlinking fails
builtin-clone.c: Need to closedir() in copy_or_link_directory()
builtin-clone: fix initial checkout
Build in clone
Provide API access to init_db()
Add a function to set a non-default work tree
Allow for having for_each_ref() list extra refs
Have a constant extern refspec for "--tags"
Add a library function to add an alternate to the alternates file
Add a lockfile function to append to a file
Mark the list of refs to fetch as const
Conflicts:
cache.h
t/t5700-clone-reference.sh
Even if "foo" and/or "bar" does not exist in index, "git diff foo bar"
should not change behaviour drastically from "git diff foo bar baz" or
"git diff foo". A feature that "sometimes works and is handy" is an
unreliable cute hack.
"git diff foo bar" outside a git repository continues to work as a more
colourful alternative to "diff -u" as before.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
normalize_absolute_path removes several oddities form absolute paths,
giving nice clean paths like "/dir/sub1/sub2". Also add a test case
for this utility, based on a new test program (in the style of test-sha1).
Signed-off-by: David Reiss <dreiss@facebook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
NO_MKDTEMP is required to build, FREAD_READS_DIRECTORIES and the definition
of _LARGE_FILES fix test suite failures and INTERNAL_QSORT is required for
adequate performance.
Tested on AIX v5.3 Maintenance Level 06
Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
Tested-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* lt/case-insensitive:
Make git-add behave more sensibly in a case-insensitive environment
When adding files to the index, add support for case-independent matches
Make unpack-tree update removed files before any updated files
Make branch merging aware of underlying case-insensitive filsystems
Add 'core.ignorecase' option
Make hash_name_lookup able to do case-independent lookups
Make "index_name_exists()" return the cache_entry it found
Move name hashing functions into a file of its own
Make unpack_trees_options bit flags actual bitfields
This new API allows the commit history to be displayed as a text-based
graphical representation.
Signed-off-by: Adam Simpkins <adam@adamsimpkins.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thanks to Johannes Schindelin for various comments and improvements,
including supporting cloning full bundles.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Currently, when looking for a packed object from the pack idx, a
simple binary search is used.
A conventional binary search loop looks like this:
unsigned lo, hi;
do {
unsigned mi = (lo + hi) / 2;
int cmp = "entry pointed at by mi" minus "target";
if (!cmp)
return mi; "mi is the wanted one"
if (cmp > 0)
hi = mi; "mi is larger than target"
else
lo = mi+1; "mi is smaller than target"
} while (lo < hi);
"did not find what we wanted"
The invariants are:
- When entering the loop, 'lo' points at a slot that is never
above the target (it could be at the target), 'hi' points at
a slot that is guaranteed to be above the target (it can
never be at the target).
- We find a point 'mi' between 'lo' and 'hi' ('mi' could be
the same as 'lo', but never can be as high as 'hi'), and
check if 'mi' hits the target. There are three cases:
- if it is a hit, we have found what we are looking for;
- if it is strictly higher than the target, we set it to
'hi', and repeat the search.
- if it is strictly lower than the target, we update 'lo'
to one slot after it, because we allow 'lo' to be at the
target and 'mi' is known to be below the target.
If the loop exits, there is no matching entry.
When choosing 'mi', we do not have to take the "middle" but
anywhere in between 'lo' and 'hi', as long as lo <= mi < hi is
satisfied. When we somehow know that the distance between the
target and 'lo' is much shorter than the target and 'hi', we
could pick 'mi' that is much closer to 'lo' than (hi+lo)/2,
which a conventional binary search would pick.
This patch takes advantage of the fact that the SHA-1 is a good
hash function, and as long as there are enough entries in the
table, we can expect uniform distribution. An entry that begins
with for example "deadbeef..." is much likely to appear much
later than in the midway of a reasonably populated table. In
fact, it can be expected to be near 87% (222/256) from the top
of the table.
This is a work-in-progress and has switches to allow easier
experiments and debugging. Exporting GIT_USE_LOOKUP environment
variable enables this code.
On my admittedly memory starved machine, with a partial KDE
repository (3.0G pack with 95M idx):
$ GIT_USE_LOOKUP=t git log -800 --stat HEAD >/dev/null
3.93user 0.16system 0:04.09elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+55588minor)pagefaults 0swaps
Without the patch, the numbers are:
$ git log -800 --stat HEAD >/dev/null
4.00user 0.15system 0:04.17elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+60258minor)pagefaults 0swaps
In the same repository:
$ GIT_USE_LOOKUP=t git log -2000 HEAD >/dev/null
0.12user 0.00system 0:00.12elapsed 97%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+4241minor)pagefaults 0swaps
Without the patch, the numbers are:
$ git log -2000 HEAD >/dev/null
0.05user 0.01system 0:00.07elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+8506minor)pagefaults 0swaps
There isn't much time difference, but the number of minor faults
seems to show that we are touching much smaller number of pages,
which is expected.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
It's really totally separate functionality, and if we want to start
doing case-insensitive hash lookups, I'd rather do it when it's
separated out.
It also renames "remove_index_entry()" to "remove_name_hash()", because
that really describes the thing better. It doesn't actually remove the
index entry, that's done by "remove_index_entry_at()", which is something
very different, despite the similarity in names.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The earlier one did not correctly propagate GITWEB_CONFIG_SYSTEM from
Makefile to generated gitweb.cgi script.
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
From a distribution point of view, configuration files for applications
should reside in /etc/. On the other hand it's convenient for multiple
instances of gitweb (e.g. virtual web servers on a single machine) to have
a per-instance configuration file, just as gitweb currently supports
through the file gitweb_config.perl next to the cgi.
To support both at runtime, this commit introduces GITWEB_CONFIG_SYSTEM as
a system-wide configuration file which will be used as a fallback if the
config file sprecified throug GITWEB_CONFIG does not exist.
See also
http://bugs.debian.org/450592
Signed-off-by: Gerrit Pape <pape@smarden.org>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
On some systems, 'sh' isn't very friendly. In particular,
t7003 fails on Solaris because it doesn't understand $().
Instead, use the specified SHELL_PATH to run shell code.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Previously, we just chose whether to allow external grep
based on the __unix__ define. However, there are systems
which define this macro but which have an inferior group
(e.g., one that does not support all options used by t7002).
This allows users to accept the potential speed penalty to
get a more consistent grep experience (and to pass the
testsuite).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
With flattened one-line-per-item list that is sorted, hopefully we will
have less merge conflicts when various topics are merged.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
It used to make sense back when nothing but diff-files, diff-index and
friends depended on diffcore infrastructure, but pretty much everything
depends on revision infrastructure which in turn depends on DIFF_OBJS.
There is no reason to treat them any differently in the Makefile.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* js/remote:
"remote update": print remote name being fetched from
builtin remote rm: remove symbolic refs, too
remote: fix "update [group...]"
remote show: Clean up connection correctly if object fetch wasn't done
builtin-remote: prune remotes correctly that were added with --mirror
Make git-remote a builtin
Test "git remote show" and "git remote prune"
parseopt: add flag to stop on first non option
path-list: add functions to work with unsorted lists
Conflicts:
parse-options.c
Some systems (namely HPUX and Windows) return -1 when maxsize in snprintf()
and in vsnprintf() is reached. So replace snprintf() and vsnprintf()
functions with our own ones that return correct value upon overflow.
[jc: verified that review comments by J6t have been incorporated, and
tightened the check to verify the resulting buffer contents, suggested
by Wayne Davison]
Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
It does not allow changing the bit to a non-root user.
This fixes t1301-shared-repo.sh on the platform.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* np/verify-pack:
add storage size output to 'git verify-pack -v'
fix unimplemented packed_object_info_detail() features
make verify_one_pack() a bit less wrong wrt packed_git structure
factorize revindex code out of builtin-pack-objects.c
Conflicts:
Makefile
* mk/maint-parse-careful:
receive-pack: use strict mode for unpacking objects
index-pack: introduce checking mode
unpack-objects: prevent writing of inconsistent objects
unpack-object: cache for non written objects
add common fsck error printing function
builtin-fsck: move common object checking code to fsck.c
builtin-fsck: reports missing parent commits
Remove unused object-ref code
builtin-fsck: move away from object-refs to fsck_walk
add generic, type aware object chain walker
Conflicts:
Makefile
builtin-fsck.c
No functional change. This is needed to fix verify-pack in a later patch.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The top-level Makefile now creates a GIT-BUILD-OPTIONS file
which stores any options selected by the make process that
may be of use to further parts of the build process.
Specifically, we store the SHELL_PATH so that it can be used
by tests to construct shell scripts on the fly.
The format of the GIT-BUILD-OPTIONS file is Bourne shell,
and it is sourced by test-lib.sh; all tests can rely on just
having $SHELL_PATH correctly set in the environment.
The GIT-BUILD-OPTIONS file is written every time the
toplevel 'make' is invoked. Since the only users right now
are the test scripts, there's no drawback to updating its
timestamp. If something build-related depends on this, we
can do a trick similar to the one used by GIT-CFLAGS.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* db/checkout: (21 commits)
checkout: error out when index is unmerged even with -m
checkout: show progress when checkout takes long time while switching branches
Add merge-subtree back
checkout: updates to tracking report
builtin-checkout.c: Remove unused prefix arguments in switch_branches path
checkout: work from a subdirectory
checkout: tone down the "forked status" diagnostic messages
Clean up reporting differences on branch switch
builtin-checkout.c: fix possible usage segfault
checkout: notice when the switched branch is behind or forked
Build in checkout
Move code to clean up after a branch change to branch.c
Library function to check for unmerged index entries
Use diff -u instead of diff in t7201
Move create_branch into a library file
Build-in merge-recursive
Add "skip_unmerged" option to unpack_trees.
Discard "deleted" cache entries after using them to update the working tree
Send unpack-trees debugging output to stderr
Add flag to make unpack_trees() not print errors.
...
Conflicts:
Makefile
* ae/pack-autothread:
Revert "pack-objects: Print a message describing the number of threads for packing"
pack-objects: Print a message describing the number of threads for packing
pack-objects: Add runtime detection of online CPU's
The requirements are:
* it may not crash on NULL pointers
* a callback function is needed, as index-pack/unpack-objects
need to do different things
* the type information is needed to check the expected <-> real type
and print better error messages
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This converts git_config_alias to the public alias_lookup
function. Because of the nature of our config parser, we
still have to rely on setting static data. However, that
interface is wrapped so that you can just say
value = alias_lookup(key);
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
On Cygwin we have to use git-archive.exe as the target, otherwise
running 'make dist' does not compile git-archive in the current
directory. That may cause 'make dist' to fail on a clean source
tree that has never been built before.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Packing objects can be done in parallell nowadays, but it's
only done if the config option pack.threads is set to a value
above 1. Because of that, the code-path used is often not the
most optimal one.
This patch adds a routine to detect the number of online CPU's
at runtime (online_cpus()). When pack.threads (or --threads=) is
given a value of 0, the number of threads is set to the number of
online CPU's. This feature is also documented.
As per Nicolas Pitre's recommendations, the default is still to
run pack-objects single-threaded unless explicitly activated,
either by configuration or by command line parameter.
The routine online_cpus() is a rework of "numcpus.c", written by
one Philip Willoughby <pgw99@doc.ic.ac.uk>. numcpus.c is in the
public domain and can presently be downloaded from
http://csgsoft.doc.ic.ac.uk/numcpus/
Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
An earlier commit e1b3a2c (Build-in merge-recursive) made the
subtree merge strategy backend unavailable. This resurrects
it.
A new test t6029 currently only tests the strategy is available,
but it should be enhanced to check the real "subtree" case.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This moves low-level merge functions out of merge-recursive.c and
places them in a new separate file, ll-merge.c
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The only differences in behavior should be:
- git checkout -m with non-trivial merging won't print out
merge-recursive messages (see the change in t7201-co.sh)
- git checkout -- paths... will give a sensible error message if
HEAD is invalid as a commit.
- some intermediate states which were written to disk in the shell
version (in particular, index states) are only kept in memory in
this version, and therefore these can no longer be revealed by
later write operations becoming impossible.
- when we change branches, we discard MERGE_MSG, SQUASH_MSG, and
rr-cache/MERGE_RR, like reset always has.
I'm not 100% sure I got the merge recursive setup exactly right; the
base for a non-trivial merge in the shell code doesn't seem
theoretically justified to me, but I tried to match it anyway, and the
tests all pass this way.
Other than these items, the results should be identical to the shell
version, so far as I can tell.
[jc: squashed lock-file fix from Dscho in]
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Some systems do not fail as expected when fread et al. are called on
a directory stream. Replace fopen on such systems which will fail
when the supplied path is a directory.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
You can also create branches, in exactly the same way, with checkout -b.
This introduces branch.{c,h} library files for doing porcelain-level
operations on branches (such as creating them with their appropriate
default configuration).
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
This makes write_tree_from_memory(), which writes the active cache as
a tree and returns the struct tree for it, available to other code. It
also makes available merge_trees(), which does the internal merge of
two trees with a known base, and merge_recursive(), which does the
recursive internal merge of two commits with a list of common
ancestors.
The first two of these will be used by checkout -m, and the third is
presumably useful in general, although the implementation of checkout
-m which entirely matches the behavior of the shell version does not
use it (since it ignores the difference of ancestry between the old
branch and the new branch).
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
qsort in Windows 2000 (and various other C libraries) is a Quicksort
with the usual O(n^2) worst case. Unfortunately, sorting Git trees
seems to get very close to that worst case quite often:
$ /git/gitbad runstatus
# On branch master
qsort, nmemb = 30842
done, 237838087 comparisons.
This patch adds a simplified version of the merge sort that is glibc's
qsort(3). As a merge sort, this needs a temporary array equal in size
to the array that is to be sorted, but has a worst-case performance of
O(n log n).
The complexity that was removed is:
* Doing direct stores for word-size and -aligned data.
* Falling back to quicksort if the allocation required to perform the
merge sort would likely push the machine into swap.
Even with these simplifications, this seems to outperform the Windows
qsort(3) implementation, even in Windows XP (where it is "fixed" and
doesn't trigger O(n^2) complexity on trees).
[jes: moved into compat/qsort.c, as per Johannes Sixt's suggestion]
[bcd: removed gcc-ism, thanks to Edgar Toernig. renamed make variable
per Junio's comment.]
Signed-off-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
"git-help--browse" helper is to launch a browser of the user's choice
to view the HTML version of git documentation for a given command. It
used to take the name of a command, convert it to the path of the
documentation by prefixing the directory name and appending the
".html" suffix, and start the browser on the path.
This updates the division of labor between the caller in help.c and
git-help--browser helper. The helper is now responsible for launching
a browser of the user's choice on given URLs, and it is the caller's
responsibility to tell it the paths to documentation files.
This is in preparation to reuse the logic to choose user's preferred
browser in instaweb.
The helper had a provision for running it without any command name, in
which case it showed the toplevel "git(7)" documentation, but the
caller in help.c never makes such a call. The helper now exits with a
usage message when no path is given.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
POSIX.1-2001 has declaration of select(2) in <sys/select.h>, but
in the previous version of SUS, it was declared in <sys/time.h>
(which is already included in git-compat-util.h).
This introduces NO_SYS_SELECT_H macro in the Makefile to be set
on older systems, to skip inclusion of <sys/select.h> that does
not exist on them.
We could check _POSIX_VERSION with 200112L and do this
automatically, but earlier it was reported that the approach
does not work well on some vintage of HP-UX. Other systems may
get _POSIX_VERSION itself wrong. At least for now, this manual
configuration is safer.
Signed-off-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When the specfile (export-subst) attribute was introduced, it added a
dependency from archive-{tar|zip}.c to builtin-archive.c. This broke the
support for archive-operations in libgit.a since builtin-archive.o doesn't
belong in libgit.a.
This patch moves the functions required by libgit.a from builtin-archive.c
to the new file archive.c (which becomes part of libgit.a).
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Update configure.ac (and config.mak.in) by adding test for unsetenv
(NO_UNSETENV). Add comment about NO_UNSETENV to Makefile header, as
original commit 731043fd adding compat/unsetenv.c didn't do that.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
rerere.enabled is _not_ on by default. The command is enabled if rr-cache
exists even when rerere.enabled is missing, and enabled or disabled by
explicitly setting the rerere.enabled variable.
This page should hold every information about the git ways to parse command
lines, and best practices to be used for scripting.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
git-instaweb relied on a pipe in a sed script, but this is not supported
by MacOS X sed when using BREs. git-instaweb relies on a working perl
in any case, and perl re are more consistent between platforms, so
replace sed invocation with an equivalent perl invocation.
Also, fix the documented -b "" to work without giving a spurious 'command
not found' error.
Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The convention for helper scripts has been
git-$TOOL--$HELPER. Since this is a "browse" helper for the
"help" tool, git-help--browse is a more sensible name.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The command was removed from the builtin command list and there was no
way to invoke it, but the code was still there.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* cc/help:
RPM spec: Adjust htmldir
git-help -w: do not require to be in git repository
git.spec.in: remove python_path
Documentation: rename git.texi to user-manual.texi
Add git-browse-help to .gitignore
git-help -i: show info documentation from matching version of git
git-help -i: invoke info with document and node name
Documentation: add gitman.info target
Documentation: describe -w/--web option to "git-help".
Use {web,instaweb,help}.browser config options.
git-help: add -w|--web option to display html man page in a browser.
Documentation: describe -i/--info option to "git-help"
git-help: add -i|--info option to display info page.
DESTDIR is supposed to be overridden on 'make install' after doing
'make'. Have the automatically generated perl/perl.mak not cache the
value of DESTDIR to support that for the perl/ subdirectory also.
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* jc/spht:
Use gitattributes to define per-path whitespace rule
core.whitespace: documentation updates.
builtin-apply: teach whitespace_rules
builtin-apply: rename "whitespace" variables and fix styles
core.whitespace: add test for diff whitespace error highlighting
git-diff: complain about >=8 consecutive spaces in initial indent
War on whitespace: first, a bit of retreat.
Conflicts:
cache.h
config.c
diff.c
Now when using "git help -w cmd", we will try to show the HTML man
page "git-cmd.html" in your prefered web browser.
To do that "help.c" code will call a new shell script
"git-browse-help".
This currently works only if the HTML versions of the man page
have been installed in $(htmldir) (typically "/usr/share/doc/git-doc"),
so new target to do that is added to "Documentation/Makefile".
The browser to use can be configured using the "web.browser"
config variable.
We try to open a new tab in an existing web browser, if possible.
The code in "git-browse-help" is heavily stolen from "git-mergetool"
by Theodore Y. Ts'o. Thanks.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Prepend $(prefix)/share/man to the MANPATH environment variable before
invoking 'man' from help.c:show_man_page(). There may be other git
documentation in the user's MANPATH but the user is asking a specific
instance of git about its own documentation, so we'd better show the
documentation for _that_ instance of git.
Signed-off-by: Sergei Organov <osv@javad.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Apple ships a newer version of iconv with Leopard (Mac OS X 10.5/Darwin
9). Ensure that OLD_ICONV is not set on any version of Darwin in the
9.x series; this should be good for at least a couple of years, when
Darwin 10 comes out and we can invert the sense of the test to
specifically check for Darwin 7 or 8.
A more sophisticated and robust check is possible for those who use
autoconf, but not everybody does that.
Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The `core.whitespace` configuration variable allows you to define what
`diff` and `apply` should consider whitespace errors for all paths in
the project (See gitlink:git-config[1]). This attribute gives you finer
control per path.
For example, if you have these in the .gitattributes:
frotz whitespace
nitfol -whitespace
xyzzy whitespace=-trailing
all types of whitespace problems known to git are noticed in path 'frotz'
(i.e. diff shows them in diff.whitespace color, and apply warns about
them), no whitespace problem is noticed in path 'nitfol', and the
default types of whitespace problems except "trailing whitespace" are
noticed for path 'xyzzy'. A project with mixed Python and C might want
to have:
*.c whitespace
*.py whitespace=-indent-with-non-tab
in its toplevel .gitattributes file.
Signed-off-by: Junio C Hamano <gitster@pobox.com>