Commit Graph

6351 Commits

Author SHA1 Message Date
Arthur Schreiber
11f6ad5fcf Add some missing const declarations. 2014-01-26 18:08:05 +01:00
Edward Thomson
93b96ea705 Merge pull request #2076 from xtao/fix-zstream
Fix write_object.
2014-01-26 06:38:02 -08:00
Edward Thomson
58582cd0b0 Merge pull request #2057 from GrahamDennis/local-file-url-push-fix
Fix local push to file:// URL.
2014-01-26 06:31:38 -08:00
XTao
1cb5a81194 Fix write_object. 2014-01-26 22:26:53 +08:00
Carlos Martín Nieto
a1bbc0ce20 merge: rename _oid() -> id()
Following the rest of the series, use 'id' when refering to the value.
2014-01-25 08:15:44 +01:00
Carlos Martín Nieto
86bfc3e1c6 diff: change id abbrev option's name to id_abbrev
Same as the other commits in the series, we use 'id' when talking about
thing rather than the datatype.
2014-01-25 08:15:44 +01:00
Carlos Martín Nieto
9950bb4e8d diff: rename the file's 'oid' to 'id'
In the same vein as the previous commits in this series.
2014-01-25 08:15:44 +01:00
Carlos Martín Nieto
f000ee4e5b tree: remove legacy 'oid' naming
Rename git_tree_entry_byoid() to _byid() as per the convention.
2014-01-25 08:15:44 +01:00
Carlos Martín Nieto
47e28349bc commit: remvoe legacy 'oid' naming 2014-01-25 08:15:44 +01:00
Carlos Martín Nieto
d541170c77 index: rename an entry's id to 'id'
This was not converted when we converted the rest, so do it now.
2014-01-25 08:15:44 +01:00
Russell Belfer
7cc001cefb Add PHP and Javascript diff drivers
Since I don't have permission yet on the code from Git, I decided
I'd take a stab at writing patterns for PHP and Javascript myself.
I think these are pretty weak, but probably better than the
default behavior without them.
2014-01-24 15:46:15 -08:00
Russell Belfer
027b8edac7 Move userdiff tests to be data driven
This moves the expected and actual test data along with the source
data for the userdiff tests into the tests/resources/userdiff test
repo and updates the test to use that.
2014-01-24 15:45:49 -08:00
Russell Belfer
3b19d2fdcb Permission for Git code from a couple more
This brings over the Pascal and CSharp userdiff data.
2014-01-24 10:54:05 -08:00
Russell Belfer
c7c260a5ff Got some permission to use userdiff patterns
I contacted a number of Git authors and lined up their permission
to relicense their work for use in libgit2 and copied over their
code for diff driver xfuncname patterns.  At this point, the code
I've copied is taken verbatim from core Git although Thomas Rast
warned me that the C++ patterns, at least, really need an update.
I've left off patterns where I don't feel like I have permission
at this point until I hear from more authors.
2014-01-24 10:54:05 -08:00
Russell Belfer
5d82c0df13 Update all tests for new pattern extraction 2014-01-24 10:54:05 -08:00
Russell Belfer
b8e86c62f7 Implement matched pattern extract for fn headers 2014-01-24 10:54:05 -08:00
Russell Belfer
9bbc53d6d4 Fix filemode updating in diff text 2014-01-24 10:54:05 -08:00
Russell Belfer
2c65602e45 Import git drivers and test HTML driver
Reorganize the builtin driver table slightly so that core Git
builtin definitions can be imported verbatim.  Then take a few of
the core Git drivers and pull them in.

This also creates a test of diffs with the builtin HTML driver
which led to some small error handling fixes in the driver
selection logic.
2014-01-24 10:51:08 -08:00
Russell Belfer
a5a386436b Initial take on builtin drivers with multiline
This extends the diff driver parser to support multiline driver
definitions along with ! prefixing for negated matches.  This
brings the driver function pattern parsing in line with core Git.

