Commit Graph

868 Commits

Author SHA1 Message Date
Vicent Marti
cfbe4be3fb More external API cleanup
Conflicts:
	src/branch.c
	tests-clar/refs/branches/create.c
2012-11-27 13:18:27 -08:00
Ben Straub
2508cc66eb Rename ref and reflog apis for consistency 2012-11-27 13:17:45 -08:00
Vicent Martí
c4d8df27bc Merge pull request #1097 from nulltoken/topic/head_tree_error
Make `git_repository_head_tree()` return error codes
2012-11-23 15:19:47 -08:00
Sascha Cunz
9094d30b93 Reset all static variables to NULL in clar's __cleanup
Without this change, any failed assertion in the second (or a later) test
inside a test suite has a chance of double deleting memory, resulting in
a heap corruption. See #1096 for details.

This leaves alone the test cases where we "just" use cl_git_sandbox_init()
and cl_git_sandbox_cleanup(). These methods already take good care to not
double delete a repository.

Fixes #1096
2012-11-23 11:41:56 +01:00
nulltoken
5cec896a3b repo: Make git_repository_head_tree() return error codes 2012-11-22 18:51:06 +01:00
nulltoken
a94002a983 test: Minor fixes 2012-11-22 18:50:50 +01:00
Philip Kelley
5cf1b4f094 Call git_remote_update_tips before git_remote_disconnect 2012-11-22 11:16:35 -05:00
Eduardo Bart
e566b609df Update clar tests p_lstat_posixly and p_lstat 2012-11-20 00:57:56 -02:00
Russell Belfer
d46b0a04c7 Improve iterator ignoring .git file
The workdir iterator has always tried to ignore .git files, but
it turns out there were some bugs.  This makes it more robust at
ignoring .git files.

This also makes iterators always check ".git" case insensitively
regardless of the properties of the system.  This will make libgit2
skip ".GIT" and the like.  This is different from core git, but on
systems with case insensitive but case preserving file systems,
allowing ".GIT" to be added is problematic.
2012-11-19 16:34:44 -08:00
Russell Belfer
02df42ddbf Set up default internal ignores
This adds "." ".." and ".git" to the internal ignores list by
default - asking about paths with these files will always say
that they are ignored.
2012-11-19 16:33:30 -08:00
Scott J. Goldman
1876360f81 Add a test for invalid filenames while writing tree from index 2012-11-18 16:59:42 -08:00
Scott J. Goldman
19af78bb36 Prevent creating .., ., and .git with tree builder
As per core git.
2012-11-18 15:15:24 -08:00
Michael Schubert
0066955d97 Fix a couple of warnings 2012-11-18 04:27:49 +01:00
nulltoken
b15df1d937 reflog: make entry_byindex() and drop() git compliant
Passing 0 as the index now retrieves the most recent entry instead
of the oldest one.
2012-11-17 18:30:35 -08:00
nulltoken
270160b91a config: Opening a nonexistent file returns ENOTFOUND 2012-11-17 18:30:34 -08:00
nulltoken
6091457e76 repo: ensure is_empty() checks there are no refs 2012-11-17 07:20:08 -08:00
nulltoken
f5a0e734bc tests: introduce cl_git_remove_placeholders() 2012-11-17 07:20:07 -08:00
nulltoken
5df7207a67 repo: readonly tests don't need a sandboxed repo 2012-11-17 07:20:04 -08:00
nulltoken
0e95e70a55 env: ensure git_futils_find_xxx() returns ENOTFOUND 2012-11-17 05:41:22 -08:00
nulltoken
aa8a76eff9 tag: rename git_tag_type to git_tag_target_type 2012-11-17 05:41:20 -08:00
nulltoken
86b9dbc12f Fix MSVC compilation warnings 2012-11-17 05:13:13 -08:00
Vicent Martí
e087973ec7 Merge pull request #1075 from carlosmn/alternates-recurse
odb: recursively load alternates
2012-11-16 10:27:46 -08:00
Carlos Martín Nieto
85e7efa163 odb: recursively load alternates
The maximum depth is 5, like in git
2012-11-16 08:46:02 -08:00
Scott J. Goldman
0cd063fd87 Merge pull request #1071 from arrbee/alternate-fix-strcmp
Win32 fixes for diff/checkout/reset
2012-11-15 23:28:52 -08:00
Russell Belfer
bbe6dbec81 Add explicit git_index ptr to diff and checkout
A number of diff APIs and the `git_checkout_index` API take a
`git_repository` object an operate on the index.  This updates
them to take a `git_index` pointer explicitly and only fall back
on the `git_repository` index if the index input is NULL.  This
makes it easier to operate on a temporary index.
2012-11-14 23:29:48 -08:00
Russell Belfer
bad68c0a99 Add iterator for git_index object
The index iterator could previously only be created from a repo
object, but this allows creating an iterator from a `git_index`
object instead (while keeping, though renaming, the old function).
2012-11-14 22:55:40 -08:00
Russell Belfer
5735bf5e6a Fix diff API to better parameter order
The diff API is not in the parameter order one would expect from
other libgit2 APIs.  This fixes that.
2012-11-14 22:54:31 -08:00
Russell Belfer
402b92cfe9 Fix reset hard tests on platforms with CRLF
The reset hard tests had hardcoded expected file content and was
not correctly compensating for CRLF filtering when a file needed
to be reverted by the reset hard.  This fixes that.
2012-11-14 22:44:17 -08:00
Russell Belfer
cccacac555 Add POSIX compat lstat() variant for win32
The existing p_lstat implementation on win32 is not quite POSIX
compliant when setting errno to ENOTDIR.  This adds an option to
make is be compliant so that code (such as checkout) that cares
to have separate behavior for ENOTDIR can use it portably.

