1
0
mirror of https://github.com/git/git.git synced 2024-10-21 06:59:20 +02:00
Commit Graph

27675 Commits

Author SHA1 Message Date
Michael Haggerty
39ef7fae9a write_remote_refs(): create packed (rather than extra) refs
write_remote_refs() creates new packed refs from references obtained
from the remote repository, which is "out of thin air" as far as the
local repository is concerned.  Previously it did this by creating
"extra" refs, then calling pack_refs() to bake them into the
packed-refs file.  Instead, create packed refs (in the packed
reference cache) directly, then call pack_refs().

Aside from being more logical, this is another step towards removing
extra refs entirely.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-17 11:55:04 -08:00
Michael Haggerty
30249ee68f add_packed_ref(): new function in the refs API.
Add a new function add_packed_ref() that adds a reference directly to
the in-memory packed reference cache.  This will be useful for
creating local references while cloning.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-17 11:55:04 -08:00
Michael Haggerty
e6ed3ca651 ref_array: keep track of whether references are sorted
Keep track of how many entries at the beginning of a ref_array are already
sorted.  In sort_ref_array(), return early if the the array is already
sorted (i.e., if no new references has been appended to the end of the
list since the last call to sort_ref_array()).

Sort ref_arrays only when needed, namely in search_ref_array() and in
do_for_each_ref().  However, never call sort_ref_array() on the
extra_refs, because extra_refs can contain multiple entries with the same
name and because sort_ref_array() not only sorts, but de-dups its
contents.

This change is currently not useful, because entries are not added to
ref_arrays after they are created.  But in a moment they will be...

Implementation note: we could store a binary "sorted" value instead of
an integer, but storing the number of sorted entries leaves the way
open for a couple of possible future optimizations:

* In sort_ref_array(), sort *only* the unsorted entries, then merge
  them with the sorted entries.  This should be faster if most of the
  entries are already sorted.

* Teach search_ref_array() to do a binary search of any sorted
  entries, and if unsuccessful do a linear search of any unsorted
  entries.  This would avoid the need to sort the list every time that
  search_ref_array() is called, and (given some intelligence about how
  often to sort) could significantly improve the speed in certain
  hypothetical usage patterns.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-17 11:53:21 -08:00
Michael Haggerty
e45a59955e pack_refs(): remove redundant check
handle_one_ref() only adds refs to the cbdata.ref_to_prune list if
(cbdata.flags & PACK_REFS_PRUNE) is set.  So any references in this
list at the end of pack_refs() can be pruned unconditionally.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-17 11:41:41 -08:00
Junio C Hamano
6db5c6e43d Git 1.7.9-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.7.9-rc1
2012-01-12 23:43:28 -08:00
Junio C Hamano
478c44658e Merge branch 'jc/request-pull-show-head-4'
* jc/request-pull-show-head-4:
  request-pull: use the real fork point when preparing the message
2012-01-12 23:34:30 -08:00
Junio C Hamano
b51ffa80f6 Merge branch 'tr/maint-mailinfo'
* tr/maint-mailinfo:
  mailinfo documentation: accurately describe non -k case
2012-01-12 23:34:26 -08:00
Junio C Hamano
96e3360997 Merge branch 'ss/maint-msys-cvsexportcommit'
* ss/maint-msys-cvsexportcommit:
  git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS
  t9200: On MSYS, do not pass Windows-style paths to CVS
2012-01-12 23:34:21 -08:00
Junio C Hamano
bdb8cb5296 Merge branch 'jk/maint-upload-archive'
* jk/maint-upload-archive:
  archive: re-allow HEAD:Documentation on a remote invocation
2012-01-12 23:34:17 -08:00
Junio C Hamano
c4a01a3cbb Merge branch 'maint'
* maint:
  Update draft release notes to 1.7.8.4
  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:33:39 -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
Carlos Martín Nieto
0f544ee897 archive: re-allow HEAD:Documentation on a remote invocation
The tightening done in (ee27ca4a: archive: don't let remote clients
get unreachable commits, 2011-11-17) went too far and disallowed
HEAD:Documentation as it would try to find "HEAD:Documentation" as a
ref.

Only DWIM the "HEAD" part to see if it exists as a ref. Once we're
sure that we've been given a valid ref, we follow the normal code
path. This still disallows attempts to access commits which are not
branch tips.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-11 19:21:22 -08:00
Junio C Hamano
0e1cfc52de Merge branch 'maint'
* maint:
  attr: fix leak in free_attr_elem
  t2203: fix wrong commit command
2012-01-11 19:11:28 -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
Sebastian Schuberth
37495eef4c git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS
Due to MSYS path mangling GIT_DIR contains a Windows-style path when
checked inside a Perl script even if GIT_DIR was previously set to an
MSYS-style path in a shell script. So explicitly convert to an MSYS-style
path before calling Perl's rel2abs() to make it work.

This fix was inspired by a very similar patch in WebKit:

