]> git.proxmox.com Git - libgit2.git/log
libgit2.git
12 years agoAdd support for pathspec to diff and status
Russell Belfer [Fri, 13 Apr 2012 22:00:29 +0000 (15:00 -0700)]
Add support for pathspec to diff and status

This adds preliminary support for pathspecs to diff and status.
The implementation is not very optimized (it still looks at
every single file and evaluated the the pathspec match against
them), but it works.

12 years agoMerge remote-tracking branch 'carlosmn/revwalk-merge-base' into new-error-handling
Vicent Martí [Fri, 13 Apr 2012 18:41:06 +0000 (20:41 +0200)]
Merge remote-tracking branch 'carlosmn/revwalk-merge-base' into new-error-handling

12 years agoMerge pull request #623 from arrbee/refactor-open
Vicent Martí [Fri, 13 Apr 2012 17:51:58 +0000 (10:51 -0700)]
Merge pull request #623 from arrbee/refactor-open

Update git_repository_open

12 years agobranch: simplify error handling for git_branch_move()
Carlos Martín Nieto [Thu, 12 Apr 2012 21:40:41 +0000 (23:40 +0200)]
branch: simplify error handling for git_branch_move()

The cleanup needs to happen anyway, so set the error code and jump
there instead of copying the code.

12 years agoMerge pull request #625 from carlosmn/valgrind
Vicent Martí [Thu, 12 Apr 2012 21:28:15 +0000 (14:28 -0700)]
Merge pull request #625 from carlosmn/valgrind

Plug a few leaks

12 years agolocal transport: plug leak
Carlos Martín Nieto [Thu, 12 Apr 2012 18:52:26 +0000 (20:52 +0200)]
local transport: plug leak

12 years agobranch: plug leaks in git_branch_move() and _delete()
Carlos Martín Nieto [Thu, 12 Apr 2012 18:47:46 +0000 (20:47 +0200)]
branch: plug leaks in git_branch_move() and _delete()

12 years agoerror-handling: revwalk
Carlos Martín Nieto [Thu, 12 Apr 2012 18:25:07 +0000 (20:25 +0200)]
error-handling: revwalk

12 years agoMove git_merge_base() to is own header and document it
Carlos Martín Nieto [Sun, 8 Apr 2012 16:56:50 +0000 (18:56 +0200)]
Move git_merge_base() to is own header and document it

12 years agorevwalk: use a priority queue for calculating merge bases
Carlos Martín Nieto [Sun, 4 Mar 2012 02:00:35 +0000 (03:00 +0100)]
revwalk: use a priority queue for calculating merge bases

As parents are older than their children, we're appending to the
commit list most of the time, which makes an ordered linked list quite
inefficient.

While we're there, don't sort the results list in the main loop, as
we're sorting them afterwards and it creates extra work.

12 years agorevwalk: add test hiding a commit without a merge base
Carlos Martín Nieto [Sat, 3 Mar 2012 16:25:05 +0000 (17:25 +0100)]
revwalk: add test hiding a commit without a merge base

Nothing should be hidden and this shouldn't bother the merge base
calculation.

12 years agorevwalk: use merge bases to speed up processing
Carlos Martín Nieto [Sat, 3 Mar 2012 15:43:24 +0000 (16:43 +0100)]
revwalk: use merge bases to speed up processing

There is no need walk down the parents of a merge base to mark them as
uninteresting because we'll never see them. Calculate the merge bases
in prepare_walk() so mark_uninteresting() can stop at a merge base
instead of walking all the way to the root.

12 years agoImplement git_merge_base()
Carlos Martín Nieto [Sat, 3 Mar 2012 02:31:51 +0000 (03:31 +0100)]
Implement git_merge_base()

It's implemented in revwalk.c so it has access to the revision
walker's commit cache and related functions. The algorithm is the one
used by git, modified so it fits better with the library's functions.

