]> git.proxmox.com Git - libgit2.git/log
libgit2.git
10 years agoReturn a specific error for EACCES.
Alan Rogers [Thu, 15 May 2014 06:54:46 +0000 (16:54 +1000)]
Return a specific error for EACCES.

10 years agoSimplify the test.
Alan Rogers [Thu, 15 May 2014 06:33:26 +0000 (16:33 +1000)]
Simplify the test.

10 years agoAdd a test (failing) for a work tree status.
Alan Rogers [Wed, 14 May 2014 07:02:07 +0000 (17:02 +1000)]
Add a test (failing) for a work tree status.

When thees is an unreadable folder, we should still be able
to enumerate status.

10 years agoMerge pull request #2336 from libgit2/rb/unicode-branch-names
Russell Belfer [Mon, 12 May 2014 17:51:56 +0000 (10:51 -0700)]
Merge pull request #2336 from libgit2/rb/unicode-branch-names

Pass unconverted Unicode path data when iconv doesn't like it

10 years agoMerge pull request #2334 from libgit2/rb/fix-2333
Russell Belfer [Mon, 12 May 2014 17:44:13 +0000 (10:44 -0700)]
Merge pull request #2334 from libgit2/rb/fix-2333

Be more careful with user-supplied buffers

10 years agoDon't scale diff stat when not needed
Russell Belfer [Mon, 12 May 2014 17:28:45 +0000 (10:28 -0700)]
Don't scale diff stat when not needed

10 years agoMinor fixes for warnings and error propagation
Russell Belfer [Mon, 12 May 2014 17:24:46 +0000 (10:24 -0700)]
Minor fixes for warnings and error propagation

10 years agoMerge pull request #2300 from libgit2/cmn/match-host-tests
Russell Belfer [Mon, 12 May 2014 17:15:30 +0000 (10:15 -0700)]
Merge pull request #2300 from libgit2/cmn/match-host-tests

Some improvements to the cert checking

10 years agoMerge pull request #2188 from libgit2/cmn/config-snapshot
Russell Belfer [Mon, 12 May 2014 17:04:52 +0000 (10:04 -0700)]
Merge pull request #2188 from libgit2/cmn/config-snapshot

Configuration snapshotting

10 years agoMerge pull request #2331 from libgit2/rb/dont-stop-diff-on-safecrlf
Vicent Marti [Fri, 9 May 2014 06:59:59 +0000 (08:59 +0200)]
Merge pull request #2331 from libgit2/rb/dont-stop-diff-on-safecrlf

Add filter options and ALLOW_UNSAFE

10 years agoDisable threads::refdb::edit_while_iterate test
Russell Belfer [Thu, 8 May 2014 22:01:07 +0000 (15:01 -0700)]
Disable threads::refdb::edit_while_iterate test

It seems that with the various recent changes to reference updating
and reflog writing, that the thread safety of refdb updates has
been reduced (either that or it was never thread safe and the
window for error has increased).  Either way, this test is now
sometimes segfaulting which is no good, so let's disable the test
for now.  We don't really make any public promises about thread
safety for this type of operation, so I think this is acceptable,
at least in the short term.

10 years agoDon't always test composed-insensitive lookups
Russell Belfer [Thu, 8 May 2014 21:48:27 +0000 (14:48 -0700)]
Don't always test composed-insensitive lookups

Only on a filesystem that is composed/decomposed insensitive,
should be testing that a branch can be looked up by the opposite
form and still work correctly.

10 years agoAllow cl_repo_get_bool to work with missing key
Russell Belfer [Thu, 8 May 2014 21:33:37 +0000 (14:33 -0700)]
Allow cl_repo_get_bool to work with missing key

One of the test helpers provides a quick way for looking up a
boolean key.  But if the key way missing completely, the check
would actually raise an error.  Given the way we use this helper,
if the key is missing, this should just return false, I think.

10 years agoMerge pull request #2335 from libgit2/cmn/indexer-vector-handling
Vicent Marti [Thu, 8 May 2014 21:16:21 +0000 (23:16 +0200)]
Merge pull request #2335 from libgit2/cmn/indexer-vector-handling

indexer: avoid memory moves

10 years agoPass unconverted data when iconv doesn't like it
Russell Belfer [Thu, 8 May 2014 20:52:46 +0000 (13:52 -0700)]
Pass unconverted data when iconv doesn't like it