This also contains a couple of other minor cleanups in the
posix_w32.c implementations to avoid unnecessary work.
2012-11-14 22:41:51 -08:00
Vicent Martí
513e794ef4 Merge pull request #1068 from carlosmn/config-empty-value
Deal with empty and nonexsitent values in config
2012-11-13 14:59:18 -08:00
Carlos Martín Nieto
0da81d2b39 config: return an emtpy string when there is no value
Returning NULL for the string when we haven't signaled an error
condition is counter-intuitive and causes unnecessary edge
cases. Return an empty string when asking for a string value for a
configuration variable such as '[section] var' to avoid these edge
cases.

If the distinction between no value and an empty value is needed, this
can be retrieved from the entry directly. As a side-effect, this
change stops the int parsing functions from segfaulting on such a
variable.
2012-11-13 14:49:16 -08:00
Vicent Martí
aa1c3b588e Merge pull request #1016 from arrbee/fix-checkout-dir-removal
Update checkout with new strategies & behavior
2012-11-13 14:13:47 -08:00
Carlos Martín Nieto
47db054df0 config: distinguish between a lone variable name and one without rhs
'[section] variable' and '[section] variable =' behave differently
when parsed as booleans, so we need to store that distinction
internally.
2012-11-13 13:53:41 -08:00
Carlos Martín Nieto
3ee078c0f7 config: rename get_config_entry -> config_entry
We're already in the git_config namespace, there is no need to repeat
it.
2012-11-13 13:46:17 -08:00
Edward Thomson
603bee0791 Remove git_hash_ctx_new - callers now _ctx_init() 2012-11-13 10:23:05 -06:00
Edward Thomson
d6fb092409 Win32 CryptoAPI and CNG support for SHA1 2012-11-13 10:23:05 -06:00
Ben Straub
e45423dd2c Merge pull request #1065 from nulltoken/fix/memory-leak
Fix memory leaks
2012-11-13 05:45:08 -08:00
Michael Schubert
d51e54f1f4 Remove unused variables 2012-11-13 14:28:44 +01:00
nulltoken
4e547eee31 test: fix memory leak 2012-11-13 07:12:53 +01:00
Vicent Marti
9a50026b19 clar-helpers: Oops, grab pointer 2012-11-12 15:38:28 -08:00
Vicent Marti
19c044a17d Merge remote-tracking branch 'ben/local-transport' into development 2012-11-12 14:23:17 -08:00
nulltoken
b1a3a70ed1 repository: Refine repository_head() error report 2012-11-12 00:14:51 +01:00
nulltoken
ef8871515b Fix compilation warning 2012-11-12 00:13:02 +01:00
Edward Thomson
b0f6e45d14 create FETCH_HEAD specially instead of as a ref file 2012-11-11 11:56:33 -06:00
Vicent Martí
d18713fb4a Merge pull request #1056 from nulltoken/duplicate-tree-entries
Duplicate tree entries
2012-11-10 20:24:53 -08:00
nulltoken
33f95a9b32 index: refine add_from_workdir() error report 2012-11-10 21:01:05 +01:00
nulltoken
69c068c79f index: make git_index_new() work with a NULL path 2012-11-10 20:42:45 +01:00
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
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
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
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
nulltoken
55f9837f11 config: make git_config_open_level() work with an empty config 2012-11-09 21:49:50 +01: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
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
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
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
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
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
Keith Dahlby
35d255fda6 repo: fix state when HEAD is not detached 2012-11-04 12:13:42 -06:00
Erik van Zijst
6bb9fea13e tags: Fixed the tag parser to correctly treat the message field as optional.
This fix makes libgit2 capable of parsing annotated tag objects that lack
the optional message/description field.
Previously, libgit2 treated this field as mandatory and raised a tag_error on
such tags. However, the message field is optional.

