gitweb.git
fast-import.c: change update_branch to use ref transactionsRonnie Sahlberg Wed, 16 Apr 2014 23:21:13 +0000 (16:21 -0700)

fast-import.c: change update_branch to use ref transactions

Change update_branch() to use ref transactions for updates.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer.c: use ref transactions for all ref updatesRonnie Sahlberg Wed, 16 Apr 2014 22:37:45 +0000 (15:37 -0700)

sequencer.c: use ref transactions for all ref updates

Change to use ref transactions for all updates to refs.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit.c: use ref transactions for updatesRonnie Sahlberg Wed, 16 Apr 2014 22:34:19 +0000 (15:34 -0700)

commit.c: use ref transactions for updates

Change commit.c to use ref transactions for all ref updates.
Make sure we pass a NULL pointer to ref_transaction_update if have_old
is false.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace.c: use the ref transaction functions for updatesRonnie Sahlberg Wed, 16 Apr 2014 22:32:29 +0000 (15:32 -0700)

replace.c: use the ref transaction functions for updates

Update replace.c to use ref transactions for updates.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tag.c: use ref transactions when doing updatesRonnie Sahlberg Wed, 16 Apr 2014 22:30:41 +0000 (15:30 -0700)

tag.c: use ref transactions when doing updates

Change tag.c to use ref transactions for all ref updates.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs.c: add transaction.status and track OPEN/CLOSEDRonnie Sahlberg Tue, 29 Apr 2014 19:06:19 +0000 (12:06 -0700)

refs.c: add transaction.status and track OPEN/CLOSED

Track the state of a transaction in a new state field. Check the field for
sanity, i.e. that state must be OPEN when _commit/_create/_delete or
_update is called or else die(BUG:...)

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs.c: make ref_transaction_begin take an err argumentRonnie Sahlberg Mon, 19 May 2014 17:42:34 +0000 (10:42 -0700)

refs.c: make ref_transaction_begin take an err argument

Add an err argument to _begin so that on non-fatal failures in future ref
backends we can report a nice error back to the caller.
While _begin can currently never fail for other reasons than OOM, in which
case we die() anyway, we may add other types of backends in the future.
For example, a hypothetical MySQL backend could fail in _begin with
"Can not connect to MySQL server. No route to host".

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs.c: update ref_transaction_delete to check for... Ronnie Sahlberg Wed, 16 Apr 2014 22:27:45 +0000 (15:27 -0700)

refs.c: update ref_transaction_delete to check for error and return status

Change ref_transaction_delete() to do basic error checking and return
non-zero on error. Update all callers to check the return for
ref_transaction_delete(). There are currently no conditions in _delete that
will return error but there will be in the future. Add an err argument that
will be updated on failure.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs.c: change ref_transaction_create to do error check... Ronnie Sahlberg Wed, 16 Apr 2014 22:26:44 +0000 (15:26 -0700)

refs.c: change ref_transaction_create to do error checking and return status

Do basic error checking in ref_transaction_create() and make it return
non-zero on error. Update all callers to check the result of
ref_transaction_create(). There are currently no conditions in _create that
will return error but there will be in the future. Add an err argument that
will be updated on failure.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Start the post-2.1 cycleJunio C Hamano Tue, 2 Sep 2014 20:30:13 +0000 (13:30 -0700)

Start the post-2.1 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'rs/strbuf-getcwd'Junio C Hamano Tue, 2 Sep 2014 20:27:45 +0000 (13:27 -0700)

Merge branch 'rs/strbuf-getcwd'

Reduce the use of fixed sized buffer passed to getcwd() calls
by introducing xgetcwd() helper.

* rs/strbuf-getcwd:
use strbuf_add_absolute_path() to add absolute paths
abspath: convert absolute_path() to strbuf
use xgetcwd() to set $GIT_DIR
use xgetcwd() to get the current directory or die
wrapper: add xgetcwd()
abspath: convert real_path_internal() to strbuf
abspath: use strbuf_getcwd() to remember original working directory
setup: convert setup_git_directory_gently_1 et al. to strbuf
unix-sockets: use strbuf_getcwd()
strbuf: add strbuf_getcwd()

Merge branch 'ta/pretty-parse-config'Junio C Hamano Tue, 2 Sep 2014 20:27:39 +0000 (13:27 -0700)

Merge branch 'ta/pretty-parse-config'

* ta/pretty-parse-config:
pretty.c: make git_pretty_formats_config return -1 on git_config_string failure

Merge branch 'bc/archive-pax-header-mode'Junio C Hamano Tue, 2 Sep 2014 20:27:12 +0000 (13:27 -0700)

Merge branch 'bc/archive-pax-header-mode'

Implementations of "tar" that do not understand an extended pax
header would extract the contents of it in a regular file; make
sure the permission bits of this file follows the same tar.umask
configuration setting.

* bc/archive-pax-header-mode:
archive: honor tar.umask even for pax headers

Merge branch 'pr/remotes-in-hashmap'Junio C Hamano Tue, 2 Sep 2014 20:26:37 +0000 (13:26 -0700)

Merge branch 'pr/remotes-in-hashmap'

Optimize remotes configuration look-up in a repository with very
many remotes defined.

* pr/remotes-in-hashmap:
use a hashmap to make remotes faster

Merge branch 'jk/pretty-empty-format'Junio C Hamano Tue, 2 Sep 2014 20:25:03 +0000 (13:25 -0700)

Merge branch 'jk/pretty-empty-format'

"git log --pretty/format=" with an empty format string did not mean
the more obvious "No output whatsoever" but "Use default format",
which was counterintuitive.

* jk/pretty-empty-format:
pretty: make empty userformats truly empty
pretty: treat "--format=" as an empty userformat
revision: drop useless string offset when parsing "--pretty"

Merge branch 'ta/config-set'Junio C Hamano Tue, 2 Sep 2014 20:24:17 +0000 (13:24 -0700)

Merge branch 'ta/config-set'

Add in-core caching layer to let us avoid reading the same
configuration files number of times.

* ta/config-set:
test-config: add tests for the config_set API
add `config_set` API for caching config-like files

