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

32322 Commits

Author SHA1 Message Date
Junio C Hamano da24b1044f sort-in-topological-order: use prio-queue
Use the prio-queue data structure to implement a priority queue of
commits sorted by committer date, when handling --date-order.  The
structure can also be used as a simple LIFO stack, which is a good
match for --topo-order processing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-11 15:15:21 -07:00
Junio C Hamano b4b594a315 prio-queue: priority queue of pointers to structs
Traditionally we used a singly linked list of commits to hold a set
of in-flight commits while traversing history.  The most typical use
of the list is to add commits that are newly discovered to it, keep
the list sorted by commit timestamp, pick up the newest one from the
list, and keep digging.  The cost of keeping the singly linked list
sorted is nontrivial, and this typical use pattern better matches a
priority queue.

Introduce a prio-queue structure, that can be used either as a LIFO
stack, or a priority queue.  This will be used in the next patch to
hold in-flight commits during sort-in-topological-order.

Tests and the idea to make it usable for any "void *" pointers to
"things" are by Jeff King.  Bugs are mine.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-11 15:15:21 -07:00
Junio C Hamano 08f704f294 toposort: rename "lifo" field
The primary invariant of sort_in_topological_order() is that a
parent commit is not emitted until all children of it are.  When
traversing a forked history like this with "git log C E":

    A----B----C
     \
      D----E

we ensure that A is emitted after all of B, C, D, and E are done, B
has to wait until C is done, and D has to wait until E is done.

In some applications, however, we would further want to control how
these child commits B, C, D and E on two parallel ancestry chains
are shown.

Most of the time, we would want to see C and B emitted together, and
then E and D, and finally A (i.e. the --topo-order output).  The
"lifo" parameter of the sort_in_topological_order() function is used
to control this behaviour.  We start the traversal by knowing two
commits, C and E.  While keeping in mind that we also need to
inspect E later, we pick C first to inspect, and we notice and
record that B needs to be inspected.  By structuring the "work to be
done" set as a LIFO stack, we ensure that B is inspected next,
before other in-flight commits we had known that we will need to
inspect, e.g. E.

When showing in --date-order, we would want to see commits ordered
by timestamps, i.e. show C, E, B and D in this order before showing
A, possibly mixing commits from two parallel histories together.
When "lifo" parameter is set to false, the function keeps the "work
to be done" set sorted in the date order to realize this semantics.
After inspecting C, we add B to the "work to be done" set, but the
next commit we inspect from the set is E which is newer than B.

The name "lifo", however, is too strongly tied to the way how the
function implements its behaviour, and does not describe what the
behaviour _means_.

Replace this field with an enum rev_sort_order, with two possible
values: REV_SORT_IN_GRAPH_ORDER and REV_SORT_BY_COMMIT_DATE, and
update the existing code.  The mechanical replacement rule is:

  "lifo == 0" is equivalent to "sort_order == REV_SORT_BY_COMMIT_DATE"
  "lifo == 1" is equivalent to "sort_order == REV_SORT_IN_GRAPH_ORDER"

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-11 15:15:21 -07:00
Junio C Hamano a84b794ad0 commit-slab: introduce a macro to define a slab for new type
Introduce a header file to define a macro that can define the struct
type, initializer, accessor and cleanup functions to manage a commit
slab.  Update the "indegree" topological sort facility using it.

To associate 32 flag bits with each commit, you can write:

	define_commit_slab(flag32, uint32);

to declare "struct flag32" type, define an instance of it with

	struct flag32 flags;

and initialize it by calling

	init_flag32(&flags);

After that, a call to flag32_at() function

	uint32 *fp = flag32_at(&flags, commit);

will return a pointer pointing at a uint32 for that commit.  Once
you are done with these flags, clean them up with

	clear_flag32(&flags);

Callers that cannot hard-code how wide the data to be associated
with the commit be at compile time can use the "_with_stride"
variant to initialize the slab.

Suppose you want to give one bit per existing ref, and paint commits
down to find which refs are descendants of each commit.  Saying

	typedef uint32 bits320[5];
	define_commit_slab(flagbits, bits320);

at compile time will still limit your code with hard-coded limit,
because you may find that you have more than 320 refs at runtime.

The code can declare a commit slab "struct flagbits" like this
instead:

	define_commit_slab(flagbits, unsigned char);
	struct flagbits flags;

and initialize it by:

	nrefs = ... count number of refs ...
	init_flagbits_with_stride(&flags, (nrefs + 7) / 8);

