git
12 years agoblock-sha1: put expanded macro parameters in parentheses
Jonathan Nieder [Sun, 22 Jul 2012 23:40:54 +0000 (18:40 -0500)] 
block-sha1: put expanded macro parameters in parentheses

't' is currently always a numeric constant, but it can't hurt to
prepare for the day that it becomes useful for a caller to pass in a
more complex expression.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoblock-sha1: avoid pointer conversion that violates alignment constraints
Jonathan Nieder [Sun, 22 Jul 2012 23:39:54 +0000 (18:39 -0500)] 
block-sha1: avoid pointer conversion that violates alignment constraints

With 660231aa (block-sha1: support for architectures with memory
alignment restrictions, 2009-08-12), blk_SHA1_Update was modified to
access 32-bit chunks of memory one byte at a time on arches that
prefer that:

#define get_be32(p)    ( \
(*((unsigned char *)(p) + 0) << 24) | \
(*((unsigned char *)(p) + 1) << 16) | \
(*((unsigned char *)(p) + 2) <<  8) | \
(*((unsigned char *)(p) + 3) <<  0) )

The code previously accessed these values by just using htonl(*p).

Unfortunately, Michael noticed on an Alpha machine that git was using
plain 32-bit reads anyway.  As soon as we convert a pointer to int *,
the compiler can assume that the object pointed to is correctly
aligned as an int (C99 section 6.3.2.3 "pointer conversions"
paragraph 7), and gcc takes full advantage by using a single 32-bit
load, resulting in a whole bunch of unaligned access traps.

So we need to obey the alignment constraints even when only dealing
with pointers instead of actual values.  Do so by changing the type
of 'data' to void *.  This patch renames 'data' to 'block' at the same
time to make sure all references are updated to reflect the new type.

Reported-tested-and-explained-by: Michael Cree <mcree@orcon.net.nz>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoremove ARM and Mozilla SHA1 implementations
Nicolas Pitre [Tue, 18 Aug 2009 00:09:56 +0000 (20:09 -0400)] 
remove ARM and Mozilla SHA1 implementations

They are both slower than the new BLK_SHA1 implementation, so it is
pointless to keep them around.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: guard gcc extensions with __GNUC__
Nicolas Pitre [Tue, 18 Aug 2009 19:37:22 +0000 (15:37 -0400)] 
block-sha1: guard gcc extensions with __GNUC__

With this, the code should now be portable to any C compiler.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomake sure byte swapping is optimal for git
Nicolas Pitre [Tue, 18 Aug 2009 19:26:55 +0000 (15:26 -0400)] 
make sure byte swapping is optimal for git

We rely on ntohl() and htonl() to perform byte swapping in many places.
However, some platforms have libraries providing really poor
implementations of those which might cause significant performance
issues, especially with the block-sha1 code.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: make the size member first in the context struct
Nicolas Pitre [Tue, 18 Aug 2009 00:18:23 +0000 (20:18 -0400)] 
block-sha1: make the size member first in the context struct

This is a 64-bit value, hence having it first provides a better
alignment.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1/sha1.c: silence compiler complaints by casting void * to char *
Brandon Casey [Fri, 14 Aug 2009 22:52:15 +0000 (17:52 -0500)] 
block-sha1/sha1.c: silence compiler complaints by casting void * to char *

Some compilers produce errors when arithmetic is attempted on pointers to
void.  We want computations done on byte addresses, so cast them to char *
to work them around.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: more good unaligned memory access candidates
Nicolas Pitre [Thu, 13 Aug 2009 04:29:14 +0000 (00:29 -0400)] 
block-sha1: more good unaligned memory access candidates

In addition to X86, PowerPC and S390 are capable of unaligned memory
accesses.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: support for architectures with memory alignment restrictions
Nicolas Pitre [Wed, 12 Aug 2009 19:47:55 +0000 (15:47 -0400)] 
block-sha1: support for architectures with memory alignment restrictions

This is needed on architectures with poor or non-existent unaligned memory
support and/or no fast byte swap instruction (such as ARM) by using byte
accesses to memory and shifting the result together.

This also makes the code portable, therefore the byte access methods are
the defaults.  Any architecture that properly supports unaligned word
accesses in hardware simply has to enable the alternative methods.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: split the different "hacks" to be individually selected
Nicolas Pitre [Wed, 12 Aug 2009 19:46:41 +0000 (15:46 -0400)] 
block-sha1: split the different "hacks" to be individually selected

This is to make it easier for them to be selected individually depending
on the architecture instead of the other way around i.e. having each
architecture select a list of hacks up front.  That makes for clearer
documentation as well.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: move code around
Nicolas Pitre [Wed, 12 Aug 2009 19:45:48 +0000 (15:45 -0400)] 
block-sha1: move code around

Move the code around so specific architecture hacks are defined first.
Also make one line comments actually one line.  No code change.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: improve code on large-register-set machines
Linus Torvalds [Mon, 10 Aug 2009 23:52:07 +0000 (16:52 -0700)] 
block-sha1: improve code on large-register-set machines

For x86 performance (especially in 32-bit mode) I added that hack to write
the SHA1 internal temporary hash using a volatile pointer, in order to get
gcc to not try to cache the array contents. Because gcc will do all the
wrong things, and then spill things in insane random ways.

But on architectures like PPC, where you have 32 registers, it's actually
perfectly reasonable to put the whole temporary array[] into the register
set, and gcc can do so.

