1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-02 12:56:31 +02:00
Commit Graph

1784 Commits

Author SHA1 Message Date
Junio C Hamano 2a2aa8e556 Merge branch 'ar/i18n-no-gettext'
* ar/i18n-no-gettext:
  i18n: Do not force USE_GETTEXT_SCHEME=fallthrough on NO_GETTEXT
  i18n: Make NO_GETTEXT imply fallthrough scheme in shell l10n
  add a Makefile switch to avoid gettext translation in shell scripts
  git-sh-i18n: restructure the logic to compute gettext.sh scheme
2012-01-31 22:24:23 -08:00
Junio C Hamano d475536658 Merge branch 'svn-fe' of git://repo.or.cz/git/jrn into jn/svn-fe
This simplifies svn-fe a great deal and fulfills a longstanding wish:
support for dumps with deltas in them, and incremental imports.

The cost is that commandline usage of the svn-fe tool becomes a little
more complicated since it no longer keeps state itself but instead reads
blobs back from fast-import in order to copy them between revisions and
apply deltas to them.

Also removes a couple of custom data structures and replaces them with
strbufs like other parts of Git.

* 'svn-fe' of git://repo.or.cz/git/jrn: (32 commits)
  vcs-svn: reset first_commit_done in fast_export_init
  vcs-svn: do not initialize report_buffer twice
  vcs-svn: avoid hangs from corrupt deltas
  vcs-svn: guard against overflow when computing preimage length
  vcs-svn: cap number of bytes read from sliding view
  test-svn-fe: split off "test-svn-fe -d" into a separate function
  vcs-svn: implement text-delta handling
  vcs-svn: let deltas use data from preimage
  vcs-svn: let deltas use data from postimage
  vcs-svn: verify that deltas consume all inline data
  vcs-svn: implement copyfrom_data delta instruction
  vcs-svn: read instructions from deltas
  vcs-svn: read inline data from deltas
  vcs-svn: read the preimage when applying deltas
  vcs-svn: parse svndiff0 window header
  vcs-svn: skeleton of an svn delta parser
  vcs-svn: make buffer_read_binary API more convenient
  vcs-svn: learn to maintain a sliding view of a file
  Makefile: list one vcs-svn/xdiff object or header per line
  vcs-svn: avoid using ls command twice
  ...

Conflicts:
	Makefile
	contrib/svn-fe/svn-fe.txt
2012-01-27 11:20:00 -08:00
Junio C Hamano 60f40791f9 i18n: Do not force USE_GETTEXT_SCHEME=fallthrough on NO_GETTEXT
It should merely be the default used when the builder does not say
anything about USE_GETTEXT_SCHEME.

Even with NO_GETTEXT, USE_GETTEXT_SCHEME=gnu may be a way to avoid
possibly slower emulation in our shell scripts.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-27 10:26:37 -08:00
Junio C Hamano ba8c6ef627 i18n: Make NO_GETTEXT imply fallthrough scheme in shell l10n
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-23 14:25:19 -08:00
Alex Riesen ad17ea7347 add a Makefile switch to avoid gettext translation in shell scripts
Some systems have gettext.sh (GNU gettext) installed, but it is either
broken or misconfigured in such a way so its output is not usable.  In
case the users of these systems are unable or not interested in fixing
them, setting the new Makefile switch should help:

    make USE_GETTEXT_SCHEME=fallthrough

This will replace the translation routines with fallthrough versions,
that does not use gettext from the platform.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-23 14:24:14 -08:00
Junio C Hamano e39888ba21 Merge branch 'na/strtoimax' into maint
* na/strtoimax:
  Support sizes >=2G in various config options accepting 'g' sizes.
  Compatibility: declare strtoimax() under NO_STRTOUMAX
  Add strtoimax() compatibility function.
2011-12-28 11:32:33 -08:00
Junio C Hamano ded408fd20 Merge branch 'jk/git-prompt'
* jk/git-prompt:
  contrib: add credential helper for OS X Keychain
  Makefile: OS X has /dev/tty
  Makefile: linux has /dev/tty
  credential: use git_prompt instead of git_getpass
  prompt: use git_terminal_prompt
  add generic terminal prompt function
  refactor git_getpass into generic prompt function
  move git_getpass to its own source file
  imap-send: don't check return value of git_getpass
  imap-send: avoid buffer overflow

Conflicts:
	Makefile
2011-12-22 11:27:23 -08:00
Junio C Hamano 2dccad3c6f Merge branch 'ab/enable-i18n'
* ab/enable-i18n:
  i18n: add infrastructure for translating Git with gettext

Conflicts:
	Makefile
2011-12-19 16:06:41 -08:00
Junio C Hamano 33e7fefef6 Merge branch 'tr/cache-tree'
* tr/cache-tree:
  reset: update cache-tree data when appropriate
  commit: write cache-tree data when writing index anyway
  Refactor cache_tree_update idiom from commit
  Test the current state of the cache-tree optimization
  Add test-scrap-cache-tree
2011-12-19 16:05:20 -08:00
Junio C Hamano 367d20ec6b Merge branch 'jk/credentials'
* jk/credentials:
  t: add test harness for external credential helpers
  credentials: add "store" helper
  strbuf: add strbuf_add*_urlencode
  Makefile: unix sockets may not available on some platforms
  credentials: add "cache" helper
  docs: end-user documentation for the credential subsystem
  credential: make relevance of http path configurable
  credential: add credential.*.username
  credential: apply helper config
  http: use credential API to get passwords
  credential: add function for parsing url components
  introduce credentials API
  t5550: fix typo
  test-lib: add test_config_global variant

Conflicts:
	strbuf.c
2011-12-19 16:05:16 -08:00
Junio C Hamano 48b303675a Merge branch 'jc/stream-to-pack'
* jc/stream-to-pack:
  bulk-checkin: replace fast-import based implementation
  csum-file: introduce sha1file_checkpoint
  finish_tmp_packfile(): a helper function
  create_tmp_packfile(): a helper function
  write_pack_header(): a helper function

Conflicts:
	pack.h
2011-12-16 22:33:40 -08:00
Jeff King 3f3a9701ae Makefile: OS X has /dev/tty
We can use our enhanced getpass(). Tested by me.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12 16:09:39 -08:00
Jeff King 9b4b894601 Makefile: linux has /dev/tty
Therefore we can turn on our custom prompt function instead
of relying on getpass.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12 16:09:39 -08:00
Jeff King 21aeafceda add generic terminal prompt function
When we need to prompt the user for input interactively, we
want to access their terminal directly. We can't rely on
stdio because it may be connected to pipes or files, rather
than the terminal. Instead, we use "getpass()", because it
abstracts the idea of prompting and reading from the
terminal.  However, it has some problems:

  1. It never echoes the typed characters, which makes it OK
     for passwords but annoying for other input (like usernames).

  2. Some implementations of getpass() have an extremely
     small input buffer (e.g., Solaris 8 is reported to
     support only 8 characters).

  3. Some implementations of getpass() will fall back to
     reading from stdin (e.g., glibc). We explicitly don't
     want this, because our stdin may be connected to a pipe
     speaking a particular protocol, and reading will
     disrupt the protocol flow (e.g., the remote-curl
     helper).

  4. Some implementations of getpass() turn off signals, so
     that hitting "^C" on the terminal does not break out of
     the password prompt. This can be a mild annoyance.

Instead, let's provide an abstract "git_terminal_prompt"
function that addresses these concerns. This patch includes
an implementation based on /dev/tty, enabled by setting
HAVE_DEV_TTY. The fallback is to use getpass() as before.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12 16:09:38 -08:00
Jeff King 71e1b4b6bf credentials: add "store" helper
This is like "cache", except that we actually put the
credentials on disk. This can be terribly insecure, of
course, but we do what we can to protect them by filesystem
permissions, and we warn the user in the documentation.

This is not unlike using .netrc to store entries, but it's a
little more user-friendly. Instead of putting credentials in
place ahead of time, we transparently store them after
prompting the user for them once.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12 16:09:38 -08:00
Jeff King d3c58b83ae move git_getpass to its own source file
This is currently in connect.c, but really has nothing to
do with the git protocol itself. Let's make a new source
file all about prompting the user, which will make it
cleaner to refactor.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12 16:09:38 -08:00
Johannes Sixt 6320358e31 Makefile: unix sockets may not available on some platforms
Introduce a configuration option NO_UNIX_SOCKETS to exclude code that
depends on Unix sockets and use it in MSVC and MinGW builds.

Notice that unix-socket.h was missing from LIB_H before; fix that, too.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-12 16:00:18 -08:00
Jeff King e2770979fe credentials: add "cache" helper
If you access repositories over smart-http using http
authentication, then it can be annoying to have git ask you
for your password repeatedly. We cache credentials in
memory, of course, but git is composed of many small
programs. Having to input your password for each one can be
frustrating.

This patch introduces a credential helper that will cache
passwords in memory for a short period of time.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-11 23:16:25 -08:00
Jeff King abca927dbe introduce credentials API
There are a few places in git that need to get a username
and password credential from the user; the most notable one
is HTTP authentication for smart-http pushing.

Right now the only choices for providing credentials are to
put them plaintext into your ~/.netrc, or to have git prompt
you (either on the terminal or via an askpass program). The
former is not very secure, and the latter is not very
convenient.

Unfortunately, there is no "always best" solution for
password management. The details will depend on the tradeoff
you want between security and convenience, as well as how
git can integrate with other security systems (e.g., many
operating systems provide a keychain or password wallet for
single sign-on).

This patch provides an abstract notion of credentials as a
data item, and provides three basic operations:

  - fill (i.e., acquire from external storage or from the
    user)

  - approve (mark a credential as "working" for further
    storage)

  - reject (mark a credential as "not working", so it can
    be removed from storage)

These operations can be backed by external helper processes
that interact with system- or user-specific secure storage.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-11 23:16:24 -08:00
Junio C Hamano eb8aa3d2c2 Merge branch 'jc/pull-signed-tag'
* jc/pull-signed-tag:
  commit-tree: teach -m/-F options to read logs from elsewhere
  commit-tree: update the command line parsing
  commit: teach --amend to carry forward extra headers
  merge: force edit and no-ff mode when merging a tag object
  commit: copy merged signed tags to headers of merge commit
  merge: record tag objects without peeling in MERGE_HEAD
  merge: make usage of commit->util more extensible
  fmt-merge-msg: Add contents of merged tag in the merge message
  fmt-merge-msg: package options into a structure
  fmt-merge-msg: avoid early returns
  refs DWIMmery: use the same rule for both "git fetch" and others
  fetch: allow "git fetch $there v1.0" to fetch a tag
  merge: notice local merging of tags and keep it unwrapped
  fetch: do not store peeled tag object names in FETCH_HEAD
  Split GPG interface into its own helper library

Conflicts:
	builtin/fmt-merge-msg.c
	builtin/merge.c
2011-12-09 13:37:09 -08:00
Junio C Hamano a4043aeafe Merge branch 'jc/request-pull-show-head-4'
* jc/request-pull-show-head-4:
  request-pull: use the annotated tag contents
  fmt-merge-msg.c: Fix an "dubious one-bit signed bitfield" sparse error
  environment.c: Fix an sparse "symbol not declared" warning
  builtin/log.c: Fix an "Using plain integer as NULL pointer" warning
  fmt-merge-msg: use branch.$name.description
  request-pull: use the branch description
  request-pull: state what commit to expect
  request-pull: modernize style
  branch: teach --edit-description option
  format-patch: use branch description in cover letter
  branch: add read_branch_desc() helper function

Conflicts:
	builtin/branch.c
2011-12-09 13:37:05 -08:00
Thomas Rast 1aed2fe394 Add test-scrap-cache-tree
A simple utility that invalidates all existing cache-tree data.  We
need this for tests.  (We don't need a tool to rebuild the cache-tree
data; git read-tree HEAD works for that.)

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-06 14:52:18 -08:00
Ævar Arnfjörð Bjarmason 5e9637c629 i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.

This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.

This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.

The rest of the commit message goes into detail about various
sub-parts of this commit.

= Installation

Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.

= Perl

Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.

Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.

Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.

I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.

See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.

= Shell

Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.

If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.

If neither are present we'll use a dumb printf(1) fall-through
wrapper.

= About libcharset.h and langinfo.h

We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.

The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.

GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.

=Credits

This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.