so that

	unsigned char *fp = flagbits_at(&flags, commit);

will return a pointer pointing at an array of 40 "unsigned char"s
associated with the commit, once you figure out nrefs is 320 at
runtime.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-07 10:02:12 -07:00
Junio C Hamano 66eb375d3d commit-slab: avoid large realloc
Instead of using a single "slab" and keep reallocating it as we find
that we need to deal with commits with larger values of commit->index,
make a "slab" an array of many "slab_piece"s. Each access may need
two levels of indirections, but we only need to reallocate the first
level array of pointers when we have to grow the table this way.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-13 22:15:42 -07:00
Jeff King 96c4f4a370 commit: allow associating auxiliary info on-demand
The "indegree" field in the commit object is only used while sorting
a list of commits in topological order, and wasting memory otherwise.

We would prefer to shrink the size of individual commit objects,
which we may have to hold thousands of in-core. We could eject
"indegree" field out from the commit object and represent it as a
dynamic table based on the decoration infrastructure, but the
decoration is meant for sparse annotation and is not a good match.

Instead, let's try a different approach.

 - Assign an integer (commit->index) to each commit we keep in-core
   (reuse the space of "indegree" field for it);

 - When running the topological sort, allocate an array of integers
   in bulk (called "slab"), use the commit->index as an index into
   this array, and store the "indegree" information there.

This does _not_ reduce the memory footprint of a commit object, but
the commit->index can be used as the index to dynamically associate
commits with other kinds of information as needed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-13 21:50:54 -07:00
Junio C Hamano a46221e9ad Merge branch 'rr/test-3200-style' into maint
* rr/test-3200-style:
  t3200 (branch): modernize style

Conflicts:
	t/t3200-branch.sh
2013-04-12 13:41:48 -07:00
Junio C Hamano 97ff97dc05 Merge branch 'mg/texinfo-5' into maint
* mg/texinfo-5:
  Documentation: Strip texinfo anchors to avoid duplicates
2013-04-12 13:41:48 -07:00
Junio C Hamano 15af30e72f Merge branch 'jk/diffcore-break-divzero' into maint
* jk/diffcore-break-divzero:
  diffcore-break: don't divide by zero
2013-04-12 13:41:47 -07:00
Junio C Hamano 788e98f8c0 Merge branch 'cn/commit-amend-doc' into maint
* cn/commit-amend-doc:
  Documentation/git-commit: reword the --amend explanation
2013-04-12 13:41:47 -07:00
Junio C Hamano 23589a90c3 Merge branch 'jk/bisect-prn-unsigned' into maint
* jk/bisect-prn-unsigned:
  bisect: avoid signed integer overflow
2013-04-12 13:41:46 -07:00
Junio C Hamano cd12104ab6 Merge branch 'jk/no-more-self-assignment' into maint
* jk/no-more-self-assignment:
  match-trees: simplify score_trees() using tree_entry()
  submodule: clarify logic in show_submodule_summary
2013-04-12 13:41:46 -07:00
Junio C Hamano b5581e6ac9 Merge branch 'rr/send-email-perl-critique' into maint
* rr/send-email-perl-critique:
  send-email: use the three-arg form of open in recipients_cmd
  send-email: drop misleading function prototype
  send-email: use "return;" not "return undef;" on error codepaths
2013-04-12 13:41:46 -07:00
Junio C Hamano 6a293703af Merge branch 'jc/t5516-pushInsteadOf-vs-pushURL' into maint
* jc/t5516-pushInsteadOf-vs-pushURL:
  t5516: test interaction between pushURL and pushInsteadOf correctly