http://trac.webkit.org/changeset/76255/trunk/Tools/Scripts/commit-log-editor

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Tested-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-11 18:04:08 -08:00
Sebastian Schuberth
4397c6535e t9200: On MSYS, do not pass Windows-style paths to CVS
For details, see the commit message of 4114156ae9. Note that while using
$PWD as part of GIT_DIR is not required here, it does no harm and it is
more consistent. In addition, on MSYS using an environment variable should
be slightly faster than spawning an external executable.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-11 18:02:55 -08:00
Thomas Rast
82553cbb08 mailinfo documentation: accurately describe non -k case
Since its very first description of -k, the documentation for
git-mailinfo claimed that (in the case without -k) after cleaning up
bracketed strings [blah], it would insert [PATCH].

It doesn't; on the contrary, one of the important jobs of mailinfo is
to remove those strings.

Since we're already there, rewrite the paragraph to give a complete
enumeration of all the transformations.  Specifically, it was missing
the whitespace normalization (run of isspace(c) -> ' ') and the
removal of leading ':'.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-11 17:30:16 -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
b7e642ecec request-pull: use the real fork point when preparing the message
The command takes the "start" argument and computes the merge base
between it and the commit to be pulled so that we can show the diffstat,
but uses the "start" argument as-is when composing the message

    The following changes since commit $X are available

to tell the integrator which commit the work is based on. Giving "origin"
(most of the time it resolves to refs/remotes/origin/master) as the start
argument is often convenient, but it is usually not the fork point, and
does not help the integrator at all.

Use the real fork point, which is the merge base we already compute, when
composing that part of the message.

Suggested-by: Linus Torvalds
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10 21:51:15 -08:00
Junio C Hamano
7e521640c8 Merge branch 'bw/maint-t8006-sed-incomplete-line'
* bw/maint-t8006-sed-incomplete-line:
  Use perl instead of sed for t8006-blame-textconv test
2012-01-10 14:46:52 -08:00
Junio C Hamano
e04dc492ac Sync with maint
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10 14:46:22 -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
Ben Walton
8b9624c374 Use perl instead of sed for t8006-blame-textconv test
In test 'blame --textconv with local changes' of t8006-blame-textconv,
using /usr/xpg4/bin/sed (as set by SANE_TOOL_PATH), an additional
newline was added to the output from the 'helper' script.

This was noted by sed with a message such as:
sed: Missing newline at end of file zero.bin.

Sed then exits with status 2 causing the helper script to also exit
with status 2.

In turn, this was triggering a fatal error from git blame:
fatal: unable to read files to diff

To work around this difference in sed behaviour, use perl -p instead
of sed -e as it exits cleanly and does not insert the additional
newline.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-09 20:43:48 -08:00
Junio C Hamano
beecc7ab65 Merge branch 'jk/credentials'
* jk/credentials:
  credentials: unable to connect to cache daemon
2012-01-09 15:58:47 -08:00
Junio C Hamano
d9af2282c0 Merge branch 'mh/ref-api-less-extra-refs'
* mh/ref-api-less-extra-refs:
  write_head_info(): handle "extra refs" locally
  show_ref(): remove unused "flag" and "cb_data" arguments
  receive-pack: move more work into write_head_info()
2012-01-09 15:58:43 -08:00
Junio C Hamano
242ff87975 Merge branch 'mm/maint-gitweb-project-maxdepth'
* mm/maint-gitweb-project-maxdepth:
  gitweb: accept trailing "/" in $project_list
2012-01-09 15:58:30 -08:00
Junio C Hamano
e1e3c0694e Merge branch 'maint'
* maint:
  send-email: multiedit is a boolean config option
2012-01-09 15:56:58 -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
Clemens Buchacher
98c2924cfa credentials: unable to connect to cache daemon
Error out if we just spawned the daemon and yet we cannot connect.

And always release the string buffer.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-08 14:38:25 -08:00
Junio C Hamano
eac2d83247 Git 1.7.9-rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.7.9-rc0
2012-01-06 12:51:09 -08:00
Junio C Hamano
5de89d3abf Merge branch 'jc/show-sig'
* jc/show-sig:
  log --show-signature: reword the common two-head merge case
  log-tree: show mergetag in log --show-signature output
  log-tree.c: small refactor in show_signature()
  commit --amend -S: strip existing gpgsig headers
  verify_signed_buffer: fix stale comment
  gpg-interface: allow use of a custom GPG binary
  pretty: %G[?GS] placeholders
  test "commit -S" and "log --show-signature"
  log: --show-signature
  commit: teach --gpg-sign option

Conflicts:
	builtin/commit-tree.c
	builtin/commit.c
	builtin/merge.c
	notes-cache.c
	pretty.c
2012-01-06 12:44:07 -08:00
Junio C Hamano
4a3a1edd0b Merge branch 'jm/stash-diff-disambiguate'
* jm/stash-diff-disambiguate:
  stash: Don't fail if work dir contains file named 'HEAD'
2012-01-06 12:44:03 -08:00
Junio C Hamano
1067f8dd0e Merge branch 'jh/fetch-head-update'
* jh/fetch-head-update:
  write first for-merge ref to FETCH_HEAD first
2012-01-06 12:44:01 -08:00
Junio C Hamano
8cbfc1189c Merge branch 'pw/p4-view-updates'
* pw/p4-view-updates:
  git-p4: view spec documentation
  git-p4: rewrite view handling
  git-p4: support single file p4 client view maps
  git-p4: sort client views by reverse View number
  git-p4: fix test for unsupported P4 Client Views
  git-p4: test client view handling
2012-01-06 12:43:59 -08:00