Commit Graph

407 Commits

Author SHA1 Message Date
nulltoken
527ed55448 references: introduce git_reference_foreach_glob() 2012-06-22 21:40:24 +02:00
nulltoken
d4827081ea branch: drop git_branch_list() 2012-06-21 18:51:32 +02:00
nulltoken
a8fd805e2f branch: add git_branch_foreach() 2012-06-21 18:51:27 +02:00
Vicent Martí
c3ce8d0c9a Merge pull request #775 from arrbee/fix-index-filemodes
Make index add/append support core.filemode flag
2012-06-19 15:17:35 -07:00
Russell Belfer
77d65af439 Nicer constant 2012-06-19 15:16:38 -07:00
Russell Belfer
da825c92d9 Make index add/append support core.filemode flag
This fixes git_index_add and git_index_append to behave more like
core git, preserving old filemode data in the index when adding
and/or appending with core.filemode = false.

This also has placeholder support for core.symlinks and
core.ignorecase, but those flags are not implemented (well,
symlinks has partial support for preserving mode information in
the same way that git does, but it isn't tested).
2012-06-19 14:27:02 -07:00
nulltoken
743a4b3bdd message: Expose git_message_prettify()
git_commit() and git_tag() no longer prettify the
message by default. This has to be taken care of
by the caller.

This has the nice side effect of putting the
caller in position to actually choose to strip
the comments or not.
2012-06-19 10:02:22 +02:00
Vicent Martí
31eed56b9e Merge pull request #753 from nulltoken/topic/merge-base-many
Expose git_merge_base_many()
2012-06-18 17:36:14 -07:00
Carlos Martín Nieto
14ebe51832 Expose git_refspec_parse()
This function has been available for some time, but never in a
header. Expose it so we can use it from outside the library.
2012-06-12 15:24:33 +02:00
Russell Belfer
145e696b49 Minor fixes, cleanups, and clarifications
There are three actual changes in this commit:

1. When the trailing newline of a file is removed in a diff, the
   change will now be reported with `GIT_DIFF_LINE_DEL_EOFNL` passed
   to the callback.  Previously, the `ADD_EOFNL` constant was given
   which was just an error in my understanding of when the various
   circumstances arose.  `GIT_DIFF_LINE_ADD_EOFNL` is deprecated and
   should never be generated.  A new newline is simply an `ADD`.
2. Rewrote the `diff_delta__merge_like_cgit` function that contains
   the core logic of the `git_diff_merge` implementation.  The new
   version doesn't actually have significantly different behavior,
   but the logic should be much more obvious, I think.
3. Fixed a bug in `git_diff_merge` where it freed a string pool
   while some of the string data was still in use.  This led to
   `git_diff_print_patch` accessing memory that had been freed.

The rest of this commit contains improved documentation in `diff.h`
to make the behavior and the equivalencies with core git clearer,
and a bunch of new tests to cover the various cases, oh and a minor
simplification of `examples/diff.c`.
2012-06-08 12:11:13 -07:00
Russell Belfer
0abd724454 Fix filemode comparison in diffs
File modes were both not being ignored properly on platforms
where they should be ignored, nor be diffed consistently on
platforms where they are supported.

This change adds a number of diff and status filemode change
tests.  This also makes sure that filemode-only changes are
included in the diff output when they occur and that filemode
changes are ignored successfully when core.filemode is false.

There is no code that automatically toggles core.filemode
based on the capabilities of the current platform, so the user
still needs to be careful in their .git/config file.
2012-06-08 12:09:10 -07:00
Vicent Martí
3f0358604e misc: Fix warnings from PVS Studio trial 2012-06-07 22:43:48 +02:00
Vicent Martí
6c08e69fd9 Merge pull request #669 from nulltoken/topic/reset
Add git_reset()
2012-06-07 12:30:20 -07:00
Vicent Martí
b9ebcc59e7 Merge pull request #684 from benstraub/rev-parse
Rev parse
2012-06-07 12:29:31 -07:00
nulltoken
edebceffef Add git_reset()
Currently supports Soft and Mixed modes.
2012-06-07 21:27:30 +02:00
Vicent Martí
cddb8efe56 Merge pull request #704 from nulltoken/topic/blob_fromchunks
Add the ability to create blob given a provider of chunks of bytes
2012-06-07 11:34:48 -07:00
nulltoken
cd44576790 blob: add git_blob_create_fromchunks() 2012-06-07 20:33:22 +02:00
nulltoken
b46bdb2204 merge: Expose git_merge_base_many() 2012-06-07 16:25:37 +02:00
Vicent Martí
966fbdcb8e Merge pull request #697 from carlosmn/ssl
Add HTTPS support
2012-06-05 13:53:33 -07:00
Ben Straub
56a5000d58 Merge branch 'development' into rev-parse
Conflicts:
	src/util.h
	tests-clar/refs/branches/listall.c
2012-06-05 12:52:44 -07:00
nulltoken
d05e2c64dd refspec: expose the force update specifier through git_refspec_force() accessor 2012-05-30 01:05:17 +02:00
Carlos Martín Nieto
250b95b24b ssl: allow skipping the server certificate check
Sometimes it's useful not to perform the check. Allow it to be
configurable.
2012-05-26 21:17:08 +02:00
Carlos Martín Nieto
dbb36e1b42 ssl: check certificates against the system's trusted CAs 2012-05-19 17:51:53 +02:00
Bruce Mitchener
d73c94b21c Fix spelling errors. 2012-05-19 20:26:52 +07:00
Vicent Marti
ad5df35a47 libgit2 v0.17.0 "Lord of Diffstruction"
Welcome to yet another libgit2 release, this one being the
biggest we've shipped so far. Highlights on this release
include diff, branches, notes and submodules support. The new
diff API is shiny and powerful. Check it out.

Apologies, one more time, to all the early adopters for the
breaking API changes. We've been iterating on the error
handling for the library until we reached its current state,
which we believe it's significantly more usable both for normal
users and for developers of bindings to other languages.
Also, we've renamed a few legacy calls to ensure that the whole
external API uses a consistent naming scheme.

As always, check the API docs for the full list of new API calls
and backwards-incompatible changes.

	http://libgit2.github.com/libgit2/

Changelog of new features follows:

Attributes:
	- Added function macros to check attribute values instead of having
	to manually compare them
	- Added support for choosing the attribute loading order (workdir files
	vs index) and to skip the systems' default `.gitattributes`
	- Fixed issues when fetching attribute data on bare repositories

Blob:
	- Added support for creating blobs from any file on disk (not
	restricted to the repository's working directory)
	- Aded support for smudge filters when writing blobs to the ODB
		- So far only CRLF normalization is available

Branches:
	- Added a high-level branch API:
		- git_branch_create
		- git_branch_delete
		- git_branch_list
		- git_branch_move

Commit:
	- Commit messages are now filtered to match Git rules (stripping
	comments and adding proper whitespacing rules)

Config:
	- Added support for setting and getting multivars
	- Added `git_config_get_mapped` to map the value of a config
	variable based on its defaults

Diff:
	- Added full diff API:
		- tree to tree
		- index to tree
		- workdir to index
		- workdir to tree
		- blob to blob

	- Added helper functions to print the diffs as valid patchfiles

Error handling:
	- New design for the error handling API, taking into consideration
	the requirements of dynamic languages

Indexer:
	- Added streaming packfile indexer

Merge:
	- Added support for finding the merge base between two commits

Notes:
	- Full git-notes support:
		- git_note_read
		- git_note_message/git_note_oid
		- git_note_create
		- git_note_remove
		- git_note_free
		- git_note_foreach

References:
	- Added `git_reference_name_to_oid` helper to resolve
	a reference to its final OID

	- Added `git_reference_cmp` to compare two references with
	a stable order

Remotes:
	- Added support for writing and saving remotes
		- `git_remote_add`
		- `git_remote_save`
		- Setters for all the attributes of a remote
	- Switched remote download to the new streaming packfile indexer
	- Fixed fetch on HTTP and Git under Windows
	- Added `git_remote_supported_url` helper to check if a protocol
	can be accessed by the library
	- Added `git_remote_list`

Repository:
	- Made `git_repository_open` smarter when finding the `.git` folder.
	- Added `git_repository_open_ext` with extra options when
	opening a repository

Revwalk:
	- Added support for pushing/hiding several references through a glob
	- Added helper to push/hide the current HEAD to the walker
	- Added helper to push/hide a single reference to the walker

Status:
	- Greatly improved Status implementation using the new `diff` code
	as a backend

Submodules:
	- Added a partial submodules API to get information about a
	submodule and list all the submodules in a repository
		- git_submodule_foreach
		- git_submodule_lookup

Tag:
	- Added `git_tag_peel` helper to peel a tag to its pointed object
	- Tag messages are now filtered to match Git rules (stripping comments
	and adding proper whitespacing rules)

Tree:
	- Killed the old `git_tree_diff` API, which is replaced by the
	new diff code.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2012-05-19 01:40:46 +02:00
Vicent Martí
904b67e69f errors: Rename error codes 2012-05-18 01:48:50 +02:00
Vicent Martí
e172cf082e errors: Rename the generic return codes 2012-05-18 01:26:26 +02:00
Vicent Martí
2e2e97858d Properly tag all enums with a _t 2012-05-18 01:26:23 +02:00
Vicent Martí
4fbd1c007e refs: git_reference_listall -> git_reference_list 2012-05-18 01:26:16 +02:00
Vicent Martí
fe3bcf7d7a errors: Remove old comments 2012-05-18 01:25:57 +02:00
Vicent Martí
29e948debe global: Change parameter ordering in API
Consistency is good.
2012-05-18 01:25:57 +02:00
nulltoken
ee7680d53b notes: make git_note_foreach() callback signature easier to cope with from a binding perspective 2012-05-16 21:51:45 +02:00
Vicent Martí
9d0011fd83 tree: Naming conventions 2012-05-16 19:24:35 +02:00
Vicent Martí
cedf9ca955 tree: Kill the git_tree_diff functions
These are deprecated and replaced with the diffing code in git2/diff.h
2012-05-16 19:24:35 +02:00
Vicent Martí
c261c272af Merge pull request #702 from arrbee/fix-status-file
Update git_status_file and add ranged iterators
2012-05-16 09:57:45 -07:00
Russell Belfer
41a82592ef Ranged iterators and rewritten git_status_file
The goal of this work is to rewrite git_status_file to use the
same underlying code as git_status_foreach.

This is done in 3 phases:

1. Extend iterators to allow ranged iteration with start and
   end prefixes for the range of file names to be covered.
2. Improve diff so that when there is a pathspec and there is
   a common non-wildcard prefix of the pathspec, it will use
   ranged iterators to minimize excess iteration.
3. Rewrite git_status_file to call git_status_foreach_ext
   with a pathspec that covers just the one file being checked.

Since ranged iterators underlie the status & diff implementation,
this is actually fairly efficient.  The workdir iterator does
end up loading the contents of all the directories down to the
single file, which should ideally be avoided, but it is pretty
good.
2012-05-15 14:34:15 -07:00
Carlos Martín Nieto
73d87a091c Introduce GITERR_INDEXER 2012-05-15 21:42:20 +02:00
Vicent Martí
87d6138e2e Merge pull request #696 from nulltoken/topic/notes-list
Add git_note_foreach()
2012-05-14 13:17:19 -07:00
Vicent Martí
79fdde494f Revert "Specifiy dllimport to MSVC if we're not building libgit2.dll"
This reverts commit 1093e2de22.
2012-05-14 22:15:53 +02:00
nulltoken
86ecd84427 notes: add git_notes_foreach() 2012-05-14 22:07:42 +02:00
Sascha Cunz
1093e2de22 Specifiy dllimport to MSVC if we're not building libgit2.dll
Building a "shared object" (DLL) in Windows includes 2 steps:

- specify __declspec(dllexport)
  when building the library itself. MSVC will disallow itself from
  optimizing these symbols out and reference them in the PE's
  Exports-Table.
  Further, a static link library will be generated. This library
  contains the symbols which are exported via the declsepc above.
  The __declspec(dllexport) becomes part of the symbol-signature
  (like parameter types in C++ are 'mangled' into the symbol name,
  the export specifier is mingled with the name)

- specify __declspec(dllimport)
  when using the library. This again mingles the declspec into the
  name and declares the function / variable with external linkage.

cmake automatically adds -Dgit2_EXPORTS to the compiler arguments
when compiling the libgit2 project.
The 'git2' is the name specified via PROJECT() in CMakeLists.txt.
2012-05-14 20:22:50 +02:00
Vicent Martí
e49cb1687e Merge pull request #671 from nulltoken/topic/blob_create_fromdisk
Add git_blob_create_fromdisk()
2012-05-14 11:03:30 -07:00
Vicent Martí
72bfde9790 Merge pull request #681 from scottjg/solaris-fixes
Fix build/runtime issues on Solaris
2012-05-14 11:01:14 -07:00
Vicent Martí
27f5b7cfed Merge pull request #682 from arrbee/attribute-cache-buster
Attribute cache buster
2012-05-14 10:58:23 -07:00
Sascha Cunz
0c9a5565f7 Add missing GIT_EXTERN declarations 2012-05-14 19:56:35 +02:00
nulltoken
6ca9643c96 blob: Add git_blob_create_fromdisk()
This function will create blobs in the object database from files anywhere on the filesystem. This can be run against bare and non-bare repositories.
2012-05-13 11:28:49 +02:00
Ben Straub
bfc13e7985 Adding comment documentation for rev-parse api. 2012-05-11 11:30:46 -07:00
Ben Straub
ac250c56c7 First stab at implementation of rev-parse.
This version supports refspecs of these kinds:
- Full & partial SHAs
- Output from "git describe"
- "/refs/heads/master" (full ref names)
- "master" (partial ref names)
- "FETCH_HEAD" (named heads)
2012-05-11 11:30:45 -07:00
Scott J. Goldman
b1ec25facc Fix comment typo in common.h 2012-05-10 17:16:38 -07:00
Russell Belfer
dc13f1f7d7 Add cache busting to attribute cache
This makes the git attributes and git ignores cache check
stat information before using the file contents from the
cache.  For cached files from the index, it checks the SHA
of the file instead.  This should reduce the need to ever
call `git_attr_cache_flush()` in most situations.

This commit also fixes the `git_status_should_ignore` API
to use the libgit2 standard parameter ordering.
2012-05-10 11:12:43 -07:00