Commit Graph

9908 Commits

Author SHA1 Message Date
Patrick Steinhardt
d8c06070a8 path: extract win32_path_prefix function
Extract code which determines if a path is at a Windows system's root.
This incluses drive prefixes (e.g. "C:\") as well as network computer
names (e.g. "//computername/").
2017-02-08 12:03:45 +01:00
Edward Thomson
887c1931a2 Merge pull request #4108 from rcjsuen/patch-1
Flag given_opts in git_revert as optional
2017-02-04 11:04:30 +01:00
Remy Suen
21d4a3783e Flag given_opts in git_revert as optional
The given_opts argument can actually be NULL and thus should be
flagged accordingly in the header file.
2017-02-04 17:24:31 +09:00
Edward Thomson
104a1b0bd9 Merge pull request #4105 from pks-t/pks/vector-reverse-overflow
Vector reverse overflow
2017-02-02 17:21:23 +01:00
Patrick Steinhardt
f47db3c799 vector: do not reverse a vector if it is empty
The code reversing a vector initially determines the rear-pointer by
simply subtracting 1 from the vector's length. Obviously, this fails if
the vector is empty, in which case we have an integer overflow.

Fix the issue by returning early if the vector is empty.
2017-02-02 16:02:57 +01:00
Adam Niedzielski
390431c322 revwal: add failing test for walking with topo-sort 2017-02-02 16:01:37 +01:00
Edward Thomson
9ba610a11a Merge pull request #4096 from mplough/master
Update docs for git_oid_fromstrn and p
2017-02-02 13:31:33 +00:00
Matthew Plough
921493cc94 Update docs for git_oid_fromstrn and p 2017-01-27 14:37:16 -05:00
Edward Thomson
dad3c319d7 Merge pull request #4095 from mplough/master
Fix uninitialized variable warning
2017-01-27 17:56:52 +00:00
Matthew Plough
d0c418c0bb Fix uninitialized variable warning
Fix the following warning emitted by clang:
[ 16%] Building C object CMakeFiles/libgit2_clar.dir/src/submodule.c.o
/Users/mplough/devel/external/libgit2/src/submodule.c:408:6: warning: variable 'i' is used uninitialized whenever 'if' condition is true
      [-Wsometimes-uninitialized]
        if ((error = load_submodule_names(names, cfg)))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/mplough/devel/external/libgit2/src/submodule.c:448:20: note: uninitialized use occurs here
        git_iterator_free(i);
                          ^
/Users/mplough/devel/external/libgit2/src/submodule.c:408:2: note: remove the 'if' if its condition is always false
        if ((error = load_submodule_names(names, cfg)))
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/mplough/devel/external/libgit2/src/submodule.c:404:17: note: initialize the variable 'i' to silence this warning
        git_iterator *i;
                       ^
                        = NULL
1 warning generated.
2017-01-27 12:49:48 -05:00
Carlos Martín Nieto
8df1cfc9d7 Merge pull request #4086 from libgit2/ethomson/fixes
WIP: some coverity & compiler warning fixes
2017-01-24 21:26:41 +00:00
Carlos Martín Nieto
9b51cc82ff Merge pull request #4050 from ethomson/ethomson/winhttp_errmsgs
WinHTTP: set proper error messages when SSL fails
2017-01-24 21:10:46 +00:00
Edward Thomson
1f813cf2b8 checkout::tree test: cleanup memory leak 2017-01-23 17:32:13 -06:00
Edward Thomson
7f66a70eec attr_cache_remove: don't remove given file
If `attr_cache_lookup_entry` fails to find the given file, make sure
that we do not try to free the given file.
2017-01-23 23:23:54 +00:00
Edward Thomson
a0d3847983 mac: on 32 bit, use __builtin_umull_overflow 2017-01-23 22:29:58 +00:00
Edward Thomson
60c2bf47e4 submodule: only examine idx & head given a config 2017-01-23 22:29:57 +00:00
Edward Thomson
0fbff82b57 submodule: don't double free during load failure
When we fail to load submodules, don't free the list; it is later freed
unconditionally.
2017-01-23 22:24:40 +00:00
Edward Thomson
1196807380 Merge pull request #4087 from tiennou/warnings
Fix a few recent warnings
2017-01-23 13:29:14 +00:00
Etienne Samson
e2b3dc16b9 variable 'i' is used uninitialized whenever 'if' condition is true 2017-01-23 13:32:34 +01:00
Etienne Samson
7414acf5f9 parameter 'id' not found in the function declaration 2017-01-23 13:32:34 +01:00
Edward Thomson
185fe9c1c1 Merge pull request #4051 from tiennou/clang-analyzer-1
Clang analyzer run
2017-01-21 23:58:41 +00:00
Edward Thomson
048c5ea7c0 Merge pull request #4053 from chescock/extend-packfile-by-pages
Extend packfile in increments of page_size.
2017-01-21 23:55:21 +00:00
Edward Thomson
8d3b39a6ad Merge branch 'pr/3912' 2017-01-21 23:50:38 +00:00
Edward Thomson
28d0ba0ba5 symbolic ref target validation: fixups
Fixups requested in #3912.
2017-01-21 23:45:23 +00:00
Edward Thomson
1910a04adb winhttp: set proper cert failure error messages
Set up a WinHTTP status callback; inspect the WinHTTP status for
WINHTTP_CALLBACK_STATUS_SECURE_FAILURE, and convert the status code
to a useful message for callers.
2017-01-21 23:15:54 +00:00
Edward Thomson
0418d3b7a8 Merge pull request #4078 from pks-t/pks/example-cleanup
Fix general example memory leaks
2017-01-21 23:11:13 +00:00
Edward Thomson
44e8af8f29 Merge pull request #3892 from mitesch/shared_buffer
Use a shared buffer in calls of git_treebuilder_write to avoid heap contention
2017-01-21 22:51:50 +00:00
Edward Thomson
3b4eb107c2 CHANGELOG: move git_submodule_update_option changes
The changes to `git_submodule_update_option` are now landing in v.Next.
2017-01-21 22:40:37 +00:00
Edward Thomson
9e78b7279d Merge branch 'master' into pr/3938 2017-01-21 22:39:59 +00:00
Edward Thomson
176f55527d Merge pull request #4085 from libgit2/ethomson/packfile_close
indexer: introduce `git_packfile_close`
2017-01-21 22:16:28 +00:00
Edward Thomson
87b7a7051b indexer: avoid warning about idx->pack
It must be non-NULL to have a valid `git_indexer`.
2017-01-21 15:44:57 -05:00
Edward Thomson
bf339ab0ef indexer: introduce git_packfile_close
Encapsulation!
2017-01-21 15:21:29 -05:00
Edward Thomson
98f5387233 Merge pull request #4016 from novalis/submodule-optimization
Submodule optimization
2017-01-21 18:57:28 +00:00
Edward Thomson
52949c806b Merge branch 'pr/4060' 2017-01-21 18:30:12 +00:00
Edward Thomson
d030bba9fa indexer: only delete temp file if it was unused
Only try to `unlink` our temp file when we know that we didn't copy it
into its permanent location.
2017-01-21 17:15:33 +00:00
Brock Peabody
673dff88a2 Skip submodule head/index update when caching.
`git_submodule_status` is very slow, bottlenecked on
`git_repository_head_tree`, which it uses through `submodule_update_head`.  If
the user has requested submodule caching, assume that they want this status
cached too and skip it.

Signed-off-by: David Turner <dturner@twosigma.com>
2017-01-20 17:33:56 -05:00
Brock Peabody
4d99c4cfc6 Allow for caching of submodules.
Added `git_repository_submodule_cache_all` to initialze a cache of
submodules on the repository so that operations looking up N
submodules are O(N) and not O(N^2).  Added a
`git_repository_submodule_cache_clear` function to remove the cache.

Also optimized the function that loads all submodules as it was itself
O(N^2) w.r.t the number of submodules, having to loop through the
`.gitmodules` file once per submodule.  I changed it to process the
`.gitmodules` file once, into a map.

Signed-off-by: David Turner <dturner@twosigma.com>
2017-01-20 17:33:56 -05:00
David Turner
ca05857e71 Fix formatting
Signed-off-by: David Turner <dturner@twosigma.com>
2017-01-20 17:33:56 -05:00
Carlos Martín Nieto
df4dfaadcf Merge pull request #4055 from ethomson/ethomson/ntlm
WinHTTP: support best auth mechanism
2017-01-16 12:29:52 +00:00
Edward Thomson
4e4a1460eb WinHTTP: support best auth mechanism
For username/password credentials, support NTLM or Basic (in that order
of priority).  Use the WinHTTP built-in authentication support for both,
and maintain a bitfield of the supported mechanisms from the response.
2017-01-16 11:21:26 +00:00
Edward Thomson
cb76eed5ce Merge pull request #4054 from jfultz/jfultz/fix_GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH
Fix handling of GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH flag.
2017-01-14 17:41:49 +00:00
Carlos Martín Nieto
2854e61956 Merge pull request #4061 from libgit2/ethomson/merge_opts
merge: set default rename threshold
2017-01-14 17:12:23 +00:00
lhchavez
f5586f5c73 Addressed review feedback 2017-01-14 16:37:00 +00:00
Edward Thomson
07bb8078cb CHANGELOG: update GIT_MERGE_OPTIONS_INIT changes 2017-01-14 16:01:53 +00:00
Etienne Samson
49be45a189 pack: report revwalk error 2017-01-13 21:48:20 +01:00
Etienne Samson
b0014063b2 patch: memory leak of patch.base.diff_opts.new|old_prefix 2017-01-13 21:48:20 +01:00
Etienne Samson
8a349bf2a1 ignore: there must be a repository
Otherwise we'll NULL-dereference in git_attr_cache__init
2017-01-13 21:48:20 +01:00
Carlos Martín Nieto
a6d833a29e Merge pull request #4049 from libgit2/ethomson/error_msgs
giterr_set: consistent error messages
2017-01-13 17:05:58 +01:00
Patrick Steinhardt
f9ea8c6a14 examples: general: fix memory leaks 2017-01-12 22:04:36 +01:00
Patrick Steinhardt
ed2b1c7e75 examples: general: display config only if it was found 2017-01-12 22:01:45 +01:00