[jc: squashed a small Makefile fix from Ramsay]

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-05 20:46:55 -08:00
Junio C Hamano 5d6c53bb23 Merge branch 'na/strtoimax'
* na/strtoimax:
  Support sizes >=2G in various config options accepting 'g' sizes.
  Compatibility: declare strtoimax() under NO_STRTOUMAX
  Add strtoimax() compatibility function.
2011-12-05 15:12:49 -08:00
Junio C Hamano 568508e765 bulk-checkin: replace fast-import based implementation
This extends the earlier approach to stream a large file directly from the
filesystem to its own packfile, and allows "git add" to send large files
directly into a single pack. Older code used to spawn fast-import, but the
new bulk-checkin API replaces it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-01 11:46:09 -08:00
Jonathan Nieder 024c843d47 Makefile: add option to disable automatic dependency generation
Now that the COMPUTE_HEADER_DEPENDENCIES feature is turned on
automatically for compilers that support it (see v1.7.8-rc0~142^2~1,
2011-08-18), there is no easy way to force it off.  For example,
setting COMPUTE_HEADER_DEPENDENCIES to the empty string in config.mak
just tells the makefile to treat it as undefined and run a test
command to see if the -MMD option is supported.

So allow setting COMPUTE_HEADER_DEPENDENCIES=no to explicitly force
the feature off.  The new semantics:

 - "yes" means to explicitly enable the feature
 - "no" means to disable it
 - "auto" means to autodetect

The default is still "auto".  Any value other than these three will
cause the build to error out with a descriptive message so typos and
stale settings in config.mak don't result in mysterious behavior.

	Makefile:1278: *** please set COMPUTE_HEADER_DEPENDENCIES to
	yes, no, or auto (not "1").  Stop.

So now when someone using a compiler without -MMD support reports
trouble building git, you can reproduce it by running "make
COMPUTE_HEADER_DEPENDENCIES=no".

Suggested-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Tested-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 11:35:08 -08:00
Junio C Hamano 4c00c852b3 Sync with 1.7.7.4 2011-11-18 11:30:02 -08:00
Jonathan Nieder 487da9cdf4 Makefile: add missing header file dependencies
When the streaming filter API was introduced in v1.7.7-rc0~60^2~7
(2011-05-20), we forgot to add its header to LIB_H.  Most translation
units depend on streaming.h via cache.h.

v1.7.5-rc0~48 (Fix sparse warnings, 2011-03-22) introduced undeclared
dependencies by url.o on url.h and thread-utils.o on thread-utils.h.

Noticed by make CHECK_HEADER_DEPENDENCIES=1.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 10:45:33 -08:00
Junio C Hamano 2f47eae2a1 Split GPG interface into its own helper library
This mostly moves existing code from builtin/tag.c (for signing)
and builtin/verify-tag.c (for verifying) to a new gpg-interface.c
file to provide a more generic library interface.

 - sign_buffer() takes a payload strbuf, a signature strbuf, and a signing
   key, runs "gpg" to produce a detached signature for the payload, and
   appends it to the signature strbuf. The contents of a signed tag that
   concatenates the payload and the detached signature can be produced by
   giving the same strbuf as payload and signature strbuf.

 - verify_signed_buffer() takes a payload and a detached signature as
   <ptr, len> pairs, and runs "gpg --verify" to see if the payload matches
   the signature. It can optionally capture the output from GPG to allow
   the callers to pretty-print it in a way more suitable for their
   contexts.

"verify-tag" (aka "tag -v") used to save the whole tag contents as if it
is a detached signature, and fed gpg the payload part of the tag. It
relied on gpg to fail when the given tag is not signed but just is
annotated.  The updated run_gpg_verify() function detects the lack of
detached signature in the input, and errors out without bothering "gpg".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-04 21:40:25 -07:00
Nick Alcock e3eed7f8d2 Add strtoimax() compatibility function.
Since systems that omit strtoumax() will likely omit strtomax() too, and
likewise for strtoull() and strtoll(), we arrange for the make variables
NO_STRTOUMAX and NO_STRTOULL to cover both the signed and unsigned
functions, and define compatibility implementations for them.

Signed-off-by: Nick Alcock <nix@esperi.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-02 13:06:30 -07:00
Erik Faye-Lund 2d52ea93a7 mingw: poll.h is no longer in sys/
Earlier we moved this header file in the code but forgot to
update the Makefile that refers to it.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-01 10:02:11 -07:00
Erik Faye-Lund 0f77dea9a8 mingw: move poll out of sys-folder
Both XSI and upstream Gnulib versions expects to find poll.h at
the root of some include path, not inside the sys-folder.

This helps us when upgrading Gnulib.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-30 18:44:28 -07:00
Junio C Hamano 60f60b4962 Merge branch 'jk/argv-array' into maint
* jk/argv-array:
  run_hook: use argv_array API
  checkout: use argv_array API
  bisect: use argv_array API
  quote: provide sq_dequote_to_argv_array
  refactor argv_array into generic code
  quote.h: fix bogus comment
  add sha1_array API docs
2011-10-26 16:13:31 -07:00
Junio C Hamano 1020fbc248 Merge branch 'jc/make-tags'
* jc/make-tags:
  Makefile: ask "ls-files" to list source files if available
2011-10-21 16:04:35 -07:00
Junio C Hamano 335339758c Makefile: ask "ls-files" to list source files if available
The [ce]tags and cscope targets used to run "find" looking for any paths
that match '*.[chS]' to feed the list of source files to downstream xargs.

Use "git ls-files" if it is already available to us, and otherwise use a
tighter "find" expression that does not list directories and does not go
into our .git directory.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-18 10:03:00 -07:00
Junio C Hamano dd57c76e84 Merge branch 'jn/no-g-plus-s-on-bsd'
* jn/no-g-plus-s-on-bsd:
  Makefile: do not set setgid bit on directories on GNU/kFreeBSD
2011-10-13 19:03:21 -07:00
Junio C Hamano 16f5bfcf65 Makefile: fix permissions of mergetools/ checked out with permissive umask
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-09 12:59:47 -07:00
Jonathan Nieder 53b742522c Makefile: fix permissions of mergetools/ checked out with permissive umask
Ever since mergetool--lib was split into multiple files in
v1.7.7-rc0~3^2~1 (2011-08-18), the Makefile takes care to reset umask
and use tar --no-owner when installing merge tool definitions to
$(gitexecdir)/mergetools/.  Unfortunately it does not take into
account the possibility that the permission bits of the files being
copied might already be wrong.

Rather than fixing the "tar" incantation and making it even more
complicated, let's just use the "install" utility.  This only means
losing the ability to install executables and subdirectories of
mergetools/, which wasn't used.

Noticed by installing from a copy of git checked out with umask 002.
Compare v1.6.0.3~81^2 (Fix permission bits on sources checked out with
an overtight umask, 2008-08-21).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-09 12:57:04 -07:00
Junio C Hamano 898eacd8ad fmt-merge-msg: use branch.$name.description
This teaches "merge --log" and fmt-merge-msg to use branch description
information when merging a local topic branch into the mainline. The
description goes between the branch name label and the list of commit
titles.

The refactoring to share the common configuration parsing between
merge and fmt-merge-msg needs to be made into a separate patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-07 10:11:47 -07:00
Junio C Hamano 7a95d1be03 Merge branch 'jk/argv-array'
* jk/argv-array:
  run_hook: use argv_array API
  checkout: use argv_array API
  bisect: use argv_array API
  quote: provide sq_dequote_to_argv_array
  refactor argv_array into generic code
  quote.h: fix bogus comment
  add sha1_array API docs
2011-10-05 12:36:24 -07:00
Junio C Hamano eb0e0dd5e6 Merge branch 'rj/quietly-create-dep-dir'
* rj/quietly-create-dep-dir:
  Makefile: Make dependency directory creation less noisy
2011-10-05 12:36:21 -07:00
Junio C Hamano 6f62cd7ab1 Merge branch 'jc/receive-verify'
* jc/receive-verify:
  receive-pack: check connectivity before concluding "git push"
  check_everything_connected(): libify
  check_everything_connected(): refactor to use an iterator
  fetch: verify we have everything we need before updating our ref

Conflicts:
	builtin/fetch.c
2011-10-05 12:36:21 -07:00
Junio C Hamano cd4093b603 Merge branch 'rr/revert-cherry-pick-continue'
* rr/revert-cherry-pick-continue:
  builtin/revert.c: make commit_list_append() static
  revert: Propagate errors upwards from do_pick_commit
  revert: Introduce --continue to continue the operation
  revert: Don't implicitly stomp pending sequencer operation
  revert: Remove sequencer state when no commits are pending
  reset: Make reset remove the sequencer state
  revert: Introduce --reset to remove sequencer state
  revert: Make pick_commits functionally act on a commit list
  revert: Save command-line options for continuing operation
  revert: Save data for continuing after conflict resolution
  revert: Don't create invalid replay_opts in parse_args
  revert: Separate cmdline parsing from functional code
  revert: Introduce struct to keep command-line options
  revert: Eliminate global "commit" variable
  revert: Rename no_replay to record_origin
  revert: Don't check lone argument in get_encoding
  revert: Simplify and inline add_message_to_msg
  config: Introduce functions to write non-standard file
  advice: Introduce error_resolve_conflict
2011-10-05 12:36:19 -07:00
Junio C Hamano 821b315ebe Merge branch 'da/make-auto-header-dependencies'
* da/make-auto-header-dependencies:
  Makefile: Improve compiler header dependency check
2011-10-05 12:36:18 -07:00
Junio C Hamano 7af4d3468f Merge branch 'fk/make-auto-header-dependencies'
* fk/make-auto-header-dependencies:
  Makefile: Use computed header dependencies if the compiler supports it
2011-10-05 12:36:16 -07:00
Jonathan Nieder 0b20dd8f3d Makefile: do not set setgid bit on directories on GNU/kFreeBSD
The g+s bit on directories to make group ownership inherited is a
SysVism --- BSD and most of its descendants do not need it since they
do the sane thing by default without g+s.  In fact, on some
filesystems (but not all --- tmpfs works this way but UFS does not),
the kernel of FreeBSD does not even allow non-root users to set setgid
bit on directories and produces errors when one tries:

	$ git init --shared dir
	fatal: Could not make /tmp/dir/.git/refs writable by group

Since the setgid bit would only mean "do what you were going to do
already", it's better to avoid setting it.  Accordingly, ever since
v1.5.5-rc0~59^2 (Do not use GUID on dir in git init --share=all on
FreeBSD, 2008-03-05), git on true FreeBSD has done exactly that.  Set
DIR_HAS_BSD_GROUP_SEMANTICS in the makefile for GNU/kFreeBSD, too, so
machines that use glibc with the kernel of FreeBSD get the same fix.

This fixes t0001-init.sh and t1301-shared-repo.sh on GNU/kFreeBSD
when running tests with --root pointing to a directory that uses
tmpfs.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-03 14:53:00 -07:00
Jeff King c1189caeaf refactor argv_array into generic code
The submodule code recently grew generic code to build a
dynamic argv array. Many other parts of the code can reuse
this, too, so let's make it generically available.

There are two enhancements not found in the original code:

  1. We now handle the NULL-termination invariant properly,
     even when no strings have been pushed (before, you
     could have an empty, NULL argv). This was not a problem
     for the submodule code, which always pushed at least
     one argument, but was not sufficiently safe for
     generic code.

  2. There is a formatted variant of the "push" function.
     This is a convenience function which was not needed by
     the submodule code, but will make it easier to port
     other users to the new code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-14 11:56:36 -07:00
Ramsay Jones 435bd2ae8e Makefile: Make dependency directory creation less noisy
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-11 13:50:44 -07:00
Junio C Hamano f96400cb46 check_everything_connected(): libify
Extract the helper function and the type definition of the iterator
function it uses out of builtin/fetch.c into a separate source and a
header file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-09 15:19:02 -07:00
Junio C Hamano 8a8895baaf Merge branch 'fk/use-kwset-pickaxe-grep-f'
* fk/use-kwset-pickaxe-grep-f:
  obstack: Fix portability issues
  Use kwset in grep
  Use kwset in pickaxe
  Adapt the kwset code to Git
  Add string search routines from GNU grep
  Add obstack.[ch] from EGLIBC 2.10
2011-09-02 10:00:38 -07:00
David Aguilar 1816bf26ec Makefile: Improve compiler header dependency check
The Makefile enables CHECK_HEADER_DEPENDENCIES when the
compiler supports generating header dependencies.
Make the check use the same flags as the invocation
to avoid a false positive when user-configured compiler
flags contain incompatible options.

