Commit Graph

6624 Commits

Author SHA1 Message Date
Vicent Marti
041336e6bd Merge pull request #2306 from odcinek/development_cmake
Make the build CMake 2.6 compatible
2014-04-28 07:36:27 -07:00
Marcin Sawicki
7f0de93a0d Make the build CMake 2.6 compatible 2014-04-28 15:24:36 +01:00
Vicent Marti
ec77105889 Merge pull request #2301 from libgit2/cmn/pack-objects-memory
Keep the deflate buffer from ballooning up
2014-04-27 03:57:53 -07:00
Carlos Martín Nieto
38d338b2b8 pack-objects: always write out the status in write_one()
Make sure we set the output parameter to a value.
2014-04-26 18:15:39 +02:00
Carlos Martín Nieto
c7f86efb13 zstream: grow based on used memory rather than allocated
When deflating data, we might need to grow the buffer. Currently we
add a guess on top of the currently-allocated buffer size.

When we re-use the buffer, it already has some memory allocated; adding
to that means that we always grow the buffer regardless of how much we
need to use.

Instead, increase on top of the currently-used size. This still leaves
us with the allocated size of the largest object we compress, but it's a
minor pain compared to unbounded growth.

This fixes #2285.
2014-04-26 18:04:43 +02:00
Carlos Martín Nieto
4f9d54146d refdb: fix typo and wording 2014-04-26 14:29:18 +02:00
Vicent Marti
e79a2998cb Merge pull request #2299 from mekishizufu/fix_leaks
Plug some leaks
2014-04-25 07:08:41 -07:00
Jiri Pospisil
7b8d564d5d Reset tests: Use sandboxed index 2014-04-25 15:49:58 +02:00
Jiri Pospisil
424222f415 Filter: Make sure to release local on error 2014-04-25 15:49:26 +02:00
Vicent Marti
8443ed6c1d Merge pull request #2284 from jacquesg/push-progress-callback
Fire progress and update tips callbacks also for pushes.
2014-04-25 02:10:19 -07:00
Vicent Marti
332e4f2027 Merge pull request #2297 from libgit2/rb/status-with-precomposed-changes
Improve test coverage of status with different core.precomposeunicode settings
2014-04-25 02:07:42 -07:00
Vicent Marti
2ad51b81d2 Merge pull request #2241 from libgit2/rb/stash-skip-submodules
Improve stash and checkout for ignored + untracked items
2014-04-25 02:04:12 -07:00
Russell Belfer
af9eeac939 Merge pull request #2294 from ethomson/merge_checkout_strategy
Merge checkout strategy
2014-04-24 16:20:08 -07:00
Russell Belfer
6b833e3a4a Improve docs for status rename detection limits
and make tests empty on platforms without iconv support.
2014-04-24 15:40:50 -07:00
Russell Belfer
f608f3bb27 Test toggling core.precomposeunicode yields rename
There is an interesting difference with core Git here, though.
Because libgit2 will do rename detection with the working directory,
in the last case where the HEAD and the working directory both
have the decomposed data and the index has the composed data, we
generate a single status record with two renames whereas Git will
generate one rename (head to index) and one untracked file.
2014-04-24 15:25:01 -07:00
Russell Belfer
2334e3d8c3 Test decomposed unicode renames work as expected 2014-04-24 14:46:59 -07:00
Russell Belfer
a409acefbb Handle explicitly ignored dir slightly differently
When considering status of untracked directories, if we find an
explicitly ignored item, even if it is a directory, treat the
parent as an IGNORED item.  It was accidentally being treated as
an EMPTY item because we were not looking into the ignored subdir.
2014-04-24 11:59:50 -07:00
Vicent Marti
87c9b741df Merge pull request #2295 from libgit2/cmn/fetchhead-quote
fetchhead: deal with quotes in branch names
2014-04-24 05:24:46 -07:00
Carlos Martín Nieto
bdc82e1c00 fetchhead: deal with quotes in branch names
The current FETCH_HEAD parsing code assumes that a quote must end the
branch name. Git however allows for quotes as part of a branch name,
which causes us to consider the FETCH_HEAD file as invalid.

Instead of searching for a single quote char, search for a quote char
followed by SP, which is not a valid part of a ref name.
2014-04-24 14:08:29 +02:00
Edward Thomson
a4e2c36a66 merge: checkout default shouldn't clobber given 2014-04-23 19:43:35 -04:00
Edward Thomson
26564d80aa merge: default checkout strategy for should be SAFE 2014-04-23 19:42:50 -04:00
Russell Belfer
219c89d19d Treat ignored, empty, and untracked dirs different
In the iterator, distinguish between ignores and empty directories
so that diff and status can ignore empty directories, but checkout
and stash can treat them as untracked items.
2014-04-23 16:28:45 -07:00
Vicent Marti
212b6205d7 Merge pull request #2291 from ethomson/patch_binary
patch: emit deflated binary patches (optionally)
2014-04-23 09:27:15 -07:00
Vicent Marti
5ca410b9a9 Merge pull request #2283 from phkelley/win32_fs
Win32: UTF-8 <-> WCHAR conversion overhaul
2014-04-23 07:13:49 -07:00
Philip Kelley
7110000dd5 React to feedback for UTF-8 <-> WCHAR and reparse work 2014-04-23 09:23:50 -04:00
Vicent Marti
5b58d6f78c Merge pull request #2289 from libgit2/rb/note-git-diff-index-behavior
Some doc and examples/diff.c changes
2014-04-23 03:21:05 -07:00
Russell Belfer
37da368545 Make checkout match diff for untracked/ignored dir
When diff finds an untracked directory, it emulates Git behavior
by looking inside the directory to see if there are any untracked
items inside it. If there are only ignored items inside the dir,
then diff considers it ignored, even if there is no direct ignore
rule for it.