An example of such a tag is refs/tags/v2.6.16.31-rc1 in Linux:

$ git cat-file tag refs/tags/v2.6.16.31-rc1
object afaa018cefb6af63befef1df7d8febaae904434f
type commit
tag v2.6.16.31-rc1
tagger Adrian Bunk <bunk@stusta.de> 1162716505 +0100
$
2012-11-02 10:28:17 -07:00
Vicent Martí
1362a98316 Merge pull request #1014 from arrbee/diff-rename-detection
Initial implementation of diff rename detection
2012-11-02 10:00:28 -07:00
Vicent Martí
d13da328e2 Merge pull request #1038 from arrbee/doc-fixes
Improve docs, examples, warnings
2012-11-01 14:18:40 -07:00
Russell Belfer
b90500f03d Improve docs, examples, warnings
This improves docs in some of the public header files, cleans
up and improves some of the example code, and fixes a couple
of pedantic warnings in places.
2012-11-01 14:08:30 -07:00
Vicent Marti
43eeca04a7 index: Fix tests 2012-11-01 20:24:43 +01:00
Vicent Martí
7ae73e94db Merge pull request #1030 from pwkelley/transports
Reorganize transport architecture
2012-11-01 09:15:29 -07:00
Philip Kelley
e068f2bb71 Fix a bug in cl_setenv on Windows XP 2012-11-01 11:50:08 -04:00
Philip Kelley
41fb1ca0ec Reorganize transport architecture (squashed 3) 2012-11-01 09:02:33 -04:00
Carlos Martín Nieto
3dfed9cb86 packbuilder: add git_packbuilder_foreach
Let the user get each object as a buffer+size pair so they can handle
the packfile content as they need to.
2012-11-01 06:21:49 +01:00
Russell Belfer
744cc03e2b Add git_config_refresh() API to reload config
This adds a new API that allows users to reload the config if the
file has changed on disk.  A new config callback function to
refresh the config was added.

The modified time and file size are used to test if the file needs
to be reloaded (and are now stored in the disk backend object).

In writing tests, just using mtime was a problem / race, so I
wanted to check file size as well.  To support that, I extended
`git_futils_readbuffer_updated` to optionally check file size in
addition to mtime, and I added a new function `git_filebuf_stats`
to fetch the mtime and size for an open filebuf (so that the
config could be easily refreshed after a write).