When using Iconv to convert unicode data and iconv doesn't like
the source data (because it thinks that it's not actual UTF-8),
instead of stopping the operation, just use the unconverted data.
This will generally do the right thing on the filesystem, since
that is the source of the non-UTF-8 path data anyhow.

This adds some tests for creating and looking up branches with
messy Unicode names.  Also, this takes the helper function that
was previously internal to `git_repository_init` and makes it
into `git_path_does_fs_decompose_unicode` which is a useful in
tests to understand what the expected results should be.

10 years agoindexer: avoid memory moves
Carlos Martín Nieto [Thu, 8 May 2014 20:31:59 +0000 (22:31 +0200)]
indexer: avoid memory moves

Our vector does a move of the rest of the array when we remove an
item. Doing this repeatedly can be expensive, and we do this a lot in
the indexer. Instead, set the value to NULL and skip those entries.

perf reported around 30% of `index-pack` time was going into
memmove. With this change, that goes away and we spent most of the time
hashing and inflating data.

10 years agoMerge pull request #2332 from libgit2/peff/iconv
Russell Belfer [Thu, 8 May 2014 20:29:09 +0000 (13:29 -0700)]
Merge pull request #2332 from libgit2/peff/iconv

iconv debugging aids

10 years agoexamples: add a basic for-each-ref example
Jeff King [Thu, 8 May 2014 05:06:38 +0000 (01:06 -0400)]
examples: add a basic for-each-ref example

This is quite close to running "git for-each-ref" except:

  1. It does not take any formatting or selection options at
     all.

  2. The output is not sorted.

I wrote it to look at debugging some issues with ref
iteration, but there's no reason it can't live on as an
example command.

10 years agocmake: s/ICONV/Iconv/ in FIND_PACKAGE
Jeff King [Thu, 8 May 2014 04:35:56 +0000 (00:35 -0400)]
cmake: s/ICONV/Iconv/ in FIND_PACKAGE

The cmake module we provide is in the file FindIconv.cmake,
so we must match the case correctly. It happens to work in
practice because we only turn on ICONV on Darwin, and people
generally have case-insensitive filesystems there.

Note that we only need to update the package name here. The
package itself still sets the all-uppercase ICONV_FOUND
flag, so we continue to use uppercase in the rest of cmake.

10 years agoUse unsigned type for APIs with opt flag mask
Russell Belfer [Thu, 8 May 2014 17:46:04 +0000 (10:46 -0700)]
Use unsigned type for APIs with opt flag mask

10 years agoBe more careful with user-supplied buffers
Russell Belfer [Thu, 8 May 2014 17:17:14 +0000 (10:17 -0700)]
Be more careful with user-supplied buffers

This adds in missing calls to `git_buf_sanitize` and fixes a
number of places where `git_buf` APIs could inadvertently write
NUL terminator bytes into invalid buffers.  This also changes the
behavior of `git_buf_sanitize` to NUL terminate a buffer if it can
and of `git_buf_shorten` to do nothing if it can.

Adds tests of filtering code with zeroed (i.e. unsanitized) buffer
which was previously triggering a segfault.

10 years agorepository: introduce a convenience config snapshot method
Carlos Martín Nieto [Wed, 7 May 2014 09:34:32 +0000 (11:34 +0200)]
repository: introduce a convenience config snapshot method

Accessing the repository's config and immediately taking a snapshot of
it is a common operation, so let's provide a convenience function for
it.

10 years agoMerge pull request #2329 from anuraggup/fix_git_shutdown
Russell Belfer [Tue, 6 May 2014 23:11:03 +0000 (16:11 -0700)]
Merge pull request #2329 from anuraggup/fix_git_shutdown

Fix the issues in git_shutdown

10 years agoAdd filter options and ALLOW_UNSAFE
Russell Belfer [Tue, 6 May 2014 23:01:49 +0000 (16:01 -0700)]
Add filter options and ALLOW_UNSAFE

Diff and status do not want core.safecrlf to actually raise an
error regardless of the setting, so this extends the filter API
with an additional options flags parameter and adds a flag so that
filters can be applied with GIT_FILTER_OPT_ALLOW_UNSAFE, indicating
that unsafe filter application should be downgraded from a failure
to a warning.

10 years agoMerge pull request #2324 from libgit2/cmn/file-in-objects-dir
Russell Belfer [Tue, 6 May 2014 21:03:58 +0000 (14:03 -0700)]
Merge pull request #2324 from libgit2/cmn/file-in-objects-dir

odb: ignore files in the objects dir

10 years agoFix the issues in git_shutdown
Anurag Gupta [Tue, 6 May 2014 20:33:47 +0000 (13:33 -0700)]
Fix the issues in git_shutdown

1) Call to git_shutdown results in setting git__n_shutdown_callbacks
to -1. Next call to git__on_shutdown results in ABW (Array Bound Write)
for array git__shutdown_callbacks. In the current Implementation,
git_atomic_dec is called git__n_shutdown_callbacks + 1 times. I have
modified it to a for loop so that it is more readable. It would not
set git__n_shutdown_callbacks to a negative number and reset the
elements of git__shutdown_callbacks to NULL.