So make the 'volatile unsigned int *' cast be dependent on a
SMALL_REGISTER_SET preprocessor symbol, and enable it (currently) on just
x86 and x86-64.  With that, the routine is fairly reasonable even when
compared to the hand-scheduled PPC version. Ben Herrenschmidt reports on
a G5:

 * Paulus asm version:       about 3.67s
 * Yours with no change:     about 5.74s
 * Yours without "volatile": about 3.78s

so with this the C version is within about 3% of the asm one.

And add a lot of commentary on what the heck is going on.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: improved SHA1 hashing
Linus Torvalds [Sat, 8 Aug 2009 04:16:46 +0000 (21:16 -0700)] 
block-sha1: improved SHA1 hashing

I think I have found a way to avoid the gcc crazyness.

Lookie here:

#             TIME[s] SPEED[MB/s]
rfc3174         5.094       119.8
rfc3174         5.098       119.7
linus           1.462       417.5
linusas         2.008         304
linusas2        1.878         325
mozilla         5.566       109.6
mozillaas       5.866       104.1
openssl         1.609       379.3
spelvin         1.675       364.5
spelvina        1.601       381.3
nettle          1.591       383.6

notice? I outperform all the hand-tuned asm on 32-bit too. By quite a
margin, in fact.

Now, I didn't try a P4, and it's possible that it won't do that there, but
the 32-bit code generation sure looks impressive on my Nehalem box. The
magic? I force the stores to the 512-bit hash bucket to be done in order.
That seems to help a lot.

The diff is trivial (on top of the "rename registers with cpp" patch), as
appended. And it does seem to fix the P4 issues too, although I can
obviously (once again) only test Prescott, and only in 64-bit mode:

#             TIME[s] SPEED[MB/s]
rfc3174         1.662       36.73
rfc3174          1.64       37.22
linus          0.2523       241.9
linusas        0.4367       139.8
linusas2       0.4487         136
mozilla        0.9704        62.9
mozillaas      0.9399       64.94

that's some really impressive improvement. All from just saying "do the
stores in the order I told you to, dammit!" to the compiler.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: perform register rotation using cpp
Linus Torvalds [Thu, 6 Aug 2009 19:41:00 +0000 (12:41 -0700)] 
block-sha1: perform register rotation using cpp

Instead of letting the compiler to figure out the optimal way to rotate
register usage, explicitly rotate the register names with cpp.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: get rid of redundant 'lenW' context
Linus Torvalds [Thu, 6 Aug 2009 14:45:46 +0000 (07:45 -0700)] 
block-sha1: get rid of redundant 'lenW' context

.. and simplify the ctx->size logic.

We now count the size in bytes, which means that 'lenW' was always just
the low 6 bits of the total size, so we don't carry it around separately
any more.  And we do the 'size in bits' shift at the end.

Suggested by Nicolas Pitre and linux@horizon.com.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: Use '(B&C)+(D&(B^C))' instead of '(B&C)|(D&(B|C))' in round 3
Linus Torvalds [Thu, 6 Aug 2009 14:27:57 +0000 (07:27 -0700)] 
block-sha1: Use '(B&C)+(D&(B^C))' instead of '(B&C)|(D&(B|C))' in round 3

It's an equivalent expression, but the '+' gives us some freedom in
instruction selection (for example, we can use 'lea' rather than 'add'),
and associates with the other additions around it to give some minor
scheduling freedom.

Suggested-by: linux@horizon.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: macroize the rounds a bit further
Linus Torvalds [Thu, 6 Aug 2009 14:20:54 +0000 (07:20 -0700)] 
block-sha1: macroize the rounds a bit further

Avoid repeating the shared parts of the different rounds by adding a
macro layer or two. It was already more cpp than C.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: re-use the temporary array as we calculate the SHA1
Linus Torvalds [Thu, 6 Aug 2009 03:49:41 +0000 (20:49 -0700)] 
block-sha1: re-use the temporary array as we calculate the SHA1

The mozilla-SHA1 code did this 80-word array for the 80 iterations.  But
the SHA1 state is really just 512 bits, and you can actually keep it in
a kind of "circular queue" of just 16 words instead.

This requires us to do the xor updates as we go along (rather than as a
pre-phase), but that's really what we want to do anyway.