For example, without this patch, trying to build universal
binaries on a Mac using CFLAGS='-arch i386 -arch x86_64'
produces:

	gcc-4.2: -E, -S, -save-temps and -M options are
	not allowed with multiple -arch flags

While at it, remove "sh -c" in the command passed to $(shell);
at this point in the Makefile, SHELL has already been set to
a sensible shell and it is better not to override that.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-30 10:15:04 -07:00
Junio C Hamano 3f1c70f717 Merge branch 'da/difftool-mergtool-refactor'
* da/difftool-mergtool-refactor:
  mergetools/meld: Use '--output' when available
  mergetool--lib: Refactor tools into separate files
  mergetool--lib: Make style consistent with git
  difftool--helper: Make style consistent with git
2011-08-25 16:00:43 -07:00
Junio C Hamano e11fa9a460 Merge branch 'di/parse-options-split'
* di/parse-options-split:
  Reduce parse-options.o dependencies
  parse-options: export opterr, optbug
2011-08-25 16:00:20 -07:00
Fredrik Kuivinen b95c5ada99 Use kwset in pickaxe
Benchmarks in the hot cache case:

before:
$ perf stat --repeat=5 git log -Sqwerty

Performance counter stats for 'git log -Sqwerty' (5 runs):

       47,092,744 cache-misses             #      2.825 M/sec   ( +-   1.607% )
      123,368,389 cache-references         #      7.400 M/sec   ( +-   0.812% )
      330,040,998 branch-misses            #      3.134 %       ( +-   0.257% )
   10,530,896,750 branches                 #    631.663 M/sec   ( +-   0.121% )
   62,037,201,030 instructions             #      1.399 IPC     ( +-   0.142% )
   44,331,294,321 cycles                   #   2659.073 M/sec   ( +-   0.326% )
           96,794 page-faults              #      0.006 M/sec   ( +-  11.952% )
               25 CPU-migrations           #      0.000 M/sec   ( +-  25.266% )
            1,424 context-switches         #      0.000 M/sec   ( +-   0.540% )
     16671.708650 task-clock-msecs         #      0.997 CPUs    ( +-   0.343% )

      16.728692052  seconds time elapsed   ( +-   0.344% )

after:
$ perf stat --repeat=5 git log -Sqwerty

Performance counter stats for 'git log -Sqwerty' (5 runs):

       51,385,522 cache-misses             #      4.619 M/sec   ( +-   0.565% )
      129,177,880 cache-references         #     11.611 M/sec   ( +-   0.219% )
      319,222,775 branch-misses            #      6.946 %       ( +-   0.134% )
    4,595,913,233 branches                 #    413.086 M/sec   ( +-   0.112% )
   31,395,042,533 instructions             #      1.062 IPC     ( +-   0.129% )
   29,558,348,598 cycles                   #   2656.740 M/sec   ( +-   0.204% )
           93,224 page-faults              #      0.008 M/sec   ( +-   4.487% )
               19 CPU-migrations           #      0.000 M/sec   ( +-  10.425% )
              950 context-switches         #      0.000 M/sec   ( +-   0.360% )
     11125.796039 task-clock-msecs         #      0.997 CPUs    ( +-   0.239% )

      11.164216599  seconds time elapsed   ( +-   0.240% )

So the kwset code is about 33% faster.

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-20 22:33:57 -07:00
Fredrik Kuivinen e831171d67 Add obstack.[ch] from EGLIBC 2.10
Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-20 22:30:46 -07:00
David Aguilar bc7a96a896 mergetool--lib: Refactor tools into separate files
Individual merge tools are now defined in a mergetools/$tool
file which is sourced at runtime.

The individual files are installed into $(git --exec-path)/mergetools/.
New tools can be added by creating a new file instead of editing the
git-mergetool--lib.sh scriptlet.

http://thread.gmane.org/gmane.comp.version-control.git/134906/focus=135006

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-19 00:09:19 -07:00
Fredrik Kuivinen 111ee18c31 Makefile: Use computed header dependencies if the compiler supports it
Previously you had to manually define COMPUTE_HEADER_DEPENDENCIES to
enable this feature. It seemed a bit sad that such a useful feature
had to be enabled manually.

To avoid the small overhead we don't do the auto-detection if
COMPUTE_HEADER_DEPENDENCIES is already set.

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-18 13:54:58 -07:00
Junio C Hamano ca01600306 Merge branch 'rc/histogram-diff'
* rc/histogram-diff:
  xdiff/xhistogram: drop need for additional variable
  xdiff/xhistogram: rely on xdl_trim_ends()
  xdiff/xhistogram: rework handling of recursed results
  xdiff: do away with xdl_mmfile_next()
  Make test number unique
  xdiff/xprepare: use a smaller sample size for histogram diff
  xdiff/xprepare: skip classification
  teach --histogram to diff
  t4033-diff-patience: factor out tests
  xdiff/xpatience: factor out fall-back-diff function
  xdiff/xprepare: refactor abort cleanups
  xdiff/xprepare: use memset()
2011-08-17 17:36:06 -07:00
Dmitry Ivankov 0687628466 Reduce parse-options.o dependencies
Currently parse-options.o pulls quite a big bunch of dependencies.
his complicates it's usage in contrib/ because it pulls external
dependencies and it also increases executables size.

Split off less generic and more internal to git part of
parse-options.c to parse-options-cb.c.

Move prefix_filename function from setup.c to abspath.c. abspath.o
and wrapper.o pull each other, so it's unlikely to increase the
dependencies. It was a dependency of parse-options.o that pulled
many others.

Now parse-options.o pulls just abspath.o, ctype.o, strbuf.o, usage.o,
wrapper.o, libc directly and strlcpy.o indirectly.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11 12:18:02 -07:00
Junio C Hamano 0e9b12f874 Merge branch 'rc/maint-http-wrong-free'
* rc/maint-http-wrong-free:
  Makefile: some changes for http-related flag documentation
  http.c: fix an invalid free()

Conflicts:
	Makefile
2011-08-11 11:03:13 -07:00
Ramkumar Ramachandra 26ae337be1 revert: Introduce --reset to remove sequencer state
To explicitly remove the sequencer state for a fresh cherry-pick or
revert invocation, introduce a new subcommand called "--reset" to
remove the sequencer state.

Take the opportunity to publicly expose the sequencer paths, and a
generic function called "remove_sequencer_state" that various git
programs can use to remove the sequencer state in a uniform manner;
"git reset" uses it later in this series.  Introducing this public API
is also in line with our long-term goal of eventually factoring out
functions from revert.c into a generic commit sequencer.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 15:41:21 -07:00
Tay Ray Chuan d24d905509 Makefile: some changes for http-related flag documentation
Rename git-http-pull to git-http-fetch. This was passed over in 215a7ad
(Big tool rename, Wed Sep 7 17:26:23 2005 -0700).

Also, distinguish between dumb and smart in flag docs, as the "warnings"
in NO_CURL and NO_EXPACT are no longer accurate given the introduction
of smart http(s).

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 11:24:28 -07:00
Thomas Cort bc5f813af6 Makefile: add Minix configuration options.
Add a $(uname_S) case for Minix with the correct options.

Minix's linker needs all libraries specified explicitly.
Add NEEDS_SSL_WITH_CURL to add -lssl when using -lcurl.
Add NEEDS_IDN_WITH_CURL to add -lidn when using -lcurl.

When NEEDS_SSL_WITH_CURL is defined and NEEDS_CRYPTO_WITH_SSL
is defined, add -lcrypt to CURL_LIBCURL.

Change OPENSSL_LINK to OPENSSL_LIBSSL in the
NEEDS_CRYPTO_WITH_SSL conditional in the libopenssl
section. Libraries go in OPENSSL_LIBSSL, OPENSSL_LINK
is for linker flags.

Signed-off-by: Thomas Cort <tcort@minix3.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-20 11:07:17 -07:00
Junio C Hamano d37b2991b1 Merge branch 'ak/gcc46-profile-feedback'
* ak/gcc46-profile-feedback:
  Add explanation of the profile feedback build to the README
  Add profile feedback build to git
  Add option to disable NORETURN
2011-07-19 09:32:52 -07:00
Junio C Hamano b57e58fc82 Merge branch 'fk/relink-upon-ldflags-update'
* fk/relink-upon-ldflags-update:
  Makefile: Track changes to LDFLAGS and relink when necessary
2011-07-13 14:31:37 -07:00
Junio C Hamano bc50897b90 Merge branch 'md/interix-update'
* md/interix-update:
  Update the Interix default build configuration.
2011-07-13 14:31:36 -07:00
Tay Ray Chuan 8c912eea94 teach --histogram to diff
Port JGit's HistogramDiff algorithm over to C. Rough numbers (TODO) show
that it is faster than its --patience cousin, as well as the default
Meyers algorithm.

The implementation has been reworked to use structs and pointers,
instead of bitmasks, thus doing away with JGit's 2^28 line limit.

We also use xdiff's default hash table implementation (xdl_hash_bits()
with XDL_HASHLONG()) for convenience.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-12 09:29:20 -07:00
Junio C Hamano 55ac692661 Merge branch 'jc/streaming' into next
* jc/streaming:
  sha1_file: use the correct type (ssize_t, not size_t) for read-style function
  streaming: read loose objects incrementally
  sha1_file.c: expose helpers to read loose objects
  streaming: read non-delta incrementally from a pack
  streaming_write_entry(): support files with holes
  convert: CRLF_INPUT is a no-op in the output codepath
  streaming_write_entry(): use streaming API in write_entry()
  streaming: a new API to read from the object store
  write_entry(): separate two helper functions out
  unpack_object_header(): make it public
  sha1_object_info_extended(): hint about objects in delta-base cache
  sha1_object_info_extended(): expose a bit more info
  packed_object_info_detail(): do not return a string
2011-06-29 17:09:27 -07:00
Fredrik Kuivinen d9a25fca5f Makefile: Track changes to LDFLAGS and relink when necessary
Some profiling tools (e.g., google-perftools and mutrace) work by
linking in a new library into the executables. When using these tools
it is convenient to only relink instead of doing a full make clean;
make cycle.

This change complements the auto-detection of changes to CFLAGS that
we already have. Tracking of more variables that affect the build can
be added when the need arise.

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-22 11:56:53 -07:00
Andi Kleen 7ddc2710b9 Add profile feedback build to git
Add a gcc profile feedback build option "profile-all" to the main
Makefile. It simply runs the test suite to generate feedback data and the
recompiles the main executables with that. The basic structure is similar
to the existing gcov code.

gcc is often able to generate better code with profile feedback data. The
training load also doesn't need to be too similar to the actual load, it
still gives benefits.

The test suite run is unfortunately quite long. It would be good to find a
suitable subset that runs faster and still gives reasonable feedback.

For now the test suite runs single threaded (I had some trouble running
the test suite with -jX)

I tested it with git gc and git blame kernel/sched.c on a Linux kernel
tree. For gc I get about 2.7% improvement in wall clock time by using the
feedback build, for blame about 2.4%.  That's not gigantic, but not shabby
either for a very small patch.

If anyone has any favourite CPU intensive git benchmarks feel free to try
them too.

I hope distributors will switch to use a feedback build in their packages.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-20 14:17:57 -07:00
Junio C Hamano 6520c84685 Add option to disable NORETURN
Due to a bug in gcc 4.6+ it can crash when doing profile feedback
with a noreturn function pointer

(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)

This adds a Makefile variable to disable noreturns.

[Patch by Junio, description by Andi Kleen]

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-20 12:32:39 -07:00
Markus Duft 715876e58d Update the Interix default build configuration.
Currently, on Interix, libsuacomp is required for building (see [1]).

Since suacomp provides poll() and inttypes.h for all interix versions,
remove NO_*=YesPlease that are no longer necessary.

Interix versions 3 and 5 miss struct sockaddr_storage, so make git
avoid using it.

Same for FNMATCH_CASEFOLD, which does not exist for Interix 3 and 5.

[1] http://news.gmane.org/find-root.php?message_id=%3c4DDF4440.4040405%40gentoo.org%3e

