Commit Graph

27322 Commits

Author SHA1 Message Date
Thomas Rast
8a557bb77f t5704: match tests to modern style
The test did not adhere to the current style on several counts:

 . empty lines around the test blocks, but within the test string
 . ': > file' or even just '> file' with an extra space
 . inconsistent indentation
 . hand-rolled commits instead of using test_commit

Fix all of them.

There's a catch to the last point: test_commit creates a tag, which the
original test did not create.  We still change it to test_commit, and
explicitly delete the tags, so as to highlight that the test relies on not
having them.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-23 13:53:27 -08:00
Thomas Rast
1c5f93b9a6 strbuf: improve strbuf_get*line documentation
Clarify strbuf_getline() documentation, and add the missing documentation
for strbuf_getwholeline() and strbuf_getwholeline_fd().

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-23 13:52:11 -08:00
Thomas Rast
bc2fed496b bundle: use a strbuf to scan the log for boundary commits
The first part of the bundle header contains the boundary commits, and
could be approximated by

  # v2 git bundle
  $(git rev-list --pretty=oneline --boundary <ARGS> | grep ^-)

git-bundle actually spawns exactly this rev-list invocation, and does
the grepping internally.

There was a subtle bug in the latter step: it used fgets() with a
1024-byte buffer.  If the user has sufficiently long subjects (e.g.,
by not adhering to the git oneline-subject convention in the first
place), the 'oneline' format can easily overflow the buffer.  fgets()
then returns the rest of the line in the next call(s).  If one of
these remaining parts started with '-', git-bundle would mistakenly
insert it into the bundle thinking it was a boundary commit.

Fix it by using strbuf_getwholeline() instead, which handles arbitrary
line lengths correctly.

Note that on the receiving side in parse_bundle_header() we were
already using strbuf_getwholeline_fd(), so that part is safe.

Reported-by: Jannis Pohlmann <jannis.pohlmann@codethink.co.uk>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-23 09:36:44 -08:00
Thomas Rast
5e8617f560 bundle: put strbuf_readline_fd in strbuf.c with adjustments
The comment even said that it should eventually go there.  While at
it, match the calling convention and name of the function to the
strbuf_get*line family.  So it now is strbuf_getwholeline_fd.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-22 18:58:16 -08:00
Junio C Hamano
d0482e88a7 Sync with 1.7.6.6
* maint-1.7.7:
  Git 1.7.6.6
  imap-send: remove dead code
2012-02-05 23:52:53 -08:00
Junio C Hamano
110c511dbe Sync with 1.7.6.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-05 23:52:25 -08:00
Junio C Hamano
f174a2583c Git 1.7.6.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-05 23:50:52 -08:00
Jeff King
28b22f8af9 imap-send: remove dead code
The imap-send code was adapted from another project, and
still contains many unused bits of code. One of these bits
contains a type "struct string_list" which bears no
resemblence to the "struct string_list" we use elsewhere in
git. This causes the compiler to complain if git's
string_list ever becomes part of cache.h.

Let's just drop the dead code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-05 23:44:56 -08:00
Junio C Hamano
c572f491e5 Git 1.7.8.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-18 15:51:00 -08:00
Junio C Hamano
d899cf559b Merge branch 'maint-1.7.7' into maint
* maint-1.7.7:
  Git 1.7.7.6
  diff-index: enable recursive pathspec matching in unpack_trees

Conflicts:
	GIT-VERSION-GEN
2012-01-18 15:48:46 -08:00
Junio C Hamano
0065343548 Git 1.7.7.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-18 15:46:31 -08:00
Nguyen Thai Ngoc Duy
5c8eeb83db diff-index: enable recursive pathspec matching in unpack_trees
The pathspec structure has a few bits of data to drive various operation
modes after we unified the pathspec matching logic in various codepaths.
For example, max_depth field is there so that "git grep" can limit the
output for files found in limited depth of tree traversal. Also in order
to show just the surface level differences in "git diff-tree", recursive
field stops us from descending into deeper level of the tree structure
when it is set to false, and this also affects pathspec matching when
we have wildcards in the pathspec.

