Russell Belfer [Thu, 3 Jan 2013 01:14:00 +0000 (17:14 -0800)]
Simplify checkout documentation
This moves a lot of the detailed checkout documentation into a new
file (docs/checkout-internals.md) and simplifies the public docs
for the checkout API.
Russell Belfer [Thu, 3 Jan 2013 01:12:45 +0000 (17:12 -0800)]
Clone should use GIT_CHECKOUT_SAFE_CREATE
For clone to work as expected, it should be using a SAFE_CREATE
checkout (i.e. create files that are missing, even if the target
tree matches the current HEAD).
Russell Belfer [Thu, 3 Jan 2013 01:10:56 +0000 (17:10 -0800)]
Extend tests for checkout with typechanges
Test a number of other cases, including intentionally forced
conflicts and deeper inspection that trees get created properly.
There is a still a bug in checkout because the first test here
(i.e. test_checkout_typechange__checkout_typechanges_safe) should
be able to pass with GIT_CHECKOUT_SAFE as a strategy, but it will
not because of some lingering submodule checkout issues.
Russell Belfer [Thu, 3 Jan 2013 01:09:07 +0000 (17:09 -0800)]
Fix some submodule and typechange checkout cases
There were a bunch of small bugs in the checkout code where I was
assuming that a typechange was always from a tree to a blob or
vice versa. This fixes up most of those cases. Also, there were
circumstances where the submodule definitions were changed by the
checkout and the submodule data was not getting reloaded properly
before the new submodules were checked out.
Russell Belfer [Thu, 3 Jan 2013 01:05:54 +0000 (17:05 -0800)]
Fix workdir notifications and removals
The notifications were broken from the various iterations over
this code and were not returning working dir item data correctly.
Also, workdir items that were alphabetically after the last item
in diff were not being processed.
Russell Belfer [Thu, 3 Jan 2013 01:01:34 +0000 (17:01 -0800)]
Fix up spoolandsort iterator usage
The spoolandsort iterator changes got sort-of cherry picked out of
this branch and so I dropped the commit when rebasing; however,
there were a few small changes that got dropped as well (since the
version merged upstream wasn't quite the same as what I dropped).
Russell Belfer [Fri, 21 Dec 2012 00:16:22 +0000 (16:16 -0800)]
Submodule caching fix and location API
This adds a new API to the submodule interface that just returns
where information about the submodule was found (e.g. config file
only or in the HEAD, index, or working directory).
Also, the old "refresh" call was potentially keeping some stale
submodule data around, so this simplfies that code and literally
discards the old cache, then reallocates.
Russell Belfer [Wed, 19 Dec 2012 23:06:40 +0000 (15:06 -0800)]
Improve error propagation in stash
Stash was sometimes obscuring the actual error code, replacing it
with a -1 when there was more descriptive value. This updates
stash to preserve the original error code more reliably along
with a variety of other error handling tweaks.
I believe this is an improvement, but arguably, preserving the
underlying error code may result in values that are harder to
interpret by the caller who does not understand the internals.
Discussion is welcome!
Russell Belfer [Wed, 19 Dec 2012 23:06:14 +0000 (15:06 -0800)]
Make git_oid_tostr use out buffer for NULL oid
Previously a NULL oid was handled like an empty buffer and
returned a status empty string. This makes git_oid_tostr()
set the output buffer to the empty string instead.
Russell Belfer [Tue, 18 Dec 2012 23:19:24 +0000 (15:19 -0800)]
Add index updating to checkout
Make checkout update entries in the index for all files that are
updated and/or removed, unless flag GIT_CHECKOUT_DONT_UPDATE_INDEX
is given. To do this, iterators were extended to allow a little
more introspection into the index being iterated over, etc.
Russell Belfer [Mon, 10 Dec 2012 23:31:43 +0000 (15:31 -0800)]
More checkout improvements
This flips checkout back to be driven off the changes between
the baseline and the target trees. This reinstates the complex
code for tracking the contents of the working directory, but
overall, I think the resulting logic is easier to follow.
Russell Belfer [Thu, 6 Dec 2012 21:36:17 +0000 (13:36 -0800)]
Rework checkout internals (again)
I've tried to map out the detailed behaviors of checkout and make
sure that we're handling the various cases correctly, along with
providing options to allow us to emulate "git checkout" and "git
checkout-index" with the various flags. I've thrown away flags
in the checkout API that seemed like clutter and added some new
ones. Also, I've converted the conflict callback to a general
notification callback so we can emulate "git checkout" output and
display "dirty" files.
As of this commit, the new behavior is not working 100% but some
of that is probably baked into tests that are not testing the
right thing. This is a decent snapshot point, I think, along the
way to getting the update done.
Russell Belfer [Tue, 27 Nov 2012 01:24:02 +0000 (17:24 -0800)]
Reorder operations in git reset
This corrects the order of operations in git reset so that the
checkout to reset the working directory content is done before
the HEAD is moved. This allows us to use the HEAD and the index
content to know what files can / should safely be reset.
Unfortunately, there are still some cases where the behavior of
this revision differs from core git. Notable, a file which has
been added to the index but is not present in the HEAD is
considered to be tracked by core git (and thus removable by a
reset command) whereas since this loads the target state into
the index prior to resetting, it will consider such a file to be
untracked and won't touch it. That is a larger fix that I'll
defer to a future commit.
Russell Belfer [Wed, 19 Dec 2012 22:52:12 +0000 (14:52 -0800)]
Update cl_git_pass to return more info
This adds a failure reporting function that is called by
cl_git_pass which captures the actual error return code and
the error message if available in the failure report.
Martin Woodward [Thu, 3 Jan 2013 22:28:59 +0000 (22:28 +0000)]
Give proper license notice to code from Android
The usage of the Android derrived code contains a full notice
which must be provided with the source code as per the terms
given at:
https://android.googlesource.com/platform/bionic/+/android-4.0.3_r1.1/libc/bionic/dirname_r.c
Martin Woodward [Thu, 3 Jan 2013 22:24:10 +0000 (22:24 +0000)]
Add full license notice to bsearch code
The original BSD glibc code contains the notice as given at
http://opensource.apple.com/source/gcc/gcc-5666.3/libiberty/bsearch.c
and should be given in full along with the code.
Congyi Wu [Thu, 3 Jan 2013 18:26:11 +0000 (13:26 -0500)]
Fix bug in gen_pktline() for deletes of missing remote refs
* gen_pktline() in smart_protocol.c was skipping refspecs that deleted
refs that were not advertised by the server. The new behavior is to
send a delete command with an old-id of zero, which matches the behavior
of the official git client.
* Update test_network_push__delete() in reaction to above fix.
* Obviate messy logic that handles missing push_spec rrefs by canonicalizing
push_spec. After calculate_work(), loid, roid, and rref, are filled in with
exactly what is sent to the server
Martin Woodward [Thu, 3 Jan 2013 22:16:37 +0000 (22:16 +0000)]
Add Apache license header back to libpqueue files
The original libpqueue file were licensed under Apache 2.0 so
therefore should retain their copyrights and header as per the
license terms at http://www.apache.org/licenses/LICENSE-2.0
Martin Woodward [Thu, 3 Jan 2013 22:28:59 +0000 (22:28 +0000)]
Give proper license notice to code from Android
The usage of the Android derrived code contains a full notice
which must be provided with the source code as per the terms
given at:
https://android.googlesource.com/platform/bionic/+/android-4.0.3_r1.1/libc/bionic/dirname_r.c
Martin Woodward [Thu, 3 Jan 2013 22:24:10 +0000 (22:24 +0000)]
Add full license notice to bsearch code
The original BSD glibc code contains the notice as given at
http://opensource.apple.com/source/gcc/gcc-5666.3/libiberty/bsearch.c
and should be given in full along with the code.
Congyi Wu [Thu, 3 Jan 2013 18:26:11 +0000 (13:26 -0500)]
Fix bug in gen_pktline() for deletes of missing remote refs
* gen_pktline() in smart_protocol.c was skipping refspecs that deleted
refs that were not advertised by the server. The new behavior is to
send a delete command with an old-id of zero, which matches the behavior
of the official git client.
* Update test_network_push__delete() in reaction to above fix.
* Obviate messy logic that handles missing push_spec rrefs by canonicalizing
push_spec. After calculate_work(), loid, roid, and rref, are filled in with
exactly what is sent to the server
Martin Woodward [Thu, 3 Jan 2013 22:16:37 +0000 (22:16 +0000)]
Add Apache license header back to libpqueue files
The original libpqueue file were licensed under Apache 2.0 so
therefore should retain their copyrights and header as per the
license terms at http://www.apache.org/licenses/LICENSE-2.0
Russell Belfer [Sat, 29 Dec 2012 06:00:24 +0000 (22:00 -0800)]
Update showindex example
I find the showindex example to be pretty useful on occasion, but
there were are couple of output tweaks I wanted, plus I wanted the
ability to specify a path to an actual index file instead of having
to open the whole repository. This makes those changes and expands
the example slightly.