Signed-off-by: Markus Duft <mduft@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-15 10:02:09 -07:00
Jonathan Nieder a8d3d26545 Merge branch 'db/delta-applier' into svn-fe
* db/delta-applier:
  vcs-svn: cap number of bytes read from sliding view
  test-svn-fe: split off "test-svn-fe -d" into a separate function
  vcs-svn: let deltas use data from preimage
  vcs-svn: let deltas use data from postimage
  vcs-svn: verify that deltas consume all inline data
  vcs-svn: implement copyfrom_data delta instruction
  vcs-svn: read instructions from deltas
  vcs-svn: read inline data from deltas
  vcs-svn: read the preimage when applying deltas
  vcs-svn: parse svndiff0 window header
  vcs-svn: skeleton of an svn delta parser
  vcs-svn: make buffer_read_binary API more convenient
  vcs-svn: learn to maintain a sliding view of a file
  Makefile: list one vcs-svn/xdiff object or header per line

Conflicts:
	Makefile
	vcs-svn/LICENSE
2011-06-15 02:17:51 -05:00
Junio C Hamano be653d6cb8 Merge branch 'mk/grep-pcre'
* mk/grep-pcre:
  git-grep: Fix problems with recently added tests
  git-grep: Update tests (mainly for -P)
  Makefile: Pass USE_LIBPCRE down in GIT-BUILD-OPTIONS
  git-grep: update tests now regexp type is "last one wins"
  git-grep: do not die upon -F/-P when grep.extendedRegexp is set.
  git-grep: Bail out when -P is used with -F or -E
  grep: Add basic tests
  configure: Check for libpcre
  git-grep: Learn PCRE
  grep: Extract compile_regexp_failed() from compile_regexp()
  grep: Fix a typo in a comment
  grep: Put calls to fixmatch() and regmatch() into patmatch()
  contrib/completion: --line-number to git grep
  Documentation: Add --line-number to git-grep synopsis
2011-05-30 00:00:07 -07:00
Junio C Hamano 01f9ffbd5d Merge branch 'jk/haves-from-alternate-odb'
* jk/haves-from-alternate-odb:
  receive-pack: eliminate duplicate .have refs
  bisect: refactor sha1_array into a generic sha1 list
  refactor refs_from_alternate_cb to allow passing extra data
2011-05-29 23:51:22 -07:00
Junio C Hamano 8784e4ddde Merge branch 'rg/no-gecos-in-pwent'
* rg/no-gecos-in-pwent:
  ident: add NO_GECOS_IN_PWENT for systems without pw_gecos in struct passwd

Conflicts:
	Makefile
2011-05-26 10:32:19 -07:00
Junio C Hamano 05318994e7 Merge branch 'kk/maint-prefix-in-config-mak' into maint
* kk/maint-prefix-in-config-mak:
  Honor $(prefix) set in config.mak* when defining ETC_GIT*
  Revert "Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir"
  Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir
2011-05-26 09:42:12 -07:00
Jonathan Nieder c19d653c4f Merge branch 'db/svn-fe-code-purge' into svn-fe
* db/svn-fe-code-purge:
  vcs-svn: drop obj_pool
  vcs-svn: drop treap
  vcs-svn: drop string_pool
  vcs-svn: pass paths through to fast-import

Conflicts:
	vcs-svn/fast_export.c
	vcs-svn/fast_export.h
	vcs-svn/repo_tree.c
	vcs-svn/repo_tree.h
	vcs-svn/string_pool.c
	vcs-svn/svndump.c
	vcs-svn/trp.txt
2011-05-26 02:12:14 -05:00
Junio C Hamano 91810abc2f Merge branch 'ab/i18n-scripts-basic'
* ab/i18n-scripts-basic:
  Makefile: add xgettext target for *.sh files
  git-sh-i18n.sh: add GIT_GETTEXT_POISON support
  git-sh-i18n.sh: add no-op gettext() and eval_gettext() wrappers
  git-sh-i18n--envsubst: our own envsubst(1) for eval_gettext()
2011-05-23 09:58:45 -07:00
Junio C Hamano 46bf043807 streaming: a new API to read from the object store
Given an object name, use open_istream() to get a git_istream handle
that you can read_istream() from as if you are using read(2) to read
the contents of the object, and close it with close_istream() when
you are done.

Currently, we do not do anything fancy--it just calls read_sha1_file()
and keeps the contents in memory as a whole, and carve it out as you
request with read_istream().

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-20 18:46:55 -07:00
Jeff King 902bb36451 bisect: refactor sha1_array into a generic sha1 list
This is a generally useful abstraction, so let's let others
make use of it.  The refactoring is more or less a straight
copy; however, functions and struct members have had their
names changed to match string_list, which is the most
similar data structure.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-19 20:02:10 -07:00
Jeff King d192508cd6 Makefile: sort TEST_PROGRAMS list
We usually keep these lists in sorted order, but the last
few entries were just tacked on the end.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-19 19:44:59 -07:00
Rafael Gieschke 590e081dea ident: add NO_GECOS_IN_PWENT for systems without pw_gecos in struct passwd
Allow NO_GECOS_IN_PWENT to be defined in the Makefile for platforms that
lack the pw_gecos field in their "struct passwd", in which case the
uppercased user name is used instead via the standard '&' replacement
mechanism.

Signed-off-by: Rafael Gieschke <rafael@gieschke.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-19 18:35:58 -07:00
Junio C Hamano 8cee0f1d8a Merge branch 'kk/maint-prefix-in-config-mak'
* kk/maint-prefix-in-config-mak:
  Honor $(prefix) set in config.mak* when defining ETC_GIT*
  Revert "Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir"
  Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir
2011-05-16 16:46:53 -07:00
Junio C Hamano a80dff2515 Makefile: Pass USE_LIBPCRE down in GIT-BUILD-OPTIONS
Otherwise we would fail to rebuild correctly when this option was
changed between $(MAKE) invocations, and more importantly, $(MAKE) test
would not pass it down and t/test-lib.sh would not set the LIBPCRE
prerequisite.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-16 00:11:53 -07:00
Ævar Arnfjörð Bjarmason adc3b2b276 Makefile: add xgettext target for *.sh files
Change the "pot" target to also extract strings from our $(SCRIPT_SH)
files with xgettext(1).

Note that due to Jonathan Nieder's trick of doing "mv $@+ $@" at the
end of the target the "pot" target will now warn:

    $ make pot
        XGETTEXT po/git.pot
    po/git.pot+: warning: Charset "CHARSET" is not a portable encoding name.
                          Message conversion to user's charset might not work.

This warnings is emitted because xgettext is writing into a non-*.pot
file, it's harmless however. The content that's written out is
equivalent to what it would be if we were writing directly into an
existing POT file with --join-existing.

As part of this change I've eliminated the && chain between xgettext
calls, this is incompatible with $(QUIET_XGETTEXT), if the && is left
in it'll emit:

    /bin/sh: @echo: not found

Since it's redundant (the Makefile will stop if there's an error) I've
removed it altogether.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-14 20:29:11 -07:00
Ævar Arnfjörð Bjarmason e00cf070a4 git-sh-i18n.sh: add no-op gettext() and eval_gettext() wrappers
Add a no-op wrapper library for Git's shell scripts. To split up the
gettext series I'm first submitting patches to gettextize the source
tree before I add any of the Makefile and Shell library changes needed
to actually use them.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-14 20:29:11 -07:00
Ævar Arnfjörð Bjarmason ba67aaf2d0 git-sh-i18n--envsubst: our own envsubst(1) for eval_gettext()
Add a git-sh-i18n--envsubst program which is a stripped-down version
of the GNU envsubst(1) program that comes with GNU gettext for use in
the eval_gettext() fallback.

We need a C helper program because implementing eval_gettext() purely
in shell turned out to be unworkable. Digging through the Git mailing
list archives will reveal two shell implementations of eval_gettext
that are almost good enough, but fail on an edge case which is tested
for in the tests which are part of this patch.

These are the modifications I made to envsubst.c as I turned it into
sh-i18n--envsubst.c:

 * Added our git-compat-util.h header for xrealloc() and friends.

 * Removed inclusion of gettext-specific headers.

 * Removed most of main() and replaced it with my own. The modified
   version only does option parsing for --variables. That's all it
   needs.

 * Modified error() invocations to use our error() instead of
   error(3).

 * Replaced the gettext XNMALLOC(n, size) macro with just
   xmalloc(n). Since XNMALLOC() only allocated char's.

 * Removed the string_list_destroy function. It's redundant (also in
   the upstream code).

 * Replaced the use of stdbool.h (a C99 header) by doing the following
   replacements on the code:

    * s/bool/unsigned short int/g
    * s/true/1/g
    * s/false/0/g

Reported-by: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-14 20:29:05 -07:00
Junio C Hamano a5794988dd Merge branch 'jn/gitweb-dependency'
* jn/gitweb-dependency:
  Remove gitweb/gitweb.cgi and other legacy targets from main Makefile
  git-instaweb: Simplify build dependency on gitweb
2011-05-11 11:38:39 -07:00
Michał Kiedrowicz 63e7e9d8b6 git-grep: Learn PCRE
This patch teaches git-grep the --perl-regexp/-P options (naming
borrowed from GNU grep) in order to allow specifying PCRE regexes on the
command line.

PCRE has a number of features which make them more handy to use than
POSIX regexes, like consistent escaping rules, extended character
classes, ungreedy matching etc.

git isn't build with PCRE support automatically. USE_LIBPCRE environment
variable must be enabled (like `make USE_LIBPCRE=YesPlease`).

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 16:29:33 -07:00
Johannes Sixt 9fb1e69842 Honor $(prefix) set in config.mak* when defining ETC_GIT*
Notice that the prefix specified for the build influenced the definitions
of ETC_GITCONFIG and ETC_GITATTRIBUTES only when it was exactly '/usr'.
Kacper Kornet noticed that this was furthermore only the case when the
build was triggered using 'make prefix=/usr', i.e., the prefix was given
on the command line; it did not work when the prefix was specified in
config.mak because this file is included much later in the Makefile.

To fix this, move the conditional after the inclusion of config.mak.

Additionally, it is desirable to specify the etc directory for a build
(for example, a build with prefix /usr/local may still want to have the
system configuration in /etc/gitconfig). For this purpose, promote the
variable 'sysconfdir' from a helper variable to a configuration
variable. The prefix check that was moved must now be wrapped so that it
does not override sysconfdir setting given in config.mak.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 15:13:03 -07:00
Junio C Hamano 410ee20bde Revert "Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir"
This reverts commit 2910bf56a4, as it
does not really solve the issue of making $(sysconfigdir) any more
useful than it currently is.
2011-05-09 15:12:13 -07:00
Jakub Narebski f09f1d35b5 Remove gitweb/gitweb.cgi and other legacy targets from main Makefile
Now that there is gitweb/Makefile, let's leave only "gitweb" and
"install-gitweb" targets in main Makefile.  Those targets just
delegate to gitweb's Makefile.

Requested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-08 11:52:57 -07:00
Jakub Narebski ff2e2cd584 git-instaweb: Simplify build dependency on gitweb
Since c0cb4ed (git-instaweb: Configure it to work with new gitweb
structure, 2010-05-28) git-instaweb does not re-create gitweb.cgi
etc., but makes use of installed gitweb.  Therefore simplify
git-instaweb dependency on gitweb subsystem in main Makefile from
'gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/static/gitweb.js'
to simply 'gitweb'.

This is preparation for splitting gitweb.perl script, and for
splitting gitweb.js (to be reassembled / combined on build).  This way
we don't have to duplicate parts of gitweb/Makefile in main
Makefile... it is also more correct description of git-instaweb
dependency.

Reported-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-08 11:52:05 -07:00
Junio C Hamano 606ee4be54 Merge branch 'js/info-man-path'
* js/info-man-path:
  Documentation: clarify meaning of --html-path, --man-path, and --info-path
  git: add --info-path and --man-path options

Conflicts:
	Makefile
2011-05-06 11:00:46 -07:00
Jon Seymour f2dd8c3799 git: add --info-path and --man-path options
Similar to the way the --html-path option lets UI programs learn where git
has its HTML documentation pages, expose the other two paths used to store
the documentation pages of these two types.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-01 21:50:04 -07:00
Junio C Hamano 78c6e0f3fa Merge branch 'mz/rebase'
* mz/rebase: (34 commits)
  rebase: define options in OPTIONS_SPEC
  Makefile: do not install sourced rebase scripts
  rebase: use @{upstream} if no upstream specified
  rebase -i: remove unnecessary state rebase-root
  rebase -i: don't read unused variable preserve_merges
  git-rebase--am: remove unnecessary --3way option
  rebase -m: don't print exit code 2 when merge fails
  rebase -m: remember allow_rerere_autoupdate option
  rebase: remember strategy and strategy options
  rebase: remember verbose option
  rebase: extract code for writing basic state
  rebase: factor out sub command handling
  rebase: make -v a tiny bit more verbose
  rebase -i: align variable names
  rebase: show consistent conflict resolution hint
  rebase: extract am code to new source file
  rebase: extract merge code to new source file
  rebase: remove $branch as synonym for $orig_head
  rebase -i: support --stat
  rebase: factor out call to pre-rebase hook
  ...