The diff-index has always wanted the recursive behaviour, and wanted to
match pathspecs without any depth limit. But we forgot to do so when we
updated tree_entry_interesting() logic to unify the pathspec matching
logic.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-18 15:44:02 -08:00
Junio C Hamano
ab8a78084b Update draft release notes to 1.7.8.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-12 23:33:29 -08:00
Junio C Hamano
5a6a939481 Merge branch 'maint-1.7.7' into maint
* maint-1.7.7:
  Update draft release notes to 1.7.7.6
  Update draft release notes to 1.7.6.6
  thin-pack: try harder to use preferred base objects as base
2012-01-12 23:31:46 -08:00
Junio C Hamano
8f83acf77c Update draft release notes to 1.7.7.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-12 23:31:41 -08:00
Junio C Hamano
901c907d83 Merge branch 'maint-1.7.6' into maint-1.7.7
* maint-1.7.6:
  Update draft release notes to 1.7.6.6
  thin-pack: try harder to use preferred base objects as base
2012-01-12 23:31:05 -08:00
Junio C Hamano
04f6785a08 Update draft release notes to 1.7.6.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-12 23:30:53 -08:00
Jeff King
15f07e061e thin-pack: try harder to use preferred base objects as base
When creating a pack using objects that reside in existing packs, we try
to avoid recomputing futile delta between an object (trg) and a candidate
for its base object (src) if they are stored in the same packfile, and trg
is not recorded as a delta already. This heuristics makes sense because it
is likely that we tried to express trg as a delta based on src but it did
not produce a good delta when we created the existing pack.

As the pack heuristics prefer producing delta to remove data, and Linus's
law dictates that the size of a file grows over time, we tend to record
the newest version of the file as inflated, and older ones as delta
against it.

When creating a thin-pack to transfer recent history, it is likely that we
will try to send an object that is recorded in full, as it is newer.  But
the heuristics to avoid recomputing futile delta effectively forbids us
from attempting to express such an object as a delta based on another
object. Sending an object in full is often more expensive than sending a
suboptimal delta based on other objects, and it is even more so if we
could use an object we know the receiving end already has (i.e. preferred
base object) as the delta base.

Tweak the recomputation avoidance logic, so that we do not punt on
computing delta against a preferred base object.

The effect of this change can be seen on two simulated upload-pack
workloads. The first is based on 44 reflog entries from my git.git
origin/master reflog, and represents the packs that kernel.org sent me git
updates for the past month or two. The second workload represents much
larger fetches, going from git's v1.0.0 tag to v1.1.0, then v1.1.0 to
v1.2.0, and so on.

The table below shows the average generated pack size and the average CPU
time consumed for each dataset, both before and after the patch:

                  dataset
            | reflog | tags
---------------------------------
     before | 53358  | 2750977
size  after | 32398  | 2668479
     change |   -39% |      -3%
---------------------------------
     before |  0.18  | 1.12
CPU   after |  0.18  | 1.15
     change |    +0% |      +3%

This patch makes a much bigger difference for packs with a shorter slice
of history (since its effect is seen at the boundaries of the pack) though
it has some benefit even for larger packs.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-12 23:06:20 -08:00
Junio C Hamano
113e828d38 Merge branch 'maint-1.7.7' into maint
* maint-1.7.7:
  attr: fix leak in free_attr_elem
  t2203: fix wrong commit command
2012-01-11 19:11:13 -08:00
Junio C Hamano
afb6b561e3 Merge branch 'maint-1.7.6' into maint-1.7.7
* maint-1.7.6:
  attr: fix leak in free_attr_elem
  t2203: fix wrong commit command