12 years agorevwalk: allow pushing/hiding a reference by name
Carlos Martín Nieto [Tue, 28 Feb 2012 01:19:57 +0000 (02:19 +0100)]
revwalk: allow pushing/hiding a reference by name

The code was already there, so factor it out and let users push an OID
by giving it a reference name. Only refs to commits are
supported. Annotated tags will throw an error.

12 years agorevwalk: don't assume malloc succeeds
Carlos Martín Nieto [Sat, 3 Mar 2012 03:46:21 +0000 (04:46 +0100)]
revwalk: don't assume malloc succeeds

12 years agoRefactor git_repository_open with new options
Russell Belfer [Wed, 11 Apr 2012 18:52:59 +0000 (11:52 -0700)]
Refactor git_repository_open with new options

Add a new command `git_repository_open_ext` with extended options
that control how searching for a repository will be done.  The
existing `git_repository_open` and `git_repository_discover` are
reimplemented on top of it.  We may want to change the default
behavior of `git_repository_open` but this commit does not do that.

Improve support for "gitdir" files where the work dir is separate
from the repo and support for the "separate-git-dir" config.  Also,
add support for opening repos created with `git-new-workdir` script
(although I have only confirmed that they can be opened, not that
all functions work correctly).

There are also a few minor changes that came up:

- Fix `git_path_prettify` to allow in-place prettifying.

- Fix `git_path_root` to support backslashes on Win32.  This fix
  should help many repo open/discover scenarios - it is the one
  function called when opening before prettifying the path.

- Tweak `git_config_get_string` to set the "out" pointer to NULL
  if the config value is not found.  Allows some other cleanup.

- Fix a couple places that should have been calling
  `git_repository_config__weakptr` and were not.

- Fix `cl_git_sandbox_init` clar helper to support bare repos.

12 years agoCannot set workdir to a nonexistent dir
Russell Belfer [Wed, 11 Apr 2012 19:10:14 +0000 (12:10 -0700)]
Cannot set workdir to a nonexistent dir

12 years agostatus: Remove status_old
Vicent Martí [Wed, 11 Apr 2012 17:19:12 +0000 (19:19 +0200)]
status: Remove status_old

This is Git yo. You can fetch stuff from the history if you need it.

12 years agotests: Remove unused file
Vicent Martí [Wed, 11 Apr 2012 17:17:21 +0000 (19:17 +0200)]
tests: Remove unused file

12 years agoerror-handling local transport
Carlos Martín Nieto [Sat, 31 Mar 2012 22:45:02 +0000 (00:45 +0200)]
error-handling local transport

12 years agoerror-handling: fetch
Carlos Martín Nieto [Fri, 30 Mar 2012 16:37:19 +0000 (18:37 +0200)]
error-handling: fetch

12 years agoUse new error handling in the example network code
Carlos Martín Nieto [Mon, 26 Mar 2012 09:36:12 +0000 (11:36 +0200)]
Use new error handling in the example network code

12 years agonetops: show winsock error messages on Windows
Carlos Martín Nieto [Fri, 16 Mar 2012 14:15:21 +0000 (15:15 +0100)]
netops: show winsock error messages on Windows

12 years agoerror-handling: netops
Carlos Martín Nieto [Wed, 7 Mar 2012 06:01:20 +0000 (07:01 +0100)]
error-handling: netops

12 years agoerror-handling: http
Carlos Martín Nieto [Tue, 6 Mar 2012 10:26:10 +0000 (11:26 +0100)]
error-handling: http

12 years agoerror-handling: git transport
Carlos Martín Nieto [Tue, 6 Mar 2012 09:47:18 +0000 (10:47 +0100)]
error-handling: git transport

12 years agoerror-handling: protocol, pkt
Carlos Martín Nieto [Tue, 6 Mar 2012 09:23:02 +0000 (10:23 +0100)]
error-handling: protocol, pkt