2011-04-28 14:11:39 -07:00
Kacper Kornet 2910bf56a4 Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir
Definitions of ETC_GITCONFIG, ETC_GITATTRIBUTES and sysconfdir depend on
value of prefix. As prefix can be changed in config.mak.autogen, all if
blocks with conditions based on prefix should be placed after the file
is included in Makefile.

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-28 13:54:12 -07:00
Ramsay Jones 0bcd9ae85d sparse: Fix errors due to missing target-specific variables
In particular, sparse issues the following errors:

    attr.c:472:43: error: undefined identifier 'ETC_GITATTRIBUTES'
    config.c:821:43: error: undefined identifier 'ETC_GITCONFIG'
    exec_cmd.c:14:37: error: undefined identifier 'PREFIX'
    exec_cmd.c:83:28: error: undefined identifier 'GIT_EXEC_PATH'
    builtin/help.c:328:46: error: undefined identifier 'GIT_MAN_PATH'
    builtin/help.c:374:40: error: undefined identifier 'GIT_INFO_PATH'
    builtin/help.c:382:45: error: undefined identifier 'GIT_HTML_PATH'
    git.c:96:42: error: undefined identifier 'GIT_HTML_PATH'
    git.c:241:35: error: invalid initializer
    http.c:293:43: error: undefined identifier 'GIT_HTTP_USER_AGENT'

which is caused by not passing the target-specific additions to
the EXTRA_CPPFLAGS variable to cgcc.

In order to fix the problem, we define a new sparse target which
depends on a set of non-existent "sparse object" files (*.sp)
which correspond to the set of C source files. In addition to the
new target, we also provide a new pattern rule for "creating" the
sparse object files from the source files by running cgcc.  This
allows us to add '*.sp' to the rules setting the target-specific
EXTRA_CPPFLAGS variable, which is then included in the new pattern
rule to run cgcc.

Also, we change the 'check' target to re-direct the user to the
new sparse target.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-22 10:03:47 -07:00
Ramsay Jones 1e0f8c41ac sparse: Fix an "symbol 'merge_file' not decared" warning
In order to fix the warning, we add a new "merge-file.h" header
containing the extern declaration of the merge_file() function,
and include the header in the source files that require the
declaration.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-11 10:35:25 -07:00
Ramsay Jones f228d1f006 Makefile: Use cgcc rather than sparse in the check target
cgcc is the recommended way to run sparse, since it provides
many -Defines suitable for the given gcc platform. Using an
"cgcc -no-compile" command runs sparse, with all the platform
specific definitions provided by cgcc, without also invoking
gcc.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-11 10:35:25 -07:00
Ævar Arnfjörð Bjarmason ff46a49afa Makefile: extract Q_() source strings as ngettext()
The Q_() wrapper added by 0c9ea33 (i18n: add stub Q_() wrapper for
ngettext, 2011-03-09) needs to be noticed by xgettext.

Add an appropriate --keyword option to the Makefile, so that "make pot"
would notice the strings in the plural form marked with the wrapper.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-11 10:34:50 -07:00
Junio C Hamano 82d861f9d6 Merge branch 'sb/sparse-more'
* sb/sparse-more:
  Makefile: Cover more files with make check
2011-04-01 17:50:20 -07:00
Jonathan Nieder ddcc8c5b46 vcs-svn: skeleton of an svn delta parser
A delta in the subversion delta (svndiff0) format consists of the
magic bytes SVN\0 followed by a sequence of windows of a certain well
specified format (starting with five integers).

Add an svndiff0_apply function and test-svn-fe -d commandline tool to
parse such a delta in the special case of not including any windows.

Later patches will add features to turn this into a fully functional
delta applier for svn-fe to use to parse the streams produced by
"svnrdump dump" and "svnadmin dump --deltas".

The content of symlinks starts with the word "link " in Subversion's
worldview, so we need to be able to prepend that text to input for the
sake of delta application.  So initialization of the input state of
the delta preimage is left to the calling program, giving callers a
chance to seed the buffer with text of their choice.

Improved-by: Ramkumar Ramachandra <artagnon@gmail.com>
Improved-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-03-27 22:41:38 -05:00
Jonathan Nieder 9d2f5ddfe5 vcs-svn: learn to maintain a sliding view of a file
Each section of a Subversion-format delta only requires examining (and
keeping in random-access memory) a small portion of the preimage.  At
any moment, this portion starts at a certain file offset and has a
well-defined length, and as the delta is applied, the portion advances
from the beginning to the end of the preimage.  Add a move_window
function to keep track of this view into the preimage.

You can use it like this:

	buffer_init(f, NULL);
	struct sliding_view window = SLIDING_VIEW_INIT(f);
	move_window(&window, 3, 7);	/* (1) */
	move_window(&window, 5, 5);	/* (2) */
	move_window(&window, 12, 2);	/* (3) */
	strbuf_release(&window.buf);
	buffer_deinit(f);

The data structure is called sliding_view instead of _window to
prevent confusion with svndiff0 Windows.

In this example, (1) reads 10 bytes and discards the first 3;
(2) discards the first 2, which are not needed any more; and (3) skips
2 bytes and reads 2 new bytes to work with.

When move_window returns, the file position indicator is at position
window->off + window->width and the data from positions window->off to
the current file position are stored in window->buf.

This function performs only sequential access from the input file and
never seeks, so it can be safely used on pipes and sockets.

On end-of-file, move_window silently reads less than the caller
requested.  On other errors, it prints a message and returns -1.

Helped-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-03-27 20:23:32 -05:00
Jonathan Nieder 3371f9b3fb Makefile: list one vcs-svn/xdiff object or header per line
As the svn import infrastructure evolves, it's getting to be a pain to
tell by eye what files were added or removed from a dependency line
like

	VCSSVN_OBJS = vcs-svn/string_pool.o vcs-svn/line_buffer.o \
		vcs-svn/repo_tree.o vcs-svn/fast_export.o vcs-svn/svndump.o

So use a style with one entry per line instead, like the existing
BUILTIN_OBJS:

	# protect against environment
	VCSSVN_OBJS =
	...
	VCSSVN_OBJS += vcs-svn/string_pool.o
	VCSSVN_OBJS += vcs-svn/line_buffer.o
	...

which is readable on its own and produces nice, clear diffs.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-03-27 15:46:34 -05:00
Junio C Hamano 3ed8868474 Merge branch 'jn/maint-c99-format'
* jn/maint-c99-format:
  unbreak and eliminate NO_C99_FORMAT
  mktag: avoid %td in format string
2011-03-23 14:55:46 -07:00
David Barr cba3546a43 vcs-svn: drop obj_pool
This reverts commit 4709455db3 (Add
memory pool library, 2010-08-09).  svn-fe uses strbufs to avoid memory
allocation overhead nowadays.

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-03-22 18:39:53 -05:00
David Barr 5db348dbd5 vcs-svn: drop treap
This reverts commit 951f316470
(Add treap implementation, 2010-08-09).  The string_pool was
trp.h's last user.

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-03-22 18:34:44 -05:00
David Barr 28c5d9ed2a vcs-svn: drop string_pool
This reverts commit 1d73b52f5b
(Add string-specific memory pool, 2010-08-09).  Now that svn-fe
does not need to maintain a growing collection of strings (paths)
over a long period of time, the string_pool is not needed.

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-03-22 18:32:58 -05:00
Stephen Boyd 52d269da7e Makefile: Cover more files with make check
After the builtin/ move 'make check' doesn't cover the builtin/
directory. We could just add builtin/*.c but lets just use GIT_OBJS
instead so we cover future movement of the source files.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-21 10:23:02 -07:00
Junio C Hamano dd7d0d0976 Merge branch 'mr/hpux' into maint
* mr/hpux:
  git-compat-util.h: Honor HP C's noreturn attribute
  Makefile: add NO_FNMATCH_CASEFOLD to HP-UX section
2011-03-20 22:11:15 -07:00
Junio C Hamano a8e04ddf6e Merge branch 'ae/better-template-failure-report' into maint
* ae/better-template-failure-report:
  Improve error messages when temporary file creation fails
2011-03-20 22:09:39 -07:00
Junio C Hamano 1e239079f7 Merge branch 'ab/i18n-basic'
* ab/i18n-basic:
  i18n: "make distclean" should clean up after "make pot"
  i18n: Makefile: "pot" target to extract messages marked for translation
  i18n: add stub Q_() wrapper for ngettext
  i18n: do not poison translations unless GIT_GETTEXT_POISON envvar is set
  i18n: add GETTEXT_POISON to simulate unfriendly translator
  i18n: add no-op _() and N_() wrappers
  commit, status: use status_printf{,_ln,_more} helpers
  commit: refer to commit template as s->fp
  wt-status: add helpers for printing wt-status lines

Conflicts:
	builtin/commit.c
2011-03-19 23:24:42 -07:00
Jonathan Nieder 28bd70d811 unbreak and eliminate NO_C99_FORMAT
In the spirit of v1.5.0.2~21 (Check for PRIuMAX rather than
NO_C99_FORMAT in fast-import.c, 2007-02-20), use PRIuMAX from
git-compat-util.h on all platforms instead of C99-specific formats
like %zu with dangerous fallbacks to %u or %lu.

So now C99-challenged platforms can build git without provoking
warnings or errors from printf, even if pointers do not have the same
size as an int or long.

The need for a fallback PRIuMAX is detected in git-compat-util.h with
"#ifndef PRIuMAX".  So while at it, simplify the Makefile and configure
script by eliminating the NO_C99_FORMAT knob altogether.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-17 15:30:49 -07:00
Junio C Hamano 848e219fe6 Merge branch 'mr/hpux'
* mr/hpux:
  git-compat-util.h: Honor HP C's noreturn attribute
  Makefile: add NO_FNMATCH_CASEFOLD to HP-UX section
2011-03-15 14:21:47 -07:00
Jonathan Nieder 92a684b916 i18n: "make distclean" should clean up after "make pot"
This is in "make distclean" and not "make clean" to avoid needlessly
changing the POT-Creation-Date in the following scenario:

	make clean;	# cleaning up after an old build
	git pull
	make pot;	# regenerate po template if necessary
	msgmerge po/my_language.po po/git.pot

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-09 23:52:52 -08:00
Ævar Arnfjörð Bjarmason cd5513a716 i18n: Makefile: "pot" target to extract messages marked for translation
Add rules to generate a template (po/git.pot) listing messages marked
for translation in the C portion of git.

To get started translating, just run "make pot".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-09 23:52:52 -08:00
Jonathan Nieder 309552295a i18n: do not poison translations unless GIT_GETTEXT_POISON envvar is set
Tweak the GETTEXT_POISON facility so it is activated at run time
instead of compile time.  If the GIT_GETTEXT_POISON environment
variable is set, _(msg) will result in gibberish as before; but if the
GIT_GETTEXT_POISON variable is not set, it will return the message for
human-readable output.  So the behavior of mistranslated and
untranslated git can be compared without rebuilding git in between.

For simplicity we always set the GIT_GETTEXT_POISON variable in tests.

This does not affect builds without the GETTEXT_POISON compile-time
option set, so non-i18n git will not be slowed down.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-08 12:10:03 -08:00
Ævar Arnfjörð Bjarmason bb946bba76 i18n: add GETTEXT_POISON to simulate unfriendly translator
Add a new GETTEXT_POISON compile-time parameter to make _(msg) always
return gibberish. So now you can run

	make GETTEXT_POISON=YesPlease

to get a copy of git that functions correctly (one hopes) but produces
output that is in nobody's native language at all.

This is a debugging aid for people who are working on the i18n part of
the system, to make sure that they are not marking plumbing messages
that should never be translated with _().

As new strings get marked for translation, naturally a number of tests
will be broken in this mode. Tests that depend on output from
Porcelain will need to be marked with the new C_LOCALE_OUTPUT test
prerequisite. Newly failing tests that do not depend on output from
Porcelain would be bugs due to messages that should not have been
marked for translation.

Note that the string we're using ("# GETTEXT POISON #") intentionally
starts the pound sign. Some of Git's tests such as
t3404-rebase-interactive.sh rely on interactive editing with a fake
editor, and will needlessly break if the message doesn't start with
something the interactive editor considers a comment.

A future patch will fix fix the underlying cause of that issue by
adding "#" characters to the commit advice automatically.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-08 12:10:03 -08:00
Ævar Arnfjörð Bjarmason 6578483036 i18n: add no-op _() and N_() wrappers
The _ function is for translating strings into the user's chosen
language.  The N_ macro just marks translatable strings for the
xgettext(1) tool without translating them; it is intended for use in
contexts where a function call cannot be used.  So, for example:

	fprintf(stderr, _("Expansion of alias '%s' failed; "
		"'%s' is not a git command\n"),
		cmd, argv[0]);

and

	const char *unpack_plumbing_errors[NB_UNPACK_TREES_ERROR_TYPES] = {
		/* ERROR_WOULD_OVERWRITE */
		N_("Entry '%s' would be overwritten by merge. Cannot merge."),
	[...]

