]> asedeno.scripts.mit.edu Git - git.git/log
git.git
16 years agofetch/push: readd rsync support
Johannes Schindelin [Sun, 30 Sep 2007 23:59:39 +0000 (00:59 +0100)]
fetch/push: readd rsync support

We lost rsync support when transitioning from shell to C.  Support it
again (even if the transport is technically deprecated, some people just
do not have any chance to use anything else).

Also, add a test to t5510.  Since rsync transport is not configured by
default on most machines, and especially not such that you can write to
rsync://127.0.0.1$(pwd)/, it is disabled by default; you can enable it by
setting the environment variable TEST_RSYNC.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoIntroduce remove_dir_recursively()
Johannes Schindelin [Fri, 28 Sep 2007 15:28:54 +0000 (16:28 +0100)]
Introduce remove_dir_recursively()

There was a function called remove_empty_dir_recursive() buried
in refs.c.  Expose a slightly enhanced version in dir.h: it can now
optionally remove a non-empty directory.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobundle transport: fix an alloc_ref() call
Junio C Hamano [Fri, 28 Sep 2007 08:46:13 +0000 (01:46 -0700)]
bundle transport: fix an alloc_ref() call

Currently alloc_ref() expects the length of the refname plus 1
as its parameter, prepares that much space and returns a "ref"
structure for the caller to fill the refname.  One caller in
transport.c::get_refs_from_bundle() however allocated one byte
less.

It may be a good idea to change the calling convention to give
alloc_ref() the length of the refname, but that clean-up can be
done in a separate patch.  This patch only fixes the bug and
makes all callers consistent.

There was also one overallocation in connect.c, which would not
hurt but was wasteful.  This patch fixes it as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAllow abbreviations in the first refspec to be merged
Daniel Barkalow [Fri, 28 Sep 2007 23:34:17 +0000 (19:34 -0400)]
Allow abbreviations in the first refspec to be merged

The config item for a refspec side and the ref name that it matches
aren't necessarily character-for-character identical. We actually want
to merge a ref by default if: there is no per-branch config, it is the
found result of looking for the match for the first refspec, and the
first refspec is not a pattern. Beyond that, anything that
get_fetch_map() thinks matches is fine.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoPrevent send-pack from segfaulting when a branch doesn't match
Shawn O. Pearce [Tue, 25 Sep 2007 04:13:25 +0000 (00:13 -0400)]
Prevent send-pack from segfaulting when a branch doesn't match

If `git push url foo` can't find a local branch named foo we can't
match it to any remote branch as the local branch is NULL and its
name is probably at position 0x34 in memory.  On most systems that
isn't a valid address for git-send-pack's virtual address space
and we segfault.

If we can't find a source match and we have no destination we
need to abort the match function early before we try to match the
destination against the remote.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoCleanup unnecessary break in remote.c
Shawn O. Pearce [Tue, 25 Sep 2007 04:13:19 +0000 (00:13 -0400)]
Cleanup unnecessary break in remote.c

This simple change makes the body of "case 0" easier to read; no
matter what the value of matched_src is we want to break out of
the switch and not fall through.  We only want to display an error
if matched_src is NULL, as this indicates there is no local branch
matching the input.

Also modified the default case's error message so it uses one less
line of text.  Even at 8 column per tab indentation we still don't
break 80 columns with this new formatting.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoCleanup style nit of 'x == NULL' in remote.c
Shawn O. Pearce [Tue, 25 Sep 2007 04:13:14 +0000 (00:13 -0400)]
Cleanup style nit of 'x == NULL' in remote.c

Git style tends to prefer "!x" over "x == NULL".  Make it so in
these handful of locations that were not following along.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix memory leaks when disconnecting transport instances
Shawn O. Pearce [Wed, 19 Sep 2007 04:49:42 +0000 (00:49 -0400)]
Fix memory leaks when disconnecting transport instances

Most transport implementations tend to allocate a data buffer
in the struct transport instance during transport_get() so we
need to free that data buffer when we disconnect it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoEnsure builtin-fetch honors {fetch,transfer}.unpackLimit
Shawn O. Pearce [Wed, 19 Sep 2007 04:49:39 +0000 (00:49 -0400)]
Ensure builtin-fetch honors {fetch,transfer}.unpackLimit

The only way to configure the unpacking limit is currently through
the .git/config (or ~/.gitconfig) mechanism as we have no existing
command line option interface to control this threshold on a per
invocation basis.  This was intentional by design as the storage
policy of the repository should be a repository-wide decision and
should not be subject to variations made on individual command
executions.

Earlier builtin-fetch was bypassing the unpacking limit chosen by
the user through the configuration file as it did not reread the
configuration options through fetch_pack_config if we called the
internal fetch_pack() API directly.  We now ensure we always run the
config file through fetch_pack_config at least once in this process,
thereby setting our unpackLimit properly.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAlways obtain fetch-pack arguments from struct fetch_pack_args
Shawn O. Pearce [Wed, 19 Sep 2007 04:49:35 +0000 (00:49 -0400)]
Always obtain fetch-pack arguments from struct fetch_pack_args

Copying the arguments from a fetch_pack_args into static globals
within the builtin-fetch-pack module is error-prone and may lead
rise to cases where arguments supplied via the struct from the
new fetch_pack() API may not be honored by the implementation.

Here we reorganize all of the static globals into a single static
struct fetch_pack_args instance and use memcpy() to move the data
from the caller supplied structure into the globals before we
execute our pack fetching implementation.  This strategy is more
robust to additions and deletions of properties.

As keep_pack is a single bit we have also introduced lock_pack to
mean not only download and store the packfile via index-pack but
also to lock it against repacking by creating a .keep file when
the packfile itself is stored.  The caller must remove the .keep
file when it is safe to do so.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRefactor struct transport_ops inlined into struct transport
Shawn O. Pearce [Wed, 19 Sep 2007 04:49:31 +0000 (00:49 -0400)]
Refactor struct transport_ops inlined into struct transport

Aside from reducing the code by 20 lines this refactoring removes
a level of indirection when trying to access the operations of a
given transport "instance", making the code clearer and easier to
follow.

It also has the nice effect of giving us the benefits of C99 style
struct initialization (namely ".fetch = X") without requiring that
level of language support from our compiler.  We don't need to worry
about new operation methods being added as they will now be NULL'd
out automatically by the xcalloc() we use to create the new struct
transport we supply to the caller.