12 years agoerror-handling: remote, transport
Carlos Martín Nieto [Tue, 6 Mar 2012 07:12:35 +0000 (08:12 +0100)]
error-handling: remote, transport

12 years agoFix compilation errors and warnings
nulltoken [Wed, 11 Apr 2012 13:25:34 +0000 (15:25 +0200)]
Fix compilation errors and warnings

12 years agoTypedefs don't have enum in front
Carlos Martín Nieto [Wed, 11 Apr 2012 12:27:40 +0000 (14:27 +0200)]
Typedefs don't have enum in front

12 years agoMerge pull request #619 from nulltoken/topic/branches
Vicent Martí [Wed, 11 Apr 2012 10:43:30 +0000 (03:43 -0700)]
Merge pull request #619 from nulltoken/topic/branches

Basic branch management API

12 years agorepository: make git_repository_set_workdir() prettify the path it is being passed
nulltoken [Tue, 10 Apr 2012 12:03:47 +0000 (14:03 +0200)]
repository: make git_repository_set_workdir() prettify the path it is being passed

12 years agoMerge branch 'new-error-handling' of github.com:libgit2/libgit2 into new-error-handling
Vicent Martí [Wed, 11 Apr 2012 10:38:45 +0000 (12:38 +0200)]
Merge branch 'new-error-handling' of github.com:libgit2/libgit2 into new-error-handling

12 years agobranch: add git_branch_move()
nulltoken [Mon, 9 Apr 2012 01:22:14 +0000 (03:22 +0200)]
branch: add git_branch_move()

12 years agofileops: Make git_futils_mkdir_r() able to skip non-empty directories
nulltoken [Mon, 9 Apr 2012 00:28:31 +0000 (02:28 +0200)]
fileops: Make git_futils_mkdir_r() able to skip non-empty directories

12 years agoAdd basic branch management API: git_branch_create(), git_branch_delete(), git_branch...
nulltoken [Wed, 4 Apr 2012 13:57:19 +0000 (15:57 +0200)]
Add basic branch management API: git_branch_create(), git_branch_delete(), git_branch_list()

12 years agotransport/local: Fix peeling of nested tags
nulltoken [Fri, 6 Apr 2012 13:23:18 +0000 (15:23 +0200)]
transport/local: Fix peeling of nested tags

12 years agotag: Add git_tag_peel() which recursively peel a tag until a non tag git_object is met
nulltoken [Fri, 6 Apr 2012 12:34:26 +0000 (14:34 +0200)]
tag: Add git_tag_peel() which recursively peel a tag until a non tag git_object is met

12 years agoMerge pull request #618 from nulltoken/fix/warning
Vicent Martí [Wed, 4 Apr 2012 17:37:25 +0000 (10:37 -0700)]
Merge pull request #618 from nulltoken/fix/warning

Fix compilation warning

12 years agoFix MSVC "unreferenced local variable" compilation warning.
nulltoken [Wed, 4 Apr 2012 11:59:58 +0000 (13:59 +0200)]
Fix  MSVC "unreferenced local variable" compilation warning.

12 years agoClean up valgrind warnings
Carlos Martín Nieto [Wed, 4 Apr 2012 11:13:43 +0000 (13:13 +0200)]
Clean up valgrind warnings

12 years agoMerge pull request #596 from nulltoken/fix/non-7bit-ascii-reference-names
Vicent Martí [Tue, 3 Apr 2012 00:25:05 +0000 (17:25 -0700)]
Merge pull request #596 from nulltoken/fix/non-7bit-ascii-reference-names

Allow references to bear non-7bit-ascii names on Windows

12 years agoerror-handling: Commit (WIP)
Vicent Martí [Wed, 28 Mar 2012 16:59:12 +0000 (18:59 +0200)]
error-handling: Commit (WIP)

