]> asedeno.scripts.mit.edu Git - git.git/log
git.git
15 years agoSimplify some instances of run_command() by using run_command_v_opt().
Johannes Sixt [Mon, 8 Jun 2009 20:34:29 +0000 (22:34 +0200)]
Simplify some instances of run_command() by using run_command_v_opt().

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoshow-branch: don't use LASTARG_DEFAULT with OPTARG
Stephen Boyd [Sun, 7 Jun 2009 23:39:15 +0000 (16:39 -0700)]
show-branch: don't use LASTARG_DEFAULT with OPTARG

5734365 (show-branch: migrate to parse-options API 2009-05-21)
incorrectly set the --more option's flags to be
PARSE_OPT_LASTARG_DEFAULT and PARSE_OPT_OPTARG. These two flags
shouldn't be used together. An option taking a default should just set
the default value desired and parse options will take care of the rest.

Update the header comment to better convey this information.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Acked-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosend-email: use UTF-8 rather than utf-8 for consistency
Brandon Casey [Sun, 7 Jun 2009 01:12:31 +0000 (20:12 -0500)]
send-email: use UTF-8 rather than utf-8 for consistency

The rest of the git source has been converted to use upper-case character
encoding names to assist older platforms.  The charset attribute of MIME
is defined to be case-insensitive, but older platforms may still have an
easier time dealing with upper-case rather than lower-case.  So do so for
send-email too.

Update t9001 to handle the changes.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-send-email.perl: improve detection of MIME encoded-words
Brandon Casey [Mon, 8 Jun 2009 00:25:58 +0000 (19:25 -0500)]
git-send-email.perl: improve detection of MIME encoded-words

According to rfc2047, an encoded word has the following form:

   encoded-word = "=?" charset "?" encoding "?" encoded-text "?="

   charset = token

   encoding = token

   token = <Any CHAR except SPACE, CTLs, and especials>

   especials = "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "
               <"> / "/" / "[" / "]" / "?" / "." / "="

   encoded-text = <Any printable ASCII character other than "?"
                     or SPACE>

And rfc822 defines CHARs and CTLs as:

    CHAR = <any ASCII character> ; (  0-177,  0.-127.)

    CTL = <any ASCII control     ; (  0- 37,  0.- 31.)
           character and DEL>    ; (    177,     127.)

The original code only detected rfc2047 encoded strings when the charset
was UTF-8.  This patch generalizes the matching expression and breaks the
check for an rfc2047 encoded string into its own function.  There's no real
functional change, since any properly rfc2047 encoded string would have
fallen through the remaining 'if' statements and been returned unchanged.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff.c: plug a memory leak in an error path
Johannes Sixt [Mon, 8 Jun 2009 20:34:30 +0000 (22:34 +0200)]
diff.c: plug a memory leak in an error path

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofetch-pack: close output channel after sideband demultiplexer terminates
Johannes Sixt [Mon, 8 Jun 2009 08:51:22 +0000 (10:51 +0200)]
fetch-pack: close output channel after sideband demultiplexer terminates

fetch-pack runs the sideband demultiplexer using start_async(). This
facility requires that the asynchronously executed function closes the
output file descriptor (see Documentation/technical/api-run-command.txt).
But the sideband demultiplexer did not do that. This fixes it.

In certain error situations this could lock up a fetch operation on
Windows because the asynchronous function is run in a thread; by not
closing the output fd the reading end never got EOF and waited for more
data indefinitely. On Unix this is not a problem because the asynchronous
function is run in a separate process, which exits after the function ends
and so implicitly closes the output.

Since the pack that is sent over the wire encodes the number of objects in
the stream, during normal operation the reading end knows when the stream
ends and terminates by itself, and does not lock up.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofix handling of iconv configuration options
Marco Nelissen [Tue, 9 Jun 2009 03:46:38 +0000 (20:46 -0700)]
fix handling of iconv configuration options

Fix the way in which the configure script handles --without-iconv
(and --with-iconv=no), which it  used to essentially ignore.
Also fix the way the configure script determines the value of
NEEDS_LIBICONV, which would be incorrectly set to 'YesPlease' on
systems that lack iconv entirely.

Signed-off-by: Marco Nelissen <marcone@xs4all.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-compat-util.h: avoid using c99 flex array feature with Sun compiler 5.8
Brandon Casey [Mon, 8 Jun 2009 23:53:48 +0000 (18:53 -0500)]
git-compat-util.h: avoid using c99 flex array feature with Sun compiler 5.8

The Sun c99 compiler as recent as version 5.8 Patch 121016-06 2007/08/01
produces an error when compiling diff-delta.c.  This source file #includes
the delta.h header file which pre-declares a struct which is later defined
to contain a flex array member.  The Sun c99 compiler fails to compile
diff-delta.c and gives the following error:

  "diff-delta.c", line 314: identifier redeclared: create_delta
          current : function(pointer to const struct delta_index {unsigned long memsize, pointer to const void src_buf, unsigned long src_size, unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash}, pointer to const void, unsigned long, pointer to unsigned long, unsigned long) returning pointer to void
          previous: function(pointer to const struct delta_index {unsigned long memsize, pointer to const void src_buf, unsigned long src_size, unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash}, pointer to const void, unsigned long, pointer to unsigned long, unsigned long) returning pointer to void : "delta.h", line 44
  c99: acomp failed for diff-delta.c

So, avoid using this c99 feature when compiling with the Sun c compilers
version 5.8 and older (the most recent version tested).

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: Make "remote show" display all urls
Michael J Gruber [Sat, 6 Jun 2009 15:16:30 +0000 (17:16 +0200)]
builtin-remote: Make "remote show" display all urls

Currently, "git remote -v" lists all urls whereas "git remote show
$remote" shows only the first. Make it so that both show all.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMinGW: Teach Makefile to detect msysgit and apply specific settings
Steffen Prohaska [Sun, 31 May 2009 16:15:25 +0000 (18:15 +0200)]
MinGW: Teach Makefile to detect msysgit and apply specific settings

This commit changes handling of the msysgit specific settings, so
that they can be applied to official git.git.  Some msysgit
settings differ from the standard MinGW settings.  We move them
into an ifndef block that is only evaluated if a file
THIS_IS_MSYSGIT is present in the parent directory, which is the
case for an msysgit working environment.  The tag file is unlikely
to be present accidentally.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix warnings in nedmalloc when compiling with GCC 4.4.0
Johannes Schindelin [Mon, 8 Jun 2009 14:46:49 +0000 (16:46 +0200)]
Fix warnings in nedmalloc when compiling with GCC 4.4.0