This gets me really close to the OpenSSL performance on my Nehalem.
Look ma, all C code (ok, there's the rol/ror hack, but that one doesn't
strictly even matter on my Nehalem, it's just a local optimization).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: make the 'ntohl()' part of the first SHA1 loop
Linus Torvalds [Thu, 6 Aug 2009 03:28:07 +0000 (20:28 -0700)] 
block-sha1: make the 'ntohl()' part of the first SHA1 loop

This helps a teeny bit.  But what I -really- want to do is to avoid the
whole 80-array loop, and do the xor updates as I go along..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: minor fixups
Junio C Hamano [Thu, 6 Aug 2009 20:52:58 +0000 (13:52 -0700)] 
block-sha1: minor fixups

Bert Wesarg noticed non-x86 version of SHA_ROT() had a typo.
Also spell in-line assembly as __asm__(), otherwise I seem to get
error: implicit declaration of function 'asm' from my compiler.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: try to use rol/ror appropriately
Linus Torvalds [Thu, 6 Aug 2009 02:42:15 +0000 (19:42 -0700)] 
block-sha1: try to use rol/ror appropriately

Use the one with the smaller constant.  It _can_ generate slightly
smaller code (a constant of 1 is special), but perhaps more importantly
it's possibly faster on any uarch that does a rotate with a loop.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblock-sha1: undo ctx->size change
Junio C Hamano [Thu, 6 Aug 2009 20:56:19 +0000 (13:56 -0700)] 
block-sha1: undo ctx->size change

Undo the change I picked up from the mailing list discussion suggested
by Nico, not because it is wrong, but it will be done at the end of the
follow-up series.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd new optimized C 'block-sha1' routines
Linus Torvalds [Wed, 5 Aug 2009 23:13:20 +0000 (16:13 -0700)] 
Add new optimized C 'block-sha1' routines

Based on the mozilla SHA1 routine, but doing the input data accesses a
word at a time and with 'htonl()' instead of loading bytes and shifting.

It requires an architecture that is ok with unaligned 32-bit loads and a
fast htonl().

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'sb/read-tree'
Junio C Hamano [Wed, 5 Aug 2009 19:40:07 +0000 (12:40 -0700)] 
Merge branch 'sb/read-tree'

* sb/read-tree:
  read-tree: migrate to parse-options
  read-tree: convert unhelpful usage()'s to helpful die()'s

15 years agoMerge branch 'jc/apply-epoch-patch'
Junio C Hamano [Wed, 5 Aug 2009 19:40:00 +0000 (12:40 -0700)] 
Merge branch 'jc/apply-epoch-patch'

* jc/apply-epoch-patch:
  apply: notice creation/removal patches produced by GNU diff

15 years agoMerge branch 'sb/parse-options'
Junio C Hamano [Wed, 5 Aug 2009 19:39:37 +0000 (12:39 -0700)] 
Merge branch 'sb/parse-options'

* sb/parse-options:
  prune-packed: migrate to parse-options
  verify-pack: migrate to parse-options
  verify-tag: migrate to parse-options
  write-tree: migrate to parse-options

15 years agoMerge branch 'ns/init-mkdir'
Junio C Hamano [Wed, 5 Aug 2009 19:39:33 +0000 (12:39 -0700)] 
Merge branch 'ns/init-mkdir'

* ns/init-mkdir:
  git init: optionally allow a directory argument

Conflicts:
builtin-init-db.c

15 years agoMerge branch 'mk/init-db-parse-options'
Junio C Hamano [Wed, 5 Aug 2009 19:39:06 +0000 (12:39 -0700)] 
Merge branch 'mk/init-db-parse-options'

* mk/init-db-parse-options:
  init-db: migrate to parse-options

15 years agoMerge branch 'jk/maint-show-tag'
Junio C Hamano [Wed, 5 Aug 2009 19:38:54 +0000 (12:38 -0700)] 
Merge branch 'jk/maint-show-tag'

* jk/maint-show-tag:
  show: add space between multiple items
  show: suppress extra newline when showing annotated tag

15 years agoMerge branch 'sb/maint-pull-rebase'
Junio C Hamano [Wed, 5 Aug 2009 19:38:39 +0000 (12:38 -0700)] 
Merge branch 'sb/maint-pull-rebase'

* sb/maint-pull-rebase:
  pull: support rebased upstream + fetch + pull --rebase
  t5520-pull: Test for rebased upstream + fetch + pull --rebase

15 years agoMerge branch 'ne/futz-upload-pack'
Junio C Hamano [Wed, 5 Aug 2009 19:38:29 +0000 (12:38 -0700)] 
Merge branch 'ne/futz-upload-pack'

* ne/futz-upload-pack:
  Shift object enumeration out of upload-pack

Conflicts:
upload-pack.c

15 years agoMerge branch 'maint'
Junio C Hamano [Wed, 5 Aug 2009 19:37:40 +0000 (12:37 -0700)] 
Merge branch 'maint'

* maint:
  gitweb/README: Document $base_url
  Documentation: git submodule: add missing options to synopsis
  Better usage string for reflog.
  hg-to-git: don't import the unused popen2 module
  send-email: remove debug trace
  config: Keep inner whitespace verbatim

15 years agoMerge branch 'maint-1.6.3' into maint
Junio C Hamano [Wed, 5 Aug 2009 19:37:24 +0000 (12:37 -0700)] 
Merge branch 'maint-1.6.3' into maint

* maint-1.6.3:
  Better usage string for reflog.
  hg-to-git: don't import the unused popen2 module
  send-email: remove debug trace
  config: Keep inner whitespace verbatim

15 years agogitweb/README: Document $base_url
Jakub Narebski [Tue, 4 Aug 2009 15:54:32 +0000 (17:54 +0200)] 
gitweb/README: Document $base_url

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: git submodule: add missing options to synopsis
Jens Lehmann [Sat, 1 Aug 2009 18:49:47 +0000 (20:49 +0200)] 
Documentation: git submodule: add missing options to synopsis

The option --merge was missing for submodule update and --cached for
submodule summary.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-merge-base/git-show-branch --merge-base: Documentation and test
Michael J Gruber [Wed, 5 Aug 2009 07:59:20 +0000 (09:59 +0200)] 
git-merge-base/git-show-branch --merge-base: Documentation and test

Currently, the documentation suggests that 'git merge-base -a' and 'git
show-branch --merge-base' are equivalent (in fact it claims that the
former cannot handle more than two revs).

Alas, the handling of more than two revs is very different. Document
this by tests and correct the documentation to reflect this.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-merge-base/git-show-branch: Cleanup documentation and usage
Michael J Gruber [Wed, 5 Aug 2009 07:59:19 +0000 (09:59 +0200)] 
git-merge-base/git-show-branch: Cleanup documentation and usage