2012-01-11 19:11:00 -08:00
Jeff King
37475f97d1 attr: fix leak in free_attr_elem
This function frees the individual "struct match_attr"s we
have allocated, but forgot to free the array holding their
pointers, leading to a minor memory leak (but it can add up
after checking attributes for paths in many directories).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-11 19:07:23 -08:00
Nguyễn Thái Ngọc Duy
592ed5673e t2203: fix wrong commit command
Add commit message to avoid commit's aborting due to the lack of
commit message, not because there are INTENT_TO_ADD entries in index.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-11 00:09:36 -08:00
Junio C Hamano
be4d2920c2 Prepare for 1.7.8.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10 14:27:14 -08:00
Junio C Hamano
55dcc2ebad Merge the attributes fix in from maint-1.6.7 branch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10 14:24:01 -08:00
Junio C Hamano
804e97fc77 Prepare for 1.7.7.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10 14:16:49 -08:00
Junio C Hamano
6c65b5ea43 Merge the attributes fix in from maint-1.6.6 branch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10 14:14:26 -08:00
Junio C Hamano
f14f9803ef Prepare for 1.7.6.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10 13:11:03 -08:00
Junio C Hamano
b6fb7fed6a Documentation: rerere's rr-cache auto-creation and rerere.enabled
The description of rerere.enabled left the user in the dark as to who
might create an rr-cache directory.  Add a note that simply invoking
rerere does this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10 12:59:31 -08:00
Junio C Hamano
c432ef996e attr.c: clarify the logic to pop attr_stack
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10 12:28:38 -08:00
Junio C Hamano
909ca7b9ac attr.c: make bootstrap_attr_stack() leave early
Thas would de-dent the body of a function that has grown rather large over
time, making it a bit easier to read.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10 12:27:37 -08:00
Jeff King
77f7f82288 attr: drop misguided defensive coding
In prepare_attr_stack, we pop the old elements of the stack
(which were left from a previous lookup and may or may not
be useful to us). Our loop to do so checks that we never
reach the top of the stack. However, the code immediately
afterwards will segfault if we did actually reach the top of
the stack.

Fortunately, this is not an actual bug, since we will never
pop all of the stack elements (we will always keep the root
gitattributes, as well as the builtin ones). So the extra
check in the loop condition simply clutters the code and
makes the intent less clear. Let's get rid of it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10 11:55:27 -08:00
Jeff King
1afca44495 attr: don't confuse prefixes with leading directories
When we prepare the attribute stack for a lookup on a path,
we start with the cached stack from the previous lookup
(because it is common to do several lookups in the same
directory hierarchy). So the first thing we must do in
preparing the stack is to pop any entries that point to
directories we are no longer interested in.

For example, if our stack contains gitattributes for:

  foo/bar/baz
  foo/bar
  foo

but we want to do a lookup in "foo/bar/bleep", then we want
to pop the top element, but retain the others.

To do this we walk down the stack from the top, popping
elements that do not match our lookup directory. However,
the test do this simply checked strncmp, meaning we would
mistake "foo/bar/baz" as a leading directory of
"foo/bar/baz_plus". We must also check that the character
after our match is '/', meaning we matched the whole path
component.

There are two special cases to consider:

  1. The top of our attr stack has the empty path. So we
     must not check for '/', but rather special-case the
     empty path, which always matches.

  2. Typically when matching paths in this way, you would
     also need to check for a full string match (i.e., the
     character after is '\0'). We don't need to do so in
     this case, though, because our path string is actually
     just the directory component of the path to a file
     (i.e., we know that it terminates with "/", because the
     filename comes after that).

Helped-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10 11:25:40 -08:00
Jeff King
829a1c6169 send-email: multiedit is a boolean config option
The sendemail.multiedit variable is meant to be a boolean.
However, it is not marked as such in the code, which means
we store its value literally. Thus in the do_edit function,
perl ends up coercing it to a boolean value according to
perl rules, not git rules. This works for "0", but "false",
"no", or "off" will erroneously be interpreted as true.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-09 15:15:28 -08:00
Junio C Hamano
5f4d133fca Git 1.7.8.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-06 12:41:39 -08:00
Junio C Hamano
b15840e5b8 Merge branch 'jn/maint-gitweb-utf8-fix' into maint
* jn/maint-gitweb-utf8-fix:
  gitweb: Fix fallback mode of to_utf8 subroutine
  gitweb: Output valid utf8 in git_blame_common('data')
  gitweb: esc_html() site name for title in OPML
  gitweb: Call to_utf8() on input string in chop_and_escape_str()
2012-01-06 12:36:43 -08:00
Junio C Hamano
cfdfc5a3b2 Merge branch 'maint-1.7.7' into maint
* maint-1.7.7:
  Documentation: rerere.enabled is the primary way to configure rerere