This pattern already exists in struct walker, so we already have
a precedent for it in Git.  We also don't really need to worry
about any sort of performance decreases that may occur as a result
of filling out 4-8 op pointers when we make a "struct transport".
The extra few CPU cycles this requires over filling in the "struct
transport_ops" is killed by the time it will take Git to actually
*use* one of those functions, as most transport operations are
going over the wire or will be copying object data locally between
two directories.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRename remote.uri to remote.url within remote handling internals
Shawn O. Pearce [Wed, 19 Sep 2007 04:49:27 +0000 (00:49 -0400)]
Rename remote.uri to remote.url within remote handling internals

Anyplace we talk about the address of a remote repository we always
refer to it as a URL, especially in the configuration file and
.git/remotes where we call it "remote.$n.url" or start the first
line with "URL:".  Calling this value a uri within the internal C
code just doesn't jive well with our commonly accepted terms.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUse 'unsigned:1' when we mean boolean options
Shawn O. Pearce [Tue, 18 Sep 2007 08:55:00 +0000 (04:55 -0400)]
Use 'unsigned:1' when we mean boolean options

These options are all strictly boolean (true/false).  Its easier to
document this implicitly by making their storage type a single bit.
There is no compelling memory space reduction reason for this change,
it just makes the structure definition slightly more readable.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoAvoid printing unnecessary warnings during fetch and push
Shawn O. Pearce [Tue, 18 Sep 2007 08:54:57 +0000 (04:54 -0400)]
Avoid printing unnecessary warnings during fetch and push

If a transport doesn't support an option we already are telling
the higher level application (fetch or push) that the option is not
valid by sending back a >0 return value from transport_set_option
so there's not a strong motivation to have the function perform the
output itself.  Instead we should let the higher level application
do the output if it is necessary.  This avoids always telling the
user that depth isn't supported on HTTP urls even when they did
not pass a --depth option to git-fetch.

If the user passes an option and the option value is invalid we now
properly die in git-fetch instead of just spitting out a message
and running anyway.  This mimics prior behavior better where
incorrect/malformed options are not accepted by the process.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoCorrect handling of branch.$name.merge in builtin-fetch
Shawn O. Pearce [Tue, 18 Sep 2007 08:54:53 +0000 (04:54 -0400)]
Correct handling of branch.$name.merge in builtin-fetch

My prior bug fix for git-push titled "Don't configure remote "." to
fetch everything to itself" actually broke t5520 as we were unable
to evaluate a branch configuration of:

  [branch "copy"]
    remote = .
    merge = refs/heads/master

as remote "." did not have a "remote...fetch" configuration entry to
offer up refs/heads/master as a possible candidate available to be
fetched and merged.  In shell script git-fetch and prior to the above
mentioned commit this was hardcoded for a url of "." to be the set of
local branches.

Chasing down this bug led me to the conclusion that our prior behavior
with regards to branch.$name.merge was incorrect.  In the shell script
based git-fetch implementation we only fetched and merged a branch if
it appeared both in branch.$name.merge *and* in remote.$r.fetch, where
$r = branch.$name.remote.  In other words in the following config file:

  [remote "origin"]
    url = git://git.kernel.org/pub/scm/git/git.git
    fetch = refs/heads/master:refs/remotes/origin/master
  [branch "master"]
    remote = origin
    merge = refs/heads/master
  [branch "pu"]
    remote = origin
    merge = refs/heads/pu

Attempting to run `git pull` while on branch "pu" would always give
the user "Already up-to-date" as git-fetch did not fetch pu and thus
did not mark it for merge in .git/FETCH_HEAD.  The configured merge
would always be ignored and the user would be left scratching her
confused head wondering why merge did not work on "pu" but worked
fine on "master".

If we are using the "default fetch" specification for the current
branch and the current branch has a branch.$name.merge configured
we now union it with the list of refs in remote.$r.fetch.  This
way the above configuration does what the user expects it to do,
which is to fetch only "master" by default but when on "pu" to
fetch both "master" and "pu".

This uncovered some breakage in the test suite where old-style Cogito
branches (.git/branches/$r) did not fetch the branches listed in
.git/config for merging and thus did not actually merge them if the
user tried to use `git pull` on that branch.  Junio and I discussed
it on list and felt that the union approach here makes more sense to
DWIM for the end-user than silently ignoring their configured request
so the test vectors for t5515 have been updated to include for-merge
lines in .git/FETCH_HEAD where they have been configured for-merge
in .git/config.

Since we are now performing a union of the fetch specification and
the merge specification and we cannot allow a branch to be listed
twice (otherwise it comes out twice in .git/FETCH_HEAD) we need to
perform a double loop here over all of the branch.$name.merge lines
and try to set their merge flag if we have already schedule that
branch for fetching by remote.$r.fetch.  If no match is found then
we must add new specifications to fetch the branch but not store it
as no local tracking branch has been designated.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoDon't attempt to merge non-existant remotes in t5515
Shawn O. Pearce [Tue, 18 Sep 2007 08:54:51 +0000 (04:54 -0400)]
Don't attempt to merge non-existant remotes in t5515

This was actually reverted in 756373da by Junio.  We no longer
support merging the right hand side of a fetchspec in a branch's
branch.$name.merge configuration setting as we interpret these
names as being only those published by the remote we are going to
fetch from.

The older shell based implementation of git-fetch did not report an
error when branch.$name.merge was referencing a branch that does
not exist on the remote and we are running `git fetch` for the
current branch.  The new builtin-fetch does notice this failure
and aborts the fetch, thus breaking the tests.

Junio and I kicked it around on #git earlier today and decided that
the best approach here is to error out and tell the user that their
configuration is wrong, as this is likely more user friendly than
silently ignoring the user's request.  Since the new builtin-fetch
is already issuing the error there is no code change required, we
just need to remove the bad configuration from our test.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agobuiltin-fetch: Don't segfault on "fetch +foo"
Shawn O. Pearce [Tue, 18 Sep 2007 08:54:48 +0000 (04:54 -0400)]
builtin-fetch: Don't segfault on "fetch +foo"

If we are fetching something and were configured to do a forced
fetch and have no local ref to store the fetched object into we
cannot mark the local ref as having a forced update.  Instead we
should just silently discard the + request.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoRemove more debugging from builtin-fetch
Shawn O. Pearce [Sun, 16 Sep 2007 06:32:17 +0000 (02:32 -0400)]
Remove more debugging from builtin-fetch