Checkout was not copying this behavior - when it found an untracked
directory, it just treated it as untracked.  Unfortunately, when
combined with GIT_CHECKOUT_REMOVE_UNTRACKED, this made is seem that
checkout (and stash, which uses checkout) was removing ignored
items when you had only asked it to remove untracked ones.

This commit moves the logic for advancing past an untracked dir
while scanning for non-ignored items into an iterator helper fn,
and uses that for both diff and checkout.
2014-04-22 21:51:54 -07:00
Edward Thomson
e349ed500b patch: emit binary patches (optionally) 2014-04-22 19:08:21 -05:00
Russell Belfer
3c1aa4c110 Failing test for stashing a buried ignored file 2014-04-22 15:23:43 -07:00
Russell Belfer
24d17de255 Make stash and checkout ignore contained repos
To emulate git, stash should not remove untracked git repositories
inside the parent repo, and checkout's REMOVE_UNTRACKED should
also skip over these items.

`git stash` actually prints a warning message for these items.
That should be possible with a checkout notify callback if you
wanted to, although it would require a bit of extra logic as things
are at the moment.
2014-04-22 15:23:43 -07:00
Russell Belfer
e60883c82f Replace math fns with simpler integer math 2014-04-22 12:59:31 -07:00
Russell Belfer
8d09efa24e Use git_diff_get_stats in example/diff + refactor
This takes the `--stat` and related example options in the example
diff.c program and converts them to use the `git_diff_get_stats`
API which nicely formats stats for you.

I went to add bar-graph scaling to the stats formatter and noticed
that the `git_diff_stats` structure was holding on to all of the
`git_patch` objects.  Unfortunately, each of these objects keeps
the full text of the diff in memory, so this is very expensive.  I
ended up modifying `git_diff_stats` to keep just the data that it
needs to keep and allowed it to release the patches.  Then, I added
width scaling to the output on top of that.

In making the diff example program match 'git diff' output, I ended
up removing an newline from the sumamry output which I then had to
compensate for in the email formatting to match the expectations.

Lastly, I went through and refactored the tests to use a couple of
helper functions and reduce the overall amount of code there.
2014-04-22 12:33:27 -07:00
Russell Belfer
12e422a056 Some doc and examples/diff.c changes
I was playing with "git diff-index" and wanted to be able to
emulate that behavior a little more closely with the diff example.

Also, I wanted to play with running `git_diff_tree_to_workdir`
directly even though core Git doesn't exactly have the equivalent,
so I added a command line option for that and tweaked some other
things in the example code.

This changes a minor output thing in that the "raw" print helper
function will no longer add ellipses (...) if the OID is not
actually abbreviated.
2014-04-22 09:17:29 -07:00
Vicent Marti
a32d684f86 Merge pull request #2282 from libgit2/cmn/remote-easier-bind
A few niceties for binding authors
2014-04-22 15:07:18 +02:00
Carlos Martín Nieto
bc0a619867 transports: allow the creds callback to say it doesn't exist
Allow the credentials callback to return GIT_PASSTHROUGH to make the
transports code behave as though none was set.

This should make it easier for bindings to behave closer to the C code
when there is no credentials callback set at their level.
2014-04-22 14:34:26 +02:00
Carlos Martín Nieto
2efd7df6b1 remote: provide read access to the callback structure
This should make it easier for bindings to dynamically override their
own callbacks.
2014-04-22 14:32:19 +02:00
Vicent Marti
dac95e4aa3 Merge pull request #2287 from libgit2/rb/moar-coverity-fixes
Fix some issues from the last Coverity scan
2014-04-22 11:04:35 +02:00
Vicent Marti
2e609e2931 Merge pull request #2286 from libgit2/rb/fix-reset-staged-delete
Fix reset for staged deletes
2014-04-22 11:03:42 +02:00
Edward Thomson
65477db166 Handle win32 reparse points properly 2014-04-22 00:28:27 -04:00
Russell Belfer
17ef678ca5 Fix some coverity-found issues 2014-04-21 11:55:57 -07:00
Russell Belfer
bd101a7eca Fix reset for staged deletes 2014-04-21 11:54:54 -07:00
Jacques Germishuys
f70cfd34f5 Verify update_tips callbacks in push test cases 2014-04-21 19:38:34 +02:00
Russell Belfer
28750a7d98 Merge pull request #2275 from jacquesg/apple-warning
Check for compiler flag support instead of checking for a platform
2014-04-21 09:50:43 -07:00
Jacques Germishuys
321d377a6a Fire update_tips callback also for pushes. 2014-04-21 17:28:03 +02:00
Carlos Martín Nieto
7839931019 attrcache: fix use-after-free
Reported by coverity.
2014-04-21 16:38:52 +02:00
Jacques Germishuys
8b686b318b Correct argument order of git__calloc() 2014-04-21 16:29:41 +02:00
Jacques Germishuys
be6996b792 It is safe to free() a NULL pointer 2014-04-21 16:29:41 +02:00
Carlos Martín Nieto
a15d3537bb sysdir: free the path if we cannot find the file
Returning an error cleared the buf, but this operation does not free the
memory associated with it. Use git_buf_free() instead.
2014-04-21 15:48:05 +02:00
Jacques Germishuys
48e60ae75e Don't redefine the same callback types, their signatures may change 2014-04-21 11:28:49 +02:00
Jacques Germishuys
98020d3a73 Rename progress callback to sideband_progress 2014-04-21 10:55:37 +02:00