Commit Graph

1188 Commits

Author SHA1 Message Date
Edward Thomson
1e60e5f42d Allow callers to set mode on packfile creation 2013-11-07 12:04:32 -05:00
Edward Thomson
cc2447da32 Add git_packbuilder_hash to query pack filename 2013-11-07 09:43:24 -05:00
Carlos Martín Nieto
a8baf4b160 Merge pull request #1946 from arthurschreiber/change-branch-iterator-definition
Change the git_branch_iterator_new definition to use git_branch_t
2013-11-05 12:26:41 -08:00
Arthur Schreiber
a667ca8298 Change the git_branch_iterator_new and git_branch_next definitions to use git_branch_t. 2013-11-05 20:51:07 +01:00
Ben Straub
8adea28ae9 Blame: change signature to be more binding-friendly 2013-11-05 11:44:42 -08:00
Edward Thomson
039db728f3 merge branch into current, updating workdir 2013-11-05 10:00:39 -05:00
Vicent Martí
c82f7f8e99 Merge pull request #1938 from libgit2/cmn/branch-iterator
branch: move from foreach to an iterator
2013-11-05 06:55:16 -08:00
Vicent Martí
ffd040532a Merge pull request #1941 from libgit2/rb/preserve-iterator-error
Preserve error messages during file system iterator cleanup
2013-11-05 06:05:32 -08:00
Carlos Martín Nieto
8ec889a45f branch: move from foreach to an iterator
Create a git_branch_iterator type which is equivalent to the foreach but
lets us write loops instead of callbacks.

Since the introduction of git_reference_shorthand(), the added value of
passing the name is reduced.
2013-11-05 14:58:16 +01:00
Vicent Marti
1eab9f0e32 error: Simplify giterr_detach 2013-11-05 14:56:10 +01:00
Edward Thomson
f966acd133 Take umask into account in filebuf_commit 2013-11-04 22:32:50 -05:00
Russell Belfer
d6c6016966 Add giterr_detach API to get and clear error
There are a number of cases where it is convenient to be able to
fetch and "claim" the current error string, clearing the error.
This is helpful when you need to call some code that may alter
the error and you want to restore it later on and/or report it via
some other mechanism.
2013-11-04 15:45:31 -08:00
Vicent Martí
0e1115d287 Merge pull request #1939 from ethomson/readwrite_odb
Allow backend consumers to specify file mode
2013-11-04 12:16:14 -08:00
Edward Thomson
dd64c71c26 Allow backend consumers to specify file mode 2013-11-04 14:50:25 -05:00
Russell Belfer
fb6b0e019e Merge pull request #1317 from libgit2/blame
Blame Canada
2013-11-04 10:44:59 -08:00
Vicent Martí
44acdd1f9a Merge pull request #1937 from scunz/checkout_assert
Don't assert in git_checkout_tree
2013-11-04 08:09:58 -08:00
Sascha Cunz
352214416c Checkout: Don't assert if treeish is NULL
In git_checkout_tree, the first check tests if either repo or treeish is
NULL and says that eithor of them has to have a valid value. But there
is no code to handle the treeish == NULL case.

So, do something meaningful in that case: use HEAD instead.
2013-11-02 03:43:34 +00:00
Sascha Cunz
10749f6ca2 Checkout: Unifiy const-ness of opts parameter
Since all 3 checkout APIs perform the same operation with the options,
all of them should use the same const-ness.
2013-11-02 03:20:05 +00:00
Russell Belfer
a5c16f3cfb Add git_diff_options_init helper
Sometimes the static initializer for git_diff_options cannot be
used and since setting them to all zeroes doesn't actually work
quite right, this adds a new helper for that situation.

This also adds an explicit new value to the submodule settings
options to be used when those enums need static initialization.
2013-11-01 10:20:51 -07:00
Russell Belfer
8e5a8ef86f Convert git_index_read to have a "force" flag
This is a little more intuitive than the turned-around option that
I originally wrote.
2013-11-01 10:20:51 -07:00
Russell Belfer
4bf630b6ba Make diff and status perform soft index reload
This changes `git_index_read` to have two modes - a hard index
reload that always resets the index to match the on-disk data
(which was the old behavior) and a soft index reload that uses
the timestamp / file size information and only replaces the index
data if the file on disk has been modified.

This then updates the git_status code to do a soft reload unless
the new GIT_STATUS_OPT_NO_REFRESH flag is passed in.