Older git-fetch.sh doesn't print "ref: X" when invoked as
`git fetch $url X" so we shouldn't do that now in the new
builtin version.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDon't configure remote "." to fetch everything to itself
Shawn O. Pearce [Sun, 16 Sep 2007 06:32:11 +0000 (02:32 -0400)]
Don't configure remote "." to fetch everything to itself

When we are talking about a remote URI of "." we are really talking
about *this* repository that we are fetching into or pushing out of.
There are no matching tracking branches for this repository; we
do not attempt to map a ref back to ourselves as this would either
create an infinite cycle (for example "fetch = +refs/*:refs/mine/*")
or it causes problems when we attempt to push back to ourselves.

So we really cannot setup a remote like this:

  [remote "."]
    url = .
    fetch = +refs/*:refs/*

In the case of `git push . B:T` to fast-forward branch T to B's
current commit git-send-pack will update branch T to B, assuming that
T is the remote tracking branch for B.  This update is performed
immediately before git-send-pack asks git-receive-pack to perform
the same update, and git-receive-pack then fails because T is not
where git-send-pack told it to expect T to be at.

In the case of `git fetch .` we really should do the same thing as
`git fetch $otherrepo`, that is load .git/FETCH_HEAD with the commit
of HEAD, so that `git pull .` will report "Already up-to-date".
We have always behaved like this before on this insane request and
we should at least continue to behave the same way.  With the above
(bad) remote configuration we were instead getting fetch errors
about funny refs, e.g. "refs/stash".

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAllow builtin-fetch to work on a detached HEAD
Shawn O. Pearce [Sun, 16 Sep 2007 06:31:26 +0000 (02:31 -0400)]
Allow builtin-fetch to work on a detached HEAD

If we are running fetch in a repository that has a detached HEAD
then there is no current_branch available.  In such a case any ref
that the fetch might update by definition cannot also be the current
branch so we should always bypass the "don't update HEAD" test.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRemove unnecessary 'fetch' argument from transport_get API
Shawn O. Pearce [Sat, 15 Sep 2007 07:23:14 +0000 (03:23 -0400)]
Remove unnecessary 'fetch' argument from transport_get API

We don't actually need to know at the time of transport_get if the
caller wants to fetch, push, or do both on the returned object.
It is easier to just delay the initialization of the HTTP walker
until we know we will need it by providing a CURL specific fetch
function in the curl_transport that makes sure the walker instance
is initialized before use.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd transport.h to LIB_H as transport.o is in LIB_OBJS
Shawn O. Pearce [Sat, 15 Sep 2007 07:23:10 +0000 (03:23 -0400)]
Add transport.h to LIB_H as transport.o is in LIB_OBJS

Any changes to transport.h probably will require rebuilding a
number of object files so we should make sure it is included
in our set of headers.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoCleanup duplicate initialization code in transport_get
Shawn O. Pearce [Sat, 15 Sep 2007 07:23:07 +0000 (03:23 -0400)]
Cleanup duplicate initialization code in transport_get

We always allocate and return a struct transport* right now as every
URL is considered to be a native Git transport if it is not rsync,
http/https/ftp or a bundle.  So we can simplify the initialization
of a new transport object by performing one xcalloc call and filling
in only the attributes required.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDon't bother passing ref log details to walker in builtin-fetch
Shawn O. Pearce [Sat, 15 Sep 2007 07:23:04 +0000 (03:23 -0400)]
Don't bother passing ref log details to walker in builtin-fetch

When using the walker API within builtin-fetch we don't allow
it to update refs locally; instead that action is reserved for
builtin-fetch's own main loop once the objects have actually
been downloaded.

Passing NULL here will bypass the unnecessary malloc/free of a
string buffer within the walker API.  That buffer is never used
because the prior argument (the refs to update) is also NULL.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoProperly cleanup in http_cleanup so builtin-fetch does not segfault
Shawn O. Pearce [Sat, 15 Sep 2007 07:23:00 +0000 (03:23 -0400)]
Properly cleanup in http_cleanup so builtin-fetch does not segfault

Junio and I both noticed that the new builtin-fetch was segfaulting
immediately on http/https/ftp style URLs (those that went through
libcurl and the commit walker).  Although the builtin-fetch changes
in this area were really just minor refactorings there was one major
change made: we invoked http_init(), http_cleanup() then http_init()
again in the same process.

When we call curl_easy_cleanup() on each active_request_slot we
are telling libcurl we did not want that buffer to be used again.
Unfortunately we did not also deallocate the active_request_slot
itself nor did we NULL out active_queue_head.  This lead us to
attempt to reuse these cleaned up libcurl handles when we later tried
to invoke http_init() a second time to reactivate the curl library.
The next file get operation then immediately segfaulted on most
versions of libcurl.

Properly freeing our own buffers and clearing the list causes us to
reinitialize the curl buffers again if/when we need to use libcurl
from within this same process.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoBackup the array passed to fetch_pack so we can free items
Shawn O. Pearce [Fri, 14 Sep 2007 22:57:11 +0000 (18:57 -0400)]
Backup the array passed to fetch_pack so we can free items

fetch_pack() can call remove_duplicates() on its input array and
this will possibly overwrite an earlier entry with a later one if
there are any duplicates in the input array.  In such a case the
caller here might then attempt to free an item multiple times as
it goes through its cleanup.

I also forgot to free the heads array we pass down into fetch_pack()
when I introduced the allocation of it in this function during my
builtin-fetch cleanup series.  Better free it while we are here
working on related memory management fixes.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix builtin-fetch memory corruption by not overstepping array
Shawn O. Pearce [Fri, 14 Sep 2007 22:59:53 +0000 (18:59 -0400)]
Fix builtin-fetch memory corruption by not overstepping array

A long time ago Junio added this line to always ensure that the
output array created by remove_duplicates() had a NULL as its
terminating node.  Today none of the downstream consumers of this
array care about a NULL terminator; they only pay attention to the
size of the array (as indicated by nr_heads).  In (nearly?) all
cases passing a NULL element will cause SIGSEGV failures.  So this
NULL terminal is not actually necessary.

Unfortunately we cannot continue to NULL terminate the array at
this point as the array may only have been allocated large enough
to match the input of nr_heads.  If there are no duplicates than
we would be trying to store NULL into heads[nr_heads] and that may
be outside of the array.

My recent series to cleanup builtin-fetch changed the allocation of
the heads array from 256 entries to exactly nr_heads thus ensuring
we were always overstepping the array and causing memory corruption.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAlways ensure the pack.keep file is removed by git-fetch
Shawn O. Pearce [Fri, 14 Sep 2007 07:31:25 +0000 (03:31 -0400)]
Always ensure the pack.keep file is removed by git-fetch

If we are using a native transport and the transport chose to
save the packfile it may have created a .keep file to protect
the packfile from a concurrently running git-repack process.

In such a case the git-fetch process should make sure it will
unlink the .keep file even if it fails to update any refs as
otherwise the newly downloaded packfile's diskspace will never
be reclaimed if the objects are not actually referenced.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRemove pack.keep after ref updates in git-fetch
Shawn O. Pearce [Fri, 14 Sep 2007 07:31:23 +0000 (03:31 -0400)]
Remove pack.keep after ref updates in git-fetch

If we are using a native packfile to perform a git-fetch invocation
and the received packfile contained more than the configured limits
of fetch.unpackLimit/transfer.unpackLimit then index-pack will output
a single line saying "keep\t$sha1\n" to stdout.  This line needs to
be captured and retained so we can delete the corresponding .keep
file ("$GIT_DIR/objects/pack/pack-$sha1.keep") once all refs have
been safely updated.

This trick has long been in use with git-fetch.sh and its lower level
helper git-fetch--tool as a way to allow index-pack to save the new
packfile before the refs have been updated and yet avoid a race with
any concurrently running git-repack process.  It was unfortunately
lost when git-fetch.sh was converted to pure C and fetch--tool was
no longer being invoked.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRefactor index-pack "keep $sha1" handling for reuse
Shawn O. Pearce [Fri, 14 Sep 2007 07:31:16 +0000 (03:31 -0400)]
Refactor index-pack "keep $sha1" handling for reuse

There is a subtle (but important) linkage between receive-pack and
index-pack that allows index-pack to create a packfile but protect
it from being deleted by a concurrent `git repack -a -d` operation.
The linkage works by having index-pack mark the newly created pack
with a ".keep" file and then it passes the SHA-1 name of that new
packfile to receive-pack along its stdout channel.

The receive-pack process must unkeep the packfile by deleting the
.keep file, but can it can only do so after all elgible refs have
been updated in the receiving repository.  This ensures that the
packfile is either kept or its objects are reachable, preventing
a concurrent repacker from deleting the packfile before it can
determine that its objects are actually needed by the repository.

The new builtin-fetch code needs to perform the same actions if
it choose to run index-pack rather than unpack-objects, so I am
moving this code out to its own function where both receive-pack
and fetch-pack are able to invoke it when necessary.  The caller
is responsible for deleting the returned ".keep" and freeing the
path if the returned path is not NULL.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoSimplify fetch transport API to just one function
Shawn O. Pearce [Fri, 14 Sep 2007 07:31:21 +0000 (03:31 -0400)]
Simplify fetch transport API to just one function

Commit walkers need to know the SHA-1 name of any objects they
have been asked to fetch while the native pack transport only
wants to know the names of the remote refs as the remote side
must do the name->SHA-1 translation.

Since we only have three fetch implementations and one of them
(bundle) doesn't even need the name information we can reduce
the code required to perform a fetch by having just one function
and passing of the filtered list of refs to be fetched.  Each
transport can then obtain the information it needs from that ref
array to construct its own internal operation state.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Conflicts:

transport.c
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoReplace custom memory growth allocator with ALLOC_GROW
Shawn O. Pearce [Fri, 14 Sep 2007 07:31:18 +0000 (03:31 -0400)]
Replace custom memory growth allocator with ALLOC_GROW

The ALLOC_GROW macro is a shorter way to implement an array that
grows upon demand as additional items are added to it.  We have
mostly standardized upon its use within git and transport.c is
not an exception.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRemove unused unpacklimit variable from builtin-fetch
Shawn O. Pearce [Fri, 14 Sep 2007 07:31:13 +0000 (03:31 -0400)]
Remove unused unpacklimit variable from builtin-fetch

Never referenced.  This should actually be handled down inside
of builtin-fetch-pack, not up here in the generic user frontend.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRemove unnecessary debugging from builtin-fetch
Shawn O. Pearce [Fri, 14 Sep 2007 07:31:11 +0000 (03:31 -0400)]
Remove unnecessary debugging from builtin-fetch

The older git-fetch client did not produce all of this debugging
information to stdout.  Most end-users and Porcelain (e.g. StGIT,
git-gui, qgit) do not want to see these low-level details on the
console so they should be removed.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix off by one bug in reflog messages written by builtin-fetch
Shawn O. Pearce [Fri, 14 Sep 2007 07:31:09 +0000 (03:31 -0400)]
Fix off by one bug in reflog messages written by builtin-fetch

We are adding a space between each argument in the sprintf above
so we must account for this as we update our position within the
reflog message and append in any remaining arguments.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoCorrect builtin-fetch to handle + in refspecs
Shawn O. Pearce [Fri, 14 Sep 2007 07:31:07 +0000 (03:31 -0400)]
Correct builtin-fetch to handle + in refspecs

If we are fetching to a local reference (the so called peer_ref) and
the refspec that created this ref/peer_ref association had started
with '+' we are supposed to allow a non-fast-forward update during
fetch, even if --force was not supplied on the command line.  The
builtin-fetch implementation was not honoring this setting as it
was copied from the wrong struct ref instance.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMake fetch a builtin
Daniel Barkalow [Tue, 11 Sep 2007 03:03:25 +0000 (23:03 -0400)]
Make fetch a builtin

Thanks to Johannes Schindelin for review and fixes, and Julian
Phillips for the original C translation.

This changes a few small bits of behavior:

branch.<name>.merge is parsed as if it were the lhs of a fetch
refspec, and does not have to exactly match the actual lhs of a
refspec, so long as it is a valid abbreviation for the same ref.

branch.<name>.merge is no longer ignored if the remote is configured
with a branches/* file. Neither behavior is useful, because there can
only be one ref that gets fetched, but this is more consistant.

Also, fetch prints different information to standard out.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd bundle transport
Johannes Schindelin [Tue, 11 Sep 2007 03:03:21 +0000 (23:03 -0400)]
Add bundle transport

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMove bundle specific stuff into bundle.[ch]
Johannes Schindelin [Tue, 11 Sep 2007 03:03:15 +0000 (23:03 -0400)]
Move bundle specific stuff into bundle.[ch]

The transport specific stuff was moved into libgit.a, and the
bundle specific stuff will not be left behind.

This is a big code move, with one exception: the function
unbundle() no longer outputs the list of refs.  You have to call
list_bundle_refs() yourself for that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd fetch methods to transport library.
Daniel Barkalow [Tue, 11 Sep 2007 03:03:11 +0000 (23:03 -0400)]
Add fetch methods to transport library.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd matching and parsing for fetch-side refspec rules
Daniel Barkalow [Tue, 11 Sep 2007 03:03:08 +0000 (23:03 -0400)]
Add matching and parsing for fetch-side refspec rules

Also exports parse_ref_spec().

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoPush code for transport library
Daniel Barkalow [Tue, 11 Sep 2007 03:03:04 +0000 (23:03 -0400)]
Push code for transport library

This moves the code to call push backends into a library that can be
extended to make matching fetch and push decisions based on the URL it
gets, and which could be changed to have built-in implementations
instead of calling external programs.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMake fetch-pack a builtin with an internal API
Daniel Barkalow [Tue, 11 Sep 2007 03:03:00 +0000 (23:03 -0400)]
Make fetch-pack a builtin with an internal API

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoReport information on branches from remote.h
Daniel Barkalow [Tue, 11 Sep 2007 03:02:56 +0000 (23:02 -0400)]
Report information on branches from remote.h

This adds full parsing for branch.<name> sections and functions to
interpret the results usefully. It incidentally corrects the fetch
configuration information for legacy branches/* files with '#'
characters in the URLs.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd uploadpack configuration info to remote.
Daniel Barkalow [Tue, 11 Sep 2007 03:02:51 +0000 (23:02 -0400)]
Add uploadpack configuration info to remote.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoModularize commit-walker
Daniel Barkalow [Tue, 11 Sep 2007 03:02:45 +0000 (23:02 -0400)]
Modularize commit-walker

This turns the extern functions to be provided by the backend into a
struct of pointers, renames the functions to be more
namespace-friendly, and updates http-fetch to this interface. It
removes the unused include from http-push.c. It makes git-http-fetch a
builtin (with the implementation a separate file, accessible
directly).

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRemove obsolete commit-walkers
Daniel Barkalow [Tue, 11 Sep 2007 03:02:40 +0000 (23:02 -0400)]
Remove obsolete commit-walkers

Removes the commit-walkers that are no longer useful, as well as
library code that was only used by ssh-fetch/push.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMake function to refill http queue a callback
Daniel Barkalow [Tue, 11 Sep 2007 03:02:34 +0000 (23:02 -0400)]
Make function to refill http queue a callback

This eliminates the last function provided by the code using http.h as
a global symbol, so it should be possible to have multiple programs
using http.h in the same executable, and it also adds an argument to
that callback, so that info can be passed into the callback without
being global.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRefactor http.h USE_CURL_MULTI fill_active_slots().
Daniel Barkalow [Tue, 11 Sep 2007 03:02:28 +0000 (23:02 -0400)]
Refactor http.h USE_CURL_MULTI fill_active_slots().

This removes all of the boilerplate and http-internal stuff from
fill_active_slots() and makes it easy to turn into a callback.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint' to sync with 1.5.3.2
Junio C Hamano [Wed, 19 Sep 2007 10:21:35 +0000 (03:21 -0700)]
Merge branch 'maint' to sync with 1.5.3.2

This is an evil merge that also updates the stale document links
in Documentation/git.txt

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoGIT 1.5.3.2 v1.5.3.2
Junio C Hamano [Wed, 19 Sep 2007 10:11:28 +0000 (03:11 -0700)]
GIT 1.5.3.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Wed, 19 Sep 2007 00:39:25 +0000 (17:39 -0700)]
Merge branch 'maint'

* maint:
  Fixed update-hook example allow-users format.
  Documentation/git-svn: updated design philosophy notes
  t/t4014: test "am -3" with mode-only change.
  Fix lapsus in builtin-apply.c
  git-push: documentation and tests for pushing only branches
  git-svnimport: Use separate arguments in the pipe for git-rev-parse

16 years agoFixed update-hook example allow-users format.
Väinö Järvelä [Tue, 18 Sep 2007 12:26:09 +0000 (15:26 +0300)]
Fixed update-hook example allow-users format.

The example provided with the update-hook-example does not work on
either bash 2.05b.0(1)-release nor 3.1.17(1)-release. The matcher did
not match the lines that it advertised to match, such as:

refs/heads/bw/        linus
refs/heads/tmp/*      *

In POSIX 1003.2 regular expressions, the star (*), is not an wildcard
meaning "match everything", it matches 0 or more matches of the atom
preceding it.

So to match "refs/heads/bw/topic-branch", the matcher should be written
as "refs/heads/bw/.*" to match "refs/heads/bw/" and everything after it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-svn: updated design philosophy notes
Eric Wong [Tue, 18 Sep 2007 23:50:42 +0000 (16:50 -0700)]
Documentation/git-svn: updated design philosophy notes

This section has not been updated in a while and
--branches/--tags/--trunk options are commonly used nowadays.

Noticed-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot/t4014: test "am -3" with mode-only change.
Junio C Hamano [Tue, 18 Sep 2007 22:19:47 +0000 (15:19 -0700)]
t/t4014: test "am -3" with mode-only change.

Earlier commit ece7b74903007cee8d280573647243d46a6f3a95 added a test
for rebase that uses "am -3", but this adds a test to check "am -3"
itself.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-commit.sh: Shell script cleanup
David Kastrup [Mon, 17 Sep 2007 20:56:44 +0000 (22:56 +0200)]
git-commit.sh: Shell script cleanup

This moves "shift" out of the argument processing "case".  It also
replaces quite a bit of expr calls with ${parameter#word} constructs,
and uses ${parameter:+word} for avoiding conditionals where possible.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agopreserve executable bits in zip archives
Dmitry Potapov [Sun, 16 Sep 2007 17:07:38 +0000 (21:07 +0400)]
preserve executable bits in zip archives

Correct `git-archive --format=zip' command to preserve executable bits in
zip archives.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix lapsus in builtin-apply.c
Pierre Habouzit [Tue, 18 Sep 2007 10:12:58 +0000 (12:12 +0200)]
Fix lapsus in builtin-apply.c

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-push: documentation and tests for pushing only branches
Jeff King [Tue, 18 Sep 2007 08:15:34 +0000 (04:15 -0400)]
git-push: documentation and tests for pushing only branches