2) In function git_sysdir_get, shutdown function is registered only if
git_sysdir__dirs_shutdown_set is set to 0. However, after this variable
is set to 1, it is never reset to 0. If git_sysdir_global_init is
called again from synchronized_threads_init it does not register
shutdown function for this subsystem.

10 years agoobject: fix a brace
Carlos Martín Nieto [Tue, 6 May 2014 19:14:58 +0000 (21:14 +0200)]
object: fix a brace

The brace in the check for peel's return was surrounding the wrong
thing, which made 'error' be set to 1 when there was an error instead of
the error code.

10 years agoFix the issues in git__on_shutdown
Anurag Gupta [Tue, 6 May 2014 19:16:24 +0000 (12:16 -0700)]
Fix the issues in git__on_shutdown

10 years agoodb: ignore files in the objects dir
Carlos Martín Nieto [Mon, 5 May 2014 14:04:14 +0000 (16:04 +0200)]
odb: ignore files in the objects dir

We assume that everything under GIT_DIR/objects/ is a directory. This is
not necessarily the case if some process left a stray file in there.

Check beforehand if we do have a directory and ignore the entry
otherwise.

10 years agoDoc fixes
Russell Belfer [Fri, 2 May 2014 22:15:43 +0000 (15:15 -0700)]
Doc fixes

10 years agoMerge pull request #2308 from libgit2/rb/diff-update-index-stat-cache
Vicent Marti [Fri, 2 May 2014 16:50:15 +0000 (09:50 -0700)]
Merge pull request #2308 from libgit2/rb/diff-update-index-stat-cache

Reduce excessive OID calculation for diff and stat

10 years agoMerge pull request #2310 from libgit2/cmn/commit-create-safe
Russell Belfer [Fri, 2 May 2014 16:42:07 +0000 (09:42 -0700)]
Merge pull request #2310 from libgit2/cmn/commit-create-safe

commit: safer commit creation with reference update

10 years agoSome further sandboxing cleanups to tests
Russell Belfer [Thu, 1 May 2014 22:12:12 +0000 (15:12 -0700)]
Some further sandboxing cleanups to tests

Trying to find other issues where tests may not clean up quite
properly when they are through...

10 years agoImprove handling of fake home directory
Russell Belfer [Thu, 1 May 2014 21:47:33 +0000 (14:47 -0700)]
Improve handling of fake home directory

There are a few tests that set up a fake home directory and a
fake GLOBAL search path so that we can test things in global
ignore or attribute or config files.  This cleans up that code to
work more robustly even if there is a test failure.  This also
fixes some valgrind warnings where scanning search paths for
separators could end up doing a little bit of sketchy data access
when coming to the end of search list.

10 years agoFix remaining init_options inconsistencies
Russell Belfer [Wed, 30 Apr 2014 18:16:31 +0000 (11:16 -0700)]
Fix remaining init_options inconsistencies

There were a couple of "init_opts()" functions a few more cases
of structure initialization that I somehow missed.

10 years agoMake init_options fns use unsigned ints and macro
Russell Belfer [Wed, 30 Apr 2014 17:57:42 +0000 (10:57 -0700)]
Make init_options fns use unsigned ints and macro

Use an unsigned int for the version and add a helper macro so the
code is simplified (and so the error message is a common string).

10 years agoRemove trace / add git_diff_perfdata struct + api
Russell Belfer [Tue, 29 Apr 2014 22:05:58 +0000 (15:05 -0700)]
Remove trace / add git_diff_perfdata struct + api