This also changes the behavior of the git_diff functions that use
the index so that when an index is not explicitly passed in (i.e.
when the functions call git_repository_index for you), they will
also do a soft reload for you.

This intentionally breaks the file signature of git_index_read
because there has been some confusion about the behavior previously
and it seems like all existing uses of the API should probably be
examined to select the desired behavior.
2013-11-01 10:20:51 -07:00
Vicent Martí
ac5e507cec Merge pull request #1918 from libgit2/cmn/indexer-naming
indexer: remove the stream infix
2013-11-01 09:31:52 -07:00
Daniel Rodríguez Troitiño
3793fa9b18 Fix saving remotes with several fetch/push ref specs.
At some moment git_config_delete_entry lost the ability to delete one entry of
a multivar configuration. The moment you had more than one fetch or push
ref spec for a remote you will not be able to save that remote anymore. The
changes in network::remote::remotes::save show that problem.

I needed to create a new git_config_delete_multivar because I was not able to
remove one or several entries of a multivar config with the current API.
Several tries modifying how git_config_set_multivar(..., NULL) behaved were
not successful.

git_config_delete_multivar is very similar to git_config_set_multivar, and
delegates into config_delete_multivar of config_file. This function search
for the cvar_t that will be deleted, storing them in a temporal array, and
rebuilding the linked list. After calling config_write to delete the entries,
the cvar_t stored in the temporal array are freed.

There is a little fix in config_write, it avoids an infinite loop when using
a regular expression (case for the multivars). This error was found by the
test network::remote::remotes::tagopt.
2013-11-01 00:08:52 +01:00
Carlos Martín Nieto
97d32abb49 Remove leftover function declaration 2013-10-30 15:15:54 +01:00
Carlos Martín Nieto
a6154f2183 indexer: remove the stream infix
It was there to keep it apart from the one which read in from a file on
disk. This other indexer does not exist anymore, so there is no need for
anything other than git_indexer to refer to it.

While here, rename _add() function to _append() and _finalize() to
_commit(). The former change is cosmetic, while the latter avoids
talking about "finalizing", which OO languages use to mean something
completely different.
2013-10-30 15:00:05 +01:00
Ben Straub
42c8f8f807 Merge remote-tracking branch 'libgit2/development' into blame 2013-10-28 11:04:58 -07:00
Vicent Martí
5c50f22a93 Merge pull request #1891 from libgit2/cmn/fix-thin-packs
Add support for thin packs
2013-10-28 09:25:44 -07:00
Vicent Martí
5565f3cda8 Merge pull request #1904 from libgit2/cmn/ssh-naming
Rename the ssh credentials
2013-10-28 07:04:58 -07:00
Ben Straub
8f4a8b096b Merge pull request #1802 from libgit2/cmn/reflog-backend
Make reflog part of refdb
2013-10-28 06:20:28 -07:00
Carlos Martín Nieto
5cb136705d transport: let the progress output return an error
There are any number of issues that can come up in the progress
callback, and we should let the user cancel at that point as well.
2013-10-23 15:45:29 +02:00
Carlos Martín Nieto
ab46b1d8eb indexer: include the delta stats
The user is unable to derive the number of deltas in the pack, as that
would require them to capture the stats exactly in the moment between
download and final processing, which is abstracted away in the fetch.

Capture these numbers for the user and expose them in the progress
struct. The clone and fetch examples now also present this information
to the user.
2013-10-23 15:08:18 +02:00
Carlos Martín Nieto
70a8c78f36 Rename the ssh credentials
The names from libssh2 are somewhat obtuse for us. We can simplify the
usual key/passphrase credential's name, as well as make clearer what the
custom signature function is.
2013-10-23 12:08:54 +02:00
Vicent Martí
1c74686e05 Merge pull request #1897 from libgit2/split-patch-from-diff
RFC: Proposed reworking of diff APIs
2013-10-22 11:55:54 -07:00
Russell Belfer
7ce60099ee Fix typo 2013-10-22 11:12:44 -07:00
Vicent Marti
98fec8a937 Implement git_odb_object_dup 2013-10-22 16:06:12 +02:00
Russell Belfer
5de4ec8104 Implement patience and minimal diff flags
It seems that to implement these options, we just have to pass
the appropriate flags through to the libxdiff code taken from
core git.  So let's do it (and add a test).
2013-10-21 15:36:38 -07:00
Russell Belfer
3b5f795446 Create git_diff_line and extend git_diff_hunk
Instead of having functions with so very many parameters to pass
hunk and line data, this takes the existing git_diff_hunk struct
and extends it with more hunk data, plus adds a git_diff_line.
Those structs are used to pass back hunk and line data instead of
the old APIs that took tons of parameters.