Nedmalloc's source code has a cute #define construct to avoid inserting
an if() statement, because that might interact badly with enclosing if()
statements.  However, GCC > 4 complains with a "warning: value computed
is not used".  So we cast the result to "void".

GCC also does not understand the Visual C++ specific pragmas, so we need
to disable them for MinGW.

We need to include malloc.h on Windows even if we happen to compile the
stuff as a MinGW program.  Otherwise the function declaration of alloca()
is missing.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosymlinks.c: small style cleanup
Kjetil Barvik [Sun, 7 Jun 2009 11:33:05 +0000 (13:33 +0200)]
symlinks.c: small style cleanup

Add {}-braces around an else-part, where the if-part already has
{}-braces.

And, also remove some unnecessary "return;"-statements at the end of
"void foo()"-functions.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: test-parse-options depends on parse-options.h
Junio C Hamano [Sun, 7 Jun 2009 08:34:51 +0000 (01:34 -0700)]
Makefile: test-parse-options depends on parse-options.h

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Sun, 7 Jun 2009 06:49:28 +0000 (23:49 -0700)]
Merge branch 'maint'

* maint:
  Documentation: refer to gitworkflows(7) from tutorial and git(1)
  daemon: Strictly parse the "extra arg" part of the command

15 years agoDocumentation: refer to gitworkflows(7) from tutorial and git(1)
Thomas Rast [Sat, 6 Jun 2009 13:11:07 +0000 (15:11 +0200)]
Documentation: refer to gitworkflows(7) from tutorial and git(1)

Add references to the gitworkflows(7) manpage added in f948dd8
(Documentation: add manpage about workflows, 2008-10-19) to both
gittutorial(1) and git(1), so that new users might actually discover
and read it.

Noticed by Randal L. Schwartz.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodaemon: Strictly parse the "extra arg" part of the command
Shawn O. Pearce [Fri, 5 Jun 2009 01:33:32 +0000 (18:33 -0700)]
daemon: Strictly parse the "extra arg" part of the command

Since 1.4.4.5 (49ba83fb67 "Add virtualization support to git-daemon")
git daemon enters an infinite loop and never terminates if a client
hides any extra arguments in the initial request line which is not
exactly "\0host=blah\0".

Since that change, a client must never insert additional extra
arguments, or attempt to use any argument other than "host=", as
any daemon will get stuck parsing the request line and will never
complete the request.

Since the client can't tell if the daemon is patched or not, it
is not possible to know if additional extra args might actually be
able to be safely requested.

If we ever need to extend the git daemon protocol to support a new
feature, we may have to do something like this to the exchange:

  # If both support git:// v2
  #
  C: 000cgit://v2
  S: 0010ok host user
  C: 0018host git.kernel.org
  C: 0027git-upload-pack /pub/linux-2.6.git
  S: ...git-upload-pack header...

  # If client supports git:// v2, server does not:
  #
  C: 000cgit://v2
  S: <EOF>

  C: 003bgit-upload-pack /pub/linux-2.6.git\0host=git.kernel.org\0
  S: ...git-upload-pack header...

This requires the client to create two TCP connections to talk to
an older git daemon, however all daemons since the introduction of
daemon.c will safely reject the unknown "git://v2" command request,
so the client can quite easily determine the server supports an
older protocol.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoparse-options: simplify usage argh handling
Stephen Boyd [Thu, 4 Jun 2009 23:43:57 +0000 (16:43 -0700)]
parse-options: simplify usage argh handling

Simplify the argh printing by simply calling usage_argh() if the option
can take an argument. Update macros defined in parse-options.h to set
the PARSE_OPT_NOARG flag.

The only other user of custom non-argument taking options is git-apply
(in this case OPTION_BOOLEAN for deprecated options). Update it to set
the PARSE_OPT_NOARG flag.

Thanks to Ren辿 Scharfe for the suggestion and starter patch.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Reviewd-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoparse-options: make OPT_INTEGER's argh explicit
Stephen Boyd [Thu, 4 Jun 2009 23:43:56 +0000 (16:43 -0700)]
parse-options: make OPT_INTEGER's argh explicit

OPTION_INTEGER hardcodes its argh member to be "n", but the decision is
hidden deep in usage_with_options_internal(). Make "n" the default argh
for the OPT_INTEGER macro while leaving it undecided for the OPTION_INTEGER
enum.

This makes it less surprising to users that argh is "n" when using the
OPT_INTEGER macro.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Reviewed-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: add section for SunOS 5.7
Brandon Casey [Fri, 5 Jun 2009 23:36:16 +0000 (18:36 -0500)]
Makefile: add section for SunOS 5.7

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: introduce SANE_TOOL_PATH for prepending required elements to PATH
Junio C Hamano [Fri, 5 Jun 2009 23:36:15 +0000 (18:36 -0500)]
Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH

Some platforms (like SunOS and family) have kept their common binaries at
some historical moment in time, and introduced new binaries with modern
features in a special location like /usr/xpg4/bin or /usr/ucb.  Some of the
features provided by these modern binaries are expected and required by git.
If the featureful binaries are not in the users path, then git could end up
using the less featureful binary and fail.

So provide a mechanism to prepend elements to the users PATH at runtime so
the modern binaries will be found.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: define __sun__ on SunOS
Brandon Casey [Fri, 5 Jun 2009 23:36:14 +0000 (18:36 -0500)]
Makefile: define __sun__ on SunOS

The SUNWspro compiler does not define __sun__ (like GCC does).  A check of
this macro was recently added to detect compilation on SunOS and to modify
the handling of the NO_ICONV and _XOPEN_SOURCE feature macros.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-compat-util.h: tweak the way _XOPEN_SOURCE is set on Solaris
Brandon Casey [Fri, 5 Jun 2009 23:36:13 +0000 (18:36 -0500)]
git-compat-util.h: tweak the way _XOPEN_SOURCE is set on Solaris

On Solaris, when _XOPEN_EXTENDED is set, its header file forces the
programs to be XPG4v2, defeating any _XOPEN_SOURCE setting to say we are
XPG5 or XPG6.  Also on Solaris, XPG6 programs must be compiled with a c99
compiler, while non XPG6 programs must be compiled with a pre-c99 compiler.

So when compiling on Solaris, always refrain from setting _XOPEN_EXTENDED,
and then set _XOPEN_SOURCE to 600 or 500 based on whether a c99 compiler
is being used or not.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoOn Solaris choose the OLD_ICONV iconv() declaration based on the UNIX spec
Brandon Casey [Fri, 5 Jun 2009 23:36:12 +0000 (18:36 -0500)]
On Solaris choose the OLD_ICONV iconv() declaration based on the UNIX spec