2013-04-12 13:41:45 -07:00
Stefano Lattarini 41ccfdd9c9 Correct common spelling mistakes in comments and tests
Most of these were found using Lucas De Marchi's codespell tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 13:38:40 -07:00
Stefano Lattarini 2fec81cbe5 kwset: fix spelling in comments
Correct spelling mistakes noticed using Lucas De Marchi's codespell
tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 12:25:08 -07:00
Stefano Lattarini 0f7b4c2e77 precompose-utf8: fix spelling of "want" in error message
Noticed using Lucas De Marchi's codespell tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 12:24:04 -07:00
Stefano Lattarini 4283b8e408 compat/nedmalloc: fix spelling in comments
Correct some typos found using Lucas De Marchi's codespell tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 12:23:58 -07:00
Stefano Lattarini ce9171cd63 compat/regex: fix spelling and grammar in comments
Some of these were found using Lucas De Marchi's codespell tool.
Others noticed by Eric Sunshine.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 12:23:44 -07:00
Stefano Lattarini 7323513d28 obstack: fix spelling of similar
Noticed using Lucas De Marchi's codespell tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 12:23:20 -07:00
Stefano Lattarini d0008b3c66 contrib/subtree: fix spelling of accidentally
Noticed with Lucas De Marchi's codespell tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 12:23:12 -07:00
Stefano Lattarini 2582ab18e4 git-remote-mediawiki: spelling fixes
Most of these were found using Lucas De Marchi's codespell tool.
Others were pointed out by Eric Sunshine.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 12:13:05 -07:00
Stefano Lattarini e1c3bf496f doc: various spelling fixes
Most of these were found using Lucas De Marchi's codespell tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 12:00:52 -07:00
Junio C Hamano 7f20008d14 Merge branch 'maint-1.8.1' into maint
* maint-1.8.1:
  fast-export: fix argument name in error messages
  Documentation: distinguish between ref and offset deltas in pack-format
2013-04-12 11:48:38 -07:00
Paul Price 04a74b6cfa fast-export: fix argument name in error messages
The --signed-tags argument is plural, while error messages referred
to --signed-tag (singular).  Tweak error messages to correspond to the
argument.

Signed-off-by: Paul Price <price@astro.princeton.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 09:48:46 -07:00
Stefan Saasen 06cb843fea Documentation: distinguish between ref and offset deltas in pack-format
eb32d236 introduced the OBJ_OFS_DELTA object that uses a relative offset to
identify the base object instead of the 20-byte SHA1 reference. The pack file
documentation only mentions the SHA1 based reference in its description of the
deltified object entry.

Update the pack format documentation to clarify that the deltified object
representation refers to its base using either a relative negative offset or
the absolute SHA1 identifier.

Signed-off-by: Stefan Saasen <ssaasen@atlassian.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 09:14:01 -07:00
Junio C Hamano 5234b41f68 Merge branch 'tb/document-status-u-tradeoff' into maint
* tb/document-status-u-tradeoff:
  i18n: make the translation of -u advice in one go
2013-04-12 08:12:47 -07:00
Jiang Xin 62901179cf i18n: make the translation of -u advice in one go
The advice (consider use of -u when read_directory takes too long) is
separated into 3 different status_printf_ln() calls, and which brings
trouble for translators.

Since status_vprintf() called by status_printf_ln() can handle eol in
buffer, we could simply join these lines into one paragraph.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 08:11:20 -07:00
Benoit Bourbie 3a51467b94 Typo fix: replacing it's -> its
Signed-off-by: Benoit Bourbie <benoit.bourbie@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-11 17:39:05 -07:00
Adam Spiers 200732744a t: make PIPE a standard test prerequisite
The 'PIPE' test prerequisite was already defined identically by t9010
and t9300, therefore it makes sense to make it a predefined
prerequisite.

Signed-off-by: Adam Spiers <git@adamspiers.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-11 17:39:05 -07:00
René Scharfe 59a7714c89 archive: clarify explanation of --worktree-attributes
Make it a bit clearer that --worktree-attributes is about files in the
working tree (checked out files, possibly changed) and not the current
working directory ($PWD).  Link to the ATTRIBUTES section, which has
more details.

Reported-by: Amit Bakshi <ambakshi@gmail.com>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-11 17:38:45 -07:00
Simon Ruderich 13cb3bb7e6 t/README: --immediate skips cleanup commands for failed tests
Signed-off-by: Simon Ruderich <simon@ruderich.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-09 15:12:28 -07:00
Junio C Hamano 5bda18c186 Git 1.8.2.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-07 15:27:23 -07:00
Junio C Hamano 6466fbbeef Sync with 1.8.1.6 2013-04-07 13:17:50 -07:00
Junio C Hamano 2137ce01f8 Git 1.8.1.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-07 08:58:30 -07:00
Junio C Hamano 4bbb830a35 Merge branch 'jc/directory-attrs-regression-fix' into maint-1.8.1
A pattern "dir" (without trailing slash) in the attributes file
stopped matching a directory "dir" by mistake with an earlier change
that wanted to allow pattern "dir/" to also match.

* jc/directory-attrs-regression-fix:
  t: check that a pattern without trailing slash matches a directory
  dir.c::match_pathname(): pay attention to the length of string parameters
  dir.c::match_pathname(): adjust patternlen when shifting pattern
  dir.c::match_basename(): pay attention to the length of string parameters
  attr.c::path_matches(): special case paths that end with a slash
  attr.c::path_matches(): the basename is part of the pathname