Commit 098e711e caused git-push to match only branches when
considering which refs to push. This patch updates the
documentation accordingly and adds a test for this behavior.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svnimport: Use separate arguments in the pipe for git-rev-parse
Matthias Urlichs [Tue, 18 Sep 2007 09:29:09 +0000 (11:29 +0200)]
git-svnimport: Use separate arguments in the pipe for git-rev-parse

Some people seem to create SVN branch names with spaces
or other shell metacharacters.

Signed-off-by: Matthias Urlichs <smurf@smurf.noris.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocontrib/fast-import: add perl version of simple example
Jeff King [Tue, 18 Sep 2007 07:26:27 +0000 (03:26 -0400)]
contrib/fast-import: add perl version of simple example

This is based on the git-import.sh script, but is a little
more robust and efficient. More importantly, it should
serve as a quick template for interfacing fast-import with
perl scripts.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocontrib/fast-import: add simple shell example
Nguyen Thai Ngoc Duy [Tue, 18 Sep 2007 07:26:01 +0000 (03:26 -0400)]
contrib/fast-import: add simple shell example

This example just puts a directory under git control. It is
significantly slower than using the git tools directly, but
hopefully shows a bit how fast-import works.

  [jk: added header comments]

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorev-list --bisect: Bisection "distance" clean up.
Christian Couder [Mon, 17 Sep 2007 03:28:36 +0000 (05:28 +0200)]
rev-list --bisect: Bisection "distance" clean up.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorev-list --bisect: Move some bisection code into best_bisection.
Christian Couder [Mon, 17 Sep 2007 03:28:29 +0000 (05:28 +0200)]
rev-list --bisect: Move some bisection code into best_bisection.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorev-list --bisect: Move finding bisection into do_find_bisection.
Christian Couder [Mon, 17 Sep 2007 03:28:20 +0000 (05:28 +0200)]
rev-list --bisect: Move finding bisection into do_find_bisection.