12 years agoreference: Fix creation of references with extended ASCII characters in their name
nulltoken [Wed, 14 Mar 2012 11:13:03 +0000 (12:13 +0100)]
reference: Fix creation of references with extended ASCII characters in their name

12 years agoMerge pull request #610 from arrbee/status-rewrite
Vicent Martí [Sat, 31 Mar 2012 15:23:37 +0000 (08:23 -0700)]
Merge pull request #610 from arrbee/status-rewrite

Rewrite status using diff

12 years agoFix bug when join_n refers to original buffer
Russell Belfer [Fri, 30 Mar 2012 21:42:23 +0000 (14:42 -0700)]
Fix bug when join_n refers to original buffer

There was a bug in git_buf_join_n when the contents of the
original buffer were joined into itself and the realloc
moved the pointer to the original buffer.

12 years agoImprove config handling for diff,submodules,attrs
Russell Belfer [Fri, 30 Mar 2012 21:40:50 +0000 (14:40 -0700)]
Improve config handling for diff,submodules,attrs

This adds support for a bunch of core.* settings that affect
diff and status, plus fixes up some incorrect implementations
of those settings from before.  Also, this cleans up the
handling of config settings in the new submodules code and
in the old attrs/ignore code.

12 years agoAdded submodule API and use in status
Russell Belfer [Wed, 28 Mar 2012 23:45:36 +0000 (16:45 -0700)]
Added submodule API and use in status

When processing status for a newly checked out repo, it is
possible that there will be submodules that have not yet been
initialized.  The only way to distinguish these from untracked
directories is to have some knowledge of submodules.  This
commit adds a new submodule API which, given a name or path,
can determine if it appears to be a submodule and can give
information about the submodule.

12 years agoFix handling of submodules in trees
Russell Belfer [Mon, 26 Mar 2012 18:22:27 +0000 (11:22 -0700)]
Fix handling of submodules in trees

12 years agoEliminate hairy COITERATE macro
Russell Belfer [Mon, 26 Mar 2012 06:04:26 +0000 (23:04 -0700)]
Eliminate hairy COITERATE macro

I decided that the COITERATE macro was, in the end causing
more confusion that it would save and decided just to write
out the loops that I needed for parallel diff list iteration.
It is not that much code and this just feels less obfuscated.

12 years agoFix error in tree iterator when popping up trees
Russell Belfer [Mon, 26 Mar 2012 04:26:48 +0000 (21:26 -0700)]
Fix error in tree iterator when popping up trees

There was an error in the tree iterator where it would
delete two tree levels instead of just one when popping
up a tree level.  Unfortunately the test data for the
tree iterator did not have any deep trees with subtrees
in the middle of the tree items, so this problem went
unnoticed.  This contains the 1-line fix plus new test
data and tests that reveal the issue.

12 years agoRestore default status recursion behavior
Russell Belfer [Fri, 23 Mar 2012 18:03:01 +0000 (11:03 -0700)]
Restore default status recursion behavior

This gives `git_status_foreach()` back its old behavior of
emulating the "--untracked=all" behavior of git.  You can
get any of the various --untracked options by passing flags
to `git_status_foreach_ext()` but the basic version will
keep the behavior it has always had.

12 years agoFix crash in new status and add recurse option
Russell Belfer [Fri, 23 Mar 2012 16:26:09 +0000 (09:26 -0700)]
Fix crash in new status and add recurse option

This fixes the bug that @nulltoken found (thank you!) where
if there were untracked directories alphabetically after the
last tracked item, the diff implementation would deref a NULL
pointer.

The fix involved the code which decides if it is necessary
to recurse into a directory in the working dir, so it was
easy to add a new option `GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS`
to control if the contents of untracked directories should be
included in status.

12 years agoMerge pull request #607 from nulltoken/fix/file-close-on-error
Russell Belfer [Thu, 22 Mar 2012 20:37:47 +0000 (13:37 -0700)]
Merge pull request #607 from nulltoken/fix/file-close-on-error