Lastly, I moved some similar file checking code for attributes
into filebuf.  It is still only being used for attrs, but it
seems potentially reusable, so I thought I'd move it over.
2012-10-30 12:11:23 -07:00
Vicent Martí
efde422553 Merge pull request #1017 from arrbee/diff-patch-to-str
Add git_diff_patch_to_str API
2012-10-30 12:04:28 -07:00
Vicent Martí
c4a9ded0f9 Merge pull request #1026 from nulltoken/repo/state
repo: enhance git_repository_state() detection
2012-10-30 12:03:22 -07:00
Vicent Martí
6c21358a89 Merge pull request #1029 from ethomson/index_refactor
Index changes
2012-10-30 11:51:58 -07:00
Michael Schubert
6cfbbf7e32 Fix a couple of warnings 2012-10-30 18:50:59 +01:00
Russell Belfer
db106d01f0 Move rename detection into new file
This improves the naming for the rename related functionality
moving it to be called `git_diff_find_similar()` and renaming
all the associated constants, etc. to make more sense.

I also moved the new code (plus the existing `git_diff_merge`)
into a new file `diff_tform.c` where I can put new functions
related to manipulating git diff lists.

This also updates the implementation significantly from the
last revision fixing some ordering issues (where break-rewrite
needs to be handled prior to copy and rename detection) and
improving config option handling.
2012-10-30 09:40:50 -07:00
Edward Thomson
f45ec1a076 index refactoring 2012-10-29 20:04:21 -05:00
Ben Straub
81eecc342b Fetch: don't clobber received count
This memset was being reached after the entire packfile under
WinHttp, so the byte count was being lost for small repos.
2012-10-29 13:34:14 -07:00
nulltoken
31966d20e3 repo: enhance git_repository_state() detection 2012-10-27 16:45:59 +02:00
nulltoken
00e161b977 tests: fix a memory leak 2012-10-27 11:43:48 +02:00
nulltoken
e4c64cf2aa stash: add git_stash_drop() 2012-10-26 22:11:15 +02:00
nulltoken
233884131d stash: add git_stash_foreach() 2012-10-26 22:11:09 +02:00
nulltoken
590fb68be0 stash: add git_stash_save() 2012-10-26 22:10:48 +02:00
nulltoken
1f87fa3595 reflog: fix bogus removal of reflog entries 2012-10-26 21:02:01 +02:00
nulltoken
65d12df525 message: reorganize tests 2012-10-26 21:01:58 +02:00
Russell Belfer
1b9346897b Merge pull request #925 from nulltoken/topic/moving-branch-updates-config
Updates config upon moving and deletion of branches
2012-10-25 10:55:03 -07:00
Ben Straub
1fc375e6ef Fix Windows build
Pedantic ordering of GIT_UNUSED vs. variable declarations.
2012-10-25 09:02:55 -07:00
nulltoken
fcccf3045f remote: introduce git_remote_rename() 2012-10-25 17:42:36 +02:00
nulltoken
3a14d3e2bc buf: introduce git_buf_splice() 2012-10-25 17:42:35 +02:00
nulltoken
e497b16c57 remote: prevent from saving a nameless remote 2012-10-25 17:42:33 +02:00
nulltoken
383f164a09 branch: rename config section upon moving 2012-10-25 17:42:31 +02:00
nulltoken
0b98a8a424 branch: remove config section upon deletion 2012-10-25 17:42:31 +02:00
Vicent Martí
1eb8cd7f87 Merge pull request #990 from ben/clone-callbacks
Progress callbacks
2012-10-25 08:16:13 -07:00
Russell Belfer
93cf7bb8e2 Add git_diff_patch_to_str API
This adds an API to generate a complete single-file patch text
from a git_diff_patch object.
2012-10-24 20:56:32 -07:00
Edward Thomson
03bdb2addd GIT_EUNMERGED 2012-10-24 20:24:37 -05:00
Edward Thomson
632d8b230b reset changes for merge 2012-10-24 20:24:37 -05:00
Ben Straub
1e3b8ed5cf Remove 'bytes' param from git_remote_download 2012-10-24 14:07:07 -07:00
Ben Straub
7d222e1312 Network progress: rename things
git_indexer_stats and friends -> git_transfer_progress*