This factorises some code and make a big function smaller.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'cr/reset'
Junio C Hamano [Tue, 18 Sep 2007 07:42:01 +0000 (00:42 -0700)]
Merge branch 'cr/reset'

* cr/reset:
  Simplify cache API
  An additional test for "git-reset -- path"
  Make "git reset" a builtin.
  Move make_cache_entry() from merge-recursive.c into read-cache.c
  Add tests for documented features of "git reset".

16 years agoMerge branch 'maint'
Junio C Hamano [Tue, 18 Sep 2007 07:41:43 +0000 (00:41 -0700)]
Merge branch 'maint'

* maint:
  Document ls-files --with-tree=<tree-ish>
  git-commit: partial commit of paths only removed from the index
  git-commit: Allow partial commit of file removal.
  send-email: make message-id generation a bit more robust
  git-gui: Disable native platform text selection in "lists"
  git-gui: Paper bag fix "Commit->Revert" format arguments
  git-gui: Provide 'uninstall' Makefile target to undo an installation
  git-gui: Font chooser to handle a large number of font families
  git-gui: Make backporting changes from i18n version easier
  git-gui: Don't delete send on Windows as it doesn't exist
  git-gui: Trim trailing slashes from untracked submodule names
  git-gui: Assume untracked directories are Git submodules
  git-gui: handle "deleted symlink" diff marker
  git-gui: show unstaged symlinks in diff viewer
  git-gui: Avoid use of libdir in Makefile
  git-gui: Disable Tk send in all git-gui sessions
  git-gui: lib/index.tcl: handle files with % in the filename properly
  git-gui: Properly set the state of "Stage/Unstage Hunk" action
  git-gui: Fix detaching current branch during checkout
  git-gui: Correct starting of git-remote to handle -w option