Make sure that usage strings and documentation coincide with each other
and with the actual code.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot6010-merge-base.sh: Depict the octopus test graph
Michael J Gruber [Wed, 5 Aug 2009 07:59:18 +0000 (09:59 +0200)] 
t6010-merge-base.sh: Depict the octopus test graph

...so that it is easier to reuse it for other tests.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoBetter usage string for reflog.
Matthieu Moy [Wed, 5 Aug 2009 15:36:28 +0000 (17:36 +0200)] 
Better usage string for reflog.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohg-to-git: don't import the unused popen2 module
Miklos Vajna [Mon, 3 Aug 2009 16:41:34 +0000 (18:41 +0200)] 
hg-to-git: don't import the unused popen2 module

Importing the popen2 module in Python-2.6 results in the
"DeprecationWarning: The popen2 module is deprecated.  Use the
subprocess module." message. The module itself isn't used in fact, so
just removing it solves the problem.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosend-email: remove debug trace
Erik Faye-Lund [Tue, 4 Aug 2009 21:57:34 +0000 (21:57 +0000)] 
send-email: remove debug trace

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
15 years agogitweb: fix 'Use of uninitialized value' error in href()
Giuseppe Bilotta [Fri, 31 Jul 2009 06:48:49 +0000 (08:48 +0200)] 
gitweb: fix 'Use of uninitialized value' error in href()

Equality between file_parent and file_name was being checked without a
preliminary check for existence of the parameters.

Fix by wrapping the equality check in appropriate if (defined ...),
rearranging the lines to prevent excessive length.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotechnical-docs: document tree-walking API
Stephen Boyd [Tue, 4 Aug 2009 04:13:21 +0000 (21:13 -0700)] 
technical-docs: document tree-walking API

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix typos on pt_BR/gittutorial.txt translation
André Goddard Rosa [Fri, 31 Jul 2009 16:50:50 +0000 (13:50 -0300)] 
Fix typos on pt_BR/gittutorial.txt translation

With extra fixes from Thadeu and Carlos as well.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Carlos R. Mafra <crmafra2@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: git-send-email: correct statement about standard ports
Wesley J. Landaker [Fri, 31 Jul 2009 17:45:00 +0000 (11:45 -0600)] 
Documentation: git-send-email: correct statement about standard ports

The current documentation states that servers typically listen on port
465 and calls this "ssmtp". While it's true that many mail servers use
port 465 for SSL smtp, this is non-standard, and hails from the days
before smtp and submission TLS support, that arrived in RFC2487 and
RFC3207. Port 465 is actually assigned by IANA for unrelated purposes,
and is mostly still used by mail servers today only to support Outlook
Express.

In any case, this patch helps the documentation better reflect both
standards and reality, while still helpfully mentioning ports numbers
that a user may wish to specify.

Signed-off-by: Wesley J. Landaker <wjl@icecavern.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: git-send-email: fix submission port number
Wesley J. Landaker [Thu, 30 Jul 2009 23:08:53 +0000 (17:08 -0600)] 
Documentation: git-send-email: fix submission port number

The current documentation confuses non-standard SSL smtp port 465 with
submission port 587 (RFC 4406). This patch just changes the referenced
number.

Signed-off-by: Wesley J. Landaker <wjl@icecavern.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoconfig: Keep inner whitespace verbatim
Björn Steinbrink [Thu, 30 Jul 2009 11:41:57 +0000 (13:41 +0200)] 
config: Keep inner whitespace verbatim

Configuration values are expected to be quoted when they have leading or
trailing whitespace, but inner whitespace should be kept verbatim even if
the value is not quoted. This is already documented in git-config(1), but
the code caused inner whitespace to be collapsed to a single space,
breaking, for example, clones from a path that has two consecutive spaces
in it, as future fetches would only see a single space.

Reported-by: John te Bokkel <tanj.tanj@gmail.com>
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit fast-export: add --no-data option
Geoffrey Irving [Tue, 28 Jul 2009 02:20:22 +0000 (22:20 -0400)] 
git fast-export: add --no-data option

When using git fast-export and git fast-import to rewrite the history
of a repository with large binary files, almost all of the time is
spent dealing with blobs.  This is extremely inefficient if all we want
to do is rewrite the commits and tree structure.  --no-data skips the
output of blobs and writes SHA-1s instead of marks, which provides a
massive speedup.

Signed-off-by: Geoffrey Irving <irving@naml.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoparse-opt: optionally show "--no-" option string
Johannes Schindelin [Mon, 27 Jul 2009 18:49:56 +0000 (20:49 +0200)] 
parse-opt: optionally show "--no-" option string

It is usually better to have positive options, to avoid confusing double
negations.  However, sometimes it is desirable to show the negative option
in the help.

Introduce the flag PARSE_OPT_NEGHELP to do that.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoTranslate the tutorial to Brazillian Portuguese
Thadeu Lima de Souza Cascardo [Mon, 29 Jun 2009 15:32:22 +0000 (12:32 -0300)] 
Translate the tutorial to Brazillian Portuguese

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorequest-pull: optionally show a patch as well
Junio C Hamano [Mon, 27 Jul 2009 21:27:47 +0000 (14:27 -0700)] 
request-pull: optionally show a patch as well

Allow git request-pull to append diff body into the pull request.

It's useful for small series of commits.