10 years agoGet rid of redundant git_diff_options_init fn
Russell Belfer [Tue, 29 Apr 2014 21:30:15 +0000 (14:30 -0700)]
Get rid of redundant git_diff_options_init fn

Since git_diff_init_options was introduced, remove this old fn.

10 years agoAdd payloads, bitmaps to trace API
Russell Belfer [Tue, 29 Apr 2014 18:29:49 +0000 (11:29 -0700)]
Add payloads, bitmaps to trace API

This is a proposed adjustment to the trace APIs.  This makes the
trace levels into a bitmask so that they can be selectively enabled
and adds a callback-level payload, plus a message-level payload.

This makes it easier for me to a GIT_TRACE_PERF callbacks that
are simply bypassed if the PERF level is not set.

10 years agoDon't use trace if GIT_TRACE not defined
Russell Belfer [Mon, 28 Apr 2014 23:47:39 +0000 (16:47 -0700)]
Don't use trace if GIT_TRACE not defined

10 years agoAdd GIT_STATUS_OPT_UPDATE_INDEX and use trace API
Russell Belfer [Mon, 28 Apr 2014 23:39:53 +0000 (16:39 -0700)]
Add GIT_STATUS_OPT_UPDATE_INDEX and use trace API

This adds an option to refresh the stat cache while generating
status.  It also rips out the GIT_PERF stuff I had an makes use
of the trace API to keep statistics about what happens during diff.

10 years agoAdd diff option to update index stat cache
Russell Belfer [Mon, 28 Apr 2014 21:48:41 +0000 (14:48 -0700)]
Add diff option to update index stat cache

When diff is scanning the working directory, if it finds a file
where it is not sure if the index entry matches the working dir,
it will recalculate the OID (which is pretty expensive).  This
adds a new flag to diff so that if the OID calculation finds that
the file actually has not changed (i.e. just the modified time was
altered or such), then it will refresh the stat cache in the index
so that future calls to diff will not have to check the oid again.

10 years agoLay groundwork for updating stat cache in diff
Russell Belfer [Mon, 28 Apr 2014 21:34:55 +0000 (14:34 -0700)]
Lay groundwork for updating stat cache in diff

This reorganized the diff OID calculation to make it easier to
correctly update the stat cache during a diff once the flags to
do so are enabled.

This includes marking the path of a git_index_entry as const so
we can make a "fake" git_index_entry with a "const char *" path
and not get warnings.  I was a little surprised at how unobtrusive
this change was, but I think it's probably a good thing.

10 years agoSkip diff oid calc when size definitely changed
Russell Belfer [Mon, 28 Apr 2014 21:16:26 +0000 (14:16 -0700)]
Skip diff oid calc when size definitely changed

When we think the stat cache in the index seems valid and the size
or mode of a file has definitely changed, then don't bother trying
to recalculate the OID of the workdir bits to confirm that it is
modified - just accept that it is modified.

This can result in files that show as modified with no actual diff,
but the behavior actually appears to match Git on the command line.

This also includes a minor optimization to not perform a submodule
lookup on the ".git" directory itself.

10 years agoAdd build option for diff internal statistics
Russell Belfer [Mon, 28 Apr 2014 21:04:29 +0000 (14:04 -0700)]
Add build option for diff internal statistics

10 years agoTemporary fix for Travis CI builds
Vicent Marti [Fri, 2 May 2014 15:14:04 +0000 (17:14 +0200)]
Temporary fix for Travis CI builds

See https://github.com/libgit2/libgit2/pull/2321#issuecomment-42039673
We may rollback once we found something more reliable

10 years agoMerge pull request #2318 from linquize/sleep
Vicent Marti [Fri, 2 May 2014 10:37:40 +0000 (03:37 -0700)]
Merge pull request #2318 from linquize/sleep

Make examples/status.c compile on Windows

10 years agoMerge pull request #2320 from libgit2/rb/fix-starstar-again
Vicent Marti [Fri, 2 May 2014 10:36:22 +0000 (03:36 -0700)]
Merge pull request #2320 from libgit2/rb/fix-starstar-again

Make ** pattern eat trailing slash

10 years agoMake ** pattern eat trailing slash
Russell Belfer [Thu, 1 May 2014 19:46:46 +0000 (12:46 -0700)]
Make ** pattern eat trailing slash