Merge branch 'rs/init-no-duplicate-real-path'Junio C Hamano Tue, 2 Sep 2014 20:24:04 +0000 (13:24 -0700)

Merge branch 'rs/init-no-duplicate-real-path'

* rs/init-no-duplicate-real-path:
init: avoid superfluous real_path() calls

Merge branch 'mm/config-edit-global'Junio C Hamano Tue, 2 Sep 2014 20:23:19 +0000 (13:23 -0700)

Merge branch 'mm/config-edit-global'

Start "git config --edit --global" from a skeletal per-user
configuration file contents, instead of a total blank, when the
user does not already have any. This immediately reduces the need
for a later "Have you forgotten setting core.user?" and we can add
more to the template as we gain more experience.

* mm/config-edit-global:
commit: advertise config --global --edit on guessed identity
home_config_paths(): let the caller ignore xdg path
config --global --edit: create a template file if needed

Merge branch 'jc/reopen-lock-file'Junio C Hamano Tue, 2 Sep 2014 20:20:12 +0000 (13:20 -0700)

Merge branch 'jc/reopen-lock-file'

There are cases where you lock and open to write a file, close it to
show the updated contents to external processes, and then have to
update the file again while still holding the lock, but the lockfile
API lacked support for such an access pattern.

* jc/reopen-lock-file:
lockfile: allow reopening a closed but still locked file

imap-send: simplify v_issue_imap_cmd() and get_cmd_resu... René Scharfe Sat, 30 Aug 2014 16:14:24 +0000 (18:14 +0200)

imap-send: simplify v_issue_imap_cmd() and get_cmd_result() using starts_with()

Use starts_with() instead of memcmp() to check if NUL-terminated
strings match prefixes. This gets rid of some magic string length
constants.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

MinGW: update tests to handle a native eol of crlfBrice Lambson Sat, 30 Aug 2014 21:39:07 +0000 (23:39 +0200)

MinGW: update tests to handle a native eol of crlf

Some of the tests were written with the assumption that the native
eol would always be lf. After defining NATIVE_CRLF on MinGW, these
tests began failing. This change will update the tests to also
handle a native eol of crlf.

Signed-off-by: Brice Lambson <bricelam@live.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: propagate NATIVE_CRLF to CPat Thoyts Sat, 30 Aug 2014 21:38:59 +0000 (23:38 +0200)

Makefile: propagate NATIVE_CRLF to C

Commit 95f31e9a (convert: The native line-ending is \r\n on MinGW,
2010-09-04) correctly points out that the NATIVE_CRLF setting is
incorrectly set on Mingw git. However, the Makefile variable is not
propagated to the C preprocessor and results in no change. This patch
pushes the definition to the C code and adds a test to validate that
when core.eol as native is crlf, we actually normalize text files to
this line ending convention when core.autocrlf is false.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grammofix in user-facing messagesAlex Henrie Sat, 30 Aug 2014 19:56:01 +0000 (13:56 -0600)

grammofix in user-facing messages

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stylefix: asterisks stick to the variable, not the... David Aguilar Sun, 31 Aug 2014 20:11:31 +0000 (13:11 -0700)

stylefix: asterisks stick to the variable, not the type

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-tree: remove unused df_conflict argumentsRené Scharfe Sat, 30 Aug 2014 21:40:34 +0000 (23:40 +0200)

merge-tree: remove unused df_conflict arguments

merge_trees_recursive() stores a pointer to its parameter df_conflict in
its struct traverse_info, but it is never actually used. Stop doing
that, remove the parameter and inline the function into merge_trees(),
as the latter is now only passing on its parameters.