Tested-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'hv/cvsps-tests'
Junio C Hamano [Wed, 29 Jul 2009 17:39:57 +0000 (10:39 -0700)] 
Merge branch 'hv/cvsps-tests'

* hv/cvsps-tests:
  t/t9600: remove exit after test_done
  cvsimport: extend testcase about patchset order to contain branches
  cvsimport: add test illustrating a bug in cvsps
  Add a test of "git cvsimport"'s handling of tags and branches
  Add some tests of git-cvsimport's handling of vendor branches
  Test contents of entire cvsimported "master" tree contents
  Use CVS's -f option if available (ignore user's ~/.cvsrc file)
  Start a library for cvsimport-related tests

15 years agoAdd a reminder test case for a merge with F/D transition
Alex Riesen [Mon, 11 May 2009 09:31:42 +0000 (11:31 +0200)] 
Add a reminder test case for a merge with F/D transition

The problem is that if a file was replaced with a directory containing
another file with the same content and mode, an attempt to merge it
with a branch descended from a commit before this F->D transition will
cause merge-recursive to break. It breaks even if there were no
conflicting changes on that other branch.

Originally reported by Anders Melchiorsen.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoStart 1.6.5 cycle
Junio C Hamano [Wed, 29 Jul 2009 16:33:29 +0000 (09:33 -0700)] 
Start 1.6.5 cycle

The next major release will be 1.6.5, hopefully with a shorter cycle
than the 1.6.4 cycle.  After that in 1.7.0 we can make potentially
backward incompatible changes if necessary.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.4 v1.6.4
Junio C Hamano [Wed, 29 Jul 2009 07:32:42 +0000 (00:32 -0700)] 
GIT 1.6.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSync with 1.6.3.4
Junio C Hamano [Wed, 29 Jul 2009 07:00:56 +0000 (00:00 -0700)] 
Sync with 1.6.3.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.3.4 v1.6.3.4
Junio C Hamano [Wed, 29 Jul 2009 06:52:58 +0000 (23:52 -0700)] 
GIT 1.6.3.4

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 agorequest-pull: allow ls-remote to notice remote.$nickname.uploadpack
Tom Grennan [Wed, 29 Jul 2009 01:30:02 +0000 (18:30 -0700)] 
request-pull: allow ls-remote to notice remote.$nickname.uploadpack

The location to pull from should be converted from the configured nickname
to URL in the message, but ls-remote should be fed the nickname so that
the command uses remote.$nickname.* variables, most notably "uploadpack".

Signed-off-by: Tom Grennan <tgrennan@redback.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUpdate the documentation of the raw diff output format
David Kågedal [Tue, 28 Jul 2009 08:32:18 +0000 (10:32 +0200)] 
Update the documentation of the raw diff output format

This includes mentioning the initial hash output of diff-tree, and
changes the header to "raw output format" which is more descriptive.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-rerere.txt: Clarify ambiguity of the config variable
Michael J Gruber [Tue, 28 Jul 2009 14:42:15 +0000 (16:42 +0200)] 
git-rerere.txt: Clarify ambiguity of the config variable

Use the less ambiguous
"set variable foo in order to enable bar"
rather than
"set variable foo to enable bar" which may trick users into
assuming that "enable" is a good value for "foo".

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot9143: do not fail if Compress::Zlib is missing
Eric Wong [Sun, 26 Jul 2009 10:01:52 +0000 (03:01 -0700)] 
t9143: do not fail if Compress::Zlib is missing

"git svn gc" will not compress unhandled.log files if
Compress::Zlib is missing.  However, leftover index files should
always be removed, so add a test for this behavior as well.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoTrivial path quoting fixes in git-instaweb
Sean Estabrooks [Sat, 18 Jul 2009 16:45:44 +0000 (09:45 -0700)] 
Trivial path quoting fixes in git-instaweb

Bodo Schlecht noticed that Instaweb didn't propely quote all
path instances in the Apache config file it generated.

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'gp/maint-rebase-p-onto'
Junio C Hamano [Sun, 26 Jul 2009 18:24:13 +0000 (11:24 -0700)] 
Merge branch 'gp/maint-rebase-p-onto'

* gp/maint-rebase-p-onto:
  Fix rebase -p --onto

15 years agoMerge branch 'en/fast-export'
Junio C Hamano [Sun, 26 Jul 2009 18:23:52 +0000 (11:23 -0700)] 
Merge branch 'en/fast-export'

* en/fast-export:
  fast-export: Document the fact that git-rev-list arguments are accepted
  Add new fast-export testcases
  fast-export: Add a --tag-of-filtered-object option for newly dangling tags
  fast-export: Do parent rewriting to avoid dropping relevant commits
  fast-export: Make sure we show actual ref names instead of "(null)"
  fast-export: Omit tags that tag trees
  fast-export: Set revs.topo_order before calling setup_revisions

15 years agoGIT 1.6.4-rc3 v1.6.4-rc3
Junio C Hamano [Sun, 26 Jul 2009 07:04:50 +0000 (00:04 -0700)] 
GIT 1.6.4-rc3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation/config.txt: a variable can be defined on the section header line
Nanako Shiraishi [Sat, 25 Jul 2009 00:28:50 +0000 (09:28 +0900)] 
Documentation/config.txt: a variable can be defined on the section header line

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge git://git.bogomips.org/git-svn
Junio C Hamano [Sun, 26 Jul 2009 05:54:03 +0000 (22:54 -0700)] 
Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
  git svn: make minimize URL more reliable over http(s)
  git svn: avoid escaping '/' when renaming/copying files
  t9142: stop httpd after the test
  git svn: the branch command no longer needs the full path
  git svn: revert default behavior for --minimize-url
  git svn: add gc command