This allows "foo/**/*.html" to match "foo/file.html"

10 years agoMake examples/status.c compile on Windows
Linquize [Thu, 1 May 2014 14:39:35 +0000 (22:39 +0800)]
Make examples/status.c compile on Windows

10 years agoMerge pull request #2304 from jacquesg/solaris
Vicent Marti [Thu, 1 May 2014 08:23:10 +0000 (01:23 -0700)]
Merge pull request #2304 from jacquesg/solaris

Solaris!

10 years agoCheck for NULL before passing it to vsnprintf
Jacques Germishuys [Wed, 30 Apr 2014 15:46:53 +0000 (17:46 +0200)]
Check for NULL before passing it to vsnprintf

10 years agostrcasecmp is in <strings.h>
Jacques Germishuys [Sun, 27 Apr 2014 17:44:20 +0000 (19:44 +0200)]
strcasecmp is in <strings.h>

10 years agoBuild regex.c for Solaris. Added required defines for Solaris
Jacques Germishuys [Tue, 29 Apr 2014 18:45:02 +0000 (20:45 +0200)]
Build regex.c for Solaris. Added required defines for Solaris

10 years agoMerge pull request #2314 from libgit2/cmn/known-libs
Vicent Marti [Wed, 30 Apr 2014 12:45:31 +0000 (05:45 -0700)]
Merge pull request #2314 from libgit2/cmn/known-libs

Assorted CMake fixups

10 years agoMerge pull request #2315 from jacquesg/qsort-cygwin
Vicent Marti [Wed, 30 Apr 2014 12:34:33 +0000 (05:34 -0700)]
Merge pull request #2315 from jacquesg/qsort-cygwin

cygwin also doesn't have qsort_r

10 years agocygwin also doesn't have qsort_r
Jacques Germishuys [Wed, 30 Apr 2014 09:47:58 +0000 (11:47 +0200)]
cygwin also doesn't have qsort_r

10 years agociscript: don't use an empty string as a number
Carlos Martín Nieto [Wed, 30 Apr 2014 09:57:54 +0000 (11:57 +0200)]
ciscript: don't use an empty string as a number

An empty string is not a valid number, and some shells complain.

Check instead if $COVERITY is non-empty, which is a common convention
and what we're doing anyway.

10 years agorefs: document _next_name()
Carlos Martín Nieto [Wed, 30 Apr 2014 09:20:51 +0000 (11:20 +0200)]
refs: document _next_name()

If it's not documented, it doesn't show up in the docs (and we really
should document, anyway).

10 years agoDon't exclude libssh2 from MinGW
Carlos Martín Nieto [Wed, 30 Apr 2014 08:55:58 +0000 (10:55 +0200)]
Don't exclude libssh2 from MinGW

It reportedly works. It does not however work when cross-compiling on
Travis, so let's disable it there.

This fixes #2311.

10 years agoWorkaround missing .pc files on FreeBSD
Ting-Wei Lan [Thu, 13 Feb 2014 14:38:23 +0000 (22:38 +0800)]
Workaround missing .pc files on FreeBSD

This fixes #2118

10 years agoUnquiet CMake output
Carlos Martín Nieto [Wed, 30 Apr 2014 08:15:44 +0000 (10:15 +0200)]
Unquiet CMake output

The point of this phase is to know what we have and not. Show the user a
clear indication of what we have.

10 years agocommit: safer commit creation with reference update
Carlos Martín Nieto [Wed, 9 Apr 2014 12:08:22 +0000 (14:08 +0200)]
commit: safer commit creation with reference update

The current version of the commit creation and amend function are unsafe
to use when passing the update_ref parameter, as they do not check that
the reference at the moment of update points to what the user expects.

Make sure that we're moving history forward when we ask the library to
update the reference for us by checking that the first parent of the new
commit is the current value of the reference. We also make sure that the
ref we're updating hasn't moved between the read and the write.

Similarly, when amending a commit, make sure that the current tip of the
branch is the commit we're amending.

10 years agoMerge pull request #2309 from jacquesg/midnightbsd
Vicent Marti [Tue, 29 Apr 2014 12:02:38 +0000 (05:02 -0700)]
Merge pull request #2309 from jacquesg/midnightbsd

MidnightBSD may also not have strnlen