Remove the parameter df_conflict from unresolved_directory() as well,
now that there is no way to pass it to merge_trees_recursive() through
that function anymore.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http-walker: simplify process_alternates_response(... René Scharfe Sat, 30 Aug 2014 15:55:45 +0000 (17:55 +0200)

http-walker: simplify process_alternates_response() using strbuf

Use strbuf to build the new base, which takes care of allocations and
the terminating NUL character automatically.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: simplify git_config_include()René Scharfe Sat, 30 Aug 2014 16:07:05 +0000 (18:07 +0200)

config: simplify git_config_include()

Instead of using skip_prefix() to check the first part of the string
and then strcmp() to check the rest, simply use strcmp() to check the
whole string.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack-write: simplify index_pack_lockfile using skip_pre... René Scharfe Sat, 30 Aug 2014 09:47:19 +0000 (11:47 +0200)

pack-write: simplify index_pack_lockfile using skip_prefix() and xstrfmt()

Get rid of magic string length constants by using skip_prefix() instead
of memcmp() and use xstrfmt() for building a string instead of a
PATH_MAX-sized buffer, snprintf() and xstrdup().

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

connect: simplify check_ref() using skip_prefix() and... René Scharfe Sat, 30 Aug 2014 09:46:54 +0000 (11:46 +0200)

connect: simplify check_ref() using skip_prefix() and starts_with()

Both callers of check_ref() pass in NUL-terminated strings for name.
Remove the len parameter and then use skip_prefix() and starts_with()
instead of memcmp() to check if it starts with certain strings. This
gets rid of several magic string length constants and a strlen() call.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

index-pack: fix race condition with duplicate basesJeff King Fri, 29 Aug 2014 20:57:47 +0000 (16:57 -0400)

index-pack: fix race condition with duplicate bases

When we are resolving deltas in an indexed pack, we do it by
first selecting a potential base (either one stored in full
in the pack, or one created by resolving another delta), and
then resolving any deltas that use that base. When we
resolve a particular delta, we flip its "real_type" field
from OBJ_{REF,OFS}_DELTA to whatever the real type is.

We assume that traversing the objects this way will visit
each delta only once. This is correct for most packs; we
visit the delta only when we process its base, and each
object (and thus each base) appears only once. However, if a
base object appears multiple times in the pack, we will try
to resolve any deltas based on it once for each instance.

We can detect this case by noting that a delta we are about
to resolve has already had its real_type field flipped, and
we already do so with an assert(). However, if multiple
threads are in use, we may race with another thread on
comparing and flipping the field. We need to synchronize the
access.

The right mechanism for doing this is a compare-and-swap (we
atomically "claim" the delta for our own and find out
whether our claim was successful). We can implement this
in C by using a pthread mutex to protect the operation. This
is not the fastest way of doing a compare-and-swap; many
processors provide instructions for this, and gcc and other
compilers provide builtins to access them. However, some
experiments showed that lock contention does not cause a
significant slowdown here. Adding c-a-s support for many
compilers would increase the maintenance burden (and we
would still end up including the pthread version as a
fallback).

Note that we only need to touch the OBJ_REF_DELTA codepath
here. An OBJ_OFS_DELTA object points to its base using an
offset, and therefore has only one base, even if another
copy of that base object appears in the pack (we do still
touch it briefly because the setting of real_type is
factored out of resolve_data).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pretty: provide a strict ISO 8601 date formatBeat Bolli Fri, 29 Aug 2014 16:58:42 +0000 (18:58 +0200)

pretty: provide a strict ISO 8601 date format

Git's "ISO" date format does not really conform to the ISO 8601
standard due to small differences, and it cannot be parsed by ISO
8601-only parsers, e.g. those of XML toolchains.

The output from "--date=iso" deviates from ISO 8601 in these ways:

- a space instead of the `T` date/time delimiter
- a space between time and time zone
- no colon between hours and minutes of the time zone

Add a strict ISO 8601 date format for displaying committer and
author dates. Use the '%aI' and '%cI' format specifiers and add
'--date=iso-strict' or '--date=iso8601-strict' date format names.

See http://thread.gmane.org/gmane.comp.version-control.git/255879 and
http://thread.gmane.org/gmane.comp.version-control.git/52414/focus=52585
for discussion.

Signed-off-by: Beat Bolli <bbolli@ewanet.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

determine_author_info(): copy getenv outputJeff King Wed, 27 Aug 2014 07:57:56 +0000 (03:57 -0400)

determine_author_info(): copy getenv output

When figuring out the author name for a commit, we may end
up either pointing to const storage from getenv("GIT_AUTHOR_*"),
or to newly allocated storage based on an existing commit or
the --author option.

Using const pointers to getenv's return has two problems:

1. It is not guaranteed that the return value from getenv
remains valid across multiple calls.

2. We do not know whether to free the values at the end,
so we just leak them.

We can solve both by duplicating the string returned by
getenv().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

determine_author_info(): reuse parsing functionsJeff King Wed, 27 Aug 2014 07:57:28 +0000 (03:57 -0400)

determine_author_info(): reuse parsing functions

Rather than parsing the header manually to find the "author"
field, and then parsing its sub-parts, let's use
find_commit_header and split_ident_line. This is shorter and
easier to read, and should do a more careful parsing job.

For example, the current parser could find the end-of-email
right-bracket across a newline (for a malformed commit), and
calculate a bogus gigantic length for the date (by using
"eol - rb").

As a bonus, this also plugs a memory leak when we pull the
date field from an existing commit (we still leak the name
and email buffers, which will be fixed in a later commit).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-import: fix segfault in store_tree()Maxim Bublis Fri, 29 Aug 2014 11:53:37 +0000 (15:53 +0400)

fast-import: fix segfault in store_tree()

Branch tree is NULLified by filedelete command if we are trying
to delete root tree. Add sanity check and use load_tree() in that case.

Signed-off-by: Maxim Bublis <satori@yandex-team.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t9300: test filedelete commandMaxim Bublis Fri, 29 Aug 2014 11:53:36 +0000 (15:53 +0400)

t9300: test filedelete command

Add new fast-import test series for filedelete command.

Signed-off-by: Maxim Bublis <satori@yandex-team.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge git://github.com/git-l10n/git-poJunio C Hamano Fri, 29 Aug 2014 17:18:22 +0000 (10:18 -0700)

Merge git://github.com/git-l10n/git-po

* git://github.com/git-l10n/git-po:
po/TEAMS: add new members to German translation team
l10n: de.po: translate 38 new messages

read_index_unmerged(): remove unnecessary loop index... Jaime Soriano Pastor Wed, 27 Aug 2014 19:48:12 +0000 (21:48 +0200)

read_index_unmerged(): remove unnecessary loop index adjustment

Signed-off-by: Jaime Soriano Pastor <jsorianopastor@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

read_index_from(): catch out of order entries when... Jaime Soriano Pastor Fri, 29 Aug 2014 08:54:41 +0000 (10:54 +0200)

read_index_from(): catch out of order entries when reading an index file

Signed-off-by: Jaime Soriano Pastor <jsorianopastor@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

po/TEAMS: add new members to German translation teamRalf Thielow Tue, 26 Aug 2014 16:54:30 +0000 (18:54 +0200)

po/TEAMS: add new members to German translation team

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>

l10n: de.po: translate 38 new messagesRalf Thielow Fri, 20 Jun 2014 15:22:48 +0000 (17:22 +0200)

l10n: de.po: translate 38 new messages

Translate 38 new messages came from git.pot update in fe05e19
(l10n: git.pot: v2.1.0 round 1 (38 new, 9 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>

contrib/svn-fe: fix MakefileMaxim Bublis Thu, 28 Aug 2014 17:00:49 +0000 (21:00 +0400)

contrib/svn-fe: fix Makefile

Fixes several problems:
* include config.mak.uname, config.mak.autogen and config.mak
in order to use settings for prefix and other such things;
* link xdiff/lib.a as it is a requirement for libgit.a;
* fix CFLAGS, LDFLAGS and EXTLIBS for Linux and Mac OS X.

Signed-off-by: Maxim Bublis <satori@yandex-team.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Document LF appearing in shallow command during send... Shawn Pearce Wed, 27 Aug 2014 20:46:56 +0000 (13:46 -0700)

Document LF appearing in shallow command during send-pack/receive-pack

The implementation sends an LF, but the protocol documentation was
missing this detail.

Signed-off-by: Shawn Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0027: Tests for core.eol=native, eol=lf, eol=crlfTorsten Bögershausen Sat, 16 Aug 2014 20:16:58 +0000 (22:16 +0200)

t0027: Tests for core.eol=native, eol=lf, eol=crlf

Add test cases for core.eol "native" and "" (unset).
(MINGW uses CRLF, all other systems LF as native line endings)

Add test cases for the attributes "eol=lf" and "eol=crlf"

Other minor changes:
- Use the more portable 'tr' instead of 'od -c' to convert '\n' into 'Q'
and '\0' into 'N'
- Style fixes for shell functions according to the coding guide lines
- Replace "txtbin" with "attr"

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs/fast-export: explain --anonymize more completelyJeff King Thu, 28 Aug 2014 12:32:58 +0000 (08:32 -0400)

docs/fast-export: explain --anonymize more completely

The original commit made mention of this option, but not why
one might want it or how they might use it. Let's try to be
a little more thorough, and also explain how to confirm that
the output really is anonymous.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge, pull: stop advising 'commit -a' in case of conflictMatthieu Moy Thu, 28 Aug 2014 09:46:58 +0000 (11:46 +0200)

merge, pull: stop advising 'commit -a' in case of conflict

'git commit -a' is rarely a good way to mark conflicts as resolved:
the user anyway has to go manually through the list of conflicts to
do the actual resolution, and it is usually better to use "git add"
on each files after doing the resolution.

On the other hand, using 'git commit -a' is potentially dangerous,
as it makes it very easy to mistakenly commit conflict markers
without noticing, and even worse, the user may have started a merge
while having local changes that do not overlap with it in the
working tree.

While we're there, synchronize the 'git pull' and 'git merge'
messages: the first was ending with '... and make a commit.', but
not the latter.

Eventually, git should detect that conflicts have been resolved in
the working tree and tailor these messages further. Not only "use
git commit -a" could be resurected, but "Fix them up in the work
tree" should be dropped when it happens.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

teach fast-export an --anonymize optionJeff King Wed, 27 Aug 2014 17:01:28 +0000 (13:01 -0400)

teach fast-export an --anonymize option

Sometimes users want to report a bug they experience on
their repository, but they are not at liberty to share the
contents of the repository. It would be useful if they could
produce a repository that has a similar shape to its history
and tree, but without leaking any information. This
"anonymized" repository could then be shared with developers
(assuming it still replicates the original problem).

This patch implements an "--anonymize" option to
fast-export, which generates a stream that can recreate such
a repository. Producing a single stream makes it easy for
the caller to verify that they are not leaking any useful
information. You can get an overview of what will be shared
by running a command like:

git fast-export --anonymize --all |
perl -pe 's/\d+/X/g' |
sort -u |
less

which will show every unique line we generate, modulo any
numbers (each anonymized token is assigned a number, like
"User 0", and we replace it consistently in the output).

In addition to anonymizing, this produces test cases that
are relatively small (compared to the original repository)
and fast to generate (compared to using filter-branch, or
modifying the output of fast-export yourself). Here are
numbers for git.git:

$ time git fast-export --anonymize --all \
--tag-of-filtered-object=drop >output
real 0m2.883s
user 0m2.828s
sys 0m0.052s

$ gzip output
$ ls -lh output.gz | awk '{print $5}'
2.9M

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

date: use strbufs in date-formatting functionsJeff King Wed, 27 Aug 2014 07:57:08 +0000 (03:57 -0400)

date: use strbufs in date-formatting functions

Many of the date functions write into fixed-size buffers.
This is a minor pain, as we have to take special
precautions, and frequently end up copying the result into a
strbuf or heap-allocated buffer anyway (for which we
sometimes use strcpy!).

Let's instead teach parse_date, datestamp, etc to write to a
strbuf. The obvious downside is that we might need to
perform a heap allocation where we otherwise would not need
to. However, it turns out that the only two new allocations
required are:

1. In test-date.c, where we don't care about efficiency.

2. In determine_author_info, which is not performance
critical (and where the use of a strbuf will help later
refactoring).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

record_author_date(): use find_commit_header()Jeff King Wed, 27 Aug 2014 07:56:55 +0000 (03:56 -0400)

record_author_date(): use find_commit_header()

This saves us some manual parsing and makes the code more
readable.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

record_author_date(): fix memory leak on malformed... Jeff King Wed, 27 Aug 2014 07:56:31 +0000 (03:56 -0400)

record_author_date(): fix memory leak on malformed commit

If we hit the end-of-header without finding an "author"
line, we just return from the function. We should jump to
the fail_exit path to clean up the buffer that we may have
allocated.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: provide a function to find a header in a bufferJeff King Wed, 27 Aug 2014 07:56:01 +0000 (03:56 -0400)

commit: provide a function to find a header in a buffer

Usually when we parse a commit, we read it line by line and
handle each individual line (e.g., parse_commit and
parse_commit_header). Sometimes, however, we only care
about extracting a single header. Code in this situation is
stuck doing an ad-hoc parse of the commit buffer.

Let's provide a reusable function to locate a header within
the commit. The code is modeled after pretty.c's
get_header, which is used to extract the encoding.

Since some callers may not have the "struct commit" to go
along with the buffer, we drop that parameter. The only
thing lost is a warning for truncated commits, but that's
OK. This shouldn't happen in practice, and even if it does,
there's no particular reason that this function needs to
complain about it. It either finds the header it was asked
for, or it doesn't (and in the latter case, the caller will
typically complain).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

log-tree: use FLEX_ARRAY in name_decorationJeff King Tue, 26 Aug 2014 10:24:20 +0000 (06:24 -0400)

log-tree: use FLEX_ARRAY in name_decoration

We are already using the flex-array technique; let's
annotate it with our usual FLEX_ARRAY macro. Besides being
more readable, this is slightly more efficient on compilers
that understand flex-arrays.

Note that we need to bump the allocation in add_name_decoration,
which did not explicitly add one byte for the NUL terminator
of the string we are putting into the flex-array (it did not
need to before, because the struct itself was over-allocated
by one byte).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

send-pack: take refspecs over stdinJeff King Thu, 21 Aug 2014 12:21:20 +0000 (08:21 -0400)

send-pack: take refspecs over stdin

Pushing a large number of refs works over most transports,
because we implement send-pack as an internal function.
However, it can sometimes fail when pushing over http,
because we have to spawn "git send-pack --stateless-rpc" to
do the heavy lifting, and we pass each refspec on the
command line. This can cause us to overflow the OS limits on
the size of the command line for a large push.

We can solve this by giving send-pack a --stdin option and
using it from remote-curl. We already dealt with this on
the fetch-pack side in 078b895 (fetch-pack: new --stdin
option to read refs from stdin, 2012-04-02). The stdin
option (and in particular, its use of packet-lines for
stateless-rpc input) is modeled after that solution.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: drop CHECK_HEADER_DEPENDENCIES codeJeff King Fri, 22 Aug 2014 04:33:16 +0000 (00:33 -0400)

Makefile: drop CHECK_HEADER_DEPENDENCIES code

This code was useful when we kept a static list of header
files, and it was easy to forget to update it. Since the last
commit, we generate the list dynamically.

Technically this could still be used to find a dependency
that our dynamic check misses (e.g., a header file without a
".h" extension). But that is reasonably unlikely to be
added, and even less likely to be noticed by this tool
(because it has to be run manually)., It is not worth
carrying around the cruft in the Makefile.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jk/diff-tree-t-fix'Junio C Hamano Tue, 26 Aug 2014 18:16:26 +0000 (11:16 -0700)

Merge branch 'jk/diff-tree-t-fix'

Fix (rarely used) "git diff-tree -t" regression in 2.0.

* jk/diff-tree-t-fix:
intersect_paths: respect mode in git's tree-sort

Merge branch 'jk/pack-shallow-always-without-bitmap'Junio C Hamano Tue, 26 Aug 2014 18:16:25 +0000 (11:16 -0700)

Merge branch 'jk/pack-shallow-always-without-bitmap'

Reachability bitmaps do not work with shallow operations.
Fixes regression in 2.0.

* jk/pack-shallow-always-without-bitmap:
pack-objects: turn off bitmaps when we see --shallow lines

Merge branch 'jk/fix-profile-feedback-build'Junio C Hamano Tue, 26 Aug 2014 18:16:25 +0000 (11:16 -0700)

Merge branch 'jk/fix-profile-feedback-build'

Fix profile-feedback build broken in 2.1 for tarball releases.

* jk/fix-profile-feedback-build:
Makefile: make perf tests optional for profile build

use strbuf_add_absolute_path() to add absolute pathsRené Scharfe Mon, 28 Jul 2014 18:34:42 +0000 (20:34 +0200)

use strbuf_add_absolute_path() to add absolute paths

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

abspath: convert absolute_path() to strbufRené Scharfe Mon, 28 Jul 2014 18:33:55 +0000 (20:33 +0200)

abspath: convert absolute_path() to strbuf

Move most of the code of absolute_path() into the new function
strbuf_add_absolute_path() and in the process transform it to use
struct strbuf and xgetcwd() instead of a PATH_MAX-sized buffer,
which can be too small on some file systems.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use xgetcwd() to set $GIT_DIRRené Scharfe Mon, 28 Jul 2014 18:31:57 +0000 (20:31 +0200)

use xgetcwd() to set $GIT_DIR

Instead of dying of a segmentation fault if getcwd() returns NULL, use
xgetcwd() to make sure to write a useful error message and then exit
in an orderly fashion.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use xgetcwd() to get the current directory or dieRené Scharfe Mon, 28 Jul 2014 18:30:39 +0000 (20:30 +0200)

use xgetcwd() to get the current directory or die

Convert several calls of getcwd() and die() to use xgetcwd() instead.
This way we get rid of fixed-size buffers (which can be too small
depending on the used file system) and gain consistent error messages.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wrapper: add xgetcwd()René Scharfe Mon, 28 Jul 2014 18:29:50 +0000 (20:29 +0200)

wrapper: add xgetcwd()

Add the helper function xgetcwd(), which returns the current directory
or dies. The returned string has to be free()d after use.

Helped-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

abspath: convert real_path_internal() to strbufRené Scharfe Mon, 28 Jul 2014 18:28:30 +0000 (20:28 +0200)

abspath: convert real_path_internal() to strbuf

Use strbuf instead of fixed-sized buffers in real_path() in order to
avoid the size limitations of the latter.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

abspath: use strbuf_getcwd() to remember original worki... René Scharfe Mon, 28 Jul 2014 18:27:34 +0000 (20:27 +0200)

abspath: use strbuf_getcwd() to remember original working directory

Store the original working directory in a strbuf instead of in a
fixed-sized buffer, in order to be able to handle longer paths.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

setup: convert setup_git_directory_gently_1 et al.... René Scharfe Mon, 28 Jul 2014 18:26:40 +0000 (20:26 +0200)

setup: convert setup_git_directory_gently_1 et al. to strbuf

Convert setup_git_directory_gently_1() and its helper functions
setup_explicit_git_dir(), setup_discovered_git_dir() and
setup_bare_git_dir() to use a struct strbuf to hold the current working
directory. Replacing the PATH_MAX-sized buffer used before removes a
path length limition on some file systems. The functions are converted
all in one go because they all read and write the variable cwd.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

log-tree: make name_decoration hash staticJeff King Tue, 26 Aug 2014 10:23:54 +0000 (06:23 -0400)

log-tree: make name_decoration hash static

In the previous commit, we made add_name_decoration global
so that adders would not have to access the hash directly.
We now make the hash itself static so that callers _have_ to
add through our function, making sure that all additions go
through a single point. To do this, we have to add one more
accessor function: a way to lookup entries in the hash.

Since the only caller doesn't actually look at the returned
value, but rather only asks whether there is a decoration or
not, we could provide only a boolean "has_name_decoration".
That would allow us to make "struct name_decoration" local
to log-tree, as well.

However, it's unlikely to cause any maintainability harm
making the actual data public, and this interface is more
flexible if we need to look at decorations from other parts
of the code in the future.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

log-tree: make add_name_decoration a public functionJeff King Tue, 26 Aug 2014 10:23:36 +0000 (06:23 -0400)

log-tree: make add_name_decoration a public function

The log-tree code keeps a "struct decoration" hash to show
text decorations for each commit during log traversals. It
makes this available to other files by providing global
access to the hash. This can result in other code adding
entries that do not conform to what log-tree expects.

For example, the bisect code adds its own "dist"
decorations to be shown. Originally the bisect code was
correct, but when the name_decoration code grew a new field
in eb3005e (commit.h: add 'type' to struct name_decoration,
2010-06-19), the bisect code was not updated. As a result,
the log-tree code can access uninitialized memory and even
segfault.

We can fix this by making name_decoration's adding function
public. If all callers use it, then any changes to struct
initialization only need to happen in one place (and because
the members come in as parameters, the compiler can notice a
caller who does not supply enough information).

As a bonus, this also means that the decoration hashes
created by the bisect code will use less memory (previously
we over-allocated space for the distance integer, but now we
format it into a temporary buffer and copy it to the final
flex-array).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

imap-send: create target mailbox if it is missingTony Finch Fri, 1 Aug 2014 08:15:52 +0000 (09:15 +0100)

imap-send: create target mailbox if it is missing

Some MUAs delete their "drafts" folder when it is empty, so
git imap-send should be able to create it if necessary.

This change checks that the folder exists immediately after
login and tries to create it if it is missing.

There was some vestigial code to handle a [TRYCREATE] response
from the server when an APPEND target is missing. However this
code never ran (the create and trycreate flags were never set)
and when I tried to make it run I found that the code had already
thrown away the contents of the message it was trying to append.

Signed-off-by: Tony Finch <dot@dotat.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

checkout -m: attempt merge when deletion of path was... Jonathan Nieder Wed, 13 Aug 2014 00:03:18 +0000 (17:03 -0700)

checkout -m: attempt merge when deletion of path was staged

twoway_merge() is missing an o->gently check in the case where a file
that needs to be modified is missing from the index but present in the
old and new trees. As a result, in this case 'git checkout -m' errors
out instead of trying to perform a merge.

Fix it by checking o->gently. While at it, inline the o->gently check
into reject_merge to prevent future call sites from making the same
mistake.

Noticed by code inspection. The test for the motivating case was
added by JC.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge git://github.com/git-l10n/git-poJunio C Hamano Mon, 25 Aug 2014 22:12:58 +0000 (15:12 -0700)

Merge git://github.com/git-l10n/git-po

* git://github.com/git-l10n/git-po:
l10n: de.po: improve message when switching branches
l10n: de.po: fix typo
po/TEAMS: Add Catalan team
l10n: Add Catalan translation
l10n: fr.po (2257t) update for version 2.1.0
l10n: sv.po: Update Swedish translation (2257t0f0u)
l10n: vi.po (2257t): Update translation
l10n: Updated Bulgarian translation of git (2257t,0f,0u)
l10n: zh_CN: translations for git v2.1.0-rc0
l10n: git.pot: v2.1.0 round 1 (38 new, 9 removed)
l10n: Updated Bulgarian translation of git (2247t,0f,0u)
l10n: Updated Bulgarian translation of git (2228t,0f,0u)
l10n: Fix more typos in the Swedish translations

Makefile: use `find` to determine static header depende... Jeff King Mon, 25 Aug 2014 20:00:42 +0000 (16:00 -0400)

Makefile: use `find` to determine static header dependencies

Most modern platforms will use automatically computed header
dependencies to figure out when a C file needs rebuilt due
to a header changing. With old compilers, however, we
fallback to a static list of header files. If any of them
changes, we recompile everything. This is overly
conservative, but the best we can do on older platforms.

It is unfortunately easy for our static header list to grow
stale, as none of the regular developers make use of it.
Instead of trying to keep it up to date, let's invoke "find"
to generate the list dynamically.

Since we do not use the value $(LIB_H) unless either
COMPUTE_HEADER_DEPENDENCIES is turned on or the user is
building "po/git.pot" (where it comes in via $(LOCALIZED_C),
make is smart enough to not even run this "find" in most
cases. However, we do need to stop using the "immediate"
variable assignment ":=" for $(LOCALIZED_C). That's OK,
because it was not otherwise useful here.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: treat "make pot" as an explicitly-invoked targetJonathan Nieder Fri, 22 Aug 2014 04:32:08 +0000 (00:32 -0400)

i18n: treat "make pot" as an explicitly-invoked target

po/git.pot is normally used as-is and not regenerated by people
building git, so it is okay if an explicit "make po/git.pot" always
automatically regenerates it. Depend on the magic FORCE target
instead of explicitly keeping track of dependencies.

This simplifies the makefile, in particular preparing for a moment
when $(LIB_H), which is part of $(LOCALIZED_C), can be computed on the
fly. It also fixes a slight breakage in which changes to perl and shell
scripts did not trigger a rebuild of po/git.pot.

We still need a dependency on GENERATED_H, to force those files to be
built when regenerating git.pot.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-prompt: do not look for refs/stash in $GIT_DIRJeff King Sat, 23 Aug 2014 05:26:51 +0000 (01:26 -0400)

git-prompt: do not look for refs/stash in $GIT_DIR

Since dd0b72c (bash prompt: use bash builtins to check stash
state, 2011-04-01), git-prompt checks whether we have a
stash by looking for $GIT_DIR/refs/stash. Generally external
programs should never do this, because they would miss
packed-refs.

That commit claims that packed-refs does not pack
refs/stash, but that is not quite true. It does pack the
ref, but due to a bug, fails to prune the ref. When we fix
that bug, we would want to be doing the right thing here.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-import: fix buffer overflow in dump_tagsJeff King Sat, 23 Aug 2014 05:32:37 +0000 (01:32 -0400)

fast-import: fix buffer overflow in dump_tags

When creating a new annotated tag, we sprintf the refname
into a static-sized buffer. If we have an absurdly long
tagname, like:

git init repo &&
cd repo &&
git commit --allow-empty -m foo &&
git tag -m message mytag &&
git fast-export mytag |
perl -lpe '/^tag/ and s/mytag/"a" x 8192/e' |
git fast-import <input

we'll overflow the buffer. We can fix it by using a strbuf.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-import: clean up pack_data pointer in end_packfileJeff King Sat, 23 Aug 2014 05:27:41 +0000 (01:27 -0400)

fast-import: clean up pack_data pointer in end_packfile

We have a global pointer pack_data pointing to the current
pack we have open. Inside end_packfile we have two new
pointers, old_p and new_p. The latter points to pack_data,
and the former points to the new "installed" version of the
packfile we get when we hand the file off to the regular
sha1_file machinery. When then free old_p.

Presumably the extra old_p pointer was there so that we
could overwrite pack_data with new_p and still free old_p,
but we don't do that. We just leave pack_data pointing to
bogus memory, and don't overwrite it until we call
start_packfile again (if ever).

This can cause problems for our die routine, which calls
end_packfile to clean things up. If we die at the wrong
moment, we can end up looking at invalid memory in
pack_data left after the last end_packfile().

Instead, let's make sure we set pack_data to NULL after we
free it, and make calling endfile() again with a NULL
pack_data a noop (there is nothing to end).

We can further make things less confusing by dropping old_p
entirely, and moving new_p closer to its point of use.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack-refs: prune top-level refs like "refs/foo"Jeff King Sat, 23 Aug 2014 05:27:07 +0000 (01:27 -0400)

pack-refs: prune top-level refs like "refs/foo"

After we have packed all refs, we prune any loose refs that
correspond to what we packed. We do so by first taking a
lock with lock_ref_sha1, and then deleting the loose ref
file.

However, lock_ref_sha1 will refuse to take a lock on any
refs that exist at the top-level of the "refs/" directory,
and we skip pruning the ref. This is almost certainly not
what we want to happen here. The criteria to be pruned
should not differ from that to be packed; if a ref makes it
to prune_ref, it's because we want it both packed and
pruned (if there are refs you do not want to be packed, they
should be omitted much earlier by pack_ref_is_possible,
which we do in this case if --all is not given).

We can fix this by switching to lock_any_ref_for_update.
This behaves exactly the same with the exception of this
top-level check.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

walker: avoid quadratic list insertion in mark_completeRené Scharfe Thu, 21 Aug 2014 18:30:24 +0000 (20:30 +0200)

walker: avoid quadratic list insertion in mark_complete

Similar to 16445242 (fetch-pack: avoid quadratic list insertion in
mark_complete), sort only after all refs are collected instead of while
inserting. The result is the same, but it's more efficient that way.
The difference will only be measurable in repositories with a large
number of refs.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_name: avoid quadratic list insertion in handle_one_refRené Scharfe Thu, 21 Aug 2014 18:30:29 +0000 (20:30 +0200)

sha1_name: avoid quadratic list insertion in handle_one_ref

Similar to 16445242 (fetch-pack: avoid quadratic list insertion in
mark_complete), sort only after all refs are collected instead of while
inserting. The result is the same, but it's more efficient that way.
The difference will only be measurable in repositories with a large
number of refs.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: de.po: improve message when switching branchesRalf Thielow Thu, 12 Jun 2014 18:15:55 +0000 (20:15 +0200)

l10n: de.po: improve message when switching branches

Suggested-by: Stefan Beller <stefanbeller@gmail.com>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>

l10n: de.po: fix typoRalf Thielow Wed, 11 Jun 2014 16:10:45 +0000 (18:10 +0200)

l10n: de.po: fix typo

Reported-by: Hartmut Henkel
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>

po/TEAMS: Add Catalan teamAlex Henrie Sat, 23 Aug 2014 02:10:30 +0000 (20:10 -0600)

po/TEAMS: Add Catalan team

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>

l10n: Add Catalan translationAlex Henrie Sat, 23 Aug 2014 02:10:22 +0000 (20:10 -0600)

l10n: Add Catalan translation

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>

upload-pack: keep poll(2)'s timeout to -1Edward Thomson Fri, 22 Aug 2014 15:19:11 +0000 (15:19 +0000)

upload-pack: keep poll(2)'s timeout to -1

Keep poll's timeout at -1 when uploadpack.keepalive = 0, instead of
setting it to -1000, since some pedantic old systems (eg HP-UX) and
the gnulib compat/poll will treat only -1 as the valid value for
an infinite timeout.

Signed-off-by: Edward Thomson <ethomson@microsoft.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pretty: note that %cd respects the --date= optionThomas Braun Wed, 20 Aug 2014 12:27:10 +0000 (14:27 +0200)

pretty: note that %cd respects the --date= option

Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http: style fixes for curl_multi_init error checkJeff King Sun, 17 Aug 2014 07:35:53 +0000 (03:35 -0400)

http: style fixes for curl_multi_init error check

Unless there is a good reason, we should use die() rather than
fprintf/exit. We can also shorten the message to match other curl init
failures (and match our usual lowercase no-full-stop style).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

intersect_paths: respect mode in git's tree-sortJeff King Wed, 20 Aug 2014 02:14:30 +0000 (22:14 -0400)

intersect_paths: respect mode in git's tree-sort

When we do a combined diff, we individually diff against
each parent, and then use intersect_paths to do a parallel
walk through the sorted results and come up with a final
list of interesting paths.

The sort order here is that returned by the diffs, which
means it is in git's tree-order which sorts sub-trees as if
their paths have "/" at the end. When we do our parallel
walk, we need to use a comparison function which provides
the same order.

Since 8518ff8 (combine-diff: optimize combine_diff_path sets
intersection, 2014-01-20), we use a simple strcmp to
compare the pathnames, and get this wrong. It's somewhat
hard to trigger because normally a diff does not produce
tree entries at all, and therefore the sort order is the
same as a strcmp. However, if the "-t" option is used with
the diff, then we will produce diff_filepairs for both trees
and files.

We can use base_name_compare to do the comparison, just as
the tree-diff code does. Even though what we have are not
technically base names (they are full paths within the
tree), the end result is the same (we do not care about
interior slashes at all, only about the final character).

However, since we do not have the length of each path
stored, we take a slight shortcut: if neither of the entries
is a sub-tree then the comparison is equivalent to a strcmp.
This lets us skip the extra strlen calls in the common case
without having to reimplement base_name_compare from
scratch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

imap-send.c: imap_folder -> imap_server_conf.folderBernhard Reiter Tue, 19 Aug 2014 21:27:11 +0000 (23:27 +0200)

imap-send.c: imap_folder -> imap_server_conf.folder

Rename the imap_folder variable to folder and make it a member
of struct imap_server_conf.

Signed-off-by: Bernhard Reiter <ockham@raz.or.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

run-command: inline prepare_run_command_v_opt()René Scharfe Tue, 19 Aug 2014 19:11:43 +0000 (21:11 +0200)

run-command: inline prepare_run_command_v_opt()

Merge prepare_run_command_v_opt() and its only caller. This removes a
pointer indirection and allows to initialize the struct child_process
using CHILD_PROCESS_INIT.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

run-command: call run_command_v_opt_cd_env() instead... René Scharfe Tue, 19 Aug 2014 19:11:00 +0000 (21:11 +0200)

run-command: call run_command_v_opt_cd_env() instead of duplicating it

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

run-command: introduce child_process_init()René Scharfe Tue, 19 Aug 2014 19:10:48 +0000 (21:10 +0200)

run-command: introduce child_process_init()

Add a helper function for initializing those struct child_process
variables for which the macro CHILD_PROCESS_INIT can't be used.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

run-command: introduce CHILD_PROCESS_INITRené Scharfe Tue, 19 Aug 2014 19:09:35 +0000 (21:09 +0200)

run-command: introduce CHILD_PROCESS_INIT

Most struct child_process variables are cleared using memset first after
declaration. Provide a macro, CHILD_PROCESS_INIT, that can be used to
initialize them statically instead. That's shorter, doesn't require a
function call and is slightly more readable (especially given that we
already have STRBUF_INIT, ARGV_ARRAY_INIT etc.).

Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: make perf tests optional for profile buildJeff King Tue, 19 Aug 2014 06:12:03 +0000 (02:12 -0400)

Makefile: make perf tests optional for profile build

The perf tests need a repository to operate on; if none is
defined, we fall back to the repository containing our build
directory. That fails, though, for an exported tarball of
git.git, which has no repository.

Since 5d7fd6d we run the perf tests as part of "make
profile". Therefore "make profile" fails out of the box on
released tarballs of v2.1.0.

We can fix this by making the perf tests optional; if they
are skipped, we still run the regular test suite, which
should give a lot of profile data (and is what we used to do
prior to 5d7fd6d anyway).

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

make config --add behave correctly for empty and NULL... Tanay Abhra Mon, 18 Aug 2014 10:17:57 +0000 (03:17 -0700)

make config --add behave correctly for empty and NULL values

Currently if we have a config file like,
[foo]
baz
bar =

and we try something like, "git config --add foo.baz roll", Git will
segfault. Moreover, for "git config --add foo.bar roll", it will
overwrite the original value instead of appending after the existing
empty value.

The problem lies with the regexp used for simulating --add in
`git_config_set_multivar_in_file()`, "^$", which in ideal case should
not match with any string but is true for empty strings. Instead use a
regexp like "a^" which can not be true for any string, empty or not.

For removing the segfault add a check for NULL values in `matches()` in
config.c.

Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

subtree: make "all" default target of MakefileJeff King Sun, 17 Aug 2014 07:07:32 +0000 (03:07 -0400)

subtree: make "all" default target of Makefile

You should be able to run "make" in contrib/subtree with no
arguments and get the "all" target. This was broken by 8e2a5cc
(contrib/subtree/Makefile: use GIT-VERSION-FILE, 2014-05-06), which
put the rule for GIT-VERSION-FILE higher in the file.

We can fix this by putting an empty "all::" target at the top of the
file, just like our main Makefile does, and document that fact.
That fixes this instance and future-proofs against it happening
again.

Reported-by: Jack Nagel <jacknagel@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: shortcut for diff'ing two binary SHA-1 objectsNguyễn Thái Ngọc Duy Sat, 16 Aug 2014 03:08:06 +0000 (10:08 +0700)

diff: shortcut for diff'ing two binary SHA-1 objects

If we are given two SHA-1 and asked to determine if they are different
(but not _what_ differences), we know right away by comparing SHA-1.

A side effect of this patch is, because large files are marked binary,
diff-tree will not need to unpack them. 'diff-index --cached' will not
either. But 'diff-files' still does.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff --stat: mark any file larger than core.bigfilethre... Nguyễn Thái Ngọc Duy Sat, 16 Aug 2014 03:08:05 +0000 (10:08 +0700)

diff --stat: mark any file larger than core.bigfilethreshold binary

Too large files may lead to failure to allocate memory. If it happens
here, it could impact quite a few commands that involve
diff. Moreover, too large files are inefficient to compare anyway (and
most likely non-text), so mark them binary and skip looking at their
content.

Noticed-by: Dale R. Worley <worley@alum.mit.edu>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff.c: allow to pass more flags to diff_populate_filespecNguyễn Thái Ngọc Duy Sat, 16 Aug 2014 03:08:04 +0000 (10:08 +0700)

diff.c: allow to pass more flags to diff_populate_filespec

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file.c: do not die failing to malloc in unpack_com... Nguyễn Thái Ngọc Duy Sat, 16 Aug 2014 03:08:03 +0000 (10:08 +0700)

sha1_file.c: do not die failing to malloc in unpack_compressed_entry

Fewer die() gives better control to the caller, provided that the
caller _can_ handle it. And in unpack_compressed_entry() case, it can,
because unpack_compressed_entry() already returns NULL if it fails to
inflate data.

A side effect from this is fsck continues to run when very large blobs
are present (and do not fit in memory).

Noticed-by: Dale R. Worley <worley@alum.mit.edu>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wrapper.c: introduce gentle xmallocz that does not... Nguyễn Thái Ngọc Duy Sat, 16 Aug 2014 03:08:02 +0000 (10:08 +0700)

wrapper.c: introduce gentle xmallocz that does not die()

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fetch: silence git-gc if --quiet is givenNguyễn Thái Ngọc Duy Sat, 16 Aug 2014 01:19:28 +0000 (08:19 +0700)

fetch: silence git-gc if --quiet is given

Noticed-by: Matthew Flaschen <mflaschen@wikimedia.org>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fetch: convert argv_gc_auto to struct argv_arrayNguyễn Thái Ngọc Duy Sat, 16 Aug 2014 01:19:27 +0000 (08:19 +0700)

fetch: convert argv_gc_auto to struct argv_array

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>