15 years agogit svn: make minimize URL more reliable over http(s)
Eric Wong [Sat, 25 Jul 2009 20:14:16 +0000 (13:14 -0700)] 
git svn: make minimize URL more reliable over http(s)

In addition to path-based restrictions, Subversion servers over
http(s) may have access controls implemented via the LimitExcept
directive in Apache.  In some cases, LimitExcept may be
(arguably) misconfigured to not allow REPORT requests while
allowing OPTIONS and PROPFIND.

This caused problems with our existing minimize_url logic that
only issued OPTIONS and PROPFIND requests when connecting and
using SVN::Ra::get_latest_revnum.  We now call SVN::Ra::get_log
if get_latest_revnum succeeds, resulting in a REPORT request
being sent.  This will increase our chances of tripping access
controls before we start attempting to fetch history.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
15 years agoDisable asciidoc 8.4.1+ semantics for `{plus}` and friends
Thomas Rast [Sat, 25 Jul 2009 12:06:50 +0000 (14:06 +0200)] 
Disable asciidoc 8.4.1+ semantics for `{plus}` and friends

asciidoc 8.4.1 changed the semantics of inline backtick quoting so
that they disable parsing of inline constructs, i.e.,

  Input: `{plus}`
  Pre 8.4.1: +
  Post 8.4.1: {plus}

Fix this by defining the asciidoc attribute 'no-inline-literal'
(which, per the 8.4.1 changelog, is the toggle to return to the old
behaviour) when under ASCIIDOC8.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit svn: avoid escaping '/' when renaming/copying files
Eric Wong [Sat, 25 Jul 2009 09:29:28 +0000 (02:29 -0700)] 
git svn: avoid escaping '/' when renaming/copying files

Timothy Schaeffer reported the following:
> Git-svn has been giving me the following error for some time
> when calling "git svn dcommit":
>
> RA layer request failed: PROPFIND request failed on
> '/svn/stf/branches/dev/sw%2Fdpemu%2Finclude%2FNetCnxn.h': PROPFIND of
> '/svn/stf/branches/dev/sw%2Fdpemu%2Finclude%2FNetCnxn.h': 302 Found
> (https://oursvnrepo.net) at /usr/local/libexec/git-core/git-svn line 508
>
> This only occurred when git detected a rename or copy.
>
> Following the lead into git-svn.perl,
> and noticing that some of the '/'s in the path were hex-encoded
> and some were not,
> I changed the regex used to find chars
> to hex-encode in the relative part of the path
> to exclude '/'.
> It works, so far.
> I have included a patch.

While this has previous not been a problem in my experience,
newer versions of SVN may be stricter and this does not
introduce regressions in t9115.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
15 years agot9142: stop httpd after the test
Eric Wong [Sat, 25 Jul 2009 09:11:39 +0000 (02:11 -0700)] 
t9142: stop httpd after the test

Otherwise it would fail in subsequent runs if the same
SVN_HTTPD_PORT was used.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
15 years agogit svn: the branch command no longer needs the full path
Eric Wong [Sat, 25 Jul 2009 08:36:06 +0000 (01:36 -0700)] 
git svn: the branch command no longer needs the full path

This was introduced in 0b2af457a49e3b00d47d556d5301934d27909db8
("Fix branch detection when repository root is inaccessible")
but reintroduced in the previous commit.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
15 years agogit svn: revert default behavior for --minimize-url
Eric Wong [Sat, 25 Jul 2009 07:00:50 +0000 (00:00 -0700)] 
git svn: revert default behavior for --minimize-url

This reverts the --minimize-url behavior change that
appeared recently in commit 0b2af457a49e3b00d47d556d5301934d27909db8
("Fix branch detection when repository root is inaccessible").

However, we now allow the option to be turned off by allowing
"--no-minimize-url" so people with limited-access setups can
still take advantage of the fix in
0b2af457a49e3b00d47d556d5301934d27909db8.

Also document the behavior and default settings of minimize-url
in the manpage for the first time.

This introduces a temporary UI regression to allow t9141 to pass
that will be reverted (fixed) in the next commit.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
15 years agogit svn: add gc command
Robert Allan Zeh [Sun, 19 Jul 2009 23:00:52 +0000 (18:00 -0500)] 
git svn: add gc command

Add a git svn gc command that gzips all unhandled.log files, and
removes all index files under .git/svn.

Signed-off-by: Robert Allan Zeh <robert.a.zeh@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
15 years agogit init: optionally allow a directory argument
Nanako Shiraishi [Fri, 24 Jul 2009 21:59:28 +0000 (06:59 +0900)] 
git init: optionally allow a directory argument

When starting a new repository, I see my students often say

    % git init newrepo

and curse git.  They could say

    % mkdir newrepo; cd newrepo; git init

but allowing it as an obvious short-cut may be nicer.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Sat, 25 Jul 2009 09:16:25 +0000 (02:16 -0700)] 
Merge branch 'maint'

* maint:
  t8005: Nobody writes Russian in shift_jis

Conflicts:
t/t8005-blame-i18n.sh

15 years agot8005: Nobody writes Russian in shift_jis
Junio C Hamano [Fri, 19 Jun 2009 02:18:37 +0000 (19:18 -0700)] 
t8005: Nobody writes Russian in shift_jis