This also adds an internal table of driver definitions and a
fallback code path that will look in that table for diff drivers
that are set with attributes without having a definition in the
config file.  Right now, I just populated the table with a kind
of simple HTML definition that is similar to the core Git def.
2014-01-24 10:43:05 -08:00
Carlos Martín Nieto
d0a3de720e note: rename the id getter to git_note_id()
This was left over when we did the general switch.
2014-01-24 11:18:51 +01:00
Vicent Marti
ca55fc6356 Merge pull request #2074 from linquize/pack-filename-sha1
Drop parsing pack filename SHA1 part
2014-01-23 08:03:29 -08:00
Linquize
8610487cd3 Drop parsing pack filename SHA1 part, no one cares the filename 2014-01-23 23:28:28 +08:00
Vicent Marti
ac8949edb2 Merge pull request #2073 from ethomson/zerobytes
Sometimes a zero byte file is just a zero byte file
2014-01-22 15:41:25 -08:00
Edward Thomson
410a8e6fed Sometimes a zero byte file is just a zero byte file
Don't go to the ODB to resolve zero byte files in the workdir
2014-01-22 18:31:25 -05:00
Ben Straub
ab4bcc038a Plug a small memory leak 2014-01-22 14:14:37 -08:00
Vicent Marti
e82b6d13d2 Merge pull request #2072 from ethomson/commit_summary
Summarize empty messages
2014-01-22 11:50:43 -08:00
Edward Thomson
238e814972 Summarize empty messages 2014-01-22 14:41:04 -05:00
Vicent Marti
2b678ce5b4 Merge pull request #2070 from ethomson/checkout_filemode
Preserve tree filemode in index during checkout
2014-01-22 10:34:25 -08:00
Edward Thomson
e8b81c698c Preserve tree filemode in index during checkout
Don't try to determine whether the system supports file modes
when putting the tree data in the index during checkout.  The tree's
mode is canonical and did not come from stat(2) in the first place.
2014-01-22 13:26:30 -05:00
Vicent Marti
ec088fec9d Merge pull request #2069 from isilkor/patch_to_buf
Expose patch serialization to git_buf
2014-01-22 09:35:25 -08:00
Nicolas Hake
c05cd7924d Drop git_patch_to_str
It's hard or even impossible to correctly free the string buffer
allocated by git_patch_to_str in some circumstances. Drop the function
so people have to use git_patch_to_buf instead - git_buf has a dedicated
destructor.
2014-01-22 17:51:32 +01:00
Nicolas Hake
450e8e9e62 Expose patch serialization to git_buf
Returning library-allocated strings from libgit2 works fine on Linux,
but may cause problems on Windows because there is no one C Runtime that
everything links against. With libgit2 not exposing its own allocator,
freeing the string is a gamble.

git_patch_to_str already serializes to a buffer, then returns the
underlying memory. Expose the functionality directly, so callers can use
the git_buf_free function to free the memory later.
2014-01-22 13:40:19 +01:00
Vicent Marti
af2b969b6f Merge pull request #2061 from ethomson/merge_improvements
Merge improvements
2014-01-20 16:26:04 -08:00
Edward Thomson
0ef19fe14c Merge submodules 2014-01-20 18:07:17 -05:00
Edward Thomson
db3462ce77 Support union merges 2014-01-20 17:15:15 -05:00
Edward Thomson
0e1ba46cfb Remove the "merge none" flag
The "merge none" (don't automerge) flag was only to aide in
merge trivial tests.  We can easily determine whether merge
trivial resulted in a trivial merge or an automerge by examining
the REUC after automerge has completed.
2014-01-20 17:15:14 -05:00
Edward Thomson
6891a862bb Load merge.conflictstyle setting from config 2014-01-20 17:15:13 -05:00
Edward Thomson
e651e8e2b5 Introduce diff3 mode for checking out conflicts 2014-01-20 17:15:13 -05:00
Edward Thomson
6b92c99bcb Don't try to merge binary files 2014-01-20 17:15:12 -05:00
Edward Thomson
c1d648c5c6 merge_file should use more aggressive levels
The default merge_file level was XDL_MERGE_MINIMAL, which will
produce conflicts where there should not be in the case where
both sides were changed identically.  Change the defaults to be
more aggressive (XDL_MERGE_ZEALOUS) which will more aggressively
compress non-conflicts.  This matches git.git's defaults.

Increase testing around reverting a previously reverted commit to
illustrate this problem.
2014-01-20 17:15:11 -05:00
Vicent Marti
e49c98e6ef Merge pull request #2065 from ethomson/submodule_unmodified
"Uninitialized" submodules are "unmodified"
2014-01-20 14:12:41 -08:00
Edward Thomson
b554ca5dc1 "Uninitialized" submodules are "unmodified"
Extend the "unmodified" submodule workdir test to include
uninitialized submodules, to prevent reporting submodules as
modified when they're not in the workdir at all.
2014-01-20 17:09:31 -05:00
Russell Belfer
d62bf0bf83 Merge pull request #2063 from linquize/reflog-msg-null
git_reflog_entry_message can be null
2014-01-20 10:15:05 -08:00
Russell Belfer
fb62dc9068 Merge pull request #2064 from piki/piki/buffer-corner-cases
Fix a couple of corner cases and an undefined behavior
2014-01-20 10:04:20 -08:00
Patrick Reynolds
abdaf93662 add unit tests for git_buf_join corner cases 2014-01-20 11:42:12 -06:00
Patrick Reynolds
7cbc6241cf fix corner cases and an undefined behavior 2014-01-20 11:41:21 -06:00
Linquize
e7c66fc89b git_reflog_entry_message can be null 2014-01-20 23:32:18 +08:00
Graham Dennis
8bf476ac31 Factor out code to convert local "url" into a path.
Previously this code was shared between `local_push` and `local_connect`.
2014-01-19 16:24:58 +11:00
Edward Thomson
b97e55f2f1 Merge pull request #2059 from linquize/git_config_get_crash
Fix segfault when calling git_config_get_* functions when a config fails to load
2014-01-18 14:48:59 -08:00
Linquize
c24130e068 Fix segfault when calling git_config_get_* functions when a config fails to load
Reinitialize the result code of get_entry() to GIT_ENOTFOUND
2014-01-18 22:58:31 +08:00