Commit Graph

3935 Commits

Author SHA1 Message Date
nulltoken
ced8eff1e5 travis: Only run Valgrind when all tests pass 2013-01-06 17:37:38 +01:00
Vicent Martí
5df7ad3ece Merge pull request #1196 from scunz/allow_clone_without_master_branch
Allow to clone repositories that don't have a `master` branch
2013-01-06 07:56:45 -08:00
Vicent Martí
74f880a639 Merge pull request #1197 from nulltoken/travis/run-online-tests
travis: Include the online suite when running against Travis
2013-01-06 07:56:08 -08:00
nulltoken
d01fe38061 reset: Fix a memory leak 2013-01-06 16:22:28 +01:00
nulltoken
b97fabfad5 tests: Fix some memory leaks 2013-01-06 16:22:24 +01:00
nulltoken
d1aee4775a clone: Fix a memory leak 2013-01-06 15:09:27 +01:00
nulltoken
09556895b7 travis: Include the online suite when running against Travis 2013-01-06 14:40:32 +01:00
Sascha Cunz
2ba6f3c7f1 Allow to clone repositories that don't have a master branch
Before this, we error out from `reference_matches_remote_head` if the
reference we're searching for does not exist.
Since we explicitly check if master is existing in `update_head_to_remote`
and error out if it doesn't, a repository without master branch could
not be cloned.
In fact this was later clobbered by what is fixed in #1194.

However, this patch introduces a `found` member in `head_info` and sets
it accordingly. That also saves us from checking the string length of
`branchname` a few times.
2013-01-06 14:30:52 +01:00
Vicent Martí
f9b4adbe54 Merge pull request #1194 from libgit2/dont-clobber-errors
git_mwindow_file_deregister() shouldn't return errors
2013-01-05 18:52:09 -08:00
Scott J. Goldman
f9b55bcb5f git_mwindow_file_deregister() shouldn't return errors
As a function that appears to only be called on error paths, I don't
think it makes sense for it to return an error, or clobber the global
giterr. Note that no existing callsites actually check the return
code.