The second and third tests of this script expected that Russian strings
are converted between ISO-8859-5 and Shift_JIS in the "blame --porcelain"
format output correctly.

Sure, many platforms may convert between such a combination, but that is
only because one of the base character set of Shift_JIS, JIS X 0208,
defines codepoints for Russian characters (among others); I do not think
anybody uses Shift_JIS when seriously writing Russian, and it is perfectly
understandable if iconv() libraries on some platforms fail converting
between this combination, as it does not matter in reality.

This patch changes the test to verify Japanese strings are converted
correctly between EUC-JP and Shift_JIS in the same procedure.  The point
of the test is not about verifying the platform's iconv() library, but to
see if "git blame" makes correct iconv() library calls when it should.

We could instead use ISO-8859-5 and KOI8-R as the combination, because
they are both meant to represent Russian, in order to make this test
meaningful on more platforms, but we already use Shift_JIS vs EUC-JP
combinations to test other programs in our test suite, so this combination
is safer from the point of view of the portability.  Besides, I do not
read nor write Russian; sorry ;-)

This change allows tests to pass on my (friend's) Solaris 5.11 box.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Sat, 25 Jul 2009 08:31:53 +0000 (01:31 -0700)] 
Merge branch 'maint'

* maint:
  Fix severe breakage in "git-apply --whitespace=fix"

15 years agoFix severe breakage in "git-apply --whitespace=fix"
Junio C Hamano [Sat, 25 Jul 2009 08:29:20 +0000 (01:29 -0700)] 
Fix severe breakage in "git-apply --whitespace=fix"

735c674 (Trailing whitespace and no newline fix, 2009-07-22) completely
broke --whitespace=fix, causing it to lose all the empty lines in a patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUpdate release notes for 1.6.4
Junio C Hamano [Sat, 25 Jul 2009 07:51:21 +0000 (00:51 -0700)] 
Update release notes for 1.6.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'js/maint-graft-unhide-true-parents'
Junio C Hamano [Sat, 25 Jul 2009 07:45:03 +0000 (00:45 -0700)] 
Merge branch 'js/maint-graft-unhide-true-parents'

* js/maint-graft-unhide-true-parents:
  git repack: keep commits hidden by a graft
  Add a test showing that 'git repack' throws away grafted-away parents

Conflicts:
git-repack.sh

15 years agoMerge branch 'av/maint-config-reader'
Junio C Hamano [Sat, 25 Jul 2009 07:44:52 +0000 (00:44 -0700)] 
Merge branch 'av/maint-config-reader'

* av/maint-config-reader:
  After renaming a section, print any trailing variable definitions
  Make section_name_match start on '[', and return the length on success

15 years agoMerge branch 'jk/maint-send-email-alias-loop'
Junio C Hamano [Sat, 25 Jul 2009 07:44:45 +0000 (00:44 -0700)] 
Merge branch 'jk/maint-send-email-alias-loop'

* jk/maint-send-email-alias-loop:
  send-email: detect cycles in alias expansion

15 years agoAfter renaming a section, print any trailing variable definitions
Alex Vandiver [Fri, 24 Jul 2009 21:21:44 +0000 (17:21 -0400)] 
After renaming a section, print any trailing variable definitions

Signed-off-by: Alex Vandiver <alex@chmrr.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMake section_name_match start on '[', and return the length on success
Alex Vandiver [Fri, 24 Jul 2009 21:21:43 +0000 (17:21 -0400)] 
Make section_name_match start on '[', and return the length on success

Signed-off-by: Alex Vandiver <alex@chmrr.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosend-email: detect cycles in alias expansion
Jeff King [Thu, 23 Jul 2009 11:09:29 +0000 (07:09 -0400)] 
send-email: detect cycles in alias expansion

With the previous code, an alias cycle like:

  $ echo 'alias a b' >aliases
  $ echo 'alias b a' >aliases
  $ git config sendemail.aliasesfile aliases
  $ git config sendemail.aliasfiletype mutt

would put send-email into an infinite loop. This patch
detects the situation and complains to the user.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoShow the presence of untracked files in the bash prompt.
Daniel Trstenjak [Wed, 22 Jul 2009 08:31:34 +0000 (10:31 +0200)] 
Show the presence of untracked files in the bash prompt.

Added the envvar GIT_PS1_SHOWUNTRACKEDFILES to 'git-completion.bash'.
When set to a nonempty value, then the char '%' will be shown next
to the branch name in the bash prompt.

Signed-off-by: Daniel Trstenjak <daniel.trstenjak@science-computing.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Fri, 24 Jul 2009 16:27:09 +0000 (09:27 -0700)] 
Merge branch 'maint'

* maint:
  SunOS grep does not understand -C<n> nor -e
  Fix export_marks() error handling.
  git branch: clean up detached branch handling
  git branch: avoid unnecessary object lookups
  git branch: fix performance problem
  do_one_ref(): null_sha1 check is not about broken ref

Conflicts:
Makefile

15 years agoSunOS grep does not understand -C<n> nor -e
Junio C Hamano [Fri, 24 Jul 2009 05:30:07 +0000 (22:30 -0700)] 
SunOS grep does not understand -C<n> nor -e

The first "grep -C1" test in t7002 does not pass on my SunOS-5.11-i86pc,
and that is not because our way to spawn external grep is broken, but
because the native grep does not understand -C<n>.