Also made git_transfer_progress members more sanely
named.
2012-10-24 13:29:14 -07:00
Michael Schubert
6f6b0c013c tests-clar/repo: remove unused variable 2012-10-24 15:42:09 +02:00
Russell Belfer
b4f5bb0747 Initial implementation of diff rename detection
This implements the basis for diff rename and copy detection,
although it is based on simple SHA comparison right now instead
of using a matching algortihm.  Just as `git_diff_merge` can be
used as a post-pass on diffs to emulate certain command line
behaviors, there is a new API `git_diff_detect` which will
update a diff list in-place, adjusting some deltas to RENAMED
or COPIED state (and also, eventually, splitting MODIFIED deltas
where the change is too large into DELETED/ADDED pairs).

This also adds a new test repo that will hold rename/copy/split
scenarios.  Right now, it just has exact-match rename and copy,
but the tests are written to use tree diffs, so we should be able
to add new test scenarios easily without breaking tests.
2012-10-23 16:40:51 -07:00
yorah
a1abe66aca Add config level support in the config API
Added `struct git_config_entry`: a git_config_entry contains the key, the value, and the config file level from which a config element was found.
Added `git_config_open_level`: build a single-level focused config object from a multi-level one.

We are now storing `git_config_entry`s in the khash of the config_file
2012-10-23 12:48:38 +02:00
yorah
f8ede94808 Fix adding variable to config file with no trailing newline
This can occur after a manual modification of a config file.
2012-10-23 11:48:50 +02:00
Vicent Martí
8a89aa1f57 Merge pull request #963 from carlosmn/remote-save-autotag
Save the autotag configuration for remotes
2012-10-22 12:04:48 -07:00
nulltoken
f36fb761dc tests: more git_repository_head_detached() coverage 2012-10-22 19:46:00 +02:00
nulltoken
c436ed26e0 reset: make git_reset() cope with an orphaned HEAD 2012-10-22 19:46:00 +02:00
nulltoken
cd1ef82253 test: extract make_head_orphaned() logic 2012-10-20 12:07:53 +02:00
nulltoken
209e34fa70 tests: leverage git_repository_detach_head() 2012-10-20 12:01:04 +02:00
Ben Straub
9c05c17b7a Checkout progress now reports completed/total steps 2012-10-19 20:05:18 -07:00
Ben Straub
cd001bbbfe Fix from rebase 2012-10-19 19:37:47 -07:00
Ben Straub
25e8b20169 Fix broken tests 2012-10-19 19:36:23 -07:00
Ben Straub
30a46ab1a9 Adjust for rebase 2012-10-19 19:36:22 -07:00
Ben Straub
aa1e86741d Clone: in-line callbacks for progress
Also implemented in the git2 example.
2012-10-19 19:36:22 -07:00
Ben Straub
216863c48f Fetch/indexer: progress callbacks 2012-10-19 19:36:22 -07:00
nulltoken
0ae81fc479 index: remove read_tree() progress indicator
git_index_read_tree() was exposing a parameter to provide the user with
a progress indicator. Unfortunately, due to the recursive nature of the
tree walk, the maximum number of items to process was unknown. Thus,
the indicator was only counting processed entries, without providing
any information how the number of remaining items.
2012-10-19 19:36:22 -07:00
Ben Straub
183d8bddeb Remove checkout_stats from git_clone 2012-10-19 19:36:22 -07:00
Ben Straub
806426565f Convert checkout_* to use progress callback 2012-10-19 19:36:21 -07:00
Ben Straub
2c8bbb27d9 Convert checkout_index to use progress callback 2012-10-19 19:34:15 -07:00
Ben Straub
3028be0723 Add git_indexer_stats field to git_remote
Also removing all the *stats parameters from external
APIs that don't need them anymore.
2012-10-19 19:34:14 -07:00
Philip Kelley
11c2a9c67d Merge pull request #1003 from arrbee/fix-test-core-env
Fix env variable tests with new Win32 path rules
2012-10-19 17:06:07 -07:00
Russell Belfer
0d422ec9c2 Fix env variable tests with new Win32 path rules
The new Win32 global path search was not working with the
environment variable tests.  But when I fixed the test, the new
codes use of getenv() was causing more failures (presumably because
of caching on Windows ???).  This fixes the global file lookup to
always go directly to the Win32 API in a predictable way.
2012-10-19 15:40:43 -07:00
Vicent Martí
cf028856bc Merge pull request #1000 from nulltoken/error/GIT_EORPHANEDHEAD
Add error GIT_EORPHANEDHEAD
2012-10-19 14:43:09 -07:00
Ted Nyman
1a23440235 Update README because vmg is @vmg. 2012-10-19 14:05:55 -07:00
nulltoken
8b05bea870 errors: deploy GIT_EORPHANEDHEAD usage 2012-10-19 22:01:53 +02:00
nulltoken
0532e7bb87 branch: allow deletion of branch when HEAD's missing 2012-10-19 21:23:22 +02:00
nulltoken
8dd0bef921 tests: Fix unused variable warning 2012-10-19 20:35:12 +02:00
nulltoken
2df37f42c1 refs: cover more refname validity edge cases 2012-10-18 23:59:22 +02:00
nulltoken
4fd7e8e583 status: querying a bare repo returns EBAREREPO 2012-10-18 23:38:35 +02:00
nulltoken
c2e43fb1f2 diff: workdir diffing in a bare repo returns EBAREREPO 2012-10-18 23:38:27 +02:00
Vicent Martí
502be5ff3f Merge pull request #993 from pwkelley/clar_update
Update clar and add reliable rename for Win32
2012-10-18 14:15:37 -07:00
nulltoken
5912d74c69 revparse: properly handle refnames containing a @
Fix #994
2012-10-18 23:05:33 +02:00
Philip Kelley
c08b8a3a73 Update clar and add reliable rename for Win32 2012-10-18 14:50:17 -04:00
Russell Belfer
4c47a8bcfe Merge pull request #968 from arrbee/diff-support-typechange
Support TYPECHANGE records in status and adjust checkout accordingly
2012-10-17 14:14:51 -07:00
Michael Schubert
70d41f6bcd Fix -Wunused-but-set-variable warning 2012-10-16 23:42:01 +02:00
Vicent Marti
18217e7e8a test: Don't be so picky with failed lookups
Not found means not found, and the other way around.
2012-10-16 19:37:21 +02:00
Philip Kelley
9e37305aad Merge pull request #984 from arrbee/fix-fnmatch-and-ignore
Fix single file ignores
2012-10-16 08:34:28 -07:00
nulltoken
add5efe7e9 test: fix some memory leaks 2012-10-16 00:49:05 +02:00
Ben Straub
71b79a0aab Merge pull request #982 from nulltoken/clone/no-checkout
clone: Explicit support of no-checkout option
2012-10-15 15:24:50 -07:00
Russell Belfer
52032ae536 Fix single-file ignore checks
To answer if a single given file should be ignored, the path to
that file has to be processed progressively checking that there
are no intermediate ignored directories in getting to the file
in question.  This enables that, fixing the broken old behavior,
and adds tests to exercise various ignore situations.
2012-10-15 12:54:46 -07:00
nulltoken
68206c54bf test: fix some memory leaks 2012-10-15 20:41:43 +02:00
nulltoken
fa5d94a0d4 reset: prevent hard reset in a bare repository 2012-10-15 20:41:42 +02:00
nulltoken
c4f68b3202 clone: fix detection of remote HEAD 2012-10-15 20:40:37 +02:00
nulltoken
4d968f134b clone: Explicit support of no-checkout option 2012-10-15 20:40:37 +02:00
Ben Straub
86a2da6e8a Clone: use libgit2's test repos 2012-10-15 10:48:17 -07:00
Ben Straub
65415ea275 Tests: add "network" category
Split the clone tests into network and no-network suites.
2012-10-15 10:48:17 -07:00
Carlos Martín Nieto
7ae5ab5696 Fix leak in the tests
Also introduce the slective ref trimming promised but also missed in
the previous commit.
2012-10-15 16:35:10 +02:00
Carlos Martín Nieto
47f44b6ee4 refs: loosen the OID parsing
We used to require loose references to contain only an OID (possibly
after trimming the string). This is however not enough for letting us
lookup FETCH_HEAD, which can have a lot of content after the initial
OID.