Define such _ and N_ in a new gettext.h and include it in cache.h, so
they can be used everywhere.  Each just returns its argument for now.
_ is a function rather than a macro like N_ to avoid the temptation to
use _("foo") as a string literal (which would be a compile-time error
once _(s) expands to an expression for the translation of s).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-08 12:10:03 -08:00
Michal Rokos 987893d82d Makefile: add NO_FNMATCH_CASEFOLD to HP-UX section
fnmatch() on HP-UX does not support the GNU FNM_CASEFOLD extension,
so set NO_FNMATCH_CASEFOLD to use the internal fnmatch implementation.

Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-08 10:57:35 -08:00
Martin von Zweigbergk fdb76c104a Makefile: do not install sourced rebase scripts
When git-rebase.sh recently started sourcing
git-rebase--interactive.sh instead of executing it, executable bit of
the latter file should have been turned off and it should have been
moved from SCRIPT_SH to SCRIPT_LIB in the Makefile. Its two new
siblings, git-rebase--am.sh and git-rebase--merge.sh (whose executable
bits are already off) should also be moved to SCRIPT_LIB in the
Makefile.

Reported-by: Johannes Sixt <j6t@kdbg.org>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-25 12:19:41 -08:00
Martin von Zweigbergk 46df82d5fa rebase: extract am code to new source file
Extract the code for am-based rebase to git-rebase--am.sh.

Suggested-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-10 14:08:09 -08:00
Martin von Zweigbergk fa99c1e1e1 rebase: extract merge code to new source file
Extract the code for merge-based rebase to git-rebase--merge.sh.

Suggested-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-10 14:08:09 -08:00
Junio C Hamano 70ec8687a6 Merge branch 'ae/better-template-failure-report'
* ae/better-template-failure-report:
  Improve error messages when temporary file creation fails
2011-02-09 16:41:16 -08:00
Junio C Hamano f3bb8b4b84 Merge branch 'nd/setup'
* nd/setup: (47 commits)
  setup_work_tree: adjust relative $GIT_WORK_TREE after moving cwd
  git.txt: correct where --work-tree path is relative to
  Revert "Documentation: always respect core.worktree if set"
  t0001: test git init when run via an alias
  Remove all logic from get_git_work_tree()
  setup: rework setup_explicit_git_dir()
  setup: clean up setup_discovered_git_dir()
  t1020-subdirectory: test alias expansion in a subdirectory
  setup: clean up setup_bare_git_dir()
  setup: limit get_git_work_tree()'s to explicit setup case only
  Use git_config_early() instead of git_config() during repo setup
  Add git_config_early()
  git-rev-parse.txt: clarify --git-dir
  t1510: setup case #31
  t1510: setup case #30
  t1510: setup case #29
  t1510: setup case #28
  t1510: setup case #27
  t1510: setup case #26
  t1510: setup case #25
  ...
2010-12-28 11:26:55 -08:00
Nguyễn Thái Ngọc Duy 0ed7481347 setup_work_tree: adjust relative $GIT_WORK_TREE after moving cwd
When setup_work_tree() is called, it moves cwd to $GIT_WORK_TREE and
makes internal copy of $GIT_WORK_TREE absolute. The environt variable,
if set by user, remains unchanged. If the variable is relative, it is
no longer correct because its base dir has changed.

Instead of making $GIT_WORK_TREE absolute too, we just say "." and let
subsequent git processes handle it.

Reported-by: Michel Briand <michelbriand@free.fr>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-27 08:34:19 -08:00
Brandon Casey 19128d6cd8 Makefile: add NO_FNMATCH_CASEFOLD to IRIX sections
IRIX's fnmatch() does not support the GNU FNM_CASEFOLD extension, so set
NO_FNMATCH_CASEFOLD so that the internal fnmatch implementation will be
used.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22 19:56:02 -08:00
Arnout Engelen 6cf6bb3e47 Improve error messages when temporary file creation fails
Before, when creating a temporary file failed, a generic 'Unable to create
temporary file' message was printed. In some cases this could lead to
confusion as to which directory should be checked for correct permissions etc.

This patch adds the template for the temporary filename to the error message,
converting it to an absolute path if needed. A test verifies that the template
is indeed printed when pointing to a nonexistent or unwritable directory.

A copy of the original template is made in case mkstemp clears the template.

Signed-off-by: Arnout Engelen <arnouten@bzzt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-21 19:51:17 -08:00
Junio C Hamano b5c6aac01b Merge branch 'rj/msvc-fix'
* rj/msvc-fix:
  msvc: Fix macro redefinition warnings
  msvc: Fix build by adding missing INTMAX_MAX define
  msvc: git-daemon.exe: Fix linker "unresolved externals" error
  msvc: Fix compilation errors in compat/win32/sys/poll.c
2010-12-16 12:55:36 -08:00
Junio C Hamano e6b71b3289 Merge branch 'maint'
* maint:
  Prepare for 1.7.3.4
  use persistent memory for rejected paths
  do not overwrite files in leading path
  lstat_cache: optionally return match_len
  add function check_ok_to_remove()
  t7607: add leading-path tests
  t7607: use test-lib functions and check MERGE_HEAD
  Do not link with -lcrypto under NO_OPENSSL

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-14 08:58:09 -08:00
Junio C Hamano 40d675f417 Merge branch 'jc/maint-no-openssl-build-fix' into maint
* jc/maint-no-openssl-build-fix:
  Do not link with -lcrypto under NO_OPENSSL
2010-12-14 07:50:20 -08:00
Junio C Hamano 6b090e1710 Merge branch 'tc/http-urls-ends-with-slash' into maint
* tc/http-urls-ends-with-slash:
  http-fetch: rework url handling
  http-push: add trailing slash at arg-parse time, instead of later on
  http-push: check path length before using it
  http-push: Normalise directory names when pushing to some WebDAV servers
  http-backend: use end_url_with_slash()
  url: add str wrapper for end_url_with_slash()
  shift end_url_with_slash() from http.[ch] to url.[ch]
  t5550-http-fetch: add test for http-fetch
  t5550-http-fetch: add missing '&&'
2010-12-14 07:36:10 -08:00
Junio C Hamano 4a29c6a0db Merge branch 'ef/help-cmd-prefix'
* ef/help-cmd-prefix:
  help: always suggest common-cmds if prefix of cmd
2010-12-12 21:49:52 -08:00
Junio C Hamano a0078dee90 Merge branch 'tc/http-urls-ends-with-slash'
* tc/http-urls-ends-with-slash:
  http-fetch: rework url handling
  http-push: add trailing slash at arg-parse time, instead of later on
  http-push: check path length before using it
  http-push: Normalise directory names when pushing to some WebDAV servers
  http-backend: use end_url_with_slash()
  url: add str wrapper for end_url_with_slash()
  shift end_url_with_slash() from http.[ch] to url.[ch]
  t5550-http-fetch: add test for http-fetch
  t5550-http-fetch: add missing '&&'
2010-12-12 21:49:52 -08:00
Junio C Hamano 1e86274cd4 Merge branch 'ef/win32-dirent'
* ef/win32-dirent:
  win32: use our own dirent.h
  msvc: opendir: handle paths ending with a slash
  win32: dirent: handle errors
  msvc: opendir: do not start the search
  msvc: opendir: allocate enough memory
  msvc: opendir: fix malloc-failure

Conflicts:
	Makefile
2010-12-12 21:49:52 -08:00
Junio C Hamano 0d181cbb8a Merge branch 'jk/asciidoc-update'
* jk/asciidoc-update:
  docs: default to more modern toolset
2010-12-12 21:49:51 -08:00
Jonathan Nieder e4117b1fe8 Makefile: transport-helper uses thread-utils.h
transport-helper.o gained a dependency on thread-utils.h in
7851b1e (remote-fd/ext: finishing touches after code review,
2010-11-17).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-10 12:57:59 -08:00
Ramsay Jones b7037b6a1f msvc: git-daemon.exe: Fix linker "unresolved externals" error
The msvc linker complains about external symbols referenced by
the new poll() emulation code. In particular, it complains about
the DispatchMessage(), PeekMessage(), TranslateMessage() and
MsgWaitForMultipleObjects() functions.

In order to satisfy the external references, we link against the
user32.lib library.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-09 11:13:56 -08:00
Junio C Hamano 5b02b9baf7 Do not link with -lcrypto under NO_OPENSSL
With 401857c (imap-send: link against libcrypto for HMAC and others,
2010-11-24) we started linking imap-send unconditionally with -lcrypto by
mistake; disable this when we are building under NO_OPENSSL.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-08 14:54:13 -08:00
Junio C Hamano 3d90c79650 Merge branch 'il/remote-fd-ext'
* il/remote-fd-ext:
  remote-fd/ext: finishing touches after code review
  git-remote-ext
  git-remote-fd
  Add bidirectional_transfer_loop()

Conflicts:
	compat/mingw.h
2010-12-08 11:24:14 -08:00
Junio C Hamano 657072f3ac Merge branch 'jh/notes-merge'
* jh/notes-merge: (23 commits)
  Provide 'git merge --abort' as a synonym to 'git reset --merge'
  cmd_merge(): Parse options before checking MERGE_HEAD
  Provide 'git notes get-ref' to easily retrieve current notes ref
  git notes merge: Add testcases for merging notes trees at different fanouts
  git notes merge: Add another auto-resolving strategy: "cat_sort_uniq"
  git notes merge: --commit should fail if underlying notes ref has moved
  git notes merge: List conflicting notes in notes merge commit message
  git notes merge: Manual conflict resolution, part 2/2
  git notes merge: Manual conflict resolution, part 1/2
  Documentation: Preliminary docs on 'git notes merge'
  git notes merge: Add automatic conflict resolvers (ours, theirs, union)
  git notes merge: Handle real, non-conflicting notes merges
  builtin/notes.c: Refactor creation of notes commits.
  git notes merge: Initial implementation handling trivial merges only
  builtin/notes.c: Split notes ref DWIMmery into a separate function
  notes.c: Use two newlines (instead of one) when concatenating notes
  (trivial) t3303: Indent with tabs instead of spaces for consistency
  notes.h/c: Propagate combine_notes_fn return value to add_note() and beyond
  notes.h/c: Allow combine_notes functions to remove notes
  notes.c: Reorder functions in preparation for next commit
  ...

Conflicts:
	builtin.h
2010-12-08 11:24:12 -08:00
Jonathan Nieder f188e33e8a Makefile: dependencies for vcs-svn tests
The vcs-svn tests (test-treap.o et al) depend on the vcs-svn
headers for declarations and inline functions.  Declare the
dependency.  While at it, declare a dependency of the vcs-svn
objects (vcs-svn/string_pool.o et al) on $(LIB_H) to reflect use
within the vcs-svn library of git-compat-util.h and cache.h.

Without this change, tweaks to inline functions in those headers
do not provoke rebuilds of the corresponding tests[*], making
such changes unnecessarily difficult to test.