It turns out that Peff was also using this option himself because our
Makefile doesn't do that automatically.  Brandon Casey uses SUNWspro
compiler without having to set this, and it turns out that the compiler
does not define preprocessor macro __unix__ which made him always use the
built-in grep, never an external one.

Let's be more explicit and say that we do not use external grep on Suns.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix export_marks() error handling.
Matthias Andree [Fri, 24 Jul 2009 08:17:13 +0000 (10:17 +0200)] 
Fix export_marks() error handling.

- Don't leak one FILE * on error per export_marks() call. Found with
  cppcheck and reported by Martin Ettl.

- Abort the potentially long for(;idnums.size;) loop on write errors.

- Record error if fprintf() fails for reasons not required to set the
  stream error indicator, such as ENOMEM.

- Add a trailing full-stop to error message when fopen() fails.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit repack: keep commits hidden by a graft
Johannes Schindelin [Thu, 23 Jul 2009 15:33:49 +0000 (17:33 +0200)] 
git repack: keep commits hidden by a graft

When you have grafts that pretend that a given commit has different
parents than the ones recorded in the commit object, it is dangerous
to let 'git repack' remove those hidden parents, as you can easily
remove the graft and end up with a broken repository.

So let's play it safe and keep those parent objects and everything
that is reachable by them, in addition to the grafted parents.

As this behavior can only be triggered by git pack-objects, and as that
command handles duplicate parents gracefully, we do not bother to cull
duplicated parents that may result by using both true and grafted
parents.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd a test showing that 'git repack' throws away grafted-away parents
Björn Steinbrink [Thu, 23 Jul 2009 15:33:45 +0000 (17:33 +0200)] 
Add a test showing that 'git repack' throws away grafted-away parents

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit branch: clean up detached branch handling
Linus Torvalds [Thu, 23 Jul 2009 19:13:48 +0000 (12:13 -0700)] 
git branch: clean up detached branch handling

Make the 'show detached branch info' a routine of its own.  And in the
process, avoid the object lookup that is unnecessary if the current
branch isn't detached.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit branch: avoid unnecessary object lookups
Linus Torvalds [Thu, 23 Jul 2009 19:05:34 +0000 (12:05 -0700)] 
git branch: avoid unnecessary object lookups

They can be expensive in the cold-cache case, so don't bother looking up
the commits for all branches unless we really need them for some reason.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit branch: fix performance problem
Linus Torvalds [Thu, 23 Jul 2009 17:17:04 +0000 (10:17 -0700)] 
git branch: fix performance problem

'git branch' looks at _all_ the refs, and verifies them.  Which means that
during cold-cache situations with a slow disk (and lots of tags, for
example) it can take several very annoying seconds (7.5s according to a
report by Carlos R.  Mafra).

This avoids most of it by simply doing the filtering before looking up
the commits, by using the "raw" version of for_each_ref.

Reported-by: Carlos R. Mafra <crmafra2@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit svn: fix shallow clone when upstream revision is too new
Eric Wong [Mon, 20 Jul 2009 09:06:24 +0000 (02:06 -0700)] 
git svn: fix shallow clone when upstream revision is too new

Thanks to Ka-Hing Cheung for the initial bug report and patch:
> git-svn uses $ra->get_latest_revnum to find out the latest
> revision, but that can be problematic, because get_latest_revnum
> returns the latest revnum in the entire repository, not
> restricted by whatever URL you used to construct $ra. So if you
> do git svn clone -r HEAD svn://blah/blah/trunk, it won't work if
> the latest checkin is in one of the branches (it will try to
> fetch a rev that doesn't exist in trunk, making the clone
> useless).

Relying on SVN::Core::INVALID_REVNUM (-1) as the "start"
argument to SVN::Ra::get_log() proved unreliable with http(s)
URLs so the result of SVN::Ra::get_latest_revnum() is used as
the "start" argument instead.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
15 years agodo_one_ref(): null_sha1 check is not about broken ref
Junio C Hamano [Thu, 23 Jul 2009 06:07:05 +0000 (23:07 -0700)] 
do_one_ref(): null_sha1 check is not about broken ref

f8948e2 (remote prune: warn dangling symrefs, 2009-02-08) introduced a
more dangerous variant of for_each_ref() family that skips the check for
dangling refs, but it also made another unrelated check optional by
mistake.

The check to see if a ref points at 0{40} is not about brokenness, but is
about a possible future plan to represent a deleted ref by writing 40 "0"
in a loose ref when there is a stale version of the same ref already in
.git/packed-refs, so that we can implement deletion of a ref without
having to rewrite the packed refs file excluding the ref being deleted.

This check has to live outside of the conditional.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoconfigure.ac: properly unset NEEDS_SSL_WITH_CRYPTO when sha1 func is missing v1.6.4-rc2
Brandon Casey [Wed, 22 Jul 2009 22:20:53 +0000 (17:20 -0500)] 
configure.ac: properly unset NEEDS_SSL_WITH_CRYPTO when sha1 func is missing

The empty assignment NEEDS_SSL_WITH_CRYPTO= was mistakenly paired with the
assignment NEEDS_SSL_WITH_CRYPTO=YesPlease in the "action-if-found"
parameter of the AC_CHECK_LIB macro.  The empty assignment was intended for
the "action-if-not-found" section, since in that case, the necessary sha1
hash function was not found and the internal sha1 implementation will be
used instead.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agojanitor: useless checks before free
Pierre Habouzit [Wed, 22 Jul 2009 21:51:55 +0000 (23:51 +0200)] 
janitor: useless checks before free

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>