OLD_ICONV is only necessary on Solaris until UNIX03.  This is indicated
by the private macro _XPG6 which is set in /usr/include/sys/feature_tests.h.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments
Brandon Casey [Fri, 5 Jun 2009 23:36:10 +0000 (18:36 -0500)]
Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments

This library is required on Solaris when compiling with NO_IPV6 since
hstrerror resides in libresolv.  Additionally, Solaris 7 will need it,
since inet_ntop and inet_pton reside there too.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot6030: test skipping away from an already skipped commit
Christian Couder [Sat, 6 Jun 2009 04:41:35 +0000 (06:41 +0200)]
t6030: test skipping away from an already skipped commit

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobisect: when skipping, choose a commit away from a skipped commit
Christian Couder [Sat, 6 Jun 2009 04:41:34 +0000 (06:41 +0200)]
bisect: when skipping, choose a commit away from a skipped commit

To do that a new function "apply_skip_ratio" is added and another
function "managed_skipped" is created to wrap both "filter_skipped"
and the previous one.

In "managed_skipped" we detect when we should choose a commit away
from a skipped one and then we automatically choose a skip ratio
to pass to "apply_skip_ratio".

The ratio is choosen so that it alternates between 1/5, 2/5 and
3/5.

In "apply_skip_ratio", we ignore a given ratio of all the commits
that could be tested.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobisect: add parameters to "filter_skipped"
Christian Couder [Sat, 6 Jun 2009 04:41:33 +0000 (06:41 +0200)]
bisect: add parameters to "filter_skipped"

because we will need to get more information from this function in
some later patches.

The new "int *count" parameter gives the number of commits left after
the skipped commit have been filtered out.

The new "int *skipped_first" parameter tells us if the first commit
in the list has been skipped. Note that using this parameter also
changes the behavior of the function if the first commit is indeed
skipped. Because we assume that in this case we will want all the
filtered commits, not just the first one, even if "show_all" is not
set.

So using a not NULL "skipped_first" parameter really means that we
plan to choose to test another commit than the first non skipped
one if the first commit in the list is skipped. That in turn means
that, in case the first commit is skipped, we have to return a
fully filtered list.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp*: add helper methods for fetching objects (loose)
Tay Ray Chuan [Sat, 6 Jun 2009 08:44:02 +0000 (16:44 +0800)]
http*: add helper methods for fetching objects (loose)

The code handling the fetching of loose objects in http-push.c and
http-walker.c have been refactored into new methods and a new struct
(object_http_request) in http.c. They are not meant to be invoked
elsewhere.

The new methods in http.c are
 - new_http_object_request
 - process_http_object_request
 - finish_http_object_request
 - abort_http_object_request
 - release_http_object_request

and the new struct is http_object_request.

RANGER_HEADER_SIZE and no_pragma_header is no longer made available
outside of http.c, since after the above changes, there are no other
instances of usage outside of http.c.

Remove members of the transfer_request struct in http-push.c and
http-walker.c, including filename, real_sha1 and zret, as they are used
no longer used.

Move the methods append_remote_object_url() and get_remote_object_url()
from http-push.c to http.c. Additionally, get_remote_object_url() is no
longer defined only when USE_CURL_MULTI is defined, since
non-USE_CURL_MULTI code in http.c uses it (namely, in
new_http_object_request()).

Refactor code from http-push.c::start_fetch_loose() and
http-walker.c::start_object_fetch_request() that deals with the details
of coming up with the filename to store the retrieved object, resuming
a previously aborted request, and making a new curl request, into a new
function, new_http_object_request().

Refactor code from http-walker.c::process_object_request() into the
function, process_http_object_request().

Refactor code from http-push.c::finish_request() and
http-walker.c::finish_object_request() into a new function,
finish_http_object_request(). It returns the result of the
move_temp_to_file() invocation.

Add a function, release_http_object_request(), which cleans up object
request data. http-push.c and http-walker.c invoke this function
separately; http-push.c::release_request() and
http-walker.c::release_object_request() do not invoke this function.

Add a function, abort_http_object_request(), which unlink()s the object
file and invokes release_http_object_request(). Update
http-walker.c::abort_object_request() to use this.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp*: add helper methods for fetching packs
Tay Ray Chuan [Sat, 6 Jun 2009 08:44:01 +0000 (16:44 +0800)]
http*: add helper methods for fetching packs

The code handling the fetching of packs in http-push.c and
http-walker.c have been refactored into new methods and a new struct
(http_pack_request) in http.c. They are not meant to be invoked
elsewhere.

The new methods in http.c are
 - new_http_pack_request
 - finish_http_pack_request
 - release_http_pack_request

and the new struct is http_pack_request.

Add a function, new_http_pack_request(), that deals with the details of
coming up with the filename to store the retrieved packfile, resuming a
previously aborted request, and making a new curl request. Update
http-push.c::start_fetch_packed() and http-walker.c::fetch_pack() to
use this.

Add a function, finish_http_pack_request(), that deals with renaming
the pack, advancing the pack list, and installing the pack. Update
http-push.c::finish_request() and http-walker.c::fetch_pack to use
this.

Update release_request() in http-push.c and http-walker.c to invoke
release_http_pack_request() to clean up pack request helper data.

The local_stream member of the transfer_request struct in http-push.c
has been removed, as the packfile pointer will be managed in the struct
http_pack_request.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp: use new http API in fetch_index()
Tay Ray Chuan [Sat, 6 Jun 2009 08:44:00 +0000 (16:44 +0800)]
http: use new http API in fetch_index()

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp*: add http_get_info_packs
Tay Ray Chuan [Sat, 6 Jun 2009 08:43:59 +0000 (16:43 +0800)]
http*: add http_get_info_packs

http-push.c and http-walker.c no longer have to use fetch_index or
setup_index; they simply need to use http_get_info_packs, a new http
method, in their fetch_indices implementations.

Move fetch_index() and rename to fetch_pack_index() in http.c; this
method is not meant to be used outside of http.c. It invokes
end_url_with_slash with base_url; apart from that change, the code is
identical.

Move setup_index() and rename to fetch_and_setup_pack_index() in
http.c; this method is not meant to be used outside of http.c.