test helpers: Fix file close on error

12 years agoMigrate remaining status tests to Clar
Russell Belfer [Thu, 22 Mar 2012 20:10:23 +0000 (13:10 -0700)]
Migrate remaining status tests to Clar

This finishes up the migration of remaining tests from
tests/t18-status.c over the tests-clar/status/worktree.c.

12 years agoMore status testing
Russell Belfer [Thu, 22 Mar 2012 19:03:30 +0000 (12:03 -0700)]
More status testing

This "fixes" the broken t18 status tests to accurately reflect
the new behavior for "created" untracked subdirectories.  See
discussion in the PR for more details.

This also contains the submodules unit test that I forgot to
git add, and ports most of the t18-status.c tests to clar (still
missing a couple of the git_status_file() single file tests).

12 years agoNew status fixes
Russell Belfer [Thu, 22 Mar 2012 17:44:36 +0000 (10:44 -0700)]
New status fixes

This adds support for roughly-right tracking of submodules
(although it does not recurse into submodules to detect
internal modifications a la core git), and it adds support
for including unmodified files in diff iteration if requested.

12 years agoAdding new tests for new status command
Russell Belfer [Thu, 22 Mar 2012 16:17:34 +0000 (09:17 -0700)]
Adding new tests for new status command

This is a work in progress.  This adds two new sets of tests,
the issue_592 tests from @nulltoken's pull request #601 and
some new tests for submodules.  The submodule tests still have
issues where the status is not reported correctly.  That needs
to be fixed before merge.

12 years agoReimplment git_status_foreach using git diff
Russell Belfer [Wed, 21 Mar 2012 19:33:09 +0000 (12:33 -0700)]
Reimplment git_status_foreach using git diff

This is an initial reimplementation of status using diff a la
the way that core git does it.

12 years agoMerge pull request #602 from arrbee/more-error-handling
Russell Belfer [Wed, 21 Mar 2012 18:01:46 +0000 (11:01 -0700)]
Merge pull request #602 from arrbee/more-error-handling

More error handling conversions

12 years agotest_helpers: fix unepextected closing of file on error
nulltoken [Wed, 21 Mar 2012 07:10:40 +0000 (08:10 +0100)]
test_helpers: fix unepextected closing of file on error

12 years agoConvert reflog to new errors
Russell Belfer [Wed, 21 Mar 2012 04:57:38 +0000 (21:57 -0700)]
Convert reflog to new errors

Cleaned up some other issues.

12 years agoConvert indexer, notes, sha1_lookup, and signature
Russell Belfer [Tue, 20 Mar 2012 00:49:46 +0000 (17:49 -0700)]
Convert indexer, notes, sha1_lookup, and signature

More files moved to new error handling style.

12 years agoMigrate index, oid, and utils to new errors
Russell Belfer [Mon, 19 Mar 2012 23:10:11 +0000 (16:10 -0700)]
Migrate index, oid, and utils to new errors

This includes a few cleanups that came up while converting
these files.

This commit introduces a could new git error classes, including
the catchall class: GITERR_INVALID which I'm using as the class
for invalid and out of range values which are detected at too low
a level of library to use a higher level classification.  For
example, an overflow error in parsing an integer or a bad letter
in parsing an OID string would generate an error in this class.

12 years agoUpdate to latest clar
Russell Belfer [Mon, 19 Mar 2012 23:09:03 +0000 (16:09 -0700)]
Update to latest clar

12 years agoConvert attr, ignore, mwindow, status to new errors
Russell Belfer [Fri, 16 Mar 2012 22:56:01 +0000 (15:56 -0700)]
Convert attr, ignore, mwindow, status to new errors

Also cleaned up some previously converted code that still had
little things to polish.

12 years agoMerge pull request #600 from nulltoken/fix/windows-network-paths
Vicent Martí [Fri, 16 Mar 2012 19:41:09 +0000 (12:41 -0700)]
Merge pull request #600 from nulltoken/fix/windows-network-paths