Some work that was previously only being done for git_diff_patch
creation (scanning the diff content for exact line counts) is now
done for all callbacks, but the performance difference should not
be noticable.
2013-10-21 13:42:42 -07:00
Edward Thomson
2648dc1a06 Allowed credential types should be a bitfield 2013-10-21 14:02:36 -05:00
Russell Belfer
74a627f045 Tweak to git_diff_delta structure for nfiles
While the base git_diff_delta structure always contains two files,
when we introduce conflict data, it will be helpful to have an
indicator when an additional file is involved.
2013-10-21 09:07:19 -07:00
Edward Thomson
629b661caa checkout (from index) can write conflicts 2013-10-16 16:20:06 -04:00
Russell Belfer
10672e3e45 Diff API cleanup
This lays groundwork for separating formatting options from diff
creation options.  This groups the formatting flags separately
from the diff list creation flags and reorders the options.  This
also tweaks some APIs to further separate code that uses patches
from code that just looks at git_diffs.
2013-10-15 15:10:07 -07:00
Russell Belfer
3ff1d12373 Rename diff objects and split patch.h
This makes no functional change to diff but renames a couple of
the objects and splits the new git_patch (formerly git_diff_patch)
into a new header file.
2013-10-11 14:51:54 -07:00
Carlos Martín Nieto
893055f22e indexer: clearer stats for thin packs
Don't increase the number of total objects, as it can produce
suprising progress output. The only addition compared to pre-thin is
the addition of local_objects to allow an output similar to git's
"completed with %d local objects".
2013-10-11 17:26:20 +02:00
Ben Straub
364d800b01 Move flag dependencies into docs and code. 2013-10-10 14:53:07 -07:00
Ben Straub
c1ca2b67e1 Include signatures in blame hunks 2013-10-10 14:30:05 -07:00
Vicent Martí
95c148b2c7 Merge pull request #1886 from libgit2/precompose-utf8
Add support for core.precomposeunicode on Mac
2013-10-08 17:03:12 -07:00
Russell Belfer
867f7c9b33 Rename new fn to git_repository_reinit_filesystem 2013-10-08 16:59:59 -07:00
Russell Belfer
92dac97586 Make reference lookups apply precomposeunicode
Before these changes, looking up a reference would return the
same precomposed or decomposed form of the reference name that
was used to look it up, so on MacOS which ignores the difference
between the two, a single reference could be looked up either way
and git_reference_name would return the form of the name that was
used to look it up!  This change makes lookup always return the
precomposed name if core.precomposeunicode is set regardless of
which version was used to look it up.  The reference iterator was
already returning the precomposed form from earlier work.

This also updates the CMakeLists.txt rules for enabling iconv
usage because the clar tests for this code were actually not being
activated properly with the old version.

Finally, this moves git_repository_reset_filesystem from include/
git2/repository.h to include/git2/sys/repository.h since it is not
really a function that normal library users should have to think
about very often.
2013-10-08 16:35:57 -07:00
Russell Belfer
14997dc5f6 More filemode cleanups for FAT on MacOS
This cleans up some additional issues.  The main change is that
on a filesystem that doesn't support mode bits, libgit2 will now
create new blobs with GIT_FILEMODE_BLOB always instead of being
at the mercy to the filesystem driver to report executable or not.
This means that if "core.filemode" lies and claims that filemode
is not supported, then we will ignore the executable bit from the
filesystem.  Previously we would have allowed it.

This adds an option to the new git_repository_reset_filesystem to
recurse through submodules if desired.  There may be other types
of APIs that would like a "recurse submodules" option, but this
one is particularly useful.

This also has a number of cleanups, etc., for related things
including trying to give better error messages when problems come
up from the filesystem.  For example, the FAT filesystem driver on
MacOS appears to return errno EINVAL if you attempt to write a
filename with invalid UTF-8 in it.  We try to capture that with a
better error message now.
2013-10-08 12:45:43 -07:00
Carlos Martín Nieto
13f670a5d9 tree: allow retrieval of raw attributes
When a tool needs to recreate the tree object (for example an
interface to another VCS), it needs to use the raw attributes,
forgoing any normalization.
2013-10-08 10:07:31 +02:00