Before:

 $ touch vcs-svn/*.h && make test-treap
 $

After:

 $ touch vcs-svn/*.h && make test-treap
 CC test-treap.o
 LINK test-treap
 $

[*] unless COMPUTE_HEADER_DEPENDENCIES is enabled

Detected with "make CHECK_HEADER_DEPENDENCIES=1".

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-07 13:12:06 -08:00
Erik Faye-Lund 6612b9e471 help: always suggest common-cmds if prefix of cmd
If someone runs "git st", the command "git status" is not suggested
because it's not one of the closest levenshtein-neighbour.

Reserve the distance of 0 for common commands where the entered command
is a prefixe, as these are often more likely to be what the user meant.

This way, "git status" is the first suggestion, while a list of possible
typos are still suggested as well.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-05 12:15:12 -08:00
Junio C Hamano 39f04dbaac Merge branch 'jn/thinner-wrapper'
* jn/thinner-wrapper:
  Remove pack file handling dependency from wrapper.o
  pack-objects: mark file-local variable static
  wrapper: give zlib wrappers their own translation unit
  strbuf: move strbuf_branchname to sha1_name.c
  path helpers: move git_mkstemp* to wrapper.c
  wrapper: move odb_* to environment.c
  wrapper: move xmmap() to sha1_file.c
2010-12-03 16:13:06 -08:00
Junio C Hamano 5e738ae820 Merge branch 'jj/icase-directory'
* jj/icase-directory:
  Support case folding in git fast-import when core.ignorecase=true
  Support case folding for git add when core.ignorecase=true
  Add case insensitivity support when using git ls-files
  Add case insensitivity support for directories when using git status
  Case insensitivity support for .gitignore via core.ignorecase
  Add string comparison functions that respect the ignore_case variable.
  Makefile & configure: add a NO_FNMATCH_CASEFOLD flag
  Makefile & configure: add a NO_FNMATCH flag

Conflicts:
	Makefile
	config.mak.in
	configure.ac
	fast-import.c
2010-12-03 16:10:34 -08:00
Junio C Hamano ec3f7d5d0f Merge branch 'md/interix'
* md/interix:
  Interix: add configure checks
  add support for the SUA layer (interix; windows)

Conflicts:
	git-compat-util.h
2010-11-29 17:52:34 -08:00
Tay Ray Chuan 1966d9f37b shift end_url_with_slash() from http.[ch] to url.[ch]
This allows non-http/curl users to access it too (eg. http-backend.c).

Update include headers in end_url_with_slash() users too.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-26 14:50:45 -08:00
Jeff King 79c461d5b1 docs: default to more modern toolset
When the ASCIIDOC8 and ASCIIDOC_NO_ROFF knobs were built,
many people were still on asciidoc 7 and using older
versions of docbook-xsl. These days, even the almost
2-year-old Debian stable needs these knobs turned.

So let's turn them by default. The new knobs ASCIIDOC7 and
ASCIIDOC_ROFF can be used to get the old behavior if people
are on older systems.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-24 15:13:58 -08:00
Junio C Hamano c6caede7fd Merge branch 'maint'
* maint:
  imap-send: link against libcrypto for HMAC and others
  git-send-email.perl: Deduplicate "to:" and "cc:" entries with names
  mingw: do not set errno to 0 on success
2010-11-24 13:24:49 -08:00
Junio C Hamano c5d2901d48 Merge branch 'ab/makefile-track-cc' into maint
* ab/makefile-track-cc:
  Makefile: add CC to TRACK_CFLAGS
2010-11-24 12:44:35 -08:00
Diego Elio Pettenò 401857c4c6 imap-send: link against libcrypto for HMAC and others
When using stricter linkers, such as GNU gold or Darwin ld, transitive
dependencies are not counted towards symbol resolution. If we don't link
imap-send to libcrypto, we'll have undefined references to the HMAC_*,
EVP_* and ERR_* functions families.

Signed-off-by: Diego Elio Pettenò <flameeyes@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-24 12:23:48 -08:00
Erik Faye-Lund d1b6e6e015 win32: use our own dirent.h
The mingw-runtime implemenation of opendir, readdir and closedir
sets errno to 0 on success, something that POSIX explicitly
forbids. 3ba7a06 ("A loose object is not corrupt if it cannot be
read due to EMFILE") introduce a dependency on this behaviour,
leading to a broken "git clone" on Windows.

compat/mingw.c contains an implementation of readdir, and
compat/msvc.c contains implementations of opendir and closedir.

Move these to compat/win32/dirent.[ch], and change to our own DIR
structure at the same time.

This provides a generic Win32-implementation of opendir, readdir
and closedir which works on both MinGW and MSVC and does not reset
errno, and as a result git clone is working again on Windows.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-23 16:06:50 -08:00
Johan Herland 75ef3f4a5c git notes merge: Initial implementation handling trivial merges only
This initial implementation of 'git notes merge' only handles the trivial
merge cases (i.e. where the merge is either a no-op, or a fast-forward).

The patch includes testcases for these trivial merge cases.

Future patches will extend the functionality of 'git notes merge'.

This patch has been improved by the following contributions:
- Stephen Boyd: Simplify argc logic
- Stephen Boyd: Use test_commit
- Ævar Arnfjörð Bjarmason: Don't use C99 comments.
- Jonathan Nieder: Add constants for common verbosity values
- Jonathan Nieder: Use trace_printf(...) instead of OUTPUT(o, 5, ...)
- Jonathan Nieder: Remove extraneous show() function
- Jonathan Nieder: Clarify handling of empty/missing notes ref in notes_merge()
- Junio C Hamano: fixup minor style issues

Thanks-to: Stephen Boyd <bebarino@gmail.com>
Thanks-to: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
Thanks-to: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-17 13:21:30 -08:00
Jonathan Nieder b0613ce0f9 wrapper: give zlib wrappers their own translation unit
Programs using xmalloc() but not git_inflate() require -lz on the
linker command line because git_inflate() is in the same translation
unit as xmalloc().

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-10 11:07:51 -08:00
Erik Faye-Lund a666b472c7 daemon: opt-out on features that require posix
Windows does not supply the POSIX-functions fork(), setuuid(), setgid(),
setsid() and initgroups(). Error out if --user or --detach is specified
when if so.

MinGW doesn't have prototypes and headers for inet_ntop and inet_pton,
so include our implementation instead. MSVC does, so avoid doing so
there.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-04 16:53:52 -07:00
Erik Faye-Lund fdc1211463 mingw: use poll-emulation from gnulib
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-04 16:53:51 -07:00
Mike Pape da523cc597 compat: add inet_pton and inet_ntop prototypes
Windows doesn't have inet_pton and inet_ntop, so
add prototypes in git-compat-util.h for them.

At the same time include git-compat-util.h in
the sources for these functions, so they use the
network-wrappers from there on Windows.

Signed-off-by: Mike Pape <dotzenlabs@gmail.com>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-04 16:53:49 -07:00
Mike Pape 088d880247 mingw: implement syslog
Syslog does not usually exist on Windows, so implement our own using
Window's ReportEvent mechanism.

Strings containing "%1" gets expanded into them selves by ReportEvent,
resulting in an unreadable string. "%2" and above is not a problem.
Unfortunately, on Windows an IPv6 address can contain "%1", so expand
"%1" to "% 1" before reporting. "%%1" is also a problem for ReportEvent,
but that string cannot occur in an IPv6 address.

Signed-off-by: Mike Pape <dotzenlabs@gmail.com>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-04 16:53:49 -07:00
Markus Duft 2844923d62 add support for the SUA layer (interix; windows)
* add required build options to Makefile.
* introduce new NO_INTTYPES_H for systems lacking inttypes; code
  includes stdint.h instead, if this is set.
* introduce new NO_SYS_POLL_H for systems lacking sys/poll.h; code
  includes poll.h instead, if this is set.
* introduce NO_INITGROUPS. initgroups() call is simply omitted.

Signed-off-by: Markus Duft <mduft@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-28 17:52:22 -07:00
Ilari Liusvaara 7f3ecebfcd git-remote-ext
This remote helper invokes external command and passes raw smart transport
stream through it. This is useful for instance for invoking ssh with
one-off odd options, connecting to git services in unix domain
sockets, in abstract namespace, using TLS or other secure protocols,
etc...

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13 16:09:28 -07:00
Ilari Liusvaara 3a9ed4bdee git-remote-fd
This remote helper reflects raw smart remote transport stream back to the
calling program. This is useful for example if some UI wants to handle
ssh itself and not use hacks via GIT_SSH.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13 16:09:26 -07:00
Junio C Hamano ee79b21778 Merge branch 'ab/makefile-track-cc'
* ab/makefile-track-cc:
  Makefile: add CC to TRACK_CFLAGS
2010-10-06 12:10:29 -07:00
Ævar Arnfjörð Bjarmason 4de066b6f1 Makefile & configure: add a NO_FNMATCH_CASEFOLD flag
On some platforms (like Solaris) there is a fnmatch, but it doesn't
support the GNU FNM_CASEFOLD extension that's used by the
jj/icase-directory series' fnmatch_icase wrapper.

Change the Makefile so that it's now possible to set
NO_FNMATCH_CASEFOLD=YesPlease on those systems, and add a configure
probe for it.

Unlike the NO_REGEX check we don't add AC_INCLUDES_DEFAULT to our
headers. This is because on a GNU system the definition of
FNM_CASEFOLD in fnmatch.h is guarded by:

    #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE

One of the headers AC_INCLUDES_DEFAULT includes ends up defining one
of those, so if we'd use it we'd always get
NO_FNMATCH_CASEFOLD=YesPlease on GNU systems, even though they have
FNM_CASEFOLD.

When checking the flags we use:

    ifdef NO_FNMATCH
    ...
    else
    ifdef NO_FNMATCH_CASEFOLD
    ...
    endif
    endif

The "else" so that we don't link against compat/fnmatch/fnmatch.o
twice if both NO_FNMATCH and NO_FNMATCH_CASEFOLD are defined.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06 11:19:58 -07:00
Ævar Arnfjörð Bjarmason f3f3d9366e Makefile & configure: add a NO_FNMATCH flag
Windows and MinGW both lack fnmatch() in their C library and needed
compat/fnmatch, but they had duplicate code for adding the compat
function, and there was no Makefile flag or configure check for
fnmatch.

Change the Makefile it so that it's now possible to compile the compat
function with a NO_FNMATCH=YesPlease flag, and add a configure probe
for it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06 11:19:50 -07:00
Junio C Hamano 2851e8eba5 Merge branch 'po/etc-gitattributes'
* po/etc-gitattributes:
  Add global and system-wide gitattributes

Conflicts:
	Documentation/config.txt
	Makefile
2010-09-29 13:47:51 -07:00
Junio C Hamano 2f76919517 MinGW: avoid collisions between "tags" and "TAGS"
On case insensitive filesystems, "tags" and "TAGS" target will try to
overwrite the same file.  Allow MinGW to use "ETAGS" instead.

These two targets do produce real files; do not put them on .PHONY target
list.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-29 13:27:50 -07:00
Ævar Arnfjörð Bjarmason b3457afc4f Makefile: add CC to TRACK_CFLAGS
Change the git make process so that everything's rebuilt if the CC is
changed. Before we wouldn't rebuilt if e.g. the CC variable was
changed from gcc to clang.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27 11:45:20 -07:00
Junio C Hamano 5879b6bbca Merge branch 'maint'
* maint:
  t3101: modernise style
  compat/nedmalloc: don't force NDEBUG on the rest of git

Conflicts:
	Makefile
2010-09-12 13:53:03 -07:00
René Scharfe d555ff5482 compat/nedmalloc: don't force NDEBUG on the rest of git
Define the nedmalloc feature configuration macros for nedmalloc.o, only.
This keeps assert(3) working for the rest of the git source; it was
turned off for nedmalloc users before by defining NDEBUG globally.

Also remove -DUSE_NED_ALLOCATOR as this macro isn't used anywhere.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-11 10:23:03 -07:00
Brandon Casey a1d558d254 Makefile: use compat regex on IRIX 6.5
The IRIX 6.5 regex.h header file defines REG_STARTEND, but the feature does
not appear to work.  Since REG_STARTEND is required for proper functioning
of git-grep, set NO_REGEX and use the alternative regex libraries in compat/

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09 17:11:06 -07:00
Junio C Hamano a2c6726417 Merge branch 'ab/test-2'
* ab/test-2: (51 commits)
  tests: factor HOME=$(pwd) in test-lib.sh
  test-lib: use subshell instead of cd $new && .. && cd $old
  tests: simplify "missing PREREQ" message
  t/t0000-basic.sh: Run the passing TODO test inside its own test-lib
  test-lib: Allow overriding of TEST_DIRECTORY
  test-lib: Use "$GIT_BUILD_DIR" instead of "$TEST_DIRECTORY"/../
  test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../
  test: Introduce $GIT_BUILD_DIR
  cvs tests: do not touch test CVS repositories shipped with source
  t/t9602-cvsimport-branches-tags.sh: Add a PERL prerequisite
  t/t9601-cvsimport-vendor-branch.sh: Add a PERL prerequisite
  t/t7105-reset-patch.sh: Add a PERL prerequisite
  t/t9001-send-email.sh: convert setup code to tests
  t/t9001-send-email.sh: change from skip_all=* to prereq skip
  t/t9001-send-email.sh: Remove needless PROG=* assignment
  t/t9600-cvsimport.sh: change from skip_all=* to prereq skip
  lib-patch-mode tests: change from skip_all=* to prereq skip
  t/t3701-add-interactive.sh: change from skip_all=* to prereq skip
  tests: Move FILEMODE prerequisite to lib-prereq-FILEMODE.sh
  t/Makefile: Create test-results dir for smoke target
  ...

Conflicts:
	t/t6035-merge-dir-to-symlink.sh
2010-09-04 08:15:36 -07:00
Junio C Hamano cd1547d204 Merge branch 'ab/compat-regex'
* ab/compat-regex:
  Fix compat/regex ANSIfication on MinGW
  autoconf: regex library detection typofix
  autoconf: don't use platform regex if it lacks REG_STARTEND
  t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTEND
  compat/regex: get rid of old-style definition
  compat/regex: define out variables only used under RE_ENABLE_I18N
  Change regerror() declaration from K&R style to ANSI C (C89)
  compat/regex: get the gawk regex engine to compile within git
  compat/regex: use the regex engine from gawk for compat

Conflicts:
	compat/regex/regex.c
2010-09-03 09:43:45 -07:00
Petr Onderka 6df42ab984 Add global and system-wide gitattributes
Allow gitattributes to be set globally and system wide. This way, settings
for particular file types can be set in one place and apply for all user's
repositories.

The location of system-wide attributes file is $(prefix)/etc/gitattributes.
The location of the global file can be configured by setting
core.attributesfile.

Some parts of the code were copied from the implementation of the same
functionality in config.c.

Signed-off-by: Petr Onderka <gsvick@gmail.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-01 12:19:36 -07:00
Junio C Hamano aca35505db Merge branch 'jn/svn-fe'
* jn/svn-fe:
  t/t9010-svn-fe.sh: add an +x bit to this test
  t9010 (svn-fe): avoid symlinks in test
  t9010 (svn-fe): use Unix-style path in URI
  vcs-svn: Avoid %z in format string
  vcs-svn: Rename dirent pool to build on Windows
  compat: add strtok_r()
  treap: style fix
  vcs-svn: remove build artifacts on "make clean"
  svn-fe manual: Clarify warning about deltas in dump files
  Update svn-fe manual
  SVN dump parser
  Infrastructure to write revisions in fast-export format
  Add stream helper library
  Add string-specific memory pool
  Add treap implementation
  Add memory pool library
  Introduce vcs-svn lib
2010-08-31 16:23:38 -07:00
Junio C Hamano dfdb1e4150 Merge branch 'so/http-user-agent'
* so/http-user-agent:
  Allow HTTP user agent string to be modified.
2010-08-21 23:28:38 -07:00
Junio C Hamano 0fd26f4830 Merge branch 'bc/use-more-hardlinks-in-install' into maint
* bc/use-more-hardlinks-in-install:
  Makefile: make hard/symbolic links for non-builtins too
  Makefile: link builtins residing in bin directory to main git binary too
2010-08-20 12:53:07 -07:00
Ævar Arnfjörð Bjarmason a997bf423d compat/regex: get the gawk regex engine to compile within git
We need to define -DGAWK -DNO_MBSUPPORT so that the gawk regex engine
will compile, and include stdio.h and stddef.h in regex.h. Gawk itself
includes these headers before it includes the regex.h header.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-18 14:06:54 -07:00
Thomas Rast e146d1772b Makefile: make gcov invocation configurable
If you customize CC to use a different version of gcc, most likely you
also need to use a different version of gcov.  Make it configurable.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-18 12:42:37 -07:00
Ævar Arnfjörð Bjarmason df07acfe0b Makefile: Add cover_db_html target
Add a target to generate a detailed HTML report for the entire Git
codebase using Devel::Cover's cover(1) tool. Output it in
cover_db_html instead of the default cover_db, so that it isn't mixed
up with our raw report files.

The target depends on the coverage-report-cover-db target, it may be
run redundantly if it was previously run. But the HTML output won't be
affected by running gcov2perl twice, so I didn't try to avoid that
small redundancy.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-18 12:42:18 -07:00
Ævar Arnfjörð Bjarmason 7432bd5fbd Makefile: Add cover_db target
Add a target to convert the *.gcov files to a Devel::Cover
database. That database can subsequently be formatted by the cover(1)
tool which is included with Devel::Cover.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-18 12:42:18 -07:00
Ævar Arnfjörð Bjarmason b5eed98104 Makefile: Split out the untested functions target
Change the coverage-report target so that it doesn't generate the
coverage-untested-functions file by default. I'm adding more targets
for doing various things with the gcov files, and they shouldn't all
run by default.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-18 12:42:18 -07:00
Ævar Arnfjörð Bjarmason bc548efe00 Makefile: Include subdirectories in "make cover" reports
We generate profiling files in all the $(OBJECTS) dirs. Aggregate
results from there, and add them to the corresponding clean target.

Also expand the gcov arguments. Generate reports for things like "x()
|| y()" using --all-blocks, and add --preserve-paths since we're
profiling in subdirectories now.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-18 12:42:18 -07:00
Jonathan Nieder 78457bc0cc compat: add strtok_r()
Windows does not have strtok_r (and while it does have an identical
strtok_s, but it is not obvious how to use it).  Grab an
implementation from glibc.

The svn-fe tool uses strtok_r to parse paths.

Acked-by: Johannes Sixt <j6t@kdbg.org>
Helped-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-14 19:35:38 -07:00
Jonathan Nieder be47d5a646 vcs-svn: remove build artifacts on "make clean"
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-14 19:35:38 -07:00
David Barr 21746aa34f SVN dump parser
svndump parses data that is in SVN dumpfile format produced by
`svnadmin dump` with the help of line_buffer and uses repo_tree and
fast_export to emit a git fast-import stream.

Based roughly on com.hydrografix.svndump 0.92 from the SvnToCCase
project at <http://svn2cc.sarovar.org/>, by Stefan Hegny and
others.

[rr: allow input from files other than stdin]
[jn: with test, more error reporting]

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-14 19:35:38 -07:00
David Barr c0e6c23dca Infrastructure to write revisions in fast-export format
repo_tree maintains the exporter's state and provides a facility to to
call fast_export, which writes objects to stdout suitable for
consumption by fast-import.

The exported functions roughly correspond to Subversion FS operations.

 . repo_add, repo_modify, repo_copy, repo_replace, and repo_delete
   update the current commit, based roughly on the corresponding
   Subversion FS operation.

 . repo_commit calls out to fast_export to write the current commit to
   the fast-import stream in stdout.

 . repo_diff is used by the fast_export module to write the changes
   for a commit.

 . repo_reset erases the exporter's state, so valgrind can be happy.

[rr: squelched compiler warnings]
[jn: removed support for maintaining state on-disk, though we may
want to add it back later]

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-14 19:35:37 -07:00
David Barr 3bbaec00a8 Add stream helper library
This library provides thread-unsafe fgets()- and fread()-like
functions where the caller does not have to supply a buffer.  It
maintains a couple of static buffers and provides an API to use
them.

[rr: allow input from files other than stdin]
[jn: with tests, documentation, and error handling improvements]

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-14 19:35:37 -07:00
David Barr 1d73b52f5b Add string-specific memory pool
Intern strings so they can be compared by address and stored without
wasting space.

This library uses the macros in the obj_pool.h and trp.h to create a
memory pool for strings and expose an API for handling them.

[rr: added API docs]
[jn: with some API simplifications, new documentation and tests]

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-14 19:35:37 -07:00
Jason Evans 951f316470 Add treap implementation
Provide macros to generate a type-specific treap implementation and
various functions to operate on it. It uses obj_pool.h to store memory
nodes in a treap.  Previously committed nodes are never removed from
the pool; after any *_commit operation, it is assumed (correctly, in
the case of svn-fast-export) that someone else must care about them.

Treaps provide a memory-efficient binary search tree structure.
Insertion/deletion/search are about as about as fast in the average
case as red-black trees and the chances of worst-case behavior are
vanishingly small, thanks to (pseudo-)randomness.  The bad worst-case
behavior is a small price to pay, given that treaps are much simpler
to implement.

>From http://www.canonware.com/download/trp/trp_hash/trp.h

[db: Altered to reference nodes by offset from a common base pointer]
[db: Bob Jenkins' hashing implementation dropped for Knuth's]
[db: Methods unnecessary for search and insert dropped]
[rr: Squelched compiler warnings]
[db: Added support for immutable treap nodes]
[jn: Reintroduced treap_nsearch(); with tests]

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-14 19:35:37 -07:00
David Barr 4709455db3 Add memory pool library
Add a memory pool library implemented using C macros. The
obj_pool_gen() macro creates a type-specific memory pool.

The memory pool library is distinguished from the existing specialized
allocators in alloc.c by using a contiguous block for all allocations.
This means that on one hand, long-lived pointers have to be written as
offsets, since the base address changes as the pool grows, but on the
other hand, the entire pool can be easily written to the file system.
This could allow the memory pool to persist between runs of an
application.

For the svn importer, such a facility is useful because each svn
revision can copy trees and files from any previous revision.  The
relevant information for all revisions has to persist somehow to
support incremental runs.

[rr: minor cleanups]
[jn: added tests; removed file system backing for now]

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-14 19:35:37 -07:00
Jonathan Nieder 3f527372d9 Introduce vcs-svn lib
Teach the build system to build a separate library for the
upcoming subversion interop support.

The resulting vcs-svn/lib.a does not contain any code, nor is
it built during a normal build.  This is just scaffolding for
later changes.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-14 19:35:37 -07:00
Junio C Hamano 14661fe59f Merge branch 'bc/use-more-hardlinks-in-install'
* bc/use-more-hardlinks-in-install:
  Makefile: make hard/symbolic links for non-builtins too
  Makefile: link builtins residing in bin directory to main git binary too
2010-08-12 18:32:20 -07:00
Spencer E. Olson b1d1058cc3 Allow HTTP user agent string to be modified.
Some firewalls restrict HTTP connections based on the clients user agent.  This
commit provides the user the ability to modify the user agent string via either
a new config option (http.useragent) or by an environment variable
(GIT_HTTP_USER_AGENT).

Relevant documentation is added to Documentation/config.txt.

Signed-off-by: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-11 14:07:31 -07:00
Jonathan Nieder 48c250a121 Makefile: add missing dependency on http.h
v1.7.1-rc0~65^2~2 (http: init and cleanup separately from
http-walker, 2010-03-02) introduced a direct dependency from
http-fetch on the HTTP request library.  Declare it.

Detected with "make CHECK_HEADER_DEPENDENCIES=1".

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-09 12:13:27 -07:00
Jonathan Nieder 5fedde3cb3 Makefile: add missing dependencies on url.h
v1.7.2-rc0~56^2 and its parent (decode file:// and ssh://
URLs, 2010-05-23) introduced a new url library.  Update the
Makefile with the relevant dependencies.

Detected with "make CHECK_HEADER_DEPENDENCIES=1".

Cc: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-09 12:12:22 -07:00
Thomas Rast e8b4ac37d8 Makefile: add check-docs exception for gitrevisions
The manpage was added in 1ed6f2c (Documentation: gitrevisions,
2010-07-05), but since it does not have a corresponding git command,
it needs an exception for check-docs.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-27 09:05:01 -07:00
Brandon Casey 76d079aa56 Makefile: make hard/symbolic links for non-builtins too
To conserve space/improve file caching we try to make hard or symbolic links
from each builtin program to the main git executable rather than having
each be a complete duplicate copy of it.  We weren't doing this for the
non-builtin programs though.  So, just because we can, and because it's
easy, and for completeness sake, let's do it.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-25 22:33:34 -07:00
Brandon Casey 40919c483a Makefile: link builtins residing in bin directory to main git binary too
To conserve space/improve file caching we try to make hard or symbolic links
from each builtin program to the main git executable rather than having
each be a complete duplicate copy of it.  We weren't doing this for the
builtin programs residing in the bin directory though.  So, let's do so.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-25 22:33:23 -07:00