2013-04-07 08:45:03 -07:00
Torsten Bögershausen 0e9b327227 remote-helpers/test-bzr.sh: do not use "grep '\s'"
Using grep "devel\s\+3:" to find at least one whitspace is not
portable on all grep versions; not all grep versions understand "\s"
as a "whitespace".

Use a literal TAB followed by SPACE.

The + as a qualifier for "one or more" is not a basic regular
expression; use egrep instead of grep.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-07 08:41:34 -07:00
Carlos Martín Nieto aa7b8c657e Documentation/git-commit: reword the --amend explanation
The explanation for 'git commit --amend' talks about preparing a tree
object, which shouldn't be how user-facing documentation talks about
commit.

Reword it to say it works as usual, but replaces the current commit.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-05 07:40:39 -07:00
Junio C Hamano 3a3101c62e mailmap: update Pasky's address
Eric Wong noticed that the address at suse.cz no longer works.
We may want to update in-code addresses as well, but let's do
this first in 'maint'.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-04 13:03:34 -07:00
Junio C Hamano f4df84de62 Merge branch 'nd/index-pack-threaded-fixes' into maint
* nd/index-pack-threaded-fixes:
  index-pack: guard nr_resolved_deltas reads by lock
  index-pack: protect deepest_delta in multithread code
2013-04-04 13:00:41 -07:00
Junio C Hamano 68447f04f4 Merge branch 'jk/index-pack-correct-depth-fix' into maint
* jk/index-pack-correct-depth-fix:
  index-pack: always zero-initialize object_entry list
2013-04-04 13:00:37 -07:00
Junio C Hamano 8ce0ab4ec8 Merge branch 'rs/submodule-summary-limit' into maint
"submodule summary --summary-limit" option did not support
"--option=value" form.

* rs/submodule-summary-limit:
  submodule summary: support --summary-limit=<n>
2013-04-04 13:00:35 -07:00
Junio C Hamano 5ccb7e2ef3 Merge branch 'jk/peel-ref' into maint
* jk/peel-ref:
  upload-pack: load non-tip "want" objects from disk
  upload-pack: make sure "want" objects are parsed
  upload-pack: drop lookup-before-parse optimization
2013-04-04 12:59:55 -07:00
Matthieu Moy 9b924eee98 git-remote-mediawiki: new wiki URL in documentation
The Bibzball wiki is not maintained anymore.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-04 09:54:38 -07:00
Martin von Gagern cbfd124c22 Documentation: Strip texinfo anchors to avoid duplicates
This keeps texinfo 5.x happy. See https://bugs.gentoo.org/464210.

Signed-off-by: Martin von Gagern <Martin.vGagern@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-03 16:14:19 -07:00
John Keeping 7b96d88802 bisect: avoid signed integer overflow
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-03 12:49:14 -07:00
John Keeping e7b00c5764 diffcore-break: don't divide by zero
When the source file is empty, the calculation of the merge score
results in a division by zero.  In the situation:

     == preimage ==             == postimage ==

     F (empty file)             F (a large file)
                                E (a new empty file)

it does not make sense to consider F->E as a rename, so it is better not
to break the pre- and post-image of F.

Bail out early in this case to avoid hitting the divide-by-zero.  This
causes the merge score to be left at zero.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-03 12:48:02 -07:00
Junio C Hamano 19534ee8a7 Update draft release notes to 1.8.2.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-03 09:29:14 -07:00
Junio C Hamano b771d8d7cf Merge branch 'mg/gpg-interface-using-status' into maint
Verification of signed tags were not done correctly when not in C
or en/US locale.

* mg/gpg-interface-using-status:
  pretty: make %GK output the signing key for signed commits
  pretty: parse the gpg status lines rather than the output
  gpg_interface: allow to request status return
  log-tree: rely upon the check in the gpg_interface
  gpg-interface: check good signature in a reliable way
2013-04-03 09:26:27 -07:00
Junio C Hamano 14c79b1faa Merge branch 'bc/commit-complete-lines-given-via-m-option' into maint
'git commit -m "$msg"' used to add an extra newline even when
$msg already ended with one.

* bc/commit-complete-lines-given-via-m-option:
  Documentation/git-commit.txt: rework the --cleanup section
  git-commit: only append a newline to -m mesg if necessary
  t7502: demonstrate breakage with a commit message with trailing newlines
  t/t7502: compare entire commit message with what was expected
2013-04-03 09:26:07 -07:00