16 years agoDocument ls-files --with-tree=<tree-ish>
Junio C Hamano [Fri, 14 Sep 2007 23:59:04 +0000 (16:59 -0700)]
Document ls-files --with-tree=<tree-ish>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-commit: partial commit of paths only removed from the index
Junio C Hamano [Fri, 14 Sep 2007 23:53:58 +0000 (16:53 -0700)]
git-commit: partial commit of paths only removed from the index

Because a partial commit is meant to be a way to ignore what are
staged in the index, "git rm --cached A && git commit A" should
just record what is in A on the filesystem.  The previous patch
made the command sequence to barf, saying that A has not been
added yet.  This fixes it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-commit: Allow partial commit of file removal.
Junio C Hamano [Wed, 12 Sep 2007 23:04:22 +0000 (16:04 -0700)]
git-commit: Allow partial commit of file removal.

When making a partial commit, git-commit uses git-ls-files with
the --error-unmatch option to expand and sanity check the user
supplied path patterns.  When any path pattern does not match
with the paths known to the index, it errors out, in order to
catch a common mistake to say "git commit Makefiel cache.h"
and end up with a commit that touches only cache.h (notice the
misspelled "Makefile").  This detection however does not work
well when the path has already been removed from the index.

If you drop a path from the index and try to commit that
partially, i.e.

$ git rm COPYING
$ git commit -m 'Remove COPYING' COPYING

the command complains because git does not know anything about
COPYING anymore.

This introduces a new option --with-tree to git-ls-files and
uses it in git-commit when we build a temporary index to
write a tree object for the partial commit.

When --with-tree=<tree-ish> option is specified, names from the
given tree are added to the set of names the index knows about,
so we can treat COPYING file in the example as known.

Of course, there is no reason to use "git rm" and git-aware
people have long time done:

$ rm COPYING
$ git commit -m 'Remove COPYING' COPYING

which works just fine.  But this caused a constant confusion.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'jc/grep-c' into maint
Junio C Hamano [Tue, 18 Sep 2007 06:56:40 +0000 (23:56 -0700)]
Merge branch 'jc/grep-c' into maint

* jc/grep-c:
  Split grep arguments in a way that does not requires to add /dev/null.

16 years agoMerge branch 'maint' of git://repo.or.cz/git-gui into maint
Junio C Hamano [Tue, 18 Sep 2007 06:50:17 +0000 (23:50 -0700)]
Merge branch 'maint' of git://repo.or.cz/git-gui into maint

* 'maint' of git://repo.or.cz/git-gui:
  git-gui: Disable native platform text selection in "lists"
  git-gui: Paper bag fix "Commit->Revert" format arguments
  git-gui: Provide 'uninstall' Makefile target to undo an installation
  git-gui: Font chooser to handle a large number of font families
  git-gui: Make backporting changes from i18n version easier
  git-gui: Don't delete send on Windows as it doesn't exist
  git-gui: Trim trailing slashes from untracked submodule names
  git-gui: Assume untracked directories are Git submodules
  git-gui: handle "deleted symlink" diff marker
  git-gui: show unstaged symlinks in diff viewer
  git-gui: Avoid use of libdir in Makefile
  git-gui: Disable Tk send in all git-gui sessions
  git-gui: lib/index.tcl: handle files with % in the filename properly
  git-gui: Properly set the state of "Stage/Unstage Hunk" action
  git-gui: Fix detaching current branch during checkout
  git-gui: Correct starting of git-remote to handle -w option

