Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Memory leak in git_remote_connect #1673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
512 commits
Select commit Hold shift + click to select a range
2498889
Fix some memory leaks
nulltoken May 10, 2013
94d24ac
Merge pull request #1573 from nulltoken/fix/leaks
ben May 10, 2013
c3a5171
Merge pull request #1572 from arrbee/diff-patch-with-rename
May 10, 2013
4a65aea
Merge pull request #1571 from arrbee/what-if-ignorecase-lies
May 10, 2013
4def703
refs: introduce an iterator
carlosmn Mar 2, 2013
69a3c76
refdb_fs: don't crash when the repo doesn't have a path
carlosmn May 4, 2013
51fc5e8
Make sure the ref iterator works in an repo without physical presence
carlosmn May 4, 2013
fb592a9
Remove outdated test
carlosmn May 4, 2013
932af0e
Add iterator support to the testdb backend
carlosmn May 4, 2013
9572724
refs: implement _foreach with the iterator
carlosmn May 4, 2013
2b562c3
refs: remove the OID/SYMBOLIC filtering
carlosmn May 4, 2013
9bd89d9
Move a couple more functions to use iterators
carlosmn May 4, 2013
c58cac1
Introduce a glob-filtering iterator
carlosmn May 4, 2013
b6cc559
Merge pull request #1385 from carlosmn/refs-iter
May 11, 2013
e583334
Fix broken build when MSVC SDL checks is enabled
linquize May 10, 2013
7b5bc8f
Merge pull request #1569 from linquize/msvc-sdl
May 11, 2013
99d3270
Fix refdb iteration early termination bug
arrbee May 11, 2013
6222103
Merge pull request #1575 from arrbee/ref-iterator-early-exit
carlosmn May 11, 2013
000e689
CMake: don't try to use bundled zlib when the system's path is in the…
carlosmn May 12, 2013
b4d33e4
Fix some memory leaks
nulltoken May 14, 2013
fbcab44
Create directory for symlink before creating symlink
May 14, 2013
3bbc87d
CMake: allow appending a string to the library filename
carlosmn May 14, 2013
103a2c7
Merge pull request #1581 from nulltoken/fix/leaks
arrbee May 14, 2013
33539b1
Merge pull request #1582 from dmgctrl/checkout_symlink_fix
arrbee May 14, 2013
0038432
Merge pull request #1580 from carlosmn/cmake-describe
arrbee May 14, 2013
bc2020d
Extend valgrind suppressions on Mac
arrbee May 14, 2013
0cb16fe
Unify whitespaces to tabs
linquize May 15, 2013
86c6f74
Merge pull request #1583 from linquize/whitespace
May 15, 2013
f0ab737
signature: Lenient when dupping, strict when creating
vmg May 15, 2013
22011b3
Cleanup
May 15, 2013
b54ed3e
Added error check
May 15, 2013
e057e41
Reworked git_cred_ssh_keyfile_passphrase_new method
May 15, 2013
ccaee22
Added GITERR_CHECK_ALLOC
May 15, 2013
6cbbd73
Renamed FindLibSSH2.cmake
May 15, 2013
a6b79b9
Changed case of FindLibSSH2.cmake to FindLIBSSH2.cmake
May 15, 2013
84ac625
Added GITERR_CHECK_ALLOC
May 15, 2013
6fe02c1
Fetch should not fail when remote HEAD reference is not present locally
jamill May 15, 2013
1fed6b0
Fix trailing whitespaces
nulltoken May 13, 2013
79ef3be
Fix diff crash when last item is untracked dir
arrbee May 15, 2013
55d3a39
Remove old symlinks before updating
arrbee May 15, 2013
dcb0f7c
Fix checkout of submodules with no .gitmodules
arrbee May 15, 2013
09fae31
Improve robustness of diff rename detection
arrbee May 15, 2013
72b3dd4
Use GIT_IDXENTRY_STAGE macro
arrbee May 15, 2013
6957f73
Merge pull request #1578 from nulltoken/fix/whitespaces
May 15, 2013
7159620
Merge pull request #1588 from arrbee/fixes-for-checkout-and-diff
May 15, 2013
487884a
Improve docs for git_index_entry flag masks
arrbee May 13, 2013
797dfb2
Add APIs to dup and free git_index_entrys
arrbee May 13, 2013
96c0199
Remove entry dup/free functions and fix comments
arrbee May 15, 2013
89251b2
Update index.h docs
arrbee May 15, 2013
54e489c
Merge pull request #1579 from arrbee/index-entry-dup-and-free
May 15, 2013
12f831f
Merge pull request #1586 from jamill/fetch_fix
May 16, 2013
7026ad8
calloc() to initialize memory
linquize May 16, 2013
58206c9
Add cat-file example and increase const use in API
arrbee May 16, 2013
8d78400
Make examples/diff.c compile vs threadsafe library
arrbee May 16, 2013
4a782c8
Merge pull request #1574 from linquize/calloc
arrbee May 16, 2013
57908bb
Ensure reuc vector is always valid
arrbee May 16, 2013
18e37db
Merge pull request #1591 from arrbee/reorder-reuc-read-for-safety
May 16, 2013
c2d282c
Merge pull request #1590 from arrbee/examples-like-git
May 16, 2013
e3107e0
Merge pull request #1558 from bmorganpa/ssh_transport
May 16, 2013
dcaa898
revparse: Simplify temporary reference freeing
nulltoken May 9, 2013
e841c53
revparse: Introduce git_revparse_ext()
nulltoken May 9, 2013
f672cd2
revparse: Make revparse_ext() return git_reference from names as well
nulltoken May 10, 2013
5b3d52c
Merge pull request #1568 from nulltoken/topic/revparse_ext
arrbee May 16, 2013
9c06b25
merge setup
May 16, 2013
0e0108f
introduce git_conflict_iterator
May 17, 2013
660d59c
Add git_oid_nfmt - a flexible OID formatter
arrbee May 17, 2013
aadfa85
Add git_diff_print_raw printing helper
arrbee May 17, 2013
0293450
Fix delta compare to use correct pathname
arrbee May 17, 2013
d958e37
Fix issues with git_diff_find_similar
arrbee May 18, 2013
5c8f37a
Extend diff example
arrbee May 18, 2013
038c165
Initialize loose_deleted before it is used for a check later on.
grimreaper May 19, 2013
9be5be4
More git_diff_find_similar improvements
arrbee May 20, 2013
4742148
Add more diff rename detection tests
arrbee May 20, 2013
60750fc
Merge pull request #1596 from grimreaper/development
May 20, 2013
e069478
define "long name" in git_reference_name_to_id
ldct May 21, 2013
fc74343
refs: export the glob iterator
carlosmn May 21, 2013
e167ec1
Merge pull request #1597 from zodiac/patch-1
ben May 21, 2013
b81cc1d
tag: Introduce git_tag_annotation_create()
nulltoken May 18, 2013
6828bf2
Merge pull request #1594 from nulltoken/topic/tag_annotation
ben May 21, 2013
ccf1a2b
cmake: Fix indentation
nulltoken May 21, 2013
095bfd7
cmake: Update Windows resources to reflect the optional vendor string
nulltoken May 21, 2013
52f537e
Bugfix: Return NULL in push_leaf, when trie is full
Merovius May 22, 2013
a21cbb1
Significant rename detection rewrite
arrbee May 22, 2013
06c070b
Add testcase for #1600
Merovius May 23, 2013
c4085fb
Merge pull request #1601 from Merovius/bugfix_shorten
ben May 23, 2013
9c941cc
Merge pull request #1599 from nulltoken/topic/windows_resources
ben May 23, 2013
c68b09d
Fix dereference of freed delta
arrbee May 23, 2013
67db583
More diff rename tests; better split swap handling
arrbee May 23, 2013
f38cea9
Move core.abbrev lookup out of diff print loop
arrbee May 23, 2013
93d8f77
Improve test failure output
ben May 23, 2013
49f70f2
Fill out diff rename test coverage
arrbee May 23, 2013
3b32b6d
More tests of config with various absent files
arrbee May 23, 2013
0700ca1
More config code checks and cleanups
arrbee May 23, 2013
6f0b814
Stop leaking memory
ben May 24, 2013
87a56fe
Merge pull request #1604 from arrbee/config-file-checks
May 24, 2013
30caf0c
Merge pull request #1595 from arrbee/even-more-rename-fixes
May 24, 2013
4811c15
Merge pull request #1603 from ben/shallow
May 24, 2013
f7ceef0
Merge pull request #1592 from ethomson/merge_setup
May 24, 2013
26ab628
Merge pull request #1593 from ethomson/conflict_iterator
May 24, 2013
25a899e
qsort_r is broken on HURD, avoid
ethomson May 24, 2013
43efc44
Ensure reuc vector is always valid
arrbee May 16, 2013
4bc67ef
Merge pull request #1605 from ethomson/replace_reuc_fix
May 24, 2013
5e57cfa
Merge pull request #1607 from ethomson/hurd
arrbee May 24, 2013
0f1f983
Add typedefs on some public enums
arrbee May 24, 2013
2e62e7c
Docs for git_libgit2_opts and cache disable tweak
arrbee May 24, 2013
16adc9f
Typedef git_config_level_t and use it everywhere
arrbee May 24, 2013
d20b044
Clarify GIT_DIFF_INCLUDE_UNTRACKED_CONTENT option
arrbee May 24, 2013
7a5ee3d
Add ~ expansion to global attributes and excludes
arrbee May 24, 2013
8528132
Merge pull request #1608 from arrbee/various-cleanups-and-tweaks
May 24, 2013
c37fb41
qsort_r appeared in glibc 2.8
May 25, 2013
0d77647
Merge pull request #1609 from ethomson/qsort_r_glibc
May 25, 2013
f8bd730
Fix documentation of git_branch_delete.
drodriguez May 26, 2013
5aee963
Merge pull request #1612 from drodriguez/fix-branch-delete-docs
arrbee May 26, 2013
0582ae6
tests: don't verify SSH unsupported with GIT_SSH
schu May 21, 2013
63908ce
Merge pull request #1613 from schu/transport-ssh
May 27, 2013
563c19a
packbuilder: also write index in git_packbuilder_write
schu May 11, 2013
8baca13
Merge pull request #1614 from schu/packbuilder-write
May 27, 2013
9007c53
Fixing unwrapped calloc
arrbee May 27, 2013
2638a03
This refs iterator pleases the gods.
vmg May 28, 2013
56960b8
Liike this
vmg May 28, 2013
31a6118
Fix two typos in the merge docs.
arthurschreiber May 28, 2013
504a4fd
Merge pull request #1615 from arthurschreiber/patch-1
May 28, 2013
ca9b170
Fix memory leak in oid shortener tests
arrbee May 29, 2013
1777631
Merge pull request #1617 from arrbee/fix-oid-memory-leak
May 29, 2013
ec24e54
What are the chances, really
vmg May 29, 2013
2d160ef
allow (ignore) bare slash in gitignore
May 29, 2013
0c01f93
Merge pull request #1619 from ethomson/gitignore_slash
arrbee May 29, 2013
4e6e2ff
...Aaaand this works
vmg May 30, 2013
d17db2f
thread: fix segfault on Windows 64 bits
yorah May 30, 2013
979f75d
Refcounting
vmg May 30, 2013
b2984e8
Merge pull request #1622 from yorah/fix/thread-segfault
ben May 30, 2013
215af2c
remote: make default tag retrieving behaviour consistent
yorah May 30, 2013
df50512
Proposal to handle default value (auto = 0)
yorah May 30, 2013
7a6e028
Build with the system's http-parser installation if available
veeti May 2, 2013
1ed356d
Frees
vmg May 30, 2013
9d6d809
Merge pull request #1530 from veeti/http-parser
May 31, 2013
af2c72d
Merge pull request #1623 from yorah/fix/tag_auto
May 31, 2013
9afc597
Merge pull request #1559 from carlosmn/ref-shorthand
May 31, 2013
8839291
Added support for setting transport flags (No check SSL cert) to git_…
NHDaly May 30, 2013
8d863aa
Merge pull request #1621 from NHDaly/clone_transport_flags
May 31, 2013
8c2458b
improve test for index extension truncation
May 31, 2013
17ef7db
Merge pull request #1626 from ethomson/index_ext_truncation
May 31, 2013
cee695a
Make iterators use GIT_ITEROVER & smart advance
arrbee May 31, 2013
f658dc4
Zero memory for major objects before freeing
arrbee May 31, 2013
1a42dd1
Mutex init can fail
arrbee May 31, 2013
efd5a4e
Merge pull request #1627 from arrbee/iterator-api-improvements
May 31, 2013
03a8907
Make git_index_read_tree preserve stat cache
arrbee Jun 1, 2013
cfbd08a
Merge pull request #1630 from arrbee/index-read-tree-preserve-stat-cache
Jun 1, 2013
dc33b3d
Don't bail on parsing commits with an invalid timezone
Jun 2, 2013
9d9fff3
Merge pull request #1631 from scottjg/fix-timezone-parsing
Jun 2, 2013
947fad4
Merge pull request #1624 from libgit2/vmg/full-ref-iterator
Jun 3, 2013
daf98cb
Allow creation of directories under the volume root in Win32
jamill Jun 4, 2013
e236b37
Merge pull request #1633 from jamill/directory_create_fix
Jun 5, 2013
b832ecf
Ensure git_futils_mkdir won't mkdir root
arrbee Jun 5, 2013
987ab76
Merge pull request #1634 from arrbee/alternative-mkdir-fix
Jun 5, 2013
2e1fa15
I'm a dick
vmg Jun 5, 2013
999d440
Simplify git_futils_mkdir
arrbee Jun 5, 2013
aad6967
Basic function context header
arrbee May 30, 2013
7000f3f
Move some diff helpers into separate file
arrbee Jun 4, 2013
f7e5615
Make mkdir early exit cases clearer
arrbee Jun 5, 2013
3de768c
Merge pull request #1635 from arrbee/simplify-mkdir
Jun 7, 2013
3e9e6cd
Add safe memset and use it
arrbee Jun 7, 2013
114f5a6
Reorganize diff and add basic diff driver
arrbee Jun 10, 2013
bda3fbb
failing unit test for similar renames
Jun 10, 2013
690bf41
keep source similarity in rename detection
Jun 10, 2013
596b121
fix missing file and bad prototype
arrbee Jun 10, 2013
2f77d8f
Fix some memory leaks
arrbee Jun 10, 2013
3eadfec
start implementing diff driver registry
arrbee Jun 10, 2013
24ec699
signature: extend trimming to more whitespace
carlosmn Jun 11, 2013
9d4db41
Merge pull request #1644 from carlosmn/sig-isspace
Jun 11, 2013
5dc9829
Implement regex pattern diff driver
arrbee Jun 11, 2013
76b893b
Add high(est) config level for application specific config files
csware Jun 11, 2013
5438e9c
Merge pull request #1645 from csware/config_level_app
Jun 11, 2013
42e6cf7
Add diff drivers tests (and fix bugs)
arrbee Jun 12, 2013
54faddd
Fix some diff driver memory leaks
arrbee Jun 12, 2013
f9c824c
Add patch from blobs API
arrbee Jun 12, 2013
6de9b2e
util: It's called `memzero`
vmg Jun 12, 2013
5a6e45c
Revert "cmake: Update Windows resources to reflect the optional vendo…
vmg Jun 12, 2013
ef3374a
Improvements to git_array
arrbee Jun 12, 2013
360f42f
Fix diff header naming issues
arrbee Jun 12, 2013
93da7af
Merge pull request #1642 from arrbee/diff-function-context
Jun 12, 2013
88c401b
Merge pull request #1643 from ethomson/rename_source
Jun 12, 2013
37f66e8
Fix Windows warnings
arrbee Jun 12, 2013
3b5001b
Merge pull request #1647 from arrbee/fix-win32-warnings-part-112
arrbee Jun 12, 2013
eb58e2d
Merge remote-tracking branch 'arrbee/minor-paranoia' into development
vmg Jun 12, 2013
c1cf1af
cmake: Add option to specify the name of the binary
nulltoken Jun 12, 2013
4878ea4
Merge pull request #1650 from nulltoken/ntk/winrc-filename
Jun 13, 2013
2da72fb
fileops: fix invalid read
yorah Jun 14, 2013
519072c
diff: fix warning
yorah Jun 14, 2013
824cf80
Merge pull request #1652 from yorah/fix/build-warnings
Jun 14, 2013
3425fee
util: git__memzero() tweaks
yorah Jun 17, 2013
0525fb7
cred: deploy git__memzero to clear memory holding a password
yorah Jun 17, 2013
7058713
Merge pull request #1654 from yorah/memzero
Jun 17, 2013
2ad7a4d
ref: free the last ref when cancelling git_branch_foreach()
yorah Jun 17, 2013
bd2319c
Merge pull request #1655 from yorah/fix/ref-memleak
Jun 17, 2013
09c2f91
branch: More obvious semantics in `foreach`
vmg Jun 17, 2013
1ee2ef8
status access by index, providing more details to callers
May 21, 2013
dfe8c8d
handle renames in status computation
May 23, 2013
e3b4a47
git__strcasesort_cmp: strcasecmp sorting rules but requires strict eq…
May 31, 2013
c9b1801
Fix some warnings
arrbee Jun 13, 2013
4e28e63
Clarify some docs and minor reordering
arrbee Jun 13, 2013
3a68d7f
Fix broken status EXCLUDE_SUBMODULES logic
arrbee Jun 13, 2013
a3e8dbb
Be more careful about the path with diffs
arrbee Jun 13, 2013
351888c
Improve case handling in git_diff__paired_foreach
arrbee Jun 13, 2013
1540b19
some simple case-sensitive index tests
May 31, 2013
6ea999b
Make index_insert keep existing case
arrbee Jun 13, 2013
eefef64
Always do tree to index diffs case sensitively
arrbee Jun 13, 2013
fb03a22
Test has to work on case sensitive systems
arrbee Jun 13, 2013
a1683f2
More tests and bug fixes for status with rename
arrbee Jun 14, 2013
f3b5bc8
Add test of rename with no changes
arrbee Jun 17, 2013
de0555a
Fix memory leaks in diff rename tests
arrbee Jun 17, 2013
f418334
Update clar to latest version
arrbee Jun 17, 2013
c09810e
Merge pull request #1651 from arrbee/status_indexed_updates
arrbee Jun 17, 2013
74ded02
Add "as_path" parameters to blob and buffer diffs
arrbee Jun 18, 2013
ffb762f
Merge pull request #1657 from arrbee/diff-blob-as-path
Jun 18, 2013
f0f2ff9
test failure when renames produce similar similarities
Jun 17, 2013
3b33407
test illustrating tri-cyclic rename failure
Jun 17, 2013
e4acc3b
Fix rename looped reference issues
arrbee Jun 18, 2013
84ba494
Merge pull request #1659 from arrbee/rename-cycle-fixes
Jun 18, 2013
c41281a
CMakeLists: fix zlib linker setup
Jun 19, 2013
5144850
Merge pull request #1660 from trast/tr/fix-zlib-configuration
Jun 19, 2013
e91f9a8
Add higher level pathspec API
arrbee Jun 19, 2013
85b8b18
Add fn to check pathspec for ignored files
arrbee Jun 19, 2013
f30fff4
Add index pathspec-based operations
arrbee Jun 19, 2013
7863523
Add tests and fix use of freed memory
arrbee Jun 19, 2013
8b2fa18
Merge pull request #1661 from arrbee/index-add-all
Jun 19, 2013
852ded9
Fix bug in diff untracked dir scan
arrbee Jun 20, 2013
cf300bb
Initial implementation of status example
arrbee Jun 20, 2013
22b6b82
Add status flags to force output sort order
arrbee Jun 20, 2013
f18f772
Add example implementation of long format status
arrbee Jun 20, 2013
9280855
Fix comment and copyright in example
arrbee Jun 20, 2013
94ef2a3
Add test for fixed diff bug
arrbee Jun 20, 2013
f2d110f
Merge pull request #1662 from arrbee/examples-like-git
Jun 20, 2013
dacce80
test asserting checkout should not recreate deleted files
Jun 21, 2013
36fd9e3
Fix checkout of modified file when missing from wd
arrbee Jun 21, 2013
00197c3
Merge pull request #1664 from arrbee/checkout-deleted-with-fix
Jun 21, 2013
9094ae5
Add target directory to checkout
arrbee Jun 21, 2013
6a15e8d
Loosen ensure_not_bare rules in checkout
arrbee Jun 21, 2013
d4f98ba
Addition checkout target directory tests
arrbee Jun 21, 2013
5d669f0
Merge pull request #1665 from arrbee/checkout-target-directory
Jun 21, 2013
a7ea409
Do not redefine WC_ERR_INVALID_CHARS
csware Jun 22, 2013
8294e8c
Constrain mkdir calls to avoid extra mkdirs
arrbee Jun 23, 2013
9f1b2c5
Merge pull request #1668 from csware/WC_ERR_INVALID_CHARS
arrbee Jun 23, 2013
3d3ea4d
Add O_CLOEXEC to open calls
arrbee Jun 23, 2013
e196716
Fixed most documentation header bugs
DerAndereAndi Jun 24, 2013
32c12ea
Work around reparse point stat issues
arrbee Jun 24, 2013
6c4dadb
Merge pull request #1669 from arrbee/fix-index-add-bypath
Jun 24, 2013
09ee60c
Merge pull request #1670 from arrbee/open-cloexec
Jun 24, 2013
353a90b
Merge pull request #1672 from TheRealKerni/fix/header_docs
Jun 24, 2013
8c510b8
Fix a leak in the local transport code.
arthurschreiber Jun 24, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ msvc/Release/
*.sdf
*.opensdf
*.aps
CMake*
*.cmake
!cmake/Modules/*.cmake
.DS_Store
*~
tags
Expand Down
17 changes: 16 additions & 1 deletion .mailmap
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
Vicent Martí <[email protected]> Vicent Marti <[email protected]>
Vicent Martí <[email protected]> Vicent Marti <[email protected]>
Vicent Martí <[email protected]> Vicent Martí <[email protected]>
Michael Schubert <[email protected]> schu <[email protected]>
Ben Straub <[email protected]> Ben Straub <[email protected]>
Ben Straub <[email protected]> Ben Straub <[email protected]>
Carlos Martín Nieto <[email protected]> <[email protected]>
Carlos Martín Nieto <[email protected]> <[email protected]>
nulltoken <[email protected]> <[email protected]>
Scott J. Goldman <[email protected]> <[email protected]>
Martin Woodward <[email protected]> <[email protected]>
Peter Drahoš <[email protected]> <[email protected]>
Adam Roben <[email protected]> <[email protected]>
Adam Roben <[email protected]> <[email protected]>
Xavier L. <[email protected]> <[email protected]>
Xavier L. <[email protected]> <[email protected]>
Sascha Cunz <[email protected]> <[email protected]>
Authmillenon <[email protected]> <[email protected]>
Authmillenon <[email protected]> <[email protected]>
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ install:

# Run the Build script
script:
- mkdir _temp
- git init --bare _temp/test.git
- git daemon --listen=localhost --export-all --enable=receive-pack --base-path=_temp _temp 2>/dev/null &
- export GITTEST_REMOTE_URL="git://localhost/test.git"
- mkdir _build
- cd _build
- cmake .. -DCMAKE_INSTALL_PREFIX=../_install $OPTIONS
Expand Down
63 changes: 50 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
PROJECT(libgit2 C)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

# Add find modules to the path
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

# Build options
#
OPTION( SONAME "Set the (SO)VERSION of the target" ON )
Expand All @@ -24,6 +27,8 @@ OPTION( BUILD_EXAMPLES "Build library usage example apps" OFF )
OPTION( TAGS "Generate tags" OFF )
OPTION( PROFILE "Generate profiling information" OFF )
OPTION( ENABLE_TRACE "Enables tracing support" OFF )
OPTION( LIBGIT2_FILENAME "Name of the produced binary" OFF )

IF(MSVC)
# This option is only availalbe when building with MSVC. By default,
# libgit2 is build using the stdcall calling convention, as that's what
Expand Down Expand Up @@ -97,14 +102,22 @@ ELSE ()
IF (NOT AMIGA)
FIND_PACKAGE(OpenSSL)
ENDIF ()
FILE(GLOB SRC_HTTP deps/http-parser/*.c)
INCLUDE_DIRECTORIES(deps/http-parser)

FIND_PACKAGE(HTTP_Parser QUIET)
IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
INCLUDE_DIRECTORIES(${HTTP_PARSER_INCLUDE_DIRS})
LINK_LIBRARIES(${HTTP_PARSER_LIBRARIES})
ELSE()
MESSAGE("http-parser was not found or is too old; using bundled 3rd-party sources.")
INCLUDE_DIRECTORIES(deps/http-parser)
FILE(GLOB SRC_HTTP deps/http-parser/*.c)
ENDIF()
ENDIF()

# Specify sha1 implementation
IF (WIN32 AND NOT MINGW AND NOT SHA1_TYPE STREQUAL "builtin")
ADD_DEFINITIONS(-DWIN32_SHA1)
FILE(GLOB SRC_SHA1 src/hash/hash_win32.c)
ADD_DEFINITIONS(-DWIN32_SHA1)
FILE(GLOB SRC_SHA1 src/hash/hash_win32.c)
ELSEIF (OPENSSL_FOUND AND NOT SHA1_TYPE STREQUAL "builtin")
ADD_DEFINITIONS(-DOPENSSL_SHA1)
ELSE()
Expand All @@ -123,25 +136,34 @@ IF(WIN32 OR AMIGA)
ENDIF()

# Optional external dependency: zlib
IF(NOT ZLIB_LIBRARY)
# It's optional, but FIND_PACKAGE gives a warning that looks more like an
# error.
FIND_PACKAGE(ZLIB QUIET)
ENDIF()
# It's optional, but FIND_PACKAGE gives a warning that looks more like an
# error.
FIND_PACKAGE(ZLIB QUIET)
IF (ZLIB_FOUND)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
LINK_LIBRARIES(${ZLIB_LIBRARIES})
# Fake the message CMake would have shown
MESSAGE("-- Found zlib: ${ZLIB_LIBRARY}")
ELSE()
MESSAGE( "zlib was not found; using bundled 3rd-party sources." )
INCLUDE_DIRECTORIES(deps/zlib)
ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP)
FILE(GLOB SRC_ZLIB deps/zlib/*.c)
ENDIF()

IF(NOT LIBSSH2_LIBRARY)
FIND_PACKAGE(LIBSSH2 QUIET)
ENDIF()
IF (LIBSSH2_FOUND)
ADD_DEFINITIONS(-DGIT_SSH)
INCLUDE_DIRECTORIES(${LIBSSH2_INCLUDE_DIR})
SET(SSH_LIBRARIES ${LIBSSH2_LIBRARIES})
ENDIF()

# Platform specific compilation flags
IF (MSVC)

STRING(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
STRING(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")

# /GF - String pooling
# /MP - Parallel build
Expand All @@ -156,7 +178,7 @@ IF (MSVC)
SET(CRT_FLAG_DEBUG "/MTd")
SET(CRT_FLAG_RELEASE "/MT")
ELSE()
SET(CRT_FLAG_DEBUG "/MDd")
SET(CRT_FLAG_DEBUG "/MDd")
SET(CRT_FLAG_RELEASE "/MD")
ENDIF()

Expand Down Expand Up @@ -277,14 +299,24 @@ ELSE()
ENDIF()
FILE(GLOB SRC_GIT2 src/*.c src/transports/*.c src/xdiff/*.c)

# Determine architecture of the machine
IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
ADD_DEFINITIONS(-DGIT_ARCH_64)
ELSEIF (CMAKE_SIZEOF_VOID_P EQUAL 4)
ADD_DEFINITIONS(-DGIT_ARCH_32)
ELSE()
message(FATAL_ERROR "Unsupported architecture")
ENDIF()

# Compile and link libgit2
ADD_LIBRARY(git2 ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1} ${WIN_RC})
TARGET_LINK_LIBRARIES(git2 ${SSL_LIBRARIES})
TARGET_LINK_LIBRARIES(git2 ${SSH_LIBRARIES})
TARGET_OS_LIBRARIES(git2)

# Workaround for Cmake bug #0011240 (see http://public.kitware.com/Bug/view.php?id=11240)
# Win64+MSVC+static libs = linker error
IF(MSVC AND NOT BUILD_SHARED_LIBS AND (${CMAKE_SIZEOF_VOID_P} MATCHES "8") )
IF(MSVC AND GIT_ARCH_64 AND NOT BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES(git2 PROPERTIES STATIC_LIBRARY_FLAGS "/MACHINE:x64")
ENDIF()

Expand All @@ -293,6 +325,10 @@ MSVC_SPLIT_SOURCES(git2)
IF (SONAME)
SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING})
SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_VERSION_MAJOR})
IF (LIBGIT2_FILENAME)
ADD_DEFINITIONS(-DLIBGIT2_FILENAME=\"${LIBGIT2_FILENAME}\")
SET_TARGET_PROPERTIES(git2 PROPERTIES OUTPUT_NAME ${LIBGIT2_FILENAME})
ENDIF()
ENDIF()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libgit2.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc @ONLY)

Expand Down Expand Up @@ -328,7 +364,7 @@ IF (BUILD_CLAR)

ADD_CUSTOM_COMMAND(
OUTPUT ${CLAR_PATH}/clar.suite
COMMAND ${PYTHON_EXECUTABLE} generate.py -xonline .
COMMAND ${PYTHON_EXECUTABLE} generate.py -f -xonline .
DEPENDS ${SRC_TEST}
WORKING_DIRECTORY ${CLAR_PATH}
)
Expand All @@ -340,6 +376,7 @@ IF (BUILD_CLAR)
ADD_EXECUTABLE(libgit2_clar ${SRC_GIT2} ${SRC_OS} ${SRC_CLAR} ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1})

TARGET_LINK_LIBRARIES(libgit2_clar ${SSL_LIBRARIES})
TARGET_LINK_LIBRARIES(libgit2_clar ${SSH_LIBRARIES})
TARGET_OS_LIBRARIES(libgit2_clar)
MSVC_SPLIT_SOURCES(libgit2_clar)

Expand Down
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ release its source code.
* Archives: <http://librelist.com/browser/libgit2/>
* Website: <http://libgit2.github.com>
* API documentation: <http://libgit2.github.com/libgit2>
* IRC: #libgit2 on irc.freenode.net.

What It Can Do
==================================
Expand Down Expand Up @@ -139,7 +140,7 @@ Here are the bindings to libgit2 that are currently available:
* Parrot Virtual Machine
* parrot-libgit2 <https://github.com/letolabs/parrot-libgit2>
* Perl
* git-xs-pm <https://github.com/ingydotnet/git-xs-pm>
* Git-Raw <https://github.com/ghedo/p5-Git-Raw>
* PHP
* php-git <https://github.com/libgit2/php-git>
* Python
Expand All @@ -155,15 +156,7 @@ we can add it to the list.
How Can I Contribute?
==================================

Fork libgit2/libgit2 on GitHub, add your improvement, push it to a branch
in your fork named for the topic, send a pull request. If you change the
API or make other large changes, make a note of it in docs/rel-notes/ in a
file named after the next release.

You can also file bugs or feature requests under the libgit2 project on
GitHub, or join us on the mailing list by sending an email to:

[email protected]
Check the [contribution guidelines](CONTRIBUTING.md).


License
Expand Down
39 changes: 39 additions & 0 deletions cmake/Modules/FindHTTP_Parser.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# - Try to find http-parser
#
# Defines the following variables:
#
# HTTP_PARSER_FOUND - system has http-parser
# HTTP_PARSER_INCLUDE_DIR - the http-parser include directory
# HTTP_PARSER_LIBRARIES - Link these to use http-parser
# HTTP_PARSER_VERSION_MAJOR - major version
# HTTP_PARSER_VERSION_MINOR - minor version
# HTTP_PARSER_VERSION_STRING - the version of http-parser found

# Find the header and library
FIND_PATH(HTTP_PARSER_INCLUDE_DIR NAMES http_parser.h)
FIND_LIBRARY(HTTP_PARSER_LIBRARY NAMES http_parser libhttp_parser)

# Found the header, read version
if (HTTP_PARSER_INCLUDE_DIR AND EXISTS "${HTTP_PARSER_INCLUDE_DIR}/http_parser.h")
FILE(READ "${HTTP_PARSER_INCLUDE_DIR}/http_parser.h" HTTP_PARSER_H)
IF (HTTP_PARSER_H)
STRING(REGEX REPLACE ".*#define[\t ]+HTTP_PARSER_VERSION_MAJOR[\t ]+([0-9]+).*" "\\1" HTTP_PARSER_VERSION_MAJOR "${HTTP_PARSER_H}")
STRING(REGEX REPLACE ".*#define[\t ]+HTTP_PARSER_VERSION_MINOR[\t ]+([0-9]+).*" "\\1" HTTP_PARSER_VERSION_MINOR "${HTTP_PARSER_H}")
SET(HTTP_PARSER_VERSION_STRING "${HTTP_PARSER_VERSION_MAJOR}.${HTTP_PARSER_VERSION_MINOR}")
ENDIF()
UNSET(HTTP_PARSER_H)
ENDIF()

# Handle the QUIETLY and REQUIRED arguments and set HTTP_PARSER_FOUND
# to TRUE if all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HTTP_Parser REQUIRED_VARS HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY)

# Hide advanced variables
MARK_AS_ADVANCED(HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY)

# Set standard variables
IF (HTTP_PARSER_FOUND)
SET(HTTP_PARSER_LIBRARIES ${HTTP_PARSER_LIBRARY})
set(HTTP_PARSER_INCLUDE_DIRS ${HTTP_PARSER_INCLUDE_DIR})
ENDIF()
44 changes: 44 additions & 0 deletions cmake/Modules/FindLIBSSH2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
if (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
set(LIBSSH2_FOUND TRUE)
else (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
find_path(LIBSSH2_INCLUDE_DIR
NAMES
libssh2.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
${CMAKE_INCLUDE_PATH}
${CMAKE_INSTALL_PREFIX}/include
)

find_library(LIBSSH2_LIBRARY
NAMES
ssh2
libssh2
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
${CMAKE_LIBRARY_PATH}
${CMAKE_INSTALL_PREFIX}/lib
)

if (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)
set(LIBSSH2_FOUND TRUE)
endif (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)

if (LIBSSH2_FOUND)
set(LIBSSH2_INCLUDE_DIRS
${LIBSSH2_INCLUDE_DIR}
)

set(LIBSSH2_LIBRARIES
${LIBSSH2_LIBRARIES}
${LIBSSH2_LIBRARY}
)
endif (LIBSSH2_FOUND)
endif (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)

88 changes: 88 additions & 0 deletions docs/diff-internals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Diff is broken into four phases:

1. Building a list of things that have changed. These changes are called
deltas (git_diff_delta objects) and are grouped into a git_diff_list.
2. Applying file similarity measurement for rename and copy detection (and
to potentially split files that have changed radically). This step is
optional.
3. Computing the textual diff for each delta. Not all deltas have a
meaningful textual diff. For those that do, the textual diff can
either be generated on the fly and passed to output callbacks or can be
turned into a git_diff_patch object.
4. Formatting the diff and/or patch into standard text formats (such as
patches, raw lists, etc).

In the source code, step 1 is implemented in `src/diff.c`, step 2 in
`src/diff_tform.c`, step 3 in `src/diff_patch.c`, and step 4 in
`src/diff_print.c`. Additionally, when it comes to accessing file
content, everything goes through diff drivers that are implemented in
`src/diff_driver.c`.

External Objects
----------------

* `git_diff_options` repesents user choices about how a diff should be
performed and is passed to most diff generating functions.
* `git_diff_file` represents an item on one side of a possible delta
* `git_diff_delta` represents a pair of items that have changed in some
way - it contains two `git_diff_file` plus a status and other stuff.
* `git_diff_list` is a list of deltas along with information about how
those particular deltas were found.
* `git_diff_patch` represents the actual diff between a pair of items. In
some cases, a delta may not have a corresponding patch, if the objects
are binary, for example. The content of a patch will be a set of hunks
and lines.
* A `hunk` is range of lines described by a `git_diff_range` (i.e. "lines
10-20 in the old file became lines 12-23 in the new"). It will have a
header that compactly represents that information, and it will have a
number of lines of context surrounding added and deleted lines.
* A `line` is simple a line of data along with a `git_diff_line_t` value
that tells how the data should be interpretted (e.g. context or added).

Internal Objects
----------------

* `git_diff_file_content` is an internal structure that represents the
data on one side of an item to be diffed; it is an augmented
`git_diff_file` with more flags and the actual file data.
** it is created from a repository plus a) a git_diff_file, b) a git_blob,
or c) raw data and size
** there are three main operations on git_diff_file_content:
*** _initialization_ sets up the data structure and does what it can up to,
but not including loading and looking at the actual data
*** _loading_ loads the data, preprocesses it (i.e. applies filters) and
potentially analyzes it (to decide if binary)
*** _free_ releases loaded data and frees any allocated memory

* The internal structure of a `git_diff_patch` stores the actual diff
between a pair of `git_diff_file_content` items
** it may be "unset" if the items are not diffable
** "empty" if the items are the same
** otherwise it will consist of a set of hunks each of which covers some
number of lines of context, additions and deletions
** a patch is created from two git_diff_file_content items
** a patch is fully instantiated in three phases:
*** initial creation and initialization
*** loading of data and preliminary data examination
*** diffing of data and optional storage of diffs
** (TBD) if a patch is asked to store the diffs and the size of the diff
is significantly smaller than the raw data of the two sides, then the
patch may be flattened using a pool of string data

* `git_diff_output` is an internal structure that represents an output
target for a `git_diff_patch`
** It consists of file, hunk, and line callbacks, plus a payload
** There is a standard flattened output that can be used for plain text output
** Typically we use a `git_xdiff_output` which drives the callbacks via the
xdiff code taken from core Git.

* `git_diff_driver` is an internal structure that encapsulates the logic
for a given type of file
** a driver is looked up based on the name and mode of a file.
** the driver can then be used to:
*** determine if a file is binary (by attributes, by git_diff_options
settings, or by examining the content)
*** give you a function pointer that is used to evaluate function context
for hunk headers
** At some point, the logic for getting a filtered version of file content
or calculating the OID of a file may be moved into the driver.
Loading