10 years agoMidnightBSD may also not have strnlen
Jacques Germishuys [Tue, 29 Apr 2014 11:28:16 +0000 (13:28 +0200)]
MidnightBSD may also not have strnlen

10 years agoMerge pull request #2306 from odcinek/development_cmake
Vicent Marti [Mon, 28 Apr 2014 14:36:27 +0000 (07:36 -0700)]
Merge pull request #2306 from odcinek/development_cmake

Make the build CMake 2.6 compatible

10 years agoMake the build CMake 2.6 compatible
Marcin Sawicki [Mon, 28 Apr 2014 14:24:36 +0000 (15:24 +0100)]
Make the build CMake 2.6 compatible

10 years agoMerge pull request #2301 from libgit2/cmn/pack-objects-memory
Vicent Marti [Sun, 27 Apr 2014 10:57:53 +0000 (03:57 -0700)]
Merge pull request #2301 from libgit2/cmn/pack-objects-memory

Keep the deflate buffer from ballooning up

10 years agopack-objects: always write out the status in write_one()
Carlos Martín Nieto [Sat, 26 Apr 2014 16:15:39 +0000 (18:15 +0200)]
pack-objects: always write out the status in write_one()

Make sure we set the output parameter to a value.

10 years agozstream: grow based on used memory rather than allocated
Carlos Martín Nieto [Sat, 26 Apr 2014 16:04:43 +0000 (18:04 +0200)]
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.

10 years agonetops: catch the server not sending a certificate
Carlos Martín Nieto [Sat, 26 Apr 2014 12:36:32 +0000 (14:36 +0200)]
netops: catch the server not sending a certificate

It's possible for an encrypted connection not have a certificate. In
this case, SSL_get_verify_result() will return OK because no error
happened (as it never even tried to validate anything).

SSL_get_peer_certificate() will return NULL in this case so we need to
catch that. On the upside, the current code would segfault in this
situation instead of letting it through as a valid cert.

10 years agonetops: provide more specific error for cert failure
Carlos Martín Nieto [Sat, 26 Apr 2014 12:16:42 +0000 (14:16 +0200)]
netops: provide more specific error for cert failure

Specify what we do not like about the certificate. In this case, we do
not like the name.

10 years agonetops: unit-test the cert host-name pattern matching
Carlos Martín Nieto [Sat, 26 Apr 2014 11:51:14 +0000 (13:51 +0200)]
netops: unit-test the cert host-name pattern matching

This kind of stuff should have unit tests, even if it's just to show
what we expect to match successfully.

10 years agorefdb: fix typo and wording
Carlos Martín Nieto [Sat, 26 Apr 2014 12:29:18 +0000 (14:29 +0200)]
refdb: fix typo and wording

10 years agoMerge pull request #2299 from mekishizufu/fix_leaks
Vicent Marti [Fri, 25 Apr 2014 14:08:41 +0000 (07:08 -0700)]
Merge pull request #2299 from mekishizufu/fix_leaks

Plug some leaks

10 years agoReset tests: Use sandboxed index
Jiri Pospisil [Fri, 25 Apr 2014 13:49:58 +0000 (15:49 +0200)]
Reset tests: Use sandboxed index

10 years agoFilter: Make sure to release local on error
Jiri Pospisil [Fri, 25 Apr 2014 13:49:26 +0000 (15:49 +0200)]
Filter: Make sure to release local on error

10 years agoMerge pull request #2284 from jacquesg/push-progress-callback
Vicent Marti [Fri, 25 Apr 2014 09:10:19 +0000 (02:10 -0700)]
Merge pull request #2284 from jacquesg/push-progress-callback

Fire progress and update tips callbacks also for pushes.

10 years agoMerge pull request #2297 from libgit2/rb/status-with-precomposed-changes
Vicent Marti [Fri, 25 Apr 2014 09:07:42 +0000 (02:07 -0700)]
Merge pull request #2297 from libgit2/rb/status-with-precomposed-changes

Improve test coverage of status with different core.precomposeunicode settings

10 years agoMerge pull request #2241 from libgit2/rb/stash-skip-submodules
Vicent Marti [Fri, 25 Apr 2014 09:04:12 +0000 (02:04 -0700)]
Merge pull request #2241 from libgit2/rb/stash-skip-submodules

Improve stash and checkout for ignored + untracked items