16 years agosend-email: make message-id generation a bit more robust
Junio C Hamano [Tue, 18 Sep 2007 04:18:20 +0000 (21:18 -0700)]
send-email: make message-id generation a bit more robust

Earlier code took Unix time and appended a few random digits.
If you are firing off many messages within a second, you could
issue the same id to different messages, which is a no-no.  If
you send out 31 messages within a single second, with random
integer taken out of rand(4200), you have about 10% chance of
producing the same message ID.

This fixes the problem by uses a prefix string which is
constant-per-invocation (time and pid), with a serial number for
each message generated by the process appended at the end.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Mon, 17 Sep 2007 09:21:43 +0000 (02:21 -0700)]
Merge branch 'maint'

* maint:
  git-apply: fix whitespace stripping
  apply --index-info: fall back to current index for mode changes
  core-tutorial: minor cleanup
  documentation: replace Discussion section by link to user-manual chapter
  user-manual: todo updates and cleanup
  user-manual: fix introduction to packfiles
  user-manual: move packfile and dangling object discussion
  user-manual: rewrite object database discussion
  user-manual: reorder commit, blob, tree discussion
  user-manual: rewrite index discussion
  user-manual: create new "low-level git operations" chapter
  user-manual: rename "git internals" to "git concepts"
  user-manual: move object format details to hacking-git chapter
  user-manual: adjust section levels in "git internals"
  revision walker: --cherry-pick is a limited operation
  git-sh-setup: typofix in comments

16 years agogit-apply: fix whitespace stripping
J. Bruce Fields [Sun, 16 Sep 2007 22:49:00 +0000 (18:49 -0400)]
git-apply: fix whitespace stripping

The algorithm isn't right here: it accumulates any set of 8 spaces into
tabs even if they're separated by tabs, so

<four spaces><tab><four spaces><tab>

is converted to

<tab><tab><tab>

when it should be just

<tab><tab>

So teach git-apply that a tab hides any group of less than 8 previous
spaces in a row.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-gui: Disable native platform text selection in "lists" gitgui-0.8.3
Shawn O. Pearce [Mon, 17 Sep 2007 03:12:19 +0000 (23:12 -0400)]
git-gui: Disable native platform text selection in "lists"

Sometimes we use a Tk text widget as though it were a listbox.
This happens typically when we want to show an icon to the left
of the text label or just when a text widget is generally a better
choice then the native listbox widget.

In these cases if we want the user to have control over the selection
we implement our own "in_sel" tag that shows the selected region
and we perform our own selection management in the background
via keybindings and mouse bindings.  In such uses we don't want
the user to be able to activate the native platform selection by
dragging their mouse through the text widget.  Doing so creates a
very confusing display and the user is left wondering what it may
mean to have two different types of selection in the same widget.

Tk doesn't allow us to delete the "sel" tag that it uses internally
to manage the native selection but it will allow us to make it
invisible by setting the tag to have the same display properties
as unselected text.  So long as we don't actually use the "sel"
tag for anything in code its effectively invisible.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoapply --index-info: fall back to current index for mode changes
Johannes Schindelin [Mon, 17 Sep 2007 00:24:57 +0000 (01:24 +0100)]
apply --index-info: fall back to current index for mode changes

"git diff" does not record index lines for pure mode changes (i.e. no
lines changed).  Therefore, apply --index-info would call out a bogus
error.

Instead, fall back to reading the info from the current index.

Incidentally, this fixes an error where git-rebase would not rebase a
commit including a pure mode change, and changes requiring a threeway
merge.

Noticed and later tested by Chris Shoemaker.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint' of git://linux-nfs.org/~bfields/git into maint
Junio C Hamano [Sun, 16 Sep 2007 06:18:05 +0000 (23:18 -0700)]
Merge branch 'maint' of git://linux-nfs.org/~bfields/git into maint

* 'maint' of git://linux-nfs.org/~bfields/git:
  core-tutorial: minor cleanup
  documentation: replace Discussion section by link to user-manual chapter
  user-manual: todo updates and cleanup
  user-manual: fix introduction to packfiles
  user-manual: move packfile and dangling object discussion
  user-manual: rewrite object database discussion
  user-manual: reorder commit, blob, tree discussion
  user-manual: rewrite index discussion
  user-manual: create new "low-level git operations" chapter
  user-manual: rename "git internals" to "git concepts"
  user-manual: move object format details to hacking-git chapter
  user-manual: adjust section levels in "git internals"

16 years agocore-tutorial: minor cleanup
J. Bruce Fields [Mon, 3 Sep 2007 14:34:27 +0000 (10:34 -0400)]
core-tutorial: minor cleanup

Revise the introduction for concision, add pointers to the tutorial and
user manual as appropriate, delete cvsimport note from the end, as that
work's been done elsewhere already.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agodocumentation: replace Discussion section by link to user-manual chapter
J. Bruce Fields [Mon, 3 Sep 2007 04:01:19 +0000 (00:01 -0400)]
documentation: replace Discussion section by link to user-manual chapter

The "Discussion" section has a lot of useful information, but is a
little wordy, especially for an already-long man page, and is designed
for an audience more of potential git hackers than users, which probably
doesn't make as much sense as git matures.  Also, I (perhaps foolishly)
forked a version in the user manual, which has been significantly
rewritten in an attempt to address some of the above problems.

So, remove this section and replace it by a (very terse) summary of the
original material--my attempt at the World's Shortest Git Overview--and
a reference to the appropriate chapter of the user manual.  It's
unfortunate to remove something that's been in this place for a long
time, as some people may still depend on finding it there.  But I think
we'll want to do this some day anyway.

Cc: Andreas Ericsson <ae@op5.se>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: todo updates and cleanup
J. Bruce Fields [Mon, 3 Sep 2007 03:28:49 +0000 (23:28 -0400)]
user-manual: todo updates and cleanup

Format a couple lists.  Reminder that we may want to add submodule
documentation some day.

16 years agouser-manual: fix introduction to packfiles
J. Bruce Fields [Sun, 9 Sep 2007 02:27:18 +0000 (22:27 -0400)]
user-manual: fix introduction to packfiles

