Commit Graph

3797 Commits

Author SHA1 Message Date
nulltoken
353e991679 tests: Add missing assertions 2012-11-10 16:43:05 +01:00
Ben Straub
2ff1a0d0f0 Helpers for local-filesystem remote URLs 2012-11-09 16:59:46 -08:00
Russell Belfer
757b406504 Fix warnings and valgrind issues
This fixes some various warnings that showed up in Travis and
a couple uses of uninitialized memory and one memory leak.
2012-11-09 14:01:44 -08:00
Russell Belfer
0f3def715d Fix various cross-platform build issues
This fixes a number of warnings and problems with cross-platform
builds.  Among other things, it's not safe to name a member of a
structure "strcmp" because that may be #defined.
2012-11-09 13:52:07 -08:00
Russell Belfer
8064ecba23 Update reset hard test
The `git_reset` API with the HARD option is still slightly
broken, but this test now does exercise the ability of the
command to revert modified files.
2012-11-09 13:52:07 -08:00
Russell Belfer
a1bf70e4c9 fix regression in diff with submodule oid 2012-11-09 13:52:07 -08:00
Russell Belfer
ad9a921b92 Rework checkout with new strategy options
This is a major reworking of checkout strategy options.  The
checkout code is now sensitive to the contents of the HEAD tree
and the new options allow you to update the working tree so that
it will match the index content only when it previously matched
the contents of the HEAD.  This allows you to, for example, to
distinguish between removing files that are in the HEAD but not
in the index, vs just removing all untracked files.

Because of various corner cases that arise, etc., this required
some additional capabilities in rmdir and other utility functions.

This includes the beginnings of an implementation of code to read
a partial tree into the index based on a pathspec, but that is
not enabled because of the possibility of creating conflicting
index entries.
2012-11-09 13:52:07 -08:00
Russell Belfer
55cbd05b18 Some diff refactorings to help code reuse
There are some diff functions that are useful in a rewritten
checkout and this lays some groundwork for that.  This contains
three main things:

1. Share the function diff uses to calculate the OID for a file
   in the working directory (now named `git_diff__oid_for_file`
2. Add a `git_diff__paired_foreach` function to iterator over
   two diff lists concurrently.  Convert status to use it.
3. Move all the string/prefix/index entry comparisons into
   function pointers inside the `git_diff_list` object so they
   can be switched between case sensitive and insensitive
   versions.  This makes them easier to reuse in various
   functions without replicating logic.  As part of this, move
   a couple of index functions out of diff.c and into index.c.
2012-11-09 13:52:07 -08:00
Russell Belfer
2e3d4b96c0 Move pathspec code in separate files
Diff uses a `git_strarray` of path specs to represent a subset
of all files to be processed.  It is useful to be able to reuse
this filtering in other places outside diff, so I've moved it
into a standalone set of utilities.
2012-11-09 13:52:07 -08:00
Russell Belfer
220d5a6c35 Make iterator ignore eval lazy
This makes it so that the check if a file is ignored will be
deferred until requested on the workdir iterator, instead of
aggressively evaluating the ignore rules for each entry.  This
should improve performance because there will be no need to
check ignore rules for files that are already in the index.
2012-11-09 13:52:07 -08:00
Russell Belfer
18eff2ad70 Clean up a couple things missed in rebase 2012-11-09 13:52:07 -08:00
Russell Belfer
32def5af9a Fix checkout behavior when its hands are tied
So, @nulltoken created a failing test case for checkout that
proved to be particularly daunting.  If checkout is given only
a very limited strategy mask (e.g. just GIT_CHECKOUT_CREATE_MISSING)
then it is possible for typechange/rename modifications to leave it
unable to complete the request.  That's okay, but the existing code
did not have enough information not to generate an error (at least
for tree/blob conflicts).

This led me to a significant reorganization of the code to handle
the failing case, but it has three benefits:

1. The test case is handled correctly (I think)
2. The new code should actually be much faster than the old code
   since I decided to make checkout aware of diff list internals.
3. The progress value accuracy is hugely increased since I added
   a fourth pass which calculates exactly what work needs to be
   done before doing anything.
2012-11-09 13:52:06 -08:00
Russell Belfer
331e7de900 Extensions to rmdir and mkdir utilities
* Rework GIT_DIRREMOVAL values to GIT_RMDIR flags, allowing
  combinations of flags
* Add GIT_RMDIR_EMPTY_PARENTS flag to remove parent dirs that
  are left empty after removal
* Add GIT_MKDIR_VERIFY_DIR to give an error if item is a file,
  not a dir (previously an EEXISTS error was ignored, even for
  files) and enable this flag for git_futils_mkpath2file call
* Improve accuracy of error messages from git_futils_mkdir
2012-11-09 13:52:06 -08:00
Vicent Martí
8a328cf442 Merge pull request #1058 from pwkelley/development
Fixes for two segfaults
2012-11-09 13:19:32 -08:00
Vicent Martí
39d7cf60de Merge pull request #1059 from nulltoken/fix/config-open-level
config: make git_config_open_level() work with an empty config
2012-11-09 13:15:57 -08:00
Philip Kelley
fcd03bebbf Fix a mutex/critical section leak 2012-11-09 15:57:32 -05:00
nulltoken
55f9837f11 config: make git_config_open_level() work with an empty config 2012-11-09 21:49:50 +01:00
Philip Kelley
2f683f0097 Fix uninitialized memory in winhttp subtransport on 64-bit 2012-11-09 15:39:25 -05:00
Philip Kelley
2364735c8f Fix implementation of strndup to not overrun 2012-11-09 15:39:10 -05:00
Ben Straub
90207709a3 Avoid copying duplicate commits 2012-11-09 10:33:16 -08:00
Ben Straub
11fabe73a0 Local fetch: add tests 2012-11-09 10:33:10 -08:00
Ben Straub
505da062b8 Implement local transport's fetch 2012-11-09 10:33:05 -08:00
nulltoken
f92bcaea49 index: prevent tree creation from a non merged state
Fix libgit2/libgit2sharp#243
2012-11-09 16:45:47 +01:00
Vicent Martí
0f674411e9 Merge pull request #1052 from delanne/invalid_read
Valgrind reports Invalid Read when the configuration file contains some empty line
2012-11-09 06:16:44 -08:00
Vicent Martí
4d062d257b Merge pull request #1057 from bts/patch-1
Update documentation in remote.h
2012-11-09 06:15:37 -08:00
Brian Schroeder
b0b8065880 Update documentation in remote.h 2012-11-08 21:28:15 -08:00
nulltoken
7cc1bf0fcb index: Introduce git_index_has_conflicts() 2012-11-08 21:16:48 +01:00
nulltoken
29cc374d2e tree: enforce coverage of silent entry replacement 2012-11-08 21:16:45 +01:00
Philip Kelley
9d64128325 Merge pull request #1048 from pwkelley/basic_auth
Basic authentication for http and winhttp
2012-11-08 08:06:23 -08:00
delanne
bcad677ba8 - Update 'tests-clar/resources/config/config11' in order to reproduce the invalidread with the unittest (just added some \n at the end of the file)
- Fix config_file.c
2012-11-08 12:28:21 +01:00
Vicent Martí
8ff2b0c759 Merge pull request #1039 from erikvanzijst/erik/tag_without_message
Correctly parse tags lacking a description
2012-11-07 16:30:55 -08:00
Ben Straub
721571cc5e Merge pull request #1050 from edubart/development
Fix compilation for mingw32 and cygwin
2012-11-07 12:58:54 -08:00
Eduardo Bart
345eef2374 Move inet_pton to posix platform-compatibility layer 2012-11-07 16:15:09 -02:00
Eduardo Bart
d1a69d0fff Fix compilation for mingw32 and cygwin
inet_pton is available only in windows vista or later,
fixed the issue by reimplementing it using WSAStringToAddress
2012-11-06 20:22:11 -02:00
Philip Kelley
11fa847283 Don't store no_check_cert; fetch it on demand 2012-11-06 11:27:23 -05:00
Philip Kelley
8a85378829 Merge pull request #1025 from ethomson/fetchodb
fetch: Write packs to the ODB instead of directly to disk
2012-11-06 07:32:29 -08:00
Philip Kelley
2f7538ec00 Fix connection leak in http subtransport 2012-11-06 09:36:04 -05:00
Philip Kelley
091361f569 Basic authentication for http and winhttp 2012-11-06 08:52:03 -05:00
Edward Thomson
09cc0b92dc create callback to handle packs from fetch, move the indexer to odb_pack 2012-11-05 16:00:29 -06:00
Russell Belfer
a5e85d86b7 Merge pull request #1046 from libgit2/empty-remote-url-crash
Bail out of remote loading if the URL would be NULL
2012-11-05 11:06:50 -08:00
Justin Spahr-Summers
c1cd036e40 'geterr' -> 'giterr' 2012-11-05 11:01:00 -08:00
Justin Spahr-Summers
6edefa1491 Revert "Don't expect the 'empty-remote-url' remote to be listed"
Apparently git_remote_list() includes even remotes for which git_remote_load() would fail. Sorry @nulltoken, false alarm.

This reverts commit f358ec143c.
2012-11-05 10:58:13 -08:00
Justin Spahr-Summers
f358ec143c Don't expect the 'empty-remote-url' remote to be listed
CC @nulltoken
2012-11-05 10:45:26 -08:00
Justin Spahr-Summers
1fe99aeea3 Test for GITERR_INVALID 2012-11-05 10:44:48 -08:00
Russell Belfer
065be7a1d9 Merge pull request #1044 from dahlbyk/repo/state
Fix state when HEAD is not detached
2012-11-05 10:44:21 -08:00
Justin Spahr-Summers
f8baece754 Set GITERR_INVALID when encountering a NULL remote URL 2012-11-05 10:42:10 -08:00
Vicent Martí
942a76983b Merge pull request #1034 from carlosmn/packbuilder-foreach
Let the user grab the packfile as it's being written
2012-11-05 06:54:34 -08:00
nulltoken
a2a618948c remote: Add malformed remote load test 2012-11-04 23:08:17 -08:00
Justin Spahr-Summers
83885891f5 Bail out if remote->url would be NULL
This fixes a crash from attempting to invoke git__strdup() against NULL.
2012-11-04 22:01:24 -08:00
Keith Dahlby
221ee54b8c Fix Clar link 2012-11-04 21:24:14 -06:00