OSDN Git Service
Jeff King [Wed, 15 Oct 2014 22:42:57 +0000 (18:42 -0400)]
make add_object_array_with_context interface more sane
When you resolve a sha1, you can optionally keep any context
found during the resolution, including the path and mode of
a tree entry (e.g., when looking up "HEAD:subdir/file.c").
The add_object_array_with_context function lets you then
attach that context to an entry in a list. Unfortunately,
the interface for doing so is horrible. The object_context
structure is large and most object_array users do not use
it. Therefore we keep a pointer to the structure to avoid
burdening other users too much. But that means when we do
use it that we must allocate the struct ourselves. And the
struct contains a fixed PATH_MAX-sized buffer, which makes
this wholly unsuitable for any large arrays.
We can observe that there is only a single user of the
"with_context" variant: builtin/grep.c. And in that use
case, the only element we care about is the path. We can
therefore store only the path as a pointer (the context's
mode field was redundant with the object_array_entry itself,
and nobody actually cared about the surrounding tree). This
still requires a strdup of the pathname, but at least we are
only consuming the minimum amount of memory for each string.
We can also handle the copying ourselves in
add_object_array_*, and free it as appropriate in
object_array_release_entry.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:42:22 +0000 (18:42 -0400)]
write_sha1_file: freshen existing objects
When we try to write a loose object file, we first check
whether that object already exists. If so, we skip the
write as an optimization. However, this can interfere with
prune's strategy of using mtimes to mark files in progress.
For example, if a branch contains a particular tree object
and is deleted, that tree object may become unreachable, and
have an old mtime. If a new operation then tries to write
the same tree, this ends up as a noop; we notice we
already have the object and do nothing. A prune running
simultaneously with this operation will see the object as
old, and may delete it.
We can solve this by "freshening" objects that we avoid
writing by updating their mtime. The algorithm for doing so
is essentially the same as that of has_sha1_file. Therefore
we provide a new (static) interface "check_and_freshen",
which finds and optionally freshens the object. It's trivial
to implement freshening and simple checking by tweaking a
single parameter.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:42:09 +0000 (18:42 -0400)]
pack-objects: match prune logic for discarding objects
A recent commit taught git-prune to keep non-recent objects
that are reachable from recent ones. However, pack-objects,
when loosening unreachable objects, tries to optimize out
the write in the case that the object will be immediately
pruned. It now gets this wrong, since its rule does not
reflect the new prune code (and this can be seen by running
t6501 with a strategically placed repack).
Let's teach pack-objects similar logic.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:41:53 +0000 (18:41 -0400)]
pack-objects: refactor unpack-unreachable expiration check
When we are loosening unreachable packed objects, we do not
bother to process objects that would simply be pruned
immediately anyway. The "would be pruned" check is a simple
comparison, but is about to get more complicated. Let's pull
it out into a separate function.
Note that this is slightly less efficient than the original,
which avoided even opening old packs, since no object in
them could pass the current check, which cares only about
the pack mtime. But the new rules will depend on the exact
object, so we need to perform the check even for old packs.
Note also that we fix a minor buglet when the pack mtime is
exactly the same as the expiration time. The prune code
considers that worth pruning, whereas our check here
considered it worth keeping. This wasn't a big deal. Besides
being unlikely to happen, the result was simply that the
object was loosened and then pruned, missing the
optimization. Still, we can easily fix it while we are here.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:41:35 +0000 (18:41 -0400)]
prune: keep objects reachable from recent objects
Our current strategy with prune is that an object falls into
one of three categories:
1. Reachable (from ref tips, reflogs, index, etc).
2. Not reachable, but recent (based on the --expire time).
3. Not reachable and not recent.
We keep objects from (1) and (2), but prune objects in (3).
The point of (2) is that these objects may be part of an
in-progress operation that has not yet updated any refs.
However, it is not always the case that objects for an
in-progress operation will have a recent mtime. For example,
the object database may have an old copy of a blob (from an
abandoned operation, a branch that was deleted, etc). If we
create a new tree that points to it, a simultaneous prune
will leave our tree, but delete the blob. Referencing that
tree with a commit will then work (we check that the tree is
in the object database, but not that all of its referred
objects are), as will mentioning the commit in a ref. But
the resulting repo is corrupt; we are missing the blob
reachable from a ref.
One way to solve this is to be more thorough when
referencing a sha1: make sure that not only do we have that
sha1, but that we have objects it refers to, and so forth
recursively. The problem is that this is very expensive.
Creating a parent link would require traversing the entire
object graph!
Instead, this patch pushes the extra work onto prune, which
runs less frequently (and has to look at the whole object
graph anyway). It creates a new category of objects: objects
which are not recent, but which are reachable from a recent
object. We do not prune these objects, just like the
reachable and recent ones.
This lets us avoid the recursive check above, because if we
have an object, even if it is unreachable, we should have
its referent. We can make a simple inductive argument that
with this patch, this property holds (that there are no
objects with missing referents in the repository):
0. When we have no objects, we have nothing to refer or be
referred to, so the property holds.
1. If we add objects to the repository, their direct
referents must generally exist (e.g., if you create a
tree, the blobs it references must exist; if you create
a commit to point at the tree, the tree must exist).
This is already the case before this patch. And it is
not 100% foolproof (you can make bogus objects using
`git hash-object`, for example), but it should be the
case for normal usage.
Therefore for any sequence of object additions, the
property will continue to hold.
2. If we remove objects from the repository, then we will
not remove a child object (like a blob) if an object
that refers to it is being kept. That is the part
implemented by this patch.
Note, however, that our reachability check and the
actual pruning are not atomic. So it _is_ still
possible to violate the property (e.g., an object
becomes referenced just as we are deleting it). This
patch is shooting for eliminating problems where the
mtimes of dependent objects differ by hours or days,
and one is dropped without the other. It does nothing
to help with short races.
Naively, the simplest way to implement this would be to add
all recent objects as tips to the reachability traversal.
However, this does not perform well. In a recently-packed
repository, all reachable objects will also be recent, and
therefore we have to look at each object twice. This patch
instead performs the reachability traversal, then follows up
with a second traversal for recent objects, skipping any
that have already been marked.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:41:21 +0000 (18:41 -0400)]
sha1_file: add for_each iterators for loose and packed objects
We typically iterate over the reachable objects in a
repository by starting at the tips and walking the graph.
There's no easy way to iterate over all of the objects,
including unreachable ones. Let's provide a way of doing so.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:41:11 +0000 (18:41 -0400)]
count-objects: use for_each_loose_file_in_objdir
This drops our line count considerably, and should make
things more readable by keeping the counting logic separate
from the traversal.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:40:58 +0000 (18:40 -0400)]
count-objects: do not use xsize_t when counting object size
The point of xsize_t is to safely cast an off_t into a size_t
(because we are about to mmap). But in count-objects, we are
summing the sizes in an off_t. Using xsize_t means that
count-objects could fail on a 32-bit system with a 4G
object (not likely, as other parts of git would fail, but
we should at least be correct here).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:40:53 +0000 (18:40 -0400)]
prune-packed: use for_each_loose_file_in_objdir
This saves us from manually traversing the directory
structure ourselves.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:40:37 +0000 (18:40 -0400)]
reachable: mark index blobs as SEEN
When we mark all reachable objects for pruning, that
includes blobs mentioned by the index. However, we do not
mark these with the SEEN flag, as we do for objects that we
find by traversing (we also do not add them to the pending
list, but that is because there is nothing further to
traverse with them).
This doesn't cause any problems with prune, because it
checks only that the object exists in the global object
hash, and not its flags. However, let's mark these objects
to be consistent and avoid any later surprises.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:38:55 +0000 (18:38 -0400)]
prune: factor out loose-object directory traversal
Prune has to walk $GIT_DIR/objects/?? in order to find the
set of loose objects to prune. Other parts of the code
(e.g., count-objects) want to do the same. Let's factor it
out into a reusable for_each-style function.
Note that this is not quite a straight code movement. The
original code had strange behavior when it found a file of
the form "[0-9a-f]{2}/.{38}" that did _not_ contain all hex
digits. It executed a "break" from the loop, meaning that we
stopped pruning in that directory (but still pruned other
directories!). This was probably a bug; we do not want to
process the file as an object, but we should keep going
otherwise (and that is how the new code handles it).
We are also a little more careful with loose object
directories which fail to open. The original code silently
ignored any failures, but the new code will complain about
any problems besides ENOENT.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:38:31 +0000 (18:38 -0400)]
reachable: reuse revision.c "add all reflogs" code
We want to add all reflog entries as tips for finding
reachable objects. The revision machinery can already do
this (to support "rev-list --reflog"); we can reuse that
code.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:37:28 +0000 (18:37 -0400)]
reachable: use traverse_commit_list instead of custom walk
To find the set of reachable objects, we add a bunch of
possible sources to our rev_info, call prepare_revision_walk,
and then launch into a custom walker that handles each
object top. This is a subset of what traverse_commit_list
does, so we can just reuse that code (it can also handle
more complex cases like UNINTERESTING commits and pathspecs,
but we don't use those features).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:35:12 +0000 (18:35 -0400)]
clean up name allocation in prepare_revision_walk
When we enter prepare_revision_walk, we have zero or more
entries in our "pending" array. We disconnect that array
from the rev_info, and then process each entry:
1. If the entry is a commit and the --source option is in
effect, we keep a pointer to the object name.
2. Otherwise, we re-add the item to the pending list with
a blank name.
We then throw away the old array by freeing the array
itself, but do not touch the "name" field of each entry. For
any items of type (2), we leak the memory associated with
the name. This commit fixes that by calling object_array_clear,
which handles the cleanup for us.
That breaks (1), though, because it depends on the memory
pointed to by the name to last forever. We can solve that by
making a copy of the name. This is slightly less efficient,
but it shouldn't matter in practice, as we do it only for
the tip commits of the traversal.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:34:34 +0000 (18:34 -0400)]
object_array: add a "clear" function
There's currently no easy way to free the memory associated
with an object_array (and in most cases, we simply leak the
memory in a rev_info's pending array). Let's provide a
helper to make this easier to handle.
We can make use of it in list-objects.c, which does the same
thing by hand (but fails to free the "name" field of each
entry, potentially leaking memory).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:34:19 +0000 (18:34 -0400)]
object_array: factor out slopbuf-freeing logic
This is not a lot of code, but it's a logical construct that
should not need to be repeated (and we are about to add a
third repetition).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:34:05 +0000 (18:34 -0400)]
isxdigit: cast input to unsigned char
Otherwise, callers must do so or risk triggering warnings
-Wchar-subscript (and rightfully so; a signed char might
cause us to use a bogus negative index into the
hexval_table).
While we are dropping the now-unnecessary casts from the
caller in urlmatch.c, we can get rid of similar casts in
actually parsing the hex by using the hexval() helper, which
implicitly casts to unsigned (but note that we cannot
implement isxdigit in terms of hexval(), as it also casts
its return value to unsigned).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 15 Oct 2014 22:33:13 +0000 (18:33 -0400)]
foreach_alt_odb: propagate return value from callback
We check the return value of the callback and stop iterating
if it is non-zero. However, we do not make the non-zero
return value available to the caller, so they have no way of
knowing whether the operation succeeded or not (technically
they can keep their own error flag in the callback data, but
that is unlike our other for_each functions).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 10 Oct 2014 06:47:27 +0000 (02:47 -0400)]
test-lib.sh: support -x option for shell-tracing
Usually running a test under "-v" makes it clear which
command is failing. However, sometimes it can be useful to
also see a complete trace of the shell commands being run in
the test. You can do so without any support from the test
suite by running "sh -x tXXXX-foo.sh". However, this
produces quite a large bit of output, as we see a trace of
the entire test suite.
This patch instead introduces a "-x" option to the test
scripts (i.e., "./tXXXX-foo.sh -x"). When enabled, this
turns on "set -x" only for the tests themselves. This can
still be a bit verbose, but should keep things to a more
manageable level. You can even use "--verbose-only" to see
the trace only for a specific test.
The implementation is a little invasive. We turn on the "set
-x" inside the "eval" of the test code. This lets the eval
itself avoid being reported in the trace (which would be
long, and redundant with the verbose listing we already
showed). And then after the eval runs, we do some trickery
with stderr to avoid showing the "set +x" to the user.
We also show traces for test_cleanup functions (since they
can impact the test outcome, too). However, we do avoid
running the noop ":" cleanup (the default if the test does
not use test_cleanup at all), as it creates unnecessary
noise in the "set -x" output.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 10 Oct 2014 06:11:14 +0000 (02:11 -0400)]
t5304: use helper to report failure of "test foo = bar"
For small outputs, we sometimes use:
test "$(some_cmd)" = "something we expect"
instead of a full test_cmp. The downside of this is that
when it fails, there is no output at all from the script.
Let's introduce a small helper to make tests easier to
debug.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 10 Oct 2014 06:07:00 +0000 (02:07 -0400)]
t5304: use test_path_is_* instead of "test -f"
This is slightly more robust (checking "! test -f" would not
notice a directory of the same name, though that is not
likely to happen here). It also makes debugging easier, as
the test script will output a message on failure.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 8 Oct 2014 20:08:55 +0000 (13:08 -0700)]
Update draft release notes to 2.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 8 Oct 2014 20:05:32 +0000 (13:05 -0700)]
Merge branch 'sp/stream-clean-filter'
When running a required clean filter, we do not have to mmap the
original before feeding the filter. Instead, stream the file
contents directly to the filter and process its output.
* sp/stream-clean-filter:
sha1_file: don't convert off_t to size_t too early to avoid potential die()
convert: stream from fd to required clean filter to reduce used address space
copy_fd(): do not close the input file descriptor
mmap_limit: introduce GIT_MMAP_LIMIT to allow testing expected mmap size
memory_limit: use git_env_ulong() to parse GIT_ALLOC_LIMIT
config.c: add git_env_ulong() to parse environment variable
convert: drop arguments other than 'path' from would_convert_to_git()
Junio C Hamano [Wed, 8 Oct 2014 20:05:29 +0000 (13:05 -0700)]
Merge branch 'bw/use-write-script-in-tests'
* bw/use-write-script-in-tests:
t/lib-credential: use write_script
Junio C Hamano [Wed, 8 Oct 2014 20:05:25 +0000 (13:05 -0700)]
Merge branch 'nd/archive-pathspec'
"git archive" learned to filter what gets archived with pathspec.
* nd/archive-pathspec:
archive: support filtering paths with glob
Junio C Hamano [Wed, 8 Oct 2014 20:05:15 +0000 (13:05 -0700)]
Merge branch 'jc/push-cert'
Allow "git push" request to be signed, so that it can be verified and
audited, using the GPG signature of the person who pushed, that the
tips of branches at a public repository really point the commits
the pusher wanted to, without having to "trust" the server.
* jc/push-cert: (24 commits)
receive-pack::hmac_sha1(): copy the entire SHA-1 hash out
signed push: allow stale nonce in stateless mode
signed push: teach smart-HTTP to pass "git push --signed" around
signed push: fortify against replay attacks
signed push: add "pushee" header to push certificate
signed push: remove duplicated protocol info
send-pack: send feature request on push-cert packet
receive-pack: GPG-validate push certificates
push: the beginning of "git push --signed"
pack-protocol doc: typofix for PKT-LINE
gpg-interface: move parse_signature() to where it should be
gpg-interface: move parse_gpg_output() to where it should be
send-pack: clarify that cmds_sent is a boolean
send-pack: refactor inspecting and resetting status and sending commands
send-pack: rename "new_refs" to "need_pack_data"
receive-pack: factor out capability string generation
send-pack: factor out capability string generation
send-pack: always send capabilities
send-pack: refactor decision to send update per ref
send-pack: move REF_STATUS_REJECT_NODELETE logic a bit higher
...
Junio C Hamano [Tue, 7 Oct 2014 20:41:03 +0000 (13:41 -0700)]
Sync with maint
* maint:
git-tag.txt: Add a missing hyphen to `-s`
Junio C Hamano [Tue, 7 Oct 2014 20:40:51 +0000 (13:40 -0700)]
Merge branch 'maint-2.0' into maint
* maint-2.0:
git-tag.txt: Add a missing hyphen to `-s`
Junio C Hamano [Tue, 7 Oct 2014 20:40:39 +0000 (13:40 -0700)]
Merge branch 'maint-1.9' into maint-2.0
* maint-1.9:
git-tag.txt: Add a missing hyphen to `-s`
Junio C Hamano [Tue, 7 Oct 2014 20:40:19 +0000 (13:40 -0700)]
Merge branch 'maint-1.8.5' into maint-1.9
* maint-1.8.5:
git-tag.txt: Add a missing hyphen to `-s`
Junio C Hamano [Tue, 7 Oct 2014 20:39:24 +0000 (13:39 -0700)]
Merge branch 'jk/mbox-from-line' into maint
Some MUAs mangled a line in a message that begins with "From " to
">From " when writing to a mailbox file and feeding such an input to
"git am" used to lose such a line.
* jk/mbox-from-line:
mailinfo: work around -Wstring-plus-int warning
mailinfo: make ">From" in-body header check more robust
Wieland Hoffmann [Sat, 4 Oct 2014 16:27:16 +0000 (18:27 +0200)]
git-tag.txt: Add a missing hyphen to `-s`
Signed-off-by: Wieland Hoffmann <themineo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 30 Sep 2014 05:17:57 +0000 (22:17 -0700)]
Sync with 2.1.2
* maint:
Git 2.1.2
Junio C Hamano [Tue, 30 Sep 2014 05:17:23 +0000 (22:17 -0700)]
Merge branch 'jt/itimer-autoconf'
setitmer(2) and related API elements can be configured from
Makefile but autoconf did not know about it.
* jt/itimer-autoconf:
autoconf: check for setitimer()
autoconf: check for struct itimerval
git-compat-util.h: add missing semicolon after struct itimerval
Junio C Hamano [Tue, 30 Sep 2014 05:17:22 +0000 (22:17 -0700)]
Merge branch 'jc/test-lazy-prereq'
Test-script clean-up.
* jc/test-lazy-prereq:
tests: drop GIT_*_TIMING_TESTS environment variable support
Junio C Hamano [Tue, 30 Sep 2014 05:17:21 +0000 (22:17 -0700)]
Merge branch 'sb/merge-recursive-copy-paste-fix'
"git merge-recursive" had a small bug that could have made it
mishandle "one side deleted, the other side did not touch it" in a
rare corner case, where the other side actually did touch to cause
the blob object names to be different but both blobs before and
after the change normalize to the same (e.g. correcting mistake to
check in a blob with CRLF line endings by replacing it with another
blob that records the same contents with LF line endings).
* sb/merge-recursive-copy-paste-fix:
merge-recursive: remove stale commented debugging code
merge-recursive: fix copy-paste mistake
Junio C Hamano [Tue, 30 Sep 2014 05:17:20 +0000 (22:17 -0700)]
Merge branch 'pr/use-default-sigpipe-setting'
We used to get confused when a process called us with SIGPIPE
ignored; we do want to die with SIGPIPE when the output is not
read by default, and do ignore the signal when appropriate.
* pr/use-default-sigpipe-setting:
mingw.h: add dummy functions for sigset_t operations
unblock and unignore SIGPIPE
Junio C Hamano [Tue, 30 Sep 2014 05:15:00 +0000 (22:15 -0700)]
Git 2.1.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 30 Sep 2014 05:10:55 +0000 (22:10 -0700)]
Merge branch 'jk/fsck-exit-code-fix' into maint
"git fsck" failed to report that it found corrupt objects via its
exit status in some cases.
* jk/fsck-exit-code-fix:
fsck: return non-zero status on missing ref tips
fsck: exit with non-zero status upon error from fsck_obj()
Junio C Hamano [Tue, 30 Sep 2014 05:10:25 +0000 (22:10 -0700)]
Merge branch 'ta/config-add-to-empty-or-true-fix' into maint
"git config --add section.var val" used to lose existing
section.var whose value was an empty string.
* ta/config-add-to-empty-or-true-fix:
config: avoid a funny sentinel value "a^"
make config --add behave correctly for empty and NULL values
Junio C Hamano [Tue, 30 Sep 2014 05:10:04 +0000 (22:10 -0700)]
Merge branch 'mk/reachable-protect-detached-head' into maint
Reachability check (used in "git prune" and friends) did not add a
detached HEAD as a starting point to traverse objects still in use.
* mk/reachable-protect-detached-head:
reachable.c: add HEAD to reachability starting commits
Junio C Hamano [Tue, 30 Sep 2014 05:09:47 +0000 (22:09 -0700)]
Merge branch 'mb/fast-import-delete-root' into maint
An attempt to remove the entire tree in the "git fast-import" input
stream caused it to misbehave.
* mb/fast-import-delete-root:
fast-import: fix segfault in store_tree()
t9300: test filedelete command
Junio C Hamano [Tue, 30 Sep 2014 05:09:24 +0000 (22:09 -0700)]
Merge branch 'jk/index-pack-threading-races' into maint
When receiving an invalid pack stream that records the same object
twice, multiple threads got confused due to a race.
* jk/index-pack-threading-races:
index-pack: fix race condition with duplicate bases
Junio C Hamano [Tue, 30 Sep 2014 05:08:17 +0000 (22:08 -0700)]
Merge branch 'jk/send-pack-many-refspecs' into maint
"git push" over HTTP transport had an artificial limit on number of
refs that can be pushed imposed by the command line length.
* jk/send-pack-many-refspecs:
send-pack: take refspecs over stdin
Junio C Hamano [Tue, 30 Sep 2014 05:08:12 +0000 (22:08 -0700)]
Merge branch 'so/rebase-doc' into maint
* so/rebase-doc:
Documentation/git-rebase.txt: <upstream> must be given to specify <branch>
Documentation/git-rebase.txt: -f forces a rebase that would otherwise be a no-op
Junio C Hamano [Mon, 29 Sep 2014 19:44:43 +0000 (12:44 -0700)]
Update draft release notes to 2.2
Junio C Hamano [Mon, 29 Sep 2014 19:36:15 +0000 (12:36 -0700)]
Merge branch 'jk/mbox-from-line'
Some MUAs mangled a line in a message that begins with "From " to
">From " when writing to a mailbox file and feeding such an input
to "git am" used to lose such a line.
* jk/mbox-from-line:
mailinfo: work around -Wstring-plus-int warning
mailinfo: make ">From" in-body header check more robust
Junio C Hamano [Mon, 29 Sep 2014 19:36:14 +0000 (12:36 -0700)]
Merge branch 'sb/t6031-typofix'
* sb/t6031-typofix:
t6031-test-merge-recursive: do not forget to add file to be committed
Junio C Hamano [Mon, 29 Sep 2014 19:36:13 +0000 (12:36 -0700)]
Merge branch 'sb/t9300-typofix'
* sb/t9300-typofix:
t9300-fast-import: fix typo in test description
Junio C Hamano [Mon, 29 Sep 2014 19:36:12 +0000 (12:36 -0700)]
Merge branch 'rs/remote-simplify'
* rs/remote-simplify:
remote: simplify match_name_with_pattern() using strbuf
Junio C Hamano [Mon, 29 Sep 2014 19:36:11 +0000 (12:36 -0700)]
Merge branch 'rs/graph-simplify'
* rs/graph-simplify:
graph: simplify graph_padding_line()
Junio C Hamano [Mon, 29 Sep 2014 19:36:10 +0000 (12:36 -0700)]
Merge branch 'da/rev-parse-verify-quiet'
"rev-parse --verify --quiet $name" is meant to quietly exit with a
non-zero status when $name is not a valid object name, but still
gave error messages in some cases.
* da/rev-parse-verify-quiet:
stash: prefer --quiet over shell redirection of the standard error stream
refs: make rev-parse --quiet actually quiet
t1503: use test_must_be_empty
Documentation: a note about stdout for git rev-parse --verify --quiet
Junio C Hamano [Mon, 29 Sep 2014 19:36:08 +0000 (12:36 -0700)]
Merge branch 'hj/pretty-naked-decoration'
The pretty-format specifier "%d", which expanded to " (tagname)"
for a tagged commit, gained a cousin "%D" that just gives the
"tagname" without frills.
* hj/pretty-naked-decoration:
pretty: add %D format specifier
Ben Walton [Mon, 29 Sep 2014 07:02:07 +0000 (08:02 +0100)]
t/lib-credential: use write_script
Use write_script to create the helper "askpass" script, instead of
hand-creating it with hardcoded "#!/bin/sh" to make sure we use the
shell the user told us to use.
Signed-off-by: Ben Walton <bdwalton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Sun, 28 Sep 2014 07:03:25 +0000 (00:03 -0700)]
Merge branch 'maint'
* maint:
l10n: de.po: use comma before "um"
l10n: de.po: change Email to E-Mail
po/TEAMS: add new member to German translation team
Junio C Hamano [Sun, 28 Sep 2014 07:02:57 +0000 (00:02 -0700)]
Merge branch 'maint' of git://github.com/git-l10n/git-po into maint
* 'maint' of git://github.com/git-l10n/git-po:
l10n: de.po: use comma before "um"
l10n: de.po: change Email to E-Mail
po/TEAMS: add new member to German translation team
Junio C Hamano [Fri, 26 Sep 2014 21:51:23 +0000 (14:51 -0700)]
Update draft release notes to 2.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 26 Sep 2014 21:39:46 +0000 (14:39 -0700)]
Merge branch 'sb/help-unknown-command-sort-fix'
Code cleanup.
* sb/help-unknown-command-sort-fix:
help: fix the size passed to qsort
Junio C Hamano [Fri, 26 Sep 2014 21:39:45 +0000 (14:39 -0700)]
Merge branch 'jk/branch-verbose-merged'
The "--verbose" option no longer breaks "git branch --merged $it".
* jk/branch-verbose-merged:
branch: clean up commit flags after merge-filter walk
Junio C Hamano [Fri, 26 Sep 2014 21:39:45 +0000 (14:39 -0700)]
Merge branch 'rs/realloc-array'
Code cleanup.
* rs/realloc-array:
use REALLOC_ARRAY for changing the allocation size of arrays
add macro REALLOC_ARRAY
Junio C Hamano [Fri, 26 Sep 2014 21:39:45 +0000 (14:39 -0700)]
Merge branch 'jk/close-stderr-of-credential-cache-deamon'
Plug fd leaks.
* jk/close-stderr-of-credential-cache-deamon:
credential-cache: close stderr in daemon process
Junio C Hamano [Fri, 26 Sep 2014 21:39:44 +0000 (14:39 -0700)]
Merge branch 'jc/ignore-sigpipe-while-running-hooks'
pre- and post-receive hooks are no longer required to read all
their inputs.
* jc/ignore-sigpipe-while-running-hooks:
receive-pack: allow hooks to ignore its standard input stream
Junio C Hamano [Fri, 26 Sep 2014 21:39:44 +0000 (14:39 -0700)]
Merge branch 'jk/prune-packed-server-info'
Code cleanup.
* jk/prune-packed-server-info:
repack: call prune_packed_objects() and update_server_info() directly
server-info: clean up after writing info/packs
make update-server-info more robust
prune-packed: fix minor memory leak
Junio C Hamano [Fri, 26 Sep 2014 21:39:44 +0000 (14:39 -0700)]
Merge branch 'jc/hash-object-fsck-tag'
Using "hash-object --literally", test one of the new breakages
js/fsck-tag-validation topic teaches "fsck" to catch is caught.
* jc/hash-object-fsck-tag:
t1450: make sure fsck detects a malformed tagger line
Junio C Hamano [Fri, 26 Sep 2014 21:39:43 +0000 (14:39 -0700)]
Merge branch 'jc/hash-object'
"hash-object" learned a new "--literally" option to hash any random
garbage into a loose object, to allow us to create a test data for
mechanisms to catch corrupt objects.
* jc/hash-object:
hash-object: add --literally option
hash-object: pass 'write_object' as a flag
hash-object: reduce file-scope statics
Junio C Hamano [Fri, 26 Sep 2014 21:39:43 +0000 (14:39 -0700)]
Merge branch 'js/fsck-tag-validation'
Teach "git fsck" to inspect the contents of annotated tag objects.
* js/fsck-tag-validation:
Make sure that index-pack --strict checks tag objects
Add regression tests for stricter tag fsck'ing
fsck: check tag objects' headers
Make sure fsck_commit_buffer() does not run out of the buffer
fsck_object(): allow passing object data separately from the object itself
Refactor type_from_string() to allow continuing after detecting an error
Junio C Hamano [Fri, 26 Sep 2014 21:39:43 +0000 (14:39 -0700)]
Merge branch 'jk/faster-name-conflicts'
Optimize the check to see if a ref $F can be created by making sure
no existing ref has $F/ as its prefix, which especially matters in
a repository with a large number of existing refs.
* jk/faster-name-conflicts:
refs: speed up is_refname_available
Junio C Hamano [Fri, 26 Sep 2014 21:39:42 +0000 (14:39 -0700)]
Merge branch 'jk/write-packed-refs-via-stdio'
Optimize the code path to write out the packed-refs file, which
especially matters in a repository with a large number of refs.
* jk/write-packed-refs-via-stdio:
refs: write packed_refs file using stdio
Phillip Sz [Tue, 23 Sep 2014 12:00:52 +0000 (14:00 +0200)]
l10n: de.po: use comma before "um"
This patch adds a comma before the "um". See:
http://www.duden.de/sprachwissen/rechtschreibregeln/komma#K117
Signed-off-by: Phillip Sz <phillip.szelat@gmail.com>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Phillip Sz [Sat, 20 Sep 2014 15:51:53 +0000 (17:51 +0200)]
l10n: de.po: change Email to E-Mail
Change all Email to E-Mail, as this is the correct form in German.
Signed-off-by: Phillip Sz <phillip.szelat@gmail.com>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Ralf Thielow [Fri, 5 Sep 2014 16:30:49 +0000 (18:30 +0200)]
po/TEAMS: add new member to German translation team
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Brian Gernhardt [Thu, 25 Sep 2014 15:02:20 +0000 (11:02 -0400)]
receive-pack::hmac_sha1(): copy the entire SHA-1 hash out
clang gives the following warning:
builtin/receive-pack.c:327:35: error: sizeof on array function
parameter will return size of 'unsigned char *' instead of 'unsigned
char [20]' [-Werror,-Wsizeof-array-argument]
git_SHA1_Update(&ctx, out, sizeof(out));
^
builtin/receive-pack.c:292:37: note: declared here
static void hmac_sha1(unsigned char out[20],
^
Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller [Tue, 23 Sep 2014 14:55:50 +0000 (16:55 +0200)]
merge-recursive: remove stale commented debugging code
Signed-off-by: Stefan Beller <stefanbeller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller [Sun, 21 Sep 2014 20:49:46 +0000 (22:49 +0200)]
merge-recursive: fix copy-paste mistake
The following issue was found by scan.coverity.com (ID:
1049510),
and claimed to be likely a copy-paste mistake.
Introduced in
331a1838b (2010-07-02, Try normalizing files
to avoid delete/modify conflicts when merging), which is
quite a long time ago, so I'm rather unsure if it's of any impact
or just went unnoticed.
The line after the changed line has a comparison of 'o.len' to 'a.len',
so we should assume the lengths may be different.
I'd be happy to have a test for this bug(?) attached to
t6031-merge-recursive.sh, but I did not manage to
come up with a test in a reasonable amount of time.
Signed-off-by: Stefan Beller <stefanbeller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Sunshine [Sun, 21 Sep 2014 09:13:58 +0000 (05:13 -0400)]
mailinfo: work around -Wstring-plus-int warning
The just-released Apple Xcode 6.0.1 has -Wstring-plus-int enabled by
default which complains about pointer arithmetic applied to a string
literal:
builtin/mailinfo.c:303:24: warning:
adding 'long' to a string does not append to the string
return !memcmp(SAMPLE + (cp - line), cp, strlen(SAMPLE) ...
~~~~~~~^~~~~~~~~~~~~
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Sixt [Mon, 22 Sep 2014 18:24:34 +0000 (20:24 +0200)]
mingw.h: add dummy functions for sigset_t operations
Windows does not have POSIX-like signals, and so we ignore all
operations on the non-existent signal mask machinery.
Do not turn sigemptyset into a function, but leave it a macro that
erases the code in the argument because it is used to set sa_mask
of a struct sigaction, but our dummy in mingw.h does not have that
member.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller [Sun, 21 Sep 2014 20:38:17 +0000 (22:38 +0200)]
t6031-test-merge-recursive: do not forget to add file to be committed
Signed-off-by: Stefan Beller <stefanbeller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller [Sun, 21 Sep 2014 15:02:57 +0000 (17:02 +0200)]
t9300-fast-import: fix typo in test description
Signed-off-by: Stefan Beller <stefanbeller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Steffen Prohaska [Sun, 21 Sep 2014 10:03:26 +0000 (12:03 +0200)]
sha1_file: don't convert off_t to size_t too early to avoid potential die()
xsize_t() checks if an off_t argument can be safely converted to
a size_t return value. If the check is executed too early, it could
fail for large files on 32-bit architectures even if the size_t code
path is not taken. Other paths might be able to handle the large file.
Specifically, index_stream_convert_blob() is able to handle a large file
if a filter is configured that returns a small result.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Sun, 21 Sep 2014 08:23:37 +0000 (10:23 +0200)]
remote: simplify match_name_with_pattern() using strbuf
Make the code simpler and shorter by avoiding repetitive use of
string length variables and leaving memory allocation to strbuf
functions.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Sat, 20 Sep 2014 18:29:53 +0000 (20:29 +0200)]
graph: simplify graph_padding_line()
Deduplicate code common to both branches of if statements.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Sun, 21 Sep 2014 03:55:06 +0000 (10:55 +0700)]
archive: support filtering paths with glob
This patch fixes two problems with using :(glob) (or even "*.c"
without ":(glob)").
The first one is we forgot to turn on the 'recursive' flag in struct
pathspec. Without that, tree_entry_interesting() will not mark
potential directories "interesting" so that it can confirm whether
those directories have anything matching the pathspec.
The marking directories interesting has a side effect that we need to
walk inside a directory to realize that there's nothing interested in
there. By that time, 'archive' code has already written the (empty)
directory down. That means lots of empty directories in the result
archive.
This problem is fixed by lazily writing directories down when we know
they are actually needed. There is a theoretical bug in this
implementation: we can't write empty trees/directories that match that
pathspec.
path_exists() is also made stricter in order to detect non-matching
pathspec because when this 'recursive' flag is on, we most likely
match some directories. The easiest way is not consider any
directories "matched".
Noticed-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 19 Sep 2014 18:51:14 +0000 (11:51 -0700)]
Update draft release notes to 2.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 19 Sep 2014 21:22:34 +0000 (14:22 -0700)]
Sync with Git 2.1.1
Junio C Hamano [Fri, 19 Sep 2014 21:21:31 +0000 (14:21 -0700)]
Git 2.1.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 19 Sep 2014 21:05:13 +0000 (14:05 -0700)]
Merge branch 'et/spell-poll-infinite-with-minus-one-only' into maint
* et/spell-poll-infinite-with-minus-one-only:
upload-pack: keep poll(2)'s timeout to -1
Junio C Hamano [Fri, 19 Sep 2014 21:05:12 +0000 (14:05 -0700)]
Merge branch 'nd/fetch-pass-quiet-to-gc-child-process' into maint
* nd/fetch-pass-quiet-to-gc-child-process:
fetch: silence git-gc if --quiet is given
fetch: convert argv_gc_auto to struct argv_array
Junio C Hamano [Fri, 19 Sep 2014 21:05:12 +0000 (14:05 -0700)]
Merge branch 'jk/prune-top-level-refs-after-packing' into maint
* jk/prune-top-level-refs-after-packing:
pack-refs: prune top-level refs like "refs/foo"
Junio C Hamano [Fri, 19 Sep 2014 21:05:12 +0000 (14:05 -0700)]
Merge branch 'jk/fast-import-fixes' into maint
* jk/fast-import-fixes:
fast-import: fix buffer overflow in dump_tags
fast-import: clean up pack_data pointer in end_packfile
Junio C Hamano [Fri, 19 Sep 2014 21:05:12 +0000 (14:05 -0700)]
Merge branch 'jn/unpack-trees-checkout-m-carry-deletion' into maint
* jn/unpack-trees-checkout-m-carry-deletion:
checkout -m: attempt merge when deletion of path was staged
unpack-trees: use 'cuddled' style for if-else cascade
unpack-trees: simplify 'all other failures' case
Junio C Hamano [Fri, 19 Sep 2014 21:05:11 +0000 (14:05 -0700)]
Merge branch 'sp/pack-protocol-doc-on-shallow' into maint
* sp/pack-protocol-doc-on-shallow:
Document LF appearing in shallow command during send-pack/receive-pack
Junio C Hamano [Fri, 19 Sep 2014 21:05:11 +0000 (14:05 -0700)]
Merge branch 'jk/prompt-stash-could-be-packed' into maint
* jk/prompt-stash-could-be-packed:
git-prompt: do not look for refs/stash in $GIT_DIR
Junio C Hamano [Fri, 19 Sep 2014 21:05:11 +0000 (14:05 -0700)]
Merge branch 'rs/refresh-beyond-symlink' into maint
* rs/refresh-beyond-symlink:
read-cache: check for leading symlinks when refreshing index
Junio C Hamano [Fri, 19 Sep 2014 21:05:11 +0000 (14:05 -0700)]
Merge branch 'lf/bundle-exclusion' into maint
* lf/bundle-exclusion:
bundle: fix exclusion of annotated tags
Junio C Hamano [Fri, 19 Sep 2014 21:05:10 +0000 (14:05 -0700)]
Merge branch 'jc/apply-ws-prefix' into maint
* jc/apply-ws-prefix:
apply: omit ws check for excluded paths
apply: hoist use_patch() helper for path exclusion up
apply: use the right attribute for paths in non-Git patches
Conflicts:
builtin/apply.c
Junio C Hamano [Fri, 19 Sep 2014 21:05:10 +0000 (14:05 -0700)]
Merge branch 'jk/command-line-config-empty-string' into maint
* jk/command-line-config-empty-string:
config: teach "git -c" to recognize an empty string
Conflicts:
config.c
Junio C Hamano [Fri, 19 Sep 2014 21:05:09 +0000 (14:05 -0700)]
Merge branch 'jk/pretty-empty-format' into maint
* jk/pretty-empty-format:
pretty: make empty userformats truly empty
pretty: treat "--format=" as an empty userformat
revision: drop useless string offset when parsing "--pretty"
Junio C Hamano [Fri, 19 Sep 2014 18:38:42 +0000 (11:38 -0700)]
Merge branch 'jk/fsck-exit-code-fix'
"git fsck" failed to report that it found corrupt objects via its
exit status in some cases.
* jk/fsck-exit-code-fix:
fsck: return non-zero status on missing ref tips
fsck: exit with non-zero status upon error from fsck_obj()
Junio C Hamano [Fri, 19 Sep 2014 18:38:42 +0000 (11:38 -0700)]
Merge branch 'so/rebase-doc'
* so/rebase-doc:
Documentation/git-rebase.txt: <upstream> must be given to specify <branch>
Junio C Hamano [Fri, 19 Sep 2014 18:38:41 +0000 (11:38 -0700)]
Merge branch 'ir/makefile-typofix'
* ir/makefile-typofix:
Makefile: fix some typos in the preamble