Fix windows network paths

12 years agoMake git_path_root() cope with windows network paths
nulltoken [Fri, 16 Mar 2012 14:16:52 +0000 (15:16 +0100)]
Make git_path_root() cope with windows network paths

Fix libgit2/libgit2sharp#125

12 years agoMerge pull request #595 from arrbee/new-errors-odb
Vicent Martí [Thu, 15 Mar 2012 00:41:04 +0000 (17:41 -0700)]
Merge pull request #595 from arrbee/new-errors-odb

Update odb code to new error handling

12 years agoContinue error conversion
Russell Belfer [Thu, 15 Mar 2012 00:36:15 +0000 (17:36 -0700)]
Continue error conversion

This converts blob.c, fileops.c, and all of the win32 files.
Also, various minor cleanups throughout the code.  Plus, in
testing the win32 build, I cleaned up a bunch (although not
all) of the warnings with the 64-bit build.

12 years agoConvert attr and other files to new errors
Russell Belfer [Wed, 14 Mar 2012 18:07:14 +0000 (11:07 -0700)]
Convert attr and other files to new errors

This continues to add other files to the new error handling
style.  I think the only real concerns here are that there are
a couple of error return cases that I have converted to asserts,
but I think that it was the correct thing to do given the new
error style.

12 years agoResolve comments from pull request
Russell Belfer [Tue, 13 Mar 2012 21:23:24 +0000 (14:23 -0700)]
Resolve comments from pull request

This converts the map validation function into a macro, tweaks
the GITERR_OS system error automatic appending, and adds a
tentative new error access API and some quick unit tests for
both the old and new error APIs.

12 years agoAdd map.c with shared p_mmap param validation
Russell Belfer [Tue, 13 Mar 2012 06:06:31 +0000 (23:06 -0700)]
Add map.c with shared p_mmap param validation

Forgot to add this file in the previous commit

12 years agoMigrate ODB files to new error handling
Russell Belfer [Tue, 13 Mar 2012 05:55:40 +0000 (22:55 -0700)]
Migrate ODB files to new error handling

This migrates odb.c, odb_loose.c, odb_pack.c and pack.c to
the new style of error handling.  Also got the unix and win32
versions of map.c.  There are some minor changes to other
files but no others were completely converted.

This also contains an update to filebuf so that a zeroed out
filebuf will not think that the fd (== 0) is actually open
(and inadvertently call close() on fd 0 if cleaned up).

Lastly, this was built and tested on win32 and contains a
bunch of fixes for the win32 build which was pretty broken.

12 years agoerror-handling: On-disk config file backend
Vicent Martí [Fri, 9 Mar 2012 18:55:50 +0000 (19:55 +0100)]
error-handling: On-disk config file backend

Includes:

- Proper error reporting when encountering syntax errors in a
config file (file, line number, column).

- Rewritten `config_write`, now with 99% less goto-spaghetti

- Error state in `git_filebuf`: filebuf write functions no longer
need to be checked for error returns. If any of the writes performed
on a buffer fail, the last call to `git_filebuf_commit` or
`git_filebuf_hash` will fail accordingly and set the appropiate error
message. Baller!

12 years agoMerge pull request #590 from arrbee/new-error-handling
Russell Belfer [Wed, 7 Mar 2012 18:55:18 +0000 (10:55 -0800)]
Merge pull request #590 from arrbee/new-error-handling

Migrating diff to new error handling

12 years agoFix issues raised on pull request
Russell Belfer [Wed, 7 Mar 2012 18:52:17 +0000 (10:52 -0800)]
Fix issues raised on pull request

This resolves the comments on pull request #590

12 years agoerror-handling: Config
Vicent Martí [Wed, 7 Mar 2012 00:37:09 +0000 (01:37 +0100)]
error-handling: Config