Actually I don't think we've previously mentioned .git/objects, so we
need a different introduction here.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: move packfile and dangling object discussion
J. Bruce Fields [Sun, 9 Sep 2007 02:13:53 +0000 (22:13 -0400)]
user-manual: move packfile and dangling object discussion

The discussions of packfiles and dangling objects both belong in the
object database section.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: rewrite object database discussion
J. Bruce Fields [Sun, 10 Jun 2007 19:15:08 +0000 (15:15 -0400)]
user-manual: rewrite object database discussion

Rewrite the introduction.  Rewrite each section completely to make them
work in the new order, to add some examples, and to move plumbing
commands (like git-commit-tree) to the following chapter.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: reorder commit, blob, tree discussion
J. Bruce Fields [Sat, 1 Sep 2007 03:26:38 +0000 (23:26 -0400)]
user-manual: reorder commit, blob, tree discussion

The bottom-up blog, tree, commit order makes sense unless you want to
give explicit examples--it's easier to discover objects to examine if
you go in the other order....,

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: rewrite index discussion
J. Bruce Fields [Mon, 3 Sep 2007 16:59:55 +0000 (12:59 -0400)]
user-manual: rewrite index discussion

Add an example using git-ls-files, standardize on the new "index"
terminology (as opposed to "cache"), attempt to clarify discussion and
make it a little shorter, avoid some unnecessary jargon ("write-back
cache").

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: create new "low-level git operations" chapter
J. Bruce Fields [Mon, 3 Sep 2007 15:27:56 +0000 (11:27 -0400)]
user-manual: create new "low-level git operations" chapter

The low-level index operations aren't as important to regular users as
the rest of this "git concepts" chapter; so move it into a separate
chapter, and do some minor cleanup.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: rename "git internals" to "git concepts"
J. Bruce Fields [Fri, 31 Aug 2007 03:10:05 +0000 (23:10 -0400)]
user-manual: rename "git internals" to "git concepts"

"git internals" sounds like something only git developers must know
about, but this stuff should be of wider interest.  Rename the chapter
and give it a slightly friendlier introduction.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: move object format details to hacking-git chapter
J. Bruce Fields [Fri, 31 Aug 2007 03:07:05 +0000 (23:07 -0400)]
user-manual: move object format details to hacking-git chapter

Most of this is probably only of interest to git developers.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: adjust section levels in "git internals"
J. Bruce Fields [Fri, 31 Aug 2007 02:49:33 +0000 (22:49 -0400)]
user-manual: adjust section levels in "git internals"

The descriptions of the various object types should all be a subsection
of the "Object Database" section.

I cribbed most of this chapter from the README (now core-intro.txt and
git(7)), because there's stuff in there people need to know and I was
too lazy to rewrite it.  The audience isn't quite right, though--the
chapter is a mixture of user- and developer- level documentation that
isn't as appropriate now as it was originally.

So, reserve this chapter for stuff users need to know, and move the
source code introduction into a new "git hacking" chapter where we'll
also move any hacker-only technical details.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agorevision walker: --cherry-pick is a limited operation
Johannes Schindelin [Sat, 15 Sep 2007 17:39:52 +0000 (18:39 +0100)]
revision walker: --cherry-pick is a limited operation

We used to rely on the fact that cherry-pick would trigger the code path
to set limited = 1 in handle_commit(), when an uninteresting commit was
encountered.

However, when cherry picking between two independent branches, i.e. when
there are no merge bases, and there is only linear development (which can
happen when you cvsimport a fork of a project), no uninteresting commit
will be encountered.

So set limited = 1 when --cherry-pick was asked for.

Noticed by Martin Bähr.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-sh-setup: typofix in comments
Junio C Hamano [Sat, 15 Sep 2007 23:32:23 +0000 (16:32 -0700)]
git-sh-setup: typofix in comments

Noticed by Anupam Srivastava.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'js/remote'
Junio C Hamano [Sat, 15 Sep 2007 05:38:06 +0000 (22:38 -0700)]
Merge branch 'js/remote'

* js/remote:
  Teach "git remote" a mirror mode

16 years agoMerge branch 'js/tag'
Junio C Hamano [Sat, 15 Sep 2007 05:37:55 +0000 (22:37 -0700)]
Merge branch 'js/tag'

* js/tag:
  verify-tag: also grok CR/LFs in the tag signature

16 years agoMerge branch 'lh/svn-first-parent'
Junio C Hamano [Sat, 15 Sep 2007 05:37:43 +0000 (22:37 -0700)]
Merge branch 'lh/svn-first-parent'

* lh/svn-first-parent:
  git-svn: always use --first-parent
  git-svn: add support for --first-parent

16 years agoMerge branch 'np/delta'
Junio C Hamano [Sat, 15 Sep 2007 05:33:28 +0000 (22:33 -0700)]
Merge branch 'np/delta'

* np/delta:
  builtin-pack-objects.c: avoid bogus gcc warnings
  threaded delta search: proper locking for cache accounting
  threaded delta search: add pack.threads config variable
  fix threaded delta search locking
  threaded delta search: specify number of threads at run time
  threaded delta search: better chunck split point
  threaded delta search: refine work allocation
  basic threaded delta search
  rearrange delta search progress reporting
  localize window memory usage accounting
  straighten the list of objects to deltify

16 years agobuiltin-pack-objects.c: avoid bogus gcc warnings
Junio C Hamano [Sat, 15 Sep 2007 05:30:20 +0000 (22:30 -0700)]
builtin-pack-objects.c: avoid bogus gcc warnings

These empty statement marcos can solicit bogus "statement with no effect"
warnings; squelch them.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'jc/pack'
Junio C Hamano [Sat, 15 Sep 2007 01:33:45 +0000 (18:33 -0700)]
Merge branch 'jc/pack'

* jc/pack:
  Keep last used delta base in the delta window

16 years agoMerge branch 'dk/diff-delta'
Junio C Hamano [Sat, 15 Sep 2007 01:33:15 +0000 (18:33 -0700)]
Merge branch 'dk/diff-delta'

* dk/diff-delta:
  diff-delta.c: Rationalize culling of hash buckets
  diff-delta.c: pack the index structure

16 years agoMerge branch 'jc/partial-remove'
Junio C Hamano [Sat, 15 Sep 2007 01:23:01 +0000 (18:23 -0700)]
Merge branch 'jc/partial-remove'

* jc/partial-remove:
  Document ls-files --with-tree=<tree-ish>
  git-commit: partial commit of paths only removed from the index
  git-commit: Allow partial commit of file removal.