In my own application, there are errors where the real error ends
up being hidden, as git_mwindow_file_deregister() clobbers the
global giterr. I'm not sure this error is even relevant?
2013-01-05 18:27:24 -08:00
Vicent Martí
d74b1bc529 Merge pull request #1131 from libgit2/correct-ahead-behind
Fix an issue with ahead-behind for lopsided traversal
2013-01-05 15:44:19 -08:00
Vicent Martí
2b7b3e1fae Merge pull request #1193 from libgit2/no-newline-packed-refs
Handle packed refs with no trailing newline
2013-01-05 04:30:24 -08:00
Scott J. Goldman
ef82ff30f6 Handle packed refs with no trailing newline
I saw a repo in the wild today which had a master branch ref which was packed, but had no trailing newline. Git handled it fine, but libgit2 choked on it. Fix seems simple enough. If we don't see a newline, assume the end of the buffer is the end of the ref line.
2013-01-05 00:46:39 -08:00
Vicent Martí
7511d8b42d Merge pull request #1192 from arrbee/fix-win32-checkout-test
Fix win32 checkout test
2013-01-04 17:28:09 -08:00
Russell Belfer
2f0895393d Actually fix win32 checkout test
It turns out that using REMOVE_UNTRACKED with checkout for this
particular test was causing the .gitattributes file to be removed
and so we do have to allow for the CRs in the created file...
2013-01-04 17:17:37 -08:00
Russell Belfer
bebdbcd442 Fix crlf issue with checkout tests
Move some checkout utility functions into a shared file and fix
some crlf filtering issues when verifying file contents.
2013-01-04 16:56:21 -08:00
Vicent Martí
7a68142e22 Merge pull request #1191 from maxpow4h/fix-format-string
Fixed size_t format string warning
2013-01-04 16:49:46 -08:00
Maxwell Swadling
79ff264e2f Fixed size_t format string warning 2013-01-05 11:34:19 +11:00
Vicent Martí
cfc7b835d6 Merge pull request #1118 from arrbee/fix-reset-hard
Fix checkout corner cases, index handling, and reset hard behavior
2013-01-04 16:14:49 -08:00
Russell Belfer
817d625161 Fix checkout of index-only dirs and prefixed paths
There are a couple of checkout bugs fixed here.  One is with
untracked working directory entries that are prefixes of tree
entries but not in a meaningful way (i.e. "read" is a prefix of
"readme.txt" but doesn't interfere in any way).  The second bug
is actually a redo of 07edfa0fc640f85f95507c3101e77accd7d2bf0d
where directory entries in the index that are not in the diff
were not being removed correctly.  That fix remedied one case
but broke another.
2013-01-04 15:47:44 -08:00
Russell Belfer
7fc0043582 Add index API to remove all files in a directory
This adds the git_index_remove_directory API plus tests.
2013-01-04 15:47:44 -08:00
Russell Belfer
1b88faf7ae Fix oid tostr issue with NULL oid
I made a small change to the behavior of this code and apparently
got it wrong. Sigh.
2013-01-04 15:47:44 -08:00
Russell Belfer
d8889d2b64 Fix checkout bug rmv untracked trees from index
When checking out with the GIT_CHECKOUT_REMOVE_UNTRACKED option
and there was an entire tree in the working directory and in the
index that is not in the baseline nor target commit, the tree was
correctly(?) removed from the working directory but was not
successfully removed from the index.  This fixes that and adds a
test of the functionality.
2013-01-04 15:47:44 -08:00
Russell Belfer
dde7602ae6 Fix memory leak with checkout tree iterator 2013-01-04 15:47:44 -08:00
Russell Belfer
0d70f65051 Fixing checkout UPDATE_ONLY and adding tests
This adds a bunch of new checkout tests and in the process I found
a bug in the GIT_CHECKOUT_UPDATE_ONLY flag which I fixed.
2013-01-04 15:47:44 -08:00
Russell Belfer
2850252af7 Oh yeah, bugs from my rebase 2013-01-04 15:47:44 -08:00
Russell Belfer
77cffa31db 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.
2013-01-04 15:47:43 -08:00
Russell Belfer
b3fb9237c2 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).
2013-01-04 15:47:43 -08:00
Russell Belfer
c50c58decd 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.
2013-01-04 15:47:43 -08:00
Russell Belfer
e0548c0ea4 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.
2013-01-04 15:47:43 -08:00
Russell Belfer
16a666d3d4 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.
2013-01-04 15:47:43 -08:00
Russell Belfer
546d65a8da 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).
2013-01-04 15:47:43 -08:00
Russell Belfer
a9a730075e 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.
2013-01-04 15:47:43 -08:00
Russell Belfer
6f58332f3a Fix use of uninitialized variable 2013-01-04 15:47:43 -08:00
Russell Belfer
a6a82e1a59 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!
2013-01-04 15:47:42 -08:00
Russell Belfer
8fe713ccf7 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.
2013-01-04 15:47:42 -08:00
Russell Belfer
5cf9875a4f 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.
2013-01-04 15:47:42 -08:00
Russell Belfer
7e5c8a5b41 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.
2013-01-04 15:47:42 -08:00
Russell Belfer
cf20803170 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.
2013-01-04 15:47:42 -08:00
Russell Belfer
bfe7d7de22 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.
2013-01-04 15:47:42 -08:00
Jameson Miller
c5df10f4aa Failing test on git_checkout_tree when removing directories 2013-01-04 15:23:47 -08:00
Marvin Gülker
d0951175d4 Add failing test to demonstrate wrong checkout behaviour 2013-01-04 15:23:47 -08:00
Russell Belfer
6fee906c98 missing error message is confusing 2013-01-04 15:23:47 -08:00
Russell Belfer
6ac724afbe Clear error to avoid leaving invalid error behind 2013-01-04 15:23:47 -08:00
Russell Belfer
e9e20c8474 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.
2013-01-04 15:23:47 -08:00
Vicent Marti
6040616214 clar: lolpython 2013-01-04 20:28:33 +01:00
Vicent Marti
3a4a961da5 clar: Corrupted pickles 2013-01-04 20:25:57 +01:00
Vicent Martí
c18a5ec58c Merge pull request #1174 from nulltoken/topic/soft_reset_with_index_conflicts
Prevent soft reset when index contains conflicts
2013-01-04 11:10:39 -08:00
Carlos Martín Nieto
702c3bf70e clar: make it compatible with python3 2013-01-04 19:03:02 +00:00
Vicent Marti
1d5d418671 clar: haha 2013-01-04 20:02:01 +01:00