10 years agoMerge pull request #2294 from ethomson/merge_checkout_strategy
Russell Belfer [Thu, 24 Apr 2014 23:20:08 +0000 (16:20 -0700)]
Merge pull request #2294 from ethomson/merge_checkout_strategy

Merge checkout strategy

10 years agoImprove docs for status rename detection limits
Russell Belfer [Thu, 24 Apr 2014 22:40:50 +0000 (15:40 -0700)]
Improve docs for status rename detection limits

and make tests empty on platforms without iconv support.

10 years agoTest toggling core.precomposeunicode yields rename
Russell Belfer [Thu, 24 Apr 2014 22:25:01 +0000 (15:25 -0700)]
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.

10 years agoTest decomposed unicode renames work as expected
Russell Belfer [Thu, 24 Apr 2014 21:46:59 +0000 (14:46 -0700)]
Test decomposed unicode renames work as expected

10 years agoHandle explicitly ignored dir slightly differently
Russell Belfer [Thu, 24 Apr 2014 18:59:50 +0000 (11:59 -0700)]
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.

10 years agoMerge pull request #2295 from libgit2/cmn/fetchhead-quote
Vicent Marti [Thu, 24 Apr 2014 12:24:46 +0000 (05:24 -0700)]
Merge pull request #2295 from libgit2/cmn/fetchhead-quote

fetchhead: deal with quotes in branch names

10 years agofetchhead: deal with quotes in branch names
Carlos Martín Nieto [Thu, 24 Apr 2014 12:08:29 +0000 (14:08 +0200)]
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.

10 years agomerge: checkout default shouldn't clobber given
Edward Thomson [Wed, 23 Apr 2014 23:40:21 +0000 (19:40 -0400)]
merge: checkout default shouldn't clobber given

10 years agomerge: default checkout strategy for should be SAFE
Edward Thomson [Wed, 23 Apr 2014 23:26:58 +0000 (19:26 -0400)]
merge: default checkout strategy for should be SAFE

10 years agoTreat ignored, empty, and untracked dirs different
Russell Belfer [Wed, 23 Apr 2014 23:28:45 +0000 (16:28 -0700)]
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.

10 years agoMerge pull request #2291 from ethomson/patch_binary
Vicent Marti [Wed, 23 Apr 2014 16:27:15 +0000 (09:27 -0700)]
Merge pull request #2291 from ethomson/patch_binary

patch: emit deflated binary patches (optionally)

10 years agoMerge pull request #2283 from phkelley/win32_fs
Vicent Marti [Wed, 23 Apr 2014 14:13:49 +0000 (07:13 -0700)]
Merge pull request #2283 from phkelley/win32_fs

Win32: UTF-8 <-> WCHAR conversion overhaul

10 years agoReact to feedback for UTF-8 <-> WCHAR and reparse work
Philip Kelley [Tue, 22 Apr 2014 14:21:19 +0000 (10:21 -0400)]
React to feedback for UTF-8 <-> WCHAR and reparse work

10 years agoMerge pull request #2289 from libgit2/rb/note-git-diff-index-behavior
Vicent Marti [Wed, 23 Apr 2014 10:21:05 +0000 (03:21 -0700)]
Merge pull request #2289 from libgit2/rb/note-git-diff-index-behavior

Some doc and examples/diff.c changes

10 years agoMake checkout match diff for untracked/ignored dir
Russell Belfer [Wed, 23 Apr 2014 04:51:54 +0000 (21:51 -0700)]
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.

10 years agopatch: emit binary patches (optionally)
Edward Thomson [Tue, 22 Apr 2014 18:58:33 +0000 (14:58 -0400)]
patch: emit binary patches (optionally)

10 years agoFailing test for stashing a buried ignored file
Russell Belfer [Tue, 22 Apr 2014 22:23:39 +0000 (15:23 -0700)]
Failing test for stashing a buried ignored file

10 years agoMake stash and checkout ignore contained repos
Russell Belfer [Wed, 2 Apr 2014 19:07:27 +0000 (12:07 -0700)]
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.

10 years agoReplace math fns with simpler integer math
Russell Belfer [Tue, 22 Apr 2014 19:59:31 +0000 (12:59 -0700)]
Replace math fns with simpler integer math

10 years agoUse git_diff_get_stats in example/diff + refactor
Russell Belfer [Tue, 22 Apr 2014 19:33:27 +0000 (12:33 -0700)]
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.