2012-01-06 12:35:12 -08:00
Junio C Hamano
8769e93327 Merge branch 'maint-1.7.6' into maint-1.7.7
* maint-1.7.6:
  Documentation: rerere.enabled is the primary way to configure rerere
2012-01-06 12:35:05 -08:00
Thomas Rast
07b88a00c0 Documentation: rerere.enabled is the primary way to configure rerere
The wording seems to suggest that creating the directory is needed and the
setting of rerere.enabled is only for disabling the feature by setting it
to 'false'. But the configuration is meant to be the primary control and
setting it to 'true' will enable it; the rr-cache directory will be
created as necessary and the user does not have to create it.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-06 12:27:59 -08:00
Clemens Buchacher
1327d83954 t5550: repack everything into one file
Subsequently we assume that there is only one pack. Currently this is
true only by accident. Pass '-a -d' to repack in order to guarantee that
assumption to hold true.

The prune-packed command is now redundant since repack -d already calls
it.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-04 10:04:59 -08:00
Junio C Hamano
6ea9385426 Merge branch 'nd/maint-parse-depth' into maint
* nd/maint-parse-depth:
  Catch invalid --depth option passed to clone or fetch
2012-01-04 09:43:26 -08:00
Nguyễn Thái Ngọc Duy
e7622ce8c4 Catch invalid --depth option passed to clone or fetch
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-04 09:39:36 -08:00
Junio C Hamano
bc0fe84b06 Merge branch 'maint-1.7.7' into maint
* maint-1.7.7:
  docs: describe behavior of relative submodule URLs
  Documentation: read-tree --prefix works with existing subtrees
  Add MYMETA.json to perl/.gitignore
2012-01-03 13:47:46 -08:00
Junio C Hamano
c07aa5b218 Merge branch 'maint-1.7.6' into maint-1.7.7
* maint-1.7.6:
  Documentation: read-tree --prefix works with existing subtrees
  Add MYMETA.json to perl/.gitignore
2012-01-03 13:47:15 -08:00
Jens Lehmann
9e6ed475e7 docs: describe behavior of relative submodule URLs
Since the relative submodule URLs have been introduced in f31a522a2d, they
do not conform to the rules for resolving relative URIs but rather to
those of relative directories.

Document that behavior.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-03 12:47:58 -08:00
Brian Harring
54440e154f fix hang in git fetch if pointed at a 0 length bundle
git-repo if interupted at the exact wrong time will generate zero
length bundles- literal empty files.  git-repo is wrong here, but
git fetch shouldn't effectively spin loop if pointed at a zero
length bundle.

Signed-off-by: Brian Harring <ferringb@chromium.org>
Helped-by: Johannes Sixt
Helped-by: Nguyen Thai Ngoc Duy
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-03 12:13:28 -08:00
Clemens Buchacher
5c951ef47b Documentation: read-tree --prefix works with existing subtrees
Since 34110cd4 (Make 'unpack_trees()' have a separate source and
destination index) it is no longer true that a subdirectory with
the same prefix must not exist.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-01 01:18:53 -08:00
Jack Nagel
0eddcbf161 Add MYMETA.json to perl/.gitignore
ExtUtils::MakeMaker generates MYMETA.json in addition to MYMETA.yml
since version 6.57_07. As it suggests, it is just meta information about
the build and is cleaned up with 'make clean', so it should be ignored.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-29 13:08:47 -08:00
Junio C Hamano
f3f778df69 Git 1.7.8.2
Contains accumulated fixes since 1.7.8 that have been merged to the
'master' branch in preparation for the 1.7.9 release.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-28 12:03:24 -08:00
Junio C Hamano
9a8e485430 Merge branch 'jv/maint-config-set' into maint
* jv/maint-config-set:
  Fix an incorrect reference to --set-all.
2011-12-28 12:03:19 -08:00
Junio C Hamano
0d57085943 Merge branch 'jk/follow-rename-score' into maint
* jk/follow-rename-score:
  use custom rename score during --follow
2011-12-28 11:49:37 -08:00