12 years agoMigrating diff to new error handling
Russell Belfer [Wed, 7 Mar 2012 00:14:31 +0000 (16:14 -0800)]
Migrating diff to new error handling

Ended up migrating a bunch of upstream functions as well
including vector, attr_file, and odb in order to get this
to work right.

12 years agoerror-handling: Repository
Vicent Martí [Tue, 6 Mar 2012 23:02:55 +0000 (00:02 +0100)]
error-handling: Repository

This also includes droping `git_buf_lasterror` because it makes no sense
in the new system. Note that in most of the places were it has been
dropped, the code needs cleanup. I.e. GIT_ENOMEM is going away, so
instead it should return a generic `-1` and obviously not throw
anything.

12 years agodiff: Fix rebase breackage
Vicent Martí [Tue, 6 Mar 2012 00:37:56 +0000 (01:37 +0100)]
diff: Fix rebase breackage

12 years agoerror-handling: References
Vicent Martí [Thu, 16 Feb 2012 23:13:34 +0000 (00:13 +0100)]
error-handling: References

Yes, this is error handling solely for `refs.c`, but some of the
abstractions leak all ofer the code base.

12 years agorefs: Error handling rework. WIP
Vicent Martí [Wed, 15 Feb 2012 15:54:17 +0000 (16:54 +0100)]
refs: Error handling rework. WIP

12 years agoerror-handling: Add new routines
Vicent Martí [Tue, 14 Feb 2012 20:23:11 +0000 (21:23 +0100)]
error-handling: Add new routines

Obviously all the old throw routines are still in place, so we can
gradually port over.

12 years agoerror-handling: Add reference documentation
Vicent Martí [Tue, 14 Feb 2012 19:36:39 +0000 (20:36 +0100)]
error-handling: Add reference documentation

12 years agoFixes for merge of filters branch
Russell Belfer [Fri, 2 Mar 2012 23:57:06 +0000 (15:57 -0800)]
Fixes for merge of filters branch

12 years agoRevert GIT_STATUS constants to avoid issues
Russell Belfer [Thu, 1 Mar 2012 19:45:00 +0000 (11:45 -0800)]
Revert GIT_STATUS constants to avoid issues

This reverts the changes to the GIT_STATUS constants and adds a
new enumeration to describe the type of change in a git_diff_delta.
I don't love this solution, but it should prevent strange errors
from occurring for now.  Eventually, I would like to unify the
various status constants, but it needs a larger plan and I just
wanted to eliminate this breakage quickly.

12 years agoFixing memory leaks indicated by valgrind
Russell Belfer [Wed, 29 Feb 2012 22:19:39 +0000 (14:19 -0800)]
Fixing memory leaks indicated by valgrind

This clears up the memory leaks that valgrind seems to find on
my machine.

12 years agoFix a win32 warning message
Russell Belfer [Wed, 29 Feb 2012 21:19:31 +0000 (13:19 -0800)]
Fix a win32 warning message

12 years agoClean up GIT_UNUSED macros on all platforms
Russell Belfer [Wed, 29 Feb 2012 20:04:59 +0000 (12:04 -0800)]
Clean up GIT_UNUSED macros on all platforms

It turns out that commit 31e9cfc4cbcaf1b38cdd3dbe3282a8f57e5366a5
did not fix the GIT_USUSED behavior on all platforms.  This commit
walks through and really cleans things up more thoroughly, getting
rid of the unnecessary stuff.

To remove the use of some GIT_UNUSED, I ended up adding a couple
of new iterators for hashtables that allow you to iterator just
over keys or just over values.

In making this change, I found a bug in the clar tests (where we
were doing *count++ but meant to do (*count)++ to increment the
value).  I fixed that but then found the test failing because it
was not really using an empty repo.  So, I took some of the code
that I wrote for iterator testing and moved it to clar_helpers.c,
then made use of that to make it easier to open fixtures on a
per test basis even within a single test file.

