summaryrefslogtreecommitdiff
path: root/src/diff_output.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-10-05 15:56:57 -0700
committerRussell Belfer <rb@github.com>2012-10-09 11:59:34 -0700
commit0d64bef941928046d114c4da1acb70bd2907855e (patch)
tree4ae0ac6484c62b0a63ca44f937d67ba15f97d7f0 /src/diff_output.c
parentf3a04e0f49d0f46e578613d1c27161abc4c2bf22 (diff)
downloadlibgit2-0d64bef941928046d114c4da1acb70bd2907855e.tar.gz
Add complex checkout test and then fix checkout
This started as a complex new test for checkout going through the "typechanges" test repository, but that revealed numerous issues with checkout, including: * complete failure with submodules * failure to create blobs with exec bits * problems when replacing a tree with a blob because the tree "example/" sorts after the blob "example" so the delete was being processed after the single file blob was created This fixes most of those problems and includes a number of other minor changes that made it easier to do that, including improving the TYPECHANGE support in diff/status, etc.
Diffstat (limited to 'src/diff_output.c')
-rw-r--r--src/diff_output.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/diff_output.c b/src/diff_output.c
index 10fbd391c..5f0d13c64 100644
--- a/src/diff_output.c
+++ b/src/diff_output.c
@@ -533,6 +533,11 @@ static int diff_patch_load(
if (delta->binary == 1)
goto cleanup;
+ if (!ctxt->hunk_cb &&
+ !ctxt->data_cb &&
+ (ctxt->opts->flags & GIT_DIFF_SKIP_BINARY_CHECK) != 0)
+ goto cleanup;
+
switch (delta->status) {
case GIT_DELTA_ADDED:
delta->old_file.flags |= GIT_DIFF_FILE_NO_DATA;
@@ -698,8 +703,10 @@ static int diff_patch_generate(
if ((patch->flags & GIT_DIFF_PATCH_DIFFABLE) == 0)
return 0;
- if (ctxt)
- patch->ctxt = ctxt;
+ if (!ctxt->file_cb && !ctxt->hunk_cb)
+ return 0;
+
+ patch->ctxt = ctxt;
memset(&xdiff_callback, 0, sizeof(xdiff_callback));
xdiff_callback.outf = diff_patch_cb;
@@ -1360,7 +1367,9 @@ int git_diff_get_patch(
if (delta_ptr)
*delta_ptr = delta;
- if (!patch_ptr && delta->binary != -1)
+ if (!patch_ptr &&
+ (delta->binary != -1 ||
+ (diff->opts.flags & GIT_DIFF_SKIP_BINARY_CHECK) != 0))
return 0;
diff_context_init(