Do not immediately set ret to 0 in http-walker.c::fetch_indices();
instead do it in the HTTP_MISSING_TARGET case, to make it clear that
the HTTP_OK and HTTP_MISSING_TARGET cases both return 0.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp-push.c::fetch_symref(): use the new http API
Mike Hommey [Sat, 6 Jun 2009 08:43:58 +0000 (16:43 +0800)]
http-push.c::fetch_symref(): use the new http API

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp-push.c::remote_exists(): use the new http API
Mike Hommey [Sat, 6 Jun 2009 08:43:57 +0000 (16:43 +0800)]
http-push.c::remote_exists(): use the new http API

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp.c::http_fetch_ref(): use the new http API
Mike Hommey [Sat, 6 Jun 2009 08:43:55 +0000 (16:43 +0800)]
http.c::http_fetch_ref(): use the new http API

The error message ("Unable to start request") has been removed, since
the http API already prints it.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotransport.c::get_refs_via_curl(): use the new http API
Mike Hommey [Sat, 6 Jun 2009 08:43:54 +0000 (16:43 +0800)]
transport.c::get_refs_via_curl(): use the new http API

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp.c: new functions for the http API
Mike Hommey [Sat, 6 Jun 2009 08:43:53 +0000 (16:43 +0800)]
http.c: new functions for the http API

The new functions added are:
 - http_request() (internal function)
 - http_get_strbuf()
 - http_get_file()
 - http_error()

http_get_strbuf and http_get_file allow respectively to retrieve contents of
an URL to a strbuf or an opened file handle.

http_error prints out an error message containing the URL and the curl error
(in curl_errorstr).

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp: create function end_url_with_slash
Tay Ray Chuan [Sat, 6 Jun 2009 08:43:43 +0000 (16:43 +0800)]
http: create function end_url_with_slash

The logic to append a slash to the url if necessary in quote_ref_url
(added in 113106e "http.c: use strbuf API in quote_ref_url") has been
moved to a new function, end_url_with_slash.

The method takes a strbuf, the URL, and the path to be appended to the
URL. It first adds the URL to the strbuf. It then appends a slash
if the URL does not end with a slash.

The check on ref in quote_ref_url for a slash at the beginning has been
removed as a result of using end_url_with_slash. This check is not
needed, because slashes will be quoted anyway.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp*: move common variables and macros to http.[ch]
Tay Ray Chuan [Sat, 6 Jun 2009 08:43:41 +0000 (16:43 +0800)]
http*: move common variables and macros to http.[ch]

Move RANGE_HEADER_SIZE to http.h.

Create no_pragma_header, the curl header list containing the header
"Pragma:" in http.[ch]. It is allocated in http_init, and freed in
http_cleanup. This replaces the no_pragma_header in http-push.c, and
the no_pragma_header member in walker_data in http-walker.c.

Create http_is_verbose. It is to be used by methods in http.c, and is
modified at the entry points of http.c's users, namely http-push.c
(when parsing options) and http-walker.c (in get_http_walker).

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotransport.c::get_refs_via_curl(): do not leak refs_url
Mike Hommey [Sat, 6 Jun 2009 08:43:40 +0000 (16:43 +0800)]
transport.c::get_refs_via_curl(): do not leak refs_url

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDon't expect verify_pack() callers to set pack_size
Mike Hommey [Sun, 18 Jan 2009 08:04:26 +0000 (09:04 +0100)]
Don't expect verify_pack() callers to set pack_size

Since use_pack() will end up populating pack_size if it is not already set,
we can just adapt the code in verify_packfile() such that it doesn't require
pack_size to be set beforehand.