12 years agoUpdate diff to use iterators
Russell Belfer [Wed, 29 Feb 2012 00:14:47 +0000 (16:14 -0800)]
Update diff to use iterators

This is a major reorganization of the diff code.  This changes
the diff functions to use the iterators for traversing the
content.  This allowed a lot of code to be simplified.  Also,
this moved the functions relating to outputting a diff into a
new file (diff_output.c).

This includes a number of other changes - adding utility
functions, extending iterators, etc. plus more tests for the
diff code.  This also takes the example diff.c program much
further in terms of emulating git-diff command line options.

12 years agoFixing unit tests post rebase
Russell Belfer [Tue, 21 Feb 2012 23:09:04 +0000 (15:09 -0800)]
Fixing unit tests post rebase

Some changes that merged cleanly actually broke the unit
tests, so this fixes them.

12 years agoFirst pass of diff index to workdir implementation
Russell Belfer [Tue, 14 Feb 2012 01:29:30 +0000 (17:29 -0800)]
First pass of diff index to workdir implementation

This is an initial version of git_diff_workdir_to_index.  It
also includes renaming some structures and some refactoring
of the existing code so that it could be shared better with
the new function.

This is not complete since it needs a rebase to get some
new odb functions from the upstream branch.

12 years agoAdd tests and fix bugs for diff whitespace options
Russell Belfer [Tue, 7 Feb 2012 23:30:18 +0000 (15:30 -0800)]
Add tests and fix bugs for diff whitespace options

Once I added tests for the whitespace handling options of
diff, I realized that there were some bugs.  This fixes
those and adds the new tests into the test suite.

12 years agoContinue implementation of git-diff
Russell Belfer [Tue, 7 Feb 2012 20:14:28 +0000 (12:14 -0800)]
Continue implementation of git-diff

* Implemented git_diff_index_to_tree
* Reworked git_diff_options structure to handle more options
* Made most of the options in git_diff_options actually work
* Reorganized code a bit to remove some redundancy
* Added option parsing to examples/diff.c to test most options

12 years agoFix minor WIN32 incompatibility
Russell Belfer [Sat, 4 Feb 2012 01:05:05 +0000 (17:05 -0800)]
Fix minor WIN32 incompatibility

File mode flags are not all defined on WIN32, but since git
is so rigid in how it uses file modes, there is no reason not
to hard code a particular value.  Also, this is only used in
the git_diff_print_compact helper function, so it is really
really not important.

12 years agoClean up diff implementation for review
Russell Belfer [Sat, 4 Feb 2012 00:53:01 +0000 (16:53 -0800)]
Clean up diff implementation for review

This fixes several bugs, updates tests and docs, eliminates the
FILE* assumption in favor of printing callbacks for the diff patch
formatter helpers, and adds a "diff" example function that can
perform a diff from the command line.

12 years agoImplement diff lists and formatters
Russell Belfer [Fri, 3 Feb 2012 02:03:43 +0000 (18:03 -0800)]
Implement diff lists and formatters

This reworks the diff API to separate the steps of producing
a diff descriptions from formatting the diff.  This will allow
us to share diff output code with the various diff creation
scenarios and will allow us to implement rename detection as
an optional pass that can be run on a diff list.

12 years agoInitial implementation of git_diff_blob
Russell Belfer [Fri, 27 Jan 2012 19:29:25 +0000 (11:29 -0800)]
Initial implementation of git_diff_blob

This gets the basic plumbing in place for git_diff_blob.
There is a known issue where additional parameters like
the number of lines of context to display on the diff
are not working correctly (which leads one of the new
unit tests to fail).

12 years agoEliminate xdiff compiler warnings
Russell Belfer [Tue, 24 Jan 2012 22:08:20 +0000 (14:08 -0800)]
Eliminate xdiff compiler warnings

This cleans up the various GCC compiler warnings with the
xdiff code that was copied in.