diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/apply.c | 10 | ||||
| -rw-r--r-- | src/transaction.c | 8 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/apply.c b/src/apply.c index 04242621a..65b057c60 100644 --- a/src/apply.c +++ b/src/apply.c @@ -845,13 +845,17 @@ int git_apply( (error = git_reader_for_index(&post_reader, repo, postimage)) < 0) goto done; - if ((error = git_repository_index(&index, repo)) < 0 || - (error = git_indexwriter_init(&indexwriter, index)) < 0) - goto done; + if (!(opts.flags & GIT_APPLY_CHECK)) + if ((error = git_repository_index(&index, repo)) < 0 || + (error = git_indexwriter_init(&indexwriter, index)) < 0) + goto done; if ((error = apply_deltas(repo, pre_reader, preimage, post_reader, postimage, diff, &opts)) < 0) goto done; + if ((opts.flags & GIT_APPLY_CHECK)) + goto done; + switch (location) { case GIT_APPLY_LOCATION_BOTH: error = git_apply__to_workdir(repo, diff, preimage, postimage, location, &opts); diff --git a/src/transaction.c b/src/transaction.c index 5dd7f42db..7367d1240 100644 --- a/src/transaction.c +++ b/src/transaction.c @@ -334,7 +334,13 @@ int git_transaction_commit(git_transaction *tx) return error; } - if (node->ref_type != GIT_REFERENCE_INVALID) { + if (node->ref_type == GIT_REFERENCE_INVALID) { + /* ref was locked but not modified */ + if ((error = git_refdb_unlock(tx->db, node->payload, false, false, NULL, NULL, NULL)) < 0) { + return error; + } + node->committed = true; + } else { if ((error = update_target(tx->db, node)) < 0) return error; } |