This allows callers not to have to set pack_size themselves, and we can thus
revert changes from 1c23d794 (Don't die in git-http-fetch when fetching packs).

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp-push: do not SEGV after fetching a bad pack idx file
Tay Ray Chuan [Sat, 6 Jun 2009 08:43:37 +0000 (16:43 +0800)]
http-push: do not SEGV after fetching a bad pack idx file

In a70c232 ("http-fetch: do not SEGV after fetching a bad pack idx
file"), changes were made to the setup_index method in http-fetch.c
(known in its present form as http-walker.c after 30ae764 ("Modularize
commit-walker")). Since http-push.c has similar similar code for
processing index files, these changes should apply to http-push.c's
implementation of setup_index as well.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp*: copy string returned by sha1_to_hex
Tay Ray Chuan [Sat, 6 Jun 2009 08:43:36 +0000 (16:43 +0800)]
http*: copy string returned by sha1_to_hex

In the fetch_index implementations in http-push.c and http-walker.c,
the string returned by sha1_to_hex is assumed to stay immutable.

This patch ensures that hex stays immutable by copying the string
returned by sha1_to_hex (via xstrdup) and frees it subsequently. It
also refactors free()'s and fclose()'s with labels.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp-walker: verify remote packs
Tay Ray Chuan [Sat, 6 Jun 2009 08:43:34 +0000 (16:43 +0800)]
http-walker: verify remote packs

In c17fb6e ("Verify remote packs, speed up pending request queue"),
changes were made to index fetching in http-push.c, particularly the
methods fetch_index and setup_index. Since http-walker.c has similar
code for index fetching, these improvements should apply to
http-walker.c's fetch_index and setup_index.

Invocations of free() of string memory are reproduced as well.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp-push, http-walker: style fixes
Tay Ray Chuan [Sat, 6 Jun 2009 08:43:33 +0000 (16:43 +0800)]
http-push, http-walker: style fixes

- Use tabs to indent, instead of spaces.

- Do not use curly-braces around a single statement body in
  if/while statement;

- Do not start multi-line comment with description on the first
  line after "/*", i.e.

  /*
   * We prefer this over...
   */

  /* comments like
   * this (notice the first line)
   */

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot5550-http-fetch: test fetching of packed objects
Tay Ray Chuan [Sat, 6 Jun 2009 08:43:32 +0000 (16:43 +0800)]
t5550-http-fetch: test fetching of packed objects

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp-push: fix missing "#ifdef USE_CURL_MULTI" around "is_running_queue"
Tay Ray Chuan [Sat, 6 Jun 2009 08:43:31 +0000 (16:43 +0800)]
http-push: fix missing "#ifdef USE_CURL_MULTI" around "is_running_queue"

As it is breaking the build when USE_CURL_MULTI is not defined.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp-push: send out fetch requests on queue
Tay Ray Chuan [Sat, 6 Jun 2009 08:43:27 +0000 (16:43 +0800)]
http-push: send out fetch requests on queue

Previously, requests for remote files were simply added to the queue
(pointed to by request_queue_head) and no transfer actually takes
place (the fill function add_fill_function() is not added until line
2441), even though code that followed may rely on these remote files to
be present (eg. the setup_revisions invocation).

The code that sends out the requests on the request queue is refactored
into the method run_request_queue.

After the get_dav_remote_heads invocation (ie. after fetch requests are
added to the queue), the requests on the queue are sent out through an
invocation to run_request_queue.

This invocation to run_request_queue entails adding a fill function
before pushing checks take place, which may lead to accidental,
unwanted pushes previously.

The flag is_running_queue is introduced to prevent this from occurring.
fill_active_slot is made to check the flag is_running_queue before
the sending of the requests proceeds.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot5540-http-push: test fetching of packed objects
Tay Ray Chuan [Sat, 6 Jun 2009 08:43:24 +0000 (16:43 +0800)]
t5540-http-push: test fetching of packed objects

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot5540-http-push: test fetching of loose objects
Tay Ray Chuan [Sat, 6 Jun 2009 08:43:23 +0000 (16:43 +0800)]
t5540-http-push: test fetching of loose objects

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'rc/maint-http-local-slot-fix' into rc/http-push
Junio C Hamano [Sat, 6 Jun 2009 17:56:17 +0000 (10:56 -0700)]
Merge branch 'rc/maint-http-local-slot-fix' into rc/http-push

* rc/maint-http-local-slot-fix:
  http*: cleanup slot->local after fclose

15 years agohttp*: cleanup slot->local after fclose
Tay Ray Chuan [Sat, 6 Jun 2009 08:43:26 +0000 (16:43 +0800)]
http*: cleanup slot->local after fclose

Set slot->local to NULL after doing a fclose() on the file it points
to. This prevents the passing of a FILE* pointer to a fclose()'d file
to ftell() in http.c::run_active_slot().

This issue was raised by Clemens Buchacher on 30th May 2009:

  http://www.spinics.net/lists/git/msg104623.html

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation/git.txt: update links to release notes
Junio C Hamano [Thu, 4 Jun 2009 05:52:37 +0000 (22:52 -0700)]
Documentation/git.txt: update links to release notes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint' to sync with 1.6.3.2
Junio C Hamano [Thu, 4 Jun 2009 05:51:56 +0000 (22:51 -0700)]
Merge branch 'maint' to sync with 1.6.3.2

15 years agoGIT 1.6.3.2 v1.6.3.2
Junio C Hamano [Thu, 4 Jun 2009 05:42:15 +0000 (22:42 -0700)]
GIT 1.6.3.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoShow presence of stashed changes in bash prompt.
Daniel Trstenjak [Tue, 2 Jun 2009 18:03:22 +0000 (20:03 +0200)]
Show presence of stashed changes in bash prompt.

Add a '$' in the __git_ps1 output to show stashed changes are present,
when GIT_PS1_SHOWSTASHSTATE is set to a nonempty value.

The code for checking if the stash has entries is taken from
'git-stash.sh'.

Signed-off-by: Daniel Trstenjak <daniel.trstenjak@online.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: fix empty word-regexp matches
René Scharfe [Wed, 3 Jun 2009 16:19:01 +0000 (18:19 +0200)]
grep: fix empty word-regexp matches

The command "git grep -w ''" dies as soon as it encounters an empty line,
reporting (wrongly) that "regexp returned nonsense".  The first hunk of
this patch relaxes the sanity check that is responsible for that,
allowing matches to start at the end.

The second hunk complements it by making sure that empty matches are
rejected if -w was specified, as they are not really words.

GNU grep does the same:

$ echo foo | grep -c ''
1
$ echo foo | grep -c -w ''
0

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'da/pretty-tempname'
Junio C Hamano [Wed, 3 Jun 2009 07:50:05 +0000 (00:50 -0700)]
Merge branch 'da/pretty-tempname'

* da/pretty-tempname:
  diff: generate pretty filenames in prep_temp_blob()
  compat: add a basename() compatibility function
  compat: add a mkstemps() compatibility function

Conflicts:
Makefile

15 years agoClean up and simplify rev_compare_tree()
Linus Torvalds [Wed, 3 Jun 2009 01:34:01 +0000 (18:34 -0700)]
Clean up and simplify rev_compare_tree()

This simplifies the logic of rev_compare_tree() by removing a special
case.

It does so by turning the special case of finding a diff to be "all new
files" into a more generic case of "all new" vs "all removed" vs "mixed
changes", so now the code is actually more powerful and more generic, and
the added symmetry actually makes it simpler too.

This makes no changes to any existing behavior, but apart from the
simplification it does make it possible to some day care about whether all
changes were just deletions if we want to. Which we may well want to for
merge handling.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Wed, 3 Jun 2009 07:49:40 +0000 (00:49 -0700)]
Merge branch 'maint'

* maint:
  blame: correctly handle a path that used to be a directory
  add -i: do not dump patch during application
  Update draft release notes for 1.6.3.2
  grep: fix colouring of matches with zero length
  Documentation: teach stash/pop workflow instead of stash/apply
  Change xdl_merge to generate output even for null merges
  t6023: merge-file fails to output anything for a degenerate merge

15 years agoblame: correctly handle a path that used to be a directory
Junio C Hamano [Wed, 3 Jun 2009 07:43:22 +0000 (00:43 -0700)]
blame: correctly handle a path that used to be a directory

When trying to see if the same path exists in the parent, we ran
"diff-tree" with pathspec set to the path we are interested in with the
parent, and expect either to have exactly one resulting filepair (either
"changed from the parent", "created when there was none") or nothing (when
there is no change from the parent).

If the path used to be a directory, however, we will also see unbounded
number of entries that talk about the files that used to exist underneath
the directory in question.  Correctly pick only the entry that describes
the path we are interested in in such a case (namely, the creation of the
path as a regular file).

Noticed by Ben Willard.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd -i: do not dump patch during application
Thomas Rast [Tue, 2 Jun 2009 21:34:27 +0000 (23:34 +0200)]
add -i: do not dump patch during application

Remove a debugging print that snuck in at 7a26e65 (Revert
"git-add--interactive: remove hunk coalescing", 2009-05-16).

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-submodule: add support for --merge.
Johan Herland [Tue, 2 Jun 2009 22:59:12 +0000 (00:59 +0200)]
git-submodule: add support for --merge.

'git submodule update --merge' merges the commit referenced by the
superproject into your local branch, instead of checking it out on
a detached HEAD.

As evidenced by the addition of "git submodule update --rebase", it
is useful to provide alternatives to the default 'checkout' behaviour
of "git submodule update". One such alternative is, when updating a
submodule to a new commit, to merge that commit into the current
local branch in that submodule. This is useful in workflows where
you want to update your submodule from its upstream, but you cannot
use --rebase, because you have downstream people working on top of
your submodule branch, and you don't want to disrupt their work.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRename submodule.<name>.rebase to submodule.<name>.update
Johan Herland [Wed, 3 Jun 2009 06:27:06 +0000 (08:27 +0200)]
Rename submodule.<name>.rebase to submodule.<name>.update

The addition of "submodule.<name>.rebase" demonstrates the usefulness of
alternatives to the default behaviour of "git submodule update". However,
by naming the config variable "submodule.<name>.rebase", and making it a
boolean choice, we are artificially constraining future git versions that
may want to add _more_ alternatives than just "rebase".

Therefore, while "submodule.<name>.rebase" is not yet in a stable git
release, future-proof it, by changing it from

  submodule.<name>.rebase = true/false

to

  submodule.<name>.update = rebase/checkout

where "checkout" specifies the default behaviour of "git submodule update"
(checking out the new commit to a detached HEAD), and "rebase" specifies
the --rebase behaviour (where the current local branch in the submodule is
rebase onto the new commit). Thus .update == checkout is equivalent to
.rebase == false, and .update == rebase is equivalent to .rebase == true.
Finally, leaving .update unset is equivalent to leaving .rebase unset.

In future git versions, other alternatives to "git submodule update"
behaviour can be included by adding them to the list of allowable values
for the submodule.<name>.update variable.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUpdate draft release notes for 1.6.3.2
Junio C Hamano [Tue, 2 Jun 2009 14:57:39 +0000 (07:57 -0700)]
Update draft release notes for 1.6.3.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'cb/maint-1.6.0-xdl-merge-fix' into maint
Junio C Hamano [Tue, 2 Jun 2009 14:48:44 +0000 (07:48 -0700)]
Merge branch 'cb/maint-1.6.0-xdl-merge-fix' into maint

* cb/maint-1.6.0-xdl-merge-fix:
  Change xdl_merge to generate output even for null merges
  t6023: merge-file fails to output anything for a degenerate merge

Conflicts:
xdiff/xmerge.c

15 years agoMerge branch 'rs/maint-grep-word-regexp-fix' into maint
Junio C Hamano [Tue, 2 Jun 2009 14:48:09 +0000 (07:48 -0700)]
Merge branch 'rs/maint-grep-word-regexp-fix' into maint

* rs/maint-grep-word-regexp-fix:
  grep: fix colouring of matches with zero length
  grep: fix word-regexp at the beginning of lines

15 years agoMerge branch 'sb/maint-1.6.2-opt-filename-fix' into maint
Junio C Hamano [Tue, 2 Jun 2009 14:47:03 +0000 (07:47 -0700)]
Merge branch 'sb/maint-1.6.2-opt-filename-fix' into maint

* sb/maint-1.6.2-opt-filename-fix:
  apply, fmt-merge-msg: use relative filenames
  commit: -F overrides -t

15 years agoMerge branch 'jc/maint-add-p-coalesce-fix' into maint
Junio C Hamano [Tue, 2 Jun 2009 14:46:52 +0000 (07:46 -0700)]
Merge branch 'jc/maint-add-p-coalesce-fix' into maint

* jc/maint-add-p-coalesce-fix:
  t3701: ensure correctly set up repository after skipped tests
  Revert "git-add--interactive: remove hunk coalescing"
  Splitting a hunk that adds a line at the top fails in "add -p"

15 years agoMerge branch 'tr/maint-doc-stash-pop' into maint
Junio C Hamano [Tue, 2 Jun 2009 14:43:45 +0000 (07:43 -0700)]
Merge branch 'tr/maint-doc-stash-pop' into maint

* tr/maint-doc-stash-pop:
  Documentation: teach stash/pop workflow instead of stash/apply

15 years agotest-lib: fix http exit codes
Clemens Buchacher [Mon, 1 Jun 2009 12:28:25 +0000 (14:28 +0200)]
test-lib: fix http exit codes

Previously, die() would report the exit code of stop_httpd. Instead,
save and reset the exit code before dying.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotest-lib: allow exit trap to be used for cleanup by tests
Clemens Buchacher [Mon, 1 Jun 2009 12:14:41 +0000 (14:14 +0200)]
test-lib: allow exit trap to be used for cleanup by tests

Exit trap should not be removed in case tests require cleanup code. This
is especially important if tests are executed with the --immediate option.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotest-lib: fail if invalid options are passed
Clemens Buchacher [Mon, 1 Jun 2009 12:14:40 +0000 (14:14 +0200)]
test-lib: fail if invalid options are passed

Previously, unknown options would be ignored, including any subsequent
valid options.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: fix colouring of matches with zero length
René Scharfe [Mon, 1 Jun 2009 21:53:05 +0000 (23:53 +0200)]
grep: fix colouring of matches with zero length

If a zero-length match is encountered, break out of loop and show the rest
of the line uncoloured.  Otherwise we'd be looping forever, trying to make
progress by advancing the pointer by zero characters.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorefuse to merge during a merge
Clemens Buchacher [Mon, 1 Jun 2009 09:20:56 +0000 (11:20 +0200)]
refuse to merge during a merge

The following is an easy mistake to make for users coming from version
control systems with an "update and commit"-style workflow.

        1. git pull
        2. resolve conflicts
        3. git pull

Step 3 overrides MERGE_HEAD, starting a new merge with dirty index.
IOW, probably not what the user intended. Instead, refuse to merge
again if a merge is in progress.

Reported-by: Dave Olszewski <cxreg@pobox.com>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomatch_refs: search ref list tail internally
Clemens Buchacher [Sun, 31 May 2009 14:26:48 +0000 (16:26 +0200)]
match_refs: search ref list tail internally

Avoid code duplication by moving list tail search to match_refs().

This does not change the semantics, except for http-push, which now inserts
to the front of the ref list in order to get rid of the global remote_tail.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-show-branch.txt: document --date-order option
Stephen Boyd [Mon, 1 Jun 2009 06:34:46 +0000 (23:34 -0700)]
git-show-branch.txt: document --date-order option

Copy the description of date-order from rev-list-options.txt, and then
reword it to be commit specific. While we're at it, put <rev> <glob>...
on a new line to not exceed 80 characters.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd custom memory allocator to MinGW and MacOS builds
Marius Storm-Olsen [Sun, 31 May 2009 16:15:23 +0000 (18:15 +0200)]
Add custom memory allocator to MinGW and MacOS builds

The standard allocator on Windows is pretty bad prior
to Windows Vista, and nedmalloc is better than the
modified dlmalloc provided with newer versions of the
MinGW libc.

NedMalloc stats in Git
----------------------
  All results are the best result out of 3 runs. The
  benchmarks have been done on different hardware, so
  the repack times are not comparable.

  These benchmarks are all based on 'git repack -adf'
  on the Linux kernel.

  XP
  -----------------------------------------------
  MinGW               Threads  Total Time   Speed
  -----------------------------------------------
  3.4.2                  (1T)  00:12:28.422
  3.4.2     + nedmalloc  (1T)  00:07:25.437 1.68x

  3.4.5                  (1T)  00:12:20.718
  3.4.5     + nedmalloc  (1T)  00:07:24.809 1.67x

  4.3.3-tdm              (1T)  00:12:01.843
  4.3.3-tdm + nedmalloc  (1T)  00:07:16.468 1.65x

  4.3.3-tdm              (2T)  00:07:35.062
  4.3.3-tdm + nedmalloc  (2T)  00:04:57.874 1.54x

  Vista
  -----------------------------------------------
  MinGW               Threads  Total Time   Speed
  -----------------------------------------------
  4.3.3-tdm              (1T)  00:07:40.844
  4.3.3-tdm + nedmalloc  (1T)  00:07:17.548 1.05x

  4.3.3-tdm              (2T)  00:05:33.746
  4.3.3-tdm + nedmalloc  (2T)  00:05:27.334 1.02x

  Mac Mini
  -----------------------------------------------
  GCC                 Threads  Total Time   Speed
  -----------------------------------------------
  i686-darwin9-4.0.1     (2T)  00:09:57.346
  i686-darwin9-4.0.1+ned (2T)  00:08:51.072 1.12x

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMinGW readdir reimplementation to support d_type
Marius Storm-Olsen [Sun, 31 May 2009 16:15:22 +0000 (18:15 +0200)]
MinGW readdir reimplementation to support d_type

The original readdir implementation was fast, but didn't
support the d_type. This means that git would do additional
lstats for each entry, to figure out if the entry was a
directory or not. This unneedingly slowed down many
operations, since Windows API provides this information
directly when walking the directories.

By running this implementation on Moe's repo structure:
  mkdir bummer && cd bummer; for ((i=0;i<100;i++)); do
    mkdir $i && pushd $i;
      for ((j=0;j<1000;j++)); do echo "$j" >$j; done;
    popd;
  done

We see the following speedups:
  git add .
  -------------------
  old: 00:00:23(.087)
  new: 00:00:21(.512) 1.07x

  git status
  -------------------
  old: 00:00:03(.306)
  new: 00:00:01(.684) 1.96x

  git clean -dxf
  -------------------
  old: 00:00:01(.918)
  new: 00:00:00(.295) 6.50x

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoconnect.c: Support PuTTY plink and TortoisePlink as SSH on Windows
Edward Z. Yang [Sun, 31 May 2009 16:15:21 +0000 (18:15 +0200)]
connect.c: Support PuTTY plink and TortoisePlink as SSH on Windows

OpenSSH uses -p to specify custom ports, while PuTTY plink and
TortoisePlink use -P. Git now detects if plink is in GIT_SSH and
modify its flags as necessary.

We call plink with -batch, so that it will error out with an error
message instead of waiting for user input.  As reported in msysGit
issue 96, plink wants to interact with the user asking if a host
key should be accepted, but this just blocks the terminal, since
plink tries to get the answer from stdin.  However, stdin is
already connected to Git that wants to send input to the remote
command.

But we do not pass -batch to TortoisePlink, because TortoisePlink
uses a GUI to communicate with the user, and it does not understand
-batch.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit: browsing paths with spaces when using the start command
Pat Thoyts [Sun, 31 May 2009 16:15:20 +0000 (18:15 +0200)]
git: browsing paths with spaces when using the start command

msysGit issue 258 tracks a problem opening a browser onto file
paths that contain spaces or parentheses when calling the
web--browse script. This patch modifies how the start command is
called to solve this.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMinGW: fix warning about implicit declaration of _getch()
Johannes Schindelin [Mon, 1 Jun 2009 06:41:45 +0000 (08:41 +0200)]
MinGW: fix warning about implicit declaration of _getch()

conio.h provides the declaration.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotest-chmtime: work around Windows limitation
Johannes Schindelin [Sun, 31 May 2009 16:15:18 +0000 (18:15 +0200)]
test-chmtime: work around Windows limitation

Windows has problems changing the mtime when the file is write protected,
even by the owner of said file.

Add a Windows-only workaround to change the mode if necessary before
trying to change the mtime.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoWork around a regression in Windows 7, causing erase_in_line() to crash sometimes
Johannes Schindelin [Mon, 1 Jun 2009 06:04:16 +0000 (08:04 +0200)]
Work around a regression in Windows 7, causing erase_in_line() to crash sometimes

The function FillConsoleOutputCharacterA() was pretty content in XP to take a NULL
pointer if we did not want to store the number of written columns.  In Windows 7,
it crashes, but only when called from within Git Bash, not from within cmd.exe.
Go figure.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoQuiet make: do not leave Windows behind
Johannes Schindelin [Sun, 31 May 2009 16:15:16 +0000 (18:15 +0200)]
Quiet make: do not leave Windows behind

On Windows, we have to check whether there are scripts which would
override .exe files, but this check missed the "quietification".
Make now prints 'BUILTIN all' instead of a long chain of 'test || rm'
commands.

[spr: added clarification what make will print. ]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMinGW: GCC >= 4 does not need SNPRINTF_SIZE_CORR anymore
Johannes Schindelin [Sun, 31 May 2009 16:15:15 +0000 (18:15 +0200)]
MinGW: GCC >= 4 does not need SNPRINTF_SIZE_CORR anymore

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff: generate pretty filenames in prep_temp_blob()
David Aguilar [Sun, 31 May 2009 08:35:52 +0000 (01:35 -0700)]
diff: generate pretty filenames in prep_temp_blob()

Naturally, prep_temp_blob() did not care about filenames.
As a result, GIT_EXTERNAL_DIFF and textconv generated
filenames such as ".diff_XXXXXX".

This modifies prep_temp_blob() to generate user-friendly
filenames when creating temporary files.

Diffing "name.ext" now generates "XXXXXX_name.ext".

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocompat: add a basename() compatibility function
David Aguilar [Sun, 31 May 2009 08:35:51 +0000 (01:35 -0700)]
compat: add a basename() compatibility function

Some systems such as Windows lack libgen.h so provide a
basename() implementation for cross-platform use.

This introduces the NO_LIBGEN_H construct to the Makefile
and autoconf scripts.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocompat: add a mkstemps() compatibility function
David Aguilar [Sun, 31 May 2009 08:35:50 +0000 (01:35 -0700)]
compat: add a mkstemps() compatibility function

mkstemps() is a BSD extension so provide an implementation
for cross-platform use.

Signed-off-by: David Aguilar <davvid@gmail.com>
Tested-by: Johannes Sixt <j6t@kdbg.org> (Windows)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'sb/opt-filename'
Junio C Hamano [Sun, 31 May 2009 23:57:42 +0000 (16:57 -0700)]
Merge branch 'sb/opt-filename'

* sb/opt-filename:
  parse-opts: add OPT_FILENAME and transition builtins
  parse-opts: prepare for OPT_FILENAME

Conflicts:
builtin-log.c

15 years agoMerge branch 'jc/solaris-0811'
Junio C Hamano [Sun, 31 May 2009 23:18:02 +0000 (16:18 -0700)]
Merge branch 'jc/solaris-0811'

* jc/solaris-0811:
  OpenSolaris 200811 (SunOS 5.11) does not want OLD_ICONV
  Teach Solaris that _XOPEN_SOURCE=600 really menas XPG6

15 years agoMerge branch 'sb/show-branch-parse-options'
Junio C Hamano [Sun, 31 May 2009 23:17:58 +0000 (16:17 -0700)]
Merge branch 'sb/show-branch-parse-options'

* sb/show-branch-parse-options:
  show-branch: migrate to parse-options API
  parse-options: add PARSE_OPT_LITERAL_ARGHELP for complicated argh's

Conflicts:
parse-options.h

15 years agoMerge branch 'mm/apply-double-slash'
Junio C Hamano [Sun, 31 May 2009 23:17:46 +0000 (16:17 -0700)]
Merge branch 'mm/apply-double-slash'

* mm/apply-double-slash:
  apply: handle filenames with double slashes better

15 years agoMerge branch 'sb/format-patch-parseopt'
Junio C Hamano [Sun, 31 May 2009 23:17:31 +0000 (16:17 -0700)]
Merge branch 'sb/format-patch-parseopt'

* sb/format-patch-parseopt:
  format-patch: migrate to parse-options API

Conflicts:
builtin-log.c

15 years agoMerge branch 'jc/mktree'
Junio C Hamano [Sun, 31 May 2009 23:17:11 +0000 (16:17 -0700)]
Merge branch 'jc/mktree'

* jc/mktree:
  mktree: validate entry type in input
  mktree --batch: build more than one tree object
  mktree --missing: updated usage message and man page
  mktree --missing: allow missing objects
  t1010: add mktree test
  mktree: do not barf on a submodule commit
  builtin-mktree.c: use a helper function to handle one line of input
  mktree: use parse-options
  build-in git-mktree

15 years agoMerge branch 'ew/svn-test-and-old-i18n'
Junio C Hamano [Sun, 31 May 2009 23:17:07 +0000 (16:17 -0700)]
Merge branch 'ew/svn-test-and-old-i18n'

* ew/svn-test-and-old-i18n:
  t8005: fix typo, it's ISO-8859-5, not KOI8-R
  t8005: convert CP1251 character set to ISO8859-5
  t8005: use more portable character encoding names
  t5100: use ancient encoding syntax for backwards compatibility
  t9301: use ISO8859-1 rather than ISO-8859-1
  t3901: Use ISO8859-1 instead of ISO-8859-1 for backward compatibility
  t3901: avoid negation on right hand side of '|'
  builtin-mailinfo.c: use "ISO8859-1" instead of "latin1" as fallback encoding
  builtin-mailinfo.c: compare character encodings case insensitively
  Use 'UTF-8' rather than 'utf-8' everywhere for backward compatibility
  t3900: use ancient iconv names for backward compatibility

15 years agoMerge branch 'mw/send-email'
Junio C Hamano [Sun, 31 May 2009 23:16:52 +0000 (16:16 -0700)]
Merge branch 'mw/send-email'

* mw/send-email:
  send-email: Remove superfluous `my $editor = ...'
  send-email: 'References:' should only reference what is sent
  send-email: Handle "GIT:" rather than "GIT: " during --compose
  Docs: send-email: --smtp-server-port can take symbolic ports
  Docs: send-email: Refer to CONFIGURATION section for sendemail.multiedit
  Docs: send-email: Put options back into alphabetical order

15 years agoMerge branch 'cc/bisect' (early part)
Junio C Hamano [Sun, 31 May 2009 23:16:48 +0000 (16:16 -0700)]
Merge branch 'cc/bisect' (early part)

* 'cc/bisect' (early part):
  bisect: check ancestors without forking a "git rev-list" process
  commit: add function to unparse a commit and its parents
  bisect: rework some rev related functions to make them more reusable

15 years agogit-add: no need for -f when resolving a conflict in already tracked path
Jeff King [Sat, 30 May 2009 21:54:18 +0000 (17:54 -0400)]
git-add: no need for -f when resolving a conflict in already tracked path

When a path F that matches ignore pattern has a conflict, "git add F"
insisted the -f option be given, which did not make sense.  It would have
required -f when the path was originally added, but when resolving a
conflict, it already is tracked.

So this should work (and does):

  $ echo file >.gitignore
  $ echo content >file
  $ git add -f file ;# need -f because we are adding new path
  $ echo more content >>file
  $ git add file ;# don't need -f; it is not actually an "other" file

This is handled under the hood by the COLLECT_IGNORED option to
read_directory. When that code finds an ignored file, it checks the
index to make sure it is not actually a tracked file. However, the test
it uses does not take into account unmerged entries, and considers them
to still be ignored. "git ls-files" uses a more elaborate test and gets
the right answer and the same test should be used here.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoconfig.txt: document add.ignore-errors
Stephen Boyd [Sun, 31 May 2009 05:08:02 +0000 (22:08 -0700)]
config.txt: document add.ignore-errors

Use the description of "--ignore-errors" from git-add.txt as
inspiration.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash: remove always true if statement from __git_ps1()
SZEDER Gábor [Fri, 29 May 2009 12:00:36 +0000 (14:00 +0200)]
bash: remove always true if statement from __git_ps1()

The recent commits 8763dbb1 (completion: fix PS1 display during a
merge on detached HEAD, 2009-05-16), ff790b6a (completion: simplify
"current branch" in __git_ps1(), 2009-05-10), and d7107ca6
(completion: fix PS1 display during an AM on detached HEAD,
2009-05-26) ensure that the branch name in __git_ps1() is always set
to something sensible.  Therefore, the condition for checking the
non-empty branch name is always fulfilled, and can be removed.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>