Change the parsing rules so that a loose refernce must e at least 40
bytes long and the 41st (if it's there) must be accepted by
isspace(3). This makes the trim unnecessary, so only do it for
symrefs. This fixes #977.
2012-10-15 14:00:19 +02:00
nulltoken
b73200c1ed tags: cover EEXISTS propagation upon creation 2012-10-11 14:15:40 +02:00
nulltoken
6251de1d17 branches: cover EEXISTS propagation upon moving 2012-10-11 14:09:27 +02:00
nulltoken
62993b6158 branches: propagate EEXISTS upon creation 2012-10-11 14:08:32 +02:00
nulltoken
3548fcf562 refs: propagate EEXISTS upon renaming 2012-10-11 14:00:26 +02:00
Carlos Martín Nieto
a75770febc tests: add a test for tag autofollow behaviour
Also tell ctest and valgrind to run libgit2_clar with '-iall' so we
run the network tests in travis.
2012-10-11 00:19:54 +02:00
Russell Belfer
2d3579bea6 Add git_buf_put_base64 to buffer API 2012-10-10 14:54:31 -07:00
Russell Belfer
8ea05f3f8f Fix clar issue 2012-10-09 15:25:58 -07:00
Russell Belfer
0bc47b6339 Update to latest clar 2012-10-09 15:13:00 -07:00
Michael Schubert
0a32dca5ec gsoc-pack-objects WIP 2012-10-09 21:28:31 +02:00
Russell Belfer
0d64bef941 Add complex checkout test and then fix checkout
This started as a complex new test for checkout going through the
"typechanges" test repository, but that revealed numerous issues
with checkout, including:

* complete failure with submodules
* failure to create blobs with exec bits
* problems when replacing a tree with a blob because the tree
  "example/" sorts after the blob "example" so the delete was
  being processed after the single file blob was created

This fixes most of those problems and includes a number of other
minor changes that made it easier to do that, including improving
the TYPECHANGE support in diff/status, etc.
2012-10-09 11:59:34 -07:00
Russell Belfer
f3a04e0f49 Test data with lots of type changes 2012-10-09 11:54:02 -07:00
Vicent Martí
21e0d297af Merge pull request #967 from arrbee/diff-submodule-tests-and-fixes
Diff submodule tests and fixes
2012-10-09 11:45:50 -07:00
Michael Schubert
aa4437f637 Fix compiler warnings
* tests-clar/status: remove an unused variable
* clone: fix -Wmaybe-uninitialized warning
2012-10-09 17:51:11 +02:00
Ben Straub
9adfa7d147 Merge pull request #949 from nulltoken/topic/deploy_repository_set_head
Deploy git_repository_set_head()
2012-10-08 15:25:44 -07:00
Russell Belfer
5d1308f25f Add test for diffs with submodules and bug fixes
The adds a test for the submodule diff capabilities and then
fixes a few bugs with how the output is generated.  It improves
the accuracy of OIDs in the diff delta object and makes the
submodule output more closely mirror the OIDs that will be used
by core git.
2012-10-08 15:22:40 -07:00
Russell Belfer
71966e2f1b Extend diff helpers for tests a little 2012-10-08 15:22:40 -07:00
Philip Kelley
edb456c328 Fix a bug where ignorecase wasn't applied to ignores 2012-10-08 16:32:43 -04:00
nulltoken
bf0e62a2b8 clone: fix cloning of empty repository 2012-10-08 00:44:21 +02:00
nulltoken
ebecf1e7d8 clone: reorganize tests 2012-10-08 00:44:19 +02:00
nulltoken
0c78f685eb branch: introduce git_branch_is_head() 2012-10-07 21:03:51 +02:00
nulltoken
b52b6571af branch: enhance branch moving test coverage 2012-10-07 21:03:48 +02:00
Vicent Marti
f9cf12b4f5 clar: Proper shutdown order 2012-10-02 20:23:54 +02:00
Russell Belfer
d0b452db02 Merge pull request #932 from ben/clone_pack_race
ODB: re-load packfiles on failed lookup
2012-10-02 11:08:30 -07:00
Russell Belfer
eada0762dd Merge pull request #939 from pwkelley/ignorecase
Support for the core.ignorecase flag
2012-10-02 10:45:40 -07:00
Carlos Martín Nieto
218c88a968 remote: set/unset the autotag setting on save
Make the configuration option match the configured behavior when
saving a remote.
2012-10-02 13:09:18 +02:00
Vicent Martí
8bc5caccee Merge pull request #961 from arrbee/win64-cleanups
Win64 cleanups
2012-10-01 13:57:32 -07:00
Carlos Martín Nieto
c128149315 refs: propagate EEXISTS
Indicate whether the error comes from the ref already existing or
elsewhere. We always perform the check and this lets the user write
more concise code.
2012-09-30 11:56:37 +02:00
Carlos Martín Nieto
3665ba8eeb refspec: add git_refspec__free, remove git_refspec_parse
The latter shouldn't be exposed and isn't used, git_refspec__parse
supersedes it.

Fix a leak in the refspec tests while we're at it.
2012-09-30 11:56:37 +02:00
Russell Belfer
cc5bf359a6 Clean up Win64 warnings 2012-09-28 14:34:08 -07:00
Vicent Martí
34402bcdb9 Merge pull request #959 from jamill/empty_file_hash
Fix error hashing empty file.
2012-09-28 11:57:02 -07:00
Vicent Martí
3f849902e4 Merge pull request #958 from schu/fix-merge-base
revwalk: fix off-by-one error
2012-09-28 11:48:43 -07:00
Jameson Miller
addc9be4fc Fix error hashing empty file. 2012-09-27 13:12:27 -04:00
Michael Schubert
8060cdc93c revwalk: fix off-by-one error
Fixes #921.
2012-09-27 19:12:01 +02:00
Russell Belfer
bae957b95d Add const to all shared pointers in diff API
There are a lot of places where the diff API gives the user access
to internal data structures and many of these were being exposed
through non-const pointers.  This replaces them all with const
pointers for any object that the user can access but is still
owned internally to the git_diff_list or git_diff_patch objects.

This will probably break some bindings...  Sorry!
2012-09-25 16:35:05 -07:00
Russell Belfer
6428630865 Fix bugs in new diff patch code
This fixes all the bugs in the new diff patch code.  The only
really interesting one is that when we merge two diffs, we now
have to actually exclude diff delta records that are not supposed
to be tracked, as opposed to before where they could be included
because they would be skipped silently by `git_diff_foreach()`.
Other than that, there are just minor errors.
2012-09-25 16:35:05 -07:00
Russell Belfer
5f69a31f7d Initial implementation of new diff patch API
Replacing the `git_iterator` object, this creates a simple API
for accessing the "patch" for any file pair in a diff list and
then gives indexed access to the hunks in the patch and the lines
in the hunk.  This is the initial implementation of this revised
API - it is still broken, but at least builds cleanly.
2012-09-25 16:35:05 -07:00
Vicent Martí
5942bd18bf Merge pull request #947 from arrbee/public-error-set
Make giterr_set_str() and giterr_set_oom() public APIs
2012-09-25 14:53:13 -07:00
Vicent Martí
31d22037a6 Merge pull request #944 from scunz/list_tags
Tags: teach git_tag_list not to include the 'refs/tags/' prefix
2012-09-25 14:52:24 -07:00
nulltoken
0adfa20aef refspec: introduce git_refspec__parse() 2012-09-25 07:49:15 +02:00
nulltoken
77e06d7e85 refs: introduce git_reference_is_valid_name() 2012-09-25 07:49:15 +02:00
nulltoken
c030ada7ff refs: make git_reference_normalize_name() accept refspec pattern 2012-09-25 07:49:14 +02:00
Sascha Cunz
8469219e37 Tests: Add test for git_tag_list to check for 'git tag -l "*bar"' 2012-09-23 01:02:07 +02:00
Sascha Cunz
daa70138fc Tests: reindent object/tag/list.c to use tabs 2012-09-23 01:02:07 +02:00
Sascha Cunz
45949b378b Tests::object::tag: also test for a 'foo/*/bar'. 2012-09-23 01:02:07 +02:00