diff options
author | nulltoken <emeric.fermas@gmail.com> | 2013-05-13 21:57:37 +0200 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-05-15 22:41:30 +0200 |
commit | 1fed6b07f0722c8b4349ff3709a49df3d3c9ae61 (patch) | |
tree | 2c1b791be59a061bebab3392575a0b90dc323b23 /src | |
parent | f0ab73720a4e7a9b37c901a27519ea65eafeb8a6 (diff) | |
download | libgit2-1fed6b07f0722c8b4349ff3709a49df3d3c9ae61.tar.gz |
Fix trailing whitespaces
Diffstat (limited to 'src')
-rw-r--r-- | src/checkout.c | 2 | ||||
-rw-r--r-- | src/clone.c | 2 | ||||
-rw-r--r-- | src/diff_tform.c | 6 | ||||
-rw-r--r-- | src/hashsig.c | 1 | ||||
-rw-r--r-- | src/index.c | 38 | ||||
-rw-r--r-- | src/merge.c | 327 | ||||
-rw-r--r-- | src/merge.h | 36 | ||||
-rw-r--r-- | src/merge_file.c | 47 | ||||
-rw-r--r-- | src/merge_file.h | 6 | ||||
-rw-r--r-- | src/pathspec.c | 2 | ||||
-rw-r--r-- | src/refdb_fs.c | 6 | ||||
-rw-r--r-- | src/reset.c | 2 | ||||
-rw-r--r-- | src/revparse.c | 1 | ||||
-rw-r--r-- | src/signature.c | 2 | ||||
-rw-r--r-- | src/trace.c | 3 | ||||
-rw-r--r-- | src/trace.h | 6 | ||||
-rw-r--r-- | src/transports/local.c | 2 | ||||
-rw-r--r-- | src/win32/findfile.c | 1 | ||||
-rw-r--r-- | src/win32/posix_w32.c | 2 |
19 files changed, 243 insertions, 249 deletions
diff --git a/src/checkout.c b/src/checkout.c index 68028dfef..8f5575779 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -771,7 +771,7 @@ static int blob_content_to_link( if ((error = git_futils_mkpath2file(path, dir_mode)) < 0) return error; - + if ((error = git_blob__getbuf(&linktarget, blob)) < 0) return error; diff --git a/src/clone.c b/src/clone.c index 499195dcc..7ebdb5765 100644 --- a/src/clone.c +++ b/src/clone.c @@ -274,7 +274,7 @@ static int update_head_to_branch( int retcode; git_buf remote_branch_name = GIT_BUF_INIT; git_reference* remote_ref = NULL; - + assert(options->checkout_branch); if ((retcode = git_buf_printf(&remote_branch_name, GIT_REFS_REMOTES_DIR "%s/%s", diff --git a/src/diff_tform.c b/src/diff_tform.c index 201a0e896..e88525654 100644 --- a/src/diff_tform.c +++ b/src/diff_tform.c @@ -178,7 +178,7 @@ int git_diff_find_similar__hashsig_for_file( GIT_UNUSED(f); error = git_hashsig_create_fromfile((git_hashsig **)out, path, opt); - + if (error == GIT_EBUFS) { error = 0; giterr_clear(); @@ -195,7 +195,7 @@ int git_diff_find_similar__hashsig_for_buf( GIT_UNUSED(f); error = git_hashsig_create((git_hashsig **)out, buf, len, opt); - + if (error == GIT_EBUFS) { error = 0; giterr_clear(); @@ -437,7 +437,7 @@ static int similarity_measure( return -1; if (!cache[b_idx] && similarity_calc(diff, opts, b_idx, cache) < 0) return -1; - + /* some metrics may not wish to process this file (too big / too small) */ if (!cache[a_idx] || !cache[b_idx]) return 0; diff --git a/src/hashsig.c b/src/hashsig.c index 3a75aaaed..ab8d8b3f0 100644 --- a/src/hashsig.c +++ b/src/hashsig.c @@ -365,4 +365,3 @@ int git_hashsig_compare(const git_hashsig *a, const git_hashsig *b) return (hashsig_heap_compare(&a->mins, &b->mins) + hashsig_heap_compare(&a->maxs, &b->maxs)) / 2; } - diff --git a/src/index.c b/src/index.c index 53edb4874..4b3c2bb4b 100644 --- a/src/index.c +++ b/src/index.c @@ -381,7 +381,7 @@ void git_index_clear(git_index *index) git_index_reuc_clear(index); git_index_name_clear(index); - + git_futils_filestamp_set(&index->stamp, NULL); git_tree_cache_free(index->tree); @@ -1108,7 +1108,7 @@ const git_index_name_entry *git_index_name_get_byindex( git_index *index, size_t n) { assert(index); - + git_vector_sort(&index->names); return git_vector_get(&index->names, n); } @@ -1122,7 +1122,7 @@ int git_index_name_add(git_index *index, conflict_name = git__calloc(1, sizeof(git_index_name_entry)); GITERR_CHECK_ALLOC(conflict_name); - + if (ancestor) { conflict_name->ancestor = git__strdup(ancestor); GITERR_CHECK_ALLOC(conflict_name->ancestor); @@ -1137,7 +1137,7 @@ int git_index_name_add(git_index *index, conflict_name->theirs = git__strdup(theirs); GITERR_CHECK_ALLOC(conflict_name->theirs); } - + return git_vector_insert(&index->names, conflict_name); } @@ -1147,7 +1147,7 @@ void git_index_name_clear(git_index *index) git_index_name_entry *conflict_name; assert(index); - + git_vector_foreach(&index->names, i, conflict_name) { if (conflict_name->ancestor) git__free(conflict_name->ancestor); @@ -1160,7 +1160,7 @@ void git_index_name_clear(git_index *index) git__free(conflict_name); } - + git_vector_clear(&index->names); } @@ -1354,7 +1354,7 @@ static int read_reuc(git_index *index, const char *buffer, size_t size) static int read_conflict_names(git_index *index, const char *buffer, size_t size) { size_t len; - + /* This gets called multiple times, the vector might already be initialized */ if (index->names._alloc_size == 0 && git_vector_init(&index->names, 16, conflict_name_cmp) < 0) @@ -1375,7 +1375,7 @@ static int read_conflict_names(git_index *index, const char *buffer, size_t size \ buffer += len; \ size -= len; - + while (size) { git_index_name_entry *conflict_name = git__calloc(1, sizeof(git_index_name_entry)); GITERR_CHECK_ALLOC(conflict_name); @@ -1383,17 +1383,17 @@ static int read_conflict_names(git_index *index, const char *buffer, size_t size read_conflict_name(conflict_name->ancestor); read_conflict_name(conflict_name->ours); read_conflict_name(conflict_name->theirs); - + if (git_vector_insert(&index->names, conflict_name) < 0) return -1; } #undef read_conflict_name - + /* entries are guaranteed to be sorted on-disk */ index->names.sorted = 1; - - return 0; + + return 0; } static size_t read_entry(git_index_entry *dest, const void *buffer, size_t buffer_size) @@ -1724,7 +1724,7 @@ static int create_name_extension_data(git_buf *name_buf, git_index_name_entry *c error = git_buf_put(name_buf, "\0", 1); else error = git_buf_put(name_buf, conflict_name->ancestor, strlen(conflict_name->ancestor) + 1); - + if (error != 0) goto on_error; @@ -1753,20 +1753,20 @@ static int write_name_extension(git_index *index, git_filebuf *file) struct index_extension extension; size_t i; int error = 0; - + git_vector_foreach(out, i, conflict_name) { if ((error = create_name_extension_data(&name_buf, conflict_name)) < 0) goto done; } - + memset(&extension, 0x0, sizeof(struct index_extension)); memcpy(&extension.signature, INDEX_EXT_CONFLICT_NAME_SIG, 4); extension.extension_size = (uint32_t)name_buf.size; - + error = write_extension(file, &extension, &name_buf); - + git_buf_free(&name_buf); - + done: return error; } @@ -1844,7 +1844,7 @@ static int write_index(git_index *index, git_filebuf *file) /* write the rename conflict extension */ if (index->names.length > 0 && write_name_extension(index, file) < 0) return -1; - + /* write the reuc extension */ if (index->reuc.length > 0 && write_reuc_extension(index, file) < 0) return -1; diff --git a/src/merge.c b/src/merge.c index 117af8179..de5d65ac0 100644 --- a/src/merge.c +++ b/src/merge.c @@ -370,14 +370,14 @@ static int merge_conflict_resolve_trivial( if (conflict->type == GIT_MERGE_DIFF_DIRECTORY_FILE || conflict->type == GIT_MERGE_DIFF_RENAMED_ADDED) return 0; - + if (conflict->our_status == GIT_DELTA_RENAMED || conflict->their_status == GIT_DELTA_RENAMED) return 0; ours_empty = !GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->our_entry); theirs_empty = !GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->their_entry); - + ours_changed = (conflict->our_status != GIT_DELTA_UNMODIFIED); theirs_changed = (conflict->their_status != GIT_DELTA_UNMODIFIED); ours_theirs_differ = ours_changed && theirs_changed && @@ -433,7 +433,7 @@ static int merge_conflict_resolve_trivial( *resolved = 1; /* Note: trivial resolution does not update the REUC. */ - + return error; } @@ -486,9 +486,9 @@ static int merge_conflict_resolve_one_renamed( int ours_changed, theirs_changed; git_index_entry *merged; int error = 0; - + assert(resolved && diff_list && conflict); - + *resolved = 0; if (!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->our_entry) || @@ -497,7 +497,7 @@ static int merge_conflict_resolve_one_renamed( ours_renamed = (conflict->our_status == GIT_DELTA_RENAMED); theirs_renamed = (conflict->their_status == GIT_DELTA_RENAMED); - + if (!ours_renamed && !theirs_renamed) return 0; @@ -509,7 +509,7 @@ static int merge_conflict_resolve_one_renamed( ours_changed = (git_oid__cmp(&conflict->ancestor_entry.oid, &conflict->our_entry.oid) != 0); theirs_changed = (git_oid__cmp(&conflict->ancestor_entry.oid, &conflict->their_entry.oid) != 0); - + /* if both are modified (and not to a common target) require a merge */ if (ours_changed && theirs_changed && git_oid__cmp(&conflict->our_entry.oid, &conflict->their_entry.oid) != 0) @@ -517,7 +517,7 @@ static int merge_conflict_resolve_one_renamed( if ((merged = git_pool_malloc(&diff_list->pool, sizeof(git_index_entry))) == NULL) return -1; - + if (ours_changed) memcpy(merged, &conflict->our_entry, sizeof(git_index_entry)); else @@ -527,12 +527,12 @@ static int merge_conflict_resolve_one_renamed( merged->path = conflict->our_entry.path; else merged->path = conflict->their_entry.path; - + *resolved = 1; - + git_vector_insert(&diff_list->staged, merged); git_vector_insert(&diff_list->resolved, (git_merge_diff *)conflict); - + return error; } @@ -550,11 +550,11 @@ static int merge_conflict_resolve_automerge( git_odb *odb = NULL; git_oid automerge_oid; int error = 0; - + assert(resolved && diff_list && conflict); - + *resolved = 0; - + if (automerge_flags == GIT_MERGE_AUTOMERGE_NONE) return 0; @@ -585,7 +585,7 @@ static int merge_conflict_resolve_automerge( !result.automergeable || (error = git_odb_write(&automerge_oid, odb, result.data, result.len, GIT_OBJ_BLOB)) < 0) goto done; - + if ((index_entry = git_pool_malloc(&diff_list->pool, sizeof(git_index_entry))) == NULL) GITERR_CHECK_ALLOC(index_entry); @@ -595,7 +595,7 @@ static int merge_conflict_resolve_automerge( index_entry->file_size = result.len; index_entry->mode = result.mode; git_oid_cpy(&index_entry->oid, &automerge_oid); - + git_vector_insert(&diff_list->staged, index_entry); git_vector_insert(&diff_list->resolved, (git_merge_diff *)conflict); @@ -607,7 +607,7 @@ done: git_merge_file_input_free(&theirs); git_merge_file_result_free(&result); git_odb_free(odb); - + return error; } @@ -619,16 +619,16 @@ static int merge_conflict_resolve( { int resolved = 0; int error = 0; - + *out = 0; - + if ((error = merge_conflict_resolve_trivial(&resolved, diff_list, conflict)) < 0) goto done; if (automerge_flags != GIT_MERGE_AUTOMERGE_NONE) { if (!resolved && (error = merge_conflict_resolve_one_removed(&resolved, diff_list, conflict)) < 0) goto done; - + if (!resolved && (error = merge_conflict_resolve_one_renamed(&resolved, diff_list, conflict)) < 0) goto done; @@ -637,7 +637,7 @@ static int merge_conflict_resolve( } *out = resolved; - + done: return error; } @@ -666,7 +666,7 @@ static int index_entry_similarity_exact( if (git_oid__cmp(&a->oid, &b->oid) == 0) return 100; - + return 0; } @@ -680,28 +680,28 @@ static int index_entry_similarity_calc( git_diff_file diff_file = {{{0}}}; git_off_t blobsize; int error; - + *out = NULL; if ((error = git_blob_lookup(&blob, repo, &entry->oid)) < 0) return error; - + git_oid_cpy(&diff_file.oid, &entry->oid); diff_file.path = entry->path; diff_file.size = entry->file_size; diff_file.mode = entry->mode; diff_file.flags = 0; - + blobsize = git_blob_rawsize(blob); /* file too big for rename processing */ if (!git__is_sizet(blobsize)) return 0; - + error = opts->metric->buffer_signature(out, &diff_file, git_blob_rawcontent(blob), (size_t)blobsize, opts->metric->payload); - + git_blob_free(blob); return error; @@ -718,16 +718,16 @@ static int index_entry_similarity_inexact( { int score = 0; int error = 0; - + if (GIT_MODE_TYPE(a->mode) != GIT_MODE_TYPE(b->mode)) return 0; - + /* update signature cache if needed */ if (!cache[a_idx] && (error = index_entry_similarity_calc(&cache[a_idx], repo, a, opts)) < 0) return error; if (!cache[b_idx] && (error = index_entry_similarity_calc(&cache[b_idx], repo, b, opts)) < 0) return error; - + /* some metrics may not wish to process this file (too big / too small) */ if (!cache[a_idx] || !cache[b_idx]) return 0; @@ -736,13 +736,13 @@ static int index_entry_similarity_inexact( if (opts->metric->similarity( &score, cache[a_idx], cache[b_idx], opts->metric->payload) < 0) return -1; - + /* clip score */ if (score < 0) score = 0; else if (score > 100) score = 100; - + return score; } @@ -758,7 +758,7 @@ static int merge_diff_mark_similarity( size_t i, j; git_merge_diff *conflict_src, *conflict_tgt; int similarity; - + git_vector_foreach(&diff_list->conflicts, i, conflict_src) { /* Items can be the source of a rename iff they have an item in the * ancestor slot and lack an item in the ours or theirs slot. */ @@ -766,63 +766,63 @@ static int merge_diff_mark_similarity( (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->our_entry) && GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->their_entry))) continue; - + git_vector_foreach(&diff_list->conflicts, j, conflict_tgt) { size_t our_idx = diff_list->conflicts.length + j; size_t their_idx = (diff_list->conflicts.length * 2) + j; - + if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_tgt->ancestor_entry)) continue; - + if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_tgt->our_entry) && !GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->our_entry)) { similarity = similarity_fn(repo, &conflict_src->ancestor_entry, i, &conflict_tgt->our_entry, our_idx, cache, opts); - + if (similarity == GIT_EBUFS) - continue; + continue; else if (similarity < 0) return similarity; - + if (similarity > similarity_ours[i].similarity && similarity > similarity_ours[j].similarity) { /* Clear previous best similarity */ if (similarity_ours[i].similarity > 0) similarity_ours[similarity_ours[i].other_idx].similarity = 0; - + if (similarity_ours[j].similarity > 0) similarity_ours[similarity_ours[j].other_idx].similarity = 0; - + similarity_ours[i].similarity = similarity; similarity_ours[i].other_idx = j; - + similarity_ours[j].similarity = similarity; similarity_ours[j].other_idx = i; } } - + if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_tgt->their_entry) && !GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->their_entry)) { similarity = similarity_fn(repo, &conflict_src->ancestor_entry, i, &conflict_tgt->their_entry, their_idx, cache, opts); - + if (similarity > similarity_theirs[i].similarity && similarity > similarity_theirs[j].similarity) { /* Clear previous best similarity */ if (similarity_theirs[i].similarity > 0) similarity_theirs[similarity_theirs[i].other_idx].similarity = 0; - + if (similarity_theirs[j].similarity > 0) similarity_theirs[similarity_theirs[j].other_idx].similarity = 0; - + similarity_theirs[i].similarity = similarity; similarity_theirs[i].other_idx = j; - + similarity_theirs[j].similarity = similarity; similarity_theirs[j].other_idx = i; } } } } - + return 0; } @@ -857,13 +857,13 @@ static void merge_diff_mark_rename_conflict( const git_merge_tree_opts *opts) { git_merge_diff *ours_source = NULL, *theirs_source = NULL; - + if (ours_renamed) ours_source = diff_list->conflicts.contents[ours_source_idx]; - + if (theirs_renamed) theirs_source = diff_list->conflicts.contents[theirs_source_idx]; - + /* Detect 2->1 conflicts */ if (ours_renamed && theirs_renamed) { /* Both renamed to the same target name. */ @@ -877,30 +877,30 @@ static void merge_diff_mark_rename_conflict( /* If our source was also renamed in theirs, this is a 1->2 */ if (similarity_theirs[ours_source_idx].similarity >= opts->rename_threshold) ours_source->type = GIT_MERGE_DIFF_BOTH_RENAMED_1_TO_2; - + else if (GIT_MERGE_INDEX_ENTRY_EXISTS(target->their_entry)) { ours_source->type = GIT_MERGE_DIFF_RENAMED_ADDED; target->type = GIT_MERGE_DIFF_RENAMED_ADDED; } - + else if (!GIT_MERGE_INDEX_ENTRY_EXISTS(ours_source->their_entry)) ours_source->type = GIT_MERGE_DIFF_RENAMED_DELETED; - + else if (ours_source->type == GIT_MERGE_DIFF_MODIFIED_DELETED) ours_source->type = GIT_MERGE_DIFF_RENAMED_MODIFIED; } else if (theirs_renamed) { /* If their source was also renamed in ours, this is a 1->2 */ if (similarity_ours[theirs_source_idx].similarity >= opts->rename_threshold) theirs_source->type = GIT_MERGE_DIFF_BOTH_RENAMED_1_TO_2; - + else if (GIT_MERGE_INDEX_ENTRY_EXISTS(target->our_entry)) { theirs_source->type = GIT_MERGE_DIFF_RENAMED_ADDED; target->type = GIT_MERGE_DIFF_RENAMED_ADDED; } - + else if (!GIT_MERGE_INDEX_ENTRY_EXISTS(theirs_source->our_entry)) theirs_source->type = GIT_MERGE_DIFF_RENAMED_DELETED; - + else if (theirs_source->type == GIT_MERGE_DIFF_MODIFIED_DELETED) theirs_source->type = GIT_MERGE_DIFF_RENAMED_MODIFIED; } @@ -915,7 +915,7 @@ GIT_INLINE(void) merge_diff_coalesce_rename( /* Coalesce the rename target into the rename source. */ memcpy(source_entry, target_entry, sizeof(git_index_entry)); *source_status = GIT_DELTA_RENAMED; - + memset(target_entry, 0x0, sizeof(git_index_entry)); *target_status = GIT_DELTA_UNMODIFIED; } @@ -930,50 +930,50 @@ static void merge_diff_list_coalesce_renames( bool ours_renamed = 0, theirs_renamed = 0; size_t ours_source_idx = 0, theirs_source_idx = 0; git_merge_diff *ours_source, *theirs_source, *target; - + for (i = 0; i < diff_list->conflicts.length; i++) { target = diff_list->conflicts.contents[i]; - + ours_renamed = 0; theirs_renamed = 0; - + if (GIT_MERGE_INDEX_ENTRY_EXISTS(target->our_entry) && similarity_ours[i].similarity >= opts->rename_threshold) { ours_source_idx = similarity_ours[i].other_idx; - + ours_source = diff_list->conflicts.contents[ours_source_idx]; - + merge_diff_coalesce_rename( &ours_source->our_entry, &ours_source->our_status, &target->our_entry, &target->our_status); - + similarity_ours[ours_source_idx].similarity = 0; similarity_ours[i].similarity = 0; - + ours_renamed = 1; } - + /* insufficient to determine direction */ if (GIT_MERGE_INDEX_ENTRY_EXISTS(target->their_entry) && similarity_theirs[i].similarity >= opts->rename_threshold) { theirs_source_idx = similarity_theirs[i].other_idx; - + theirs_source = diff_list->conflicts.contents[theirs_source_idx]; - + merge_diff_coalesce_rename( &theirs_source->their_entry, &theirs_source->their_status, &target->their_entry, &target->their_status); - + similarity_theirs[theirs_source_idx].similarity = 0; similarity_theirs[i].similarity = 0; - + theirs_renamed = 1; } - + merge_diff_mark_rename_conflict(diff_list, similarity_ours, ours_renamed, ours_source_idx, similarity_theirs, theirs_renamed, theirs_source_idx, @@ -984,7 +984,7 @@ static void merge_diff_list_coalesce_renames( static int merge_diff_empty(const git_vector *conflicts, size_t idx) { git_merge_diff *conflict = conflicts->contents[idx]; - + return (!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->ancestor_entry) && !GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->our_entry) && !GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->their_entry)); @@ -1000,7 +1000,7 @@ static void merge_diff_list_count_candidates( *src_count = 0; *tgt_count = 0; - + git_vector_foreach(&diff_list->conflicts, i, entry) { if (GIT_MERGE_INDEX_ENTRY_EXISTS(entry->ancestor_entry) && (!GIT_MERGE_INDEX_ENTRY_EXISTS(entry->our_entry) || @@ -1021,20 +1021,20 @@ int git_merge_diff_list__find_renames( size_t cache_size = 0; size_t src_count, tgt_count, i; int error = 0; - + assert(diff_list && opts); - + if ((opts->flags & GIT_MERGE_TREE_FIND_RENAMES) == 0) return 0; - + similarity_ours = git__calloc(diff_list->conflicts.length, sizeof(struct merge_diff_similarity)); GITERR_CHECK_ALLOC(similarity_ours); - + similarity_theirs = git__calloc(diff_list->conflicts.length, sizeof(struct merge_diff_similarity)); GITERR_CHECK_ALLOC(similarity_theirs); - + /* Calculate similarity between items that were deleted from the ancestor * and added in the other branch. */ @@ -1048,7 +1048,7 @@ int git_merge_diff_list__find_renames( GITERR_CHECK_ALLOC(cache); merge_diff_list_count_candidates(diff_list, &src_count, &tgt_count); - + if (src_count > opts->target_limit || tgt_count > opts->target_limit) { /* TODO: report! */ } else { @@ -1063,7 +1063,7 @@ int git_merge_diff_list__find_renames( * into the old name. */ merge_diff_list_coalesce_renames(diff_list, similarity_ours, similarity_theirs, opts); - + /* And remove any entries that were merged and are now empty. */ git_vector_remove_matching(&diff_list->conflicts, merge_diff_empty); @@ -1094,7 +1094,7 @@ GIT_INLINE(const char *) merge_diff_path( return conflict->our_entry.path; else if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->their_entry)) return conflict->their_entry.path; - + return NULL; } @@ -1106,7 +1106,7 @@ GIT_INLINE(bool) merge_diff_any_side_added_or_modified( conflict->their_status == GIT_DELTA_ADDED || conflict->their_status == GIT_DELTA_MODIFIED) return true; - + return false; } @@ -1114,11 +1114,11 @@ GIT_INLINE(bool) path_is_prefixed(const char *parent, const char *child) { size_t child_len = strlen(child); size_t parent_len = strlen(parent); - + if (child_len < parent_len || strncmp(parent, child, parent_len) != 0) return 0; - + return (child[parent_len] == '/'); } @@ -1127,7 +1127,7 @@ GIT_INLINE(int) merge_diff_detect_df_conflict( git_merge_diff *conflict) { const char *cur_path = merge_diff_path(conflict); - + /* Determine if this is a D/F conflict or the child of one */ if (df_data->df_path && path_is_prefixed(df_data->df_path, cur_path)) @@ -1139,14 +1139,14 @@ GIT_INLINE(int) merge_diff_detect_df_conflict( merge_diff_any_side_added_or_modified(conflict) && path_is_prefixed(df_data->prev_path, cur_path)) { conflict->type = GIT_MERGE_DIFF_DF_CHILD; - + df_data->prev_conflict->type = GIT_MERGE_DIFF_DIRECTORY_FILE; df_data->df_path = df_data->prev_path; } - + df_data->prev_path = cur_path; df_data->prev_conflict = conflict; - + return 0; } @@ -1172,7 +1172,7 @@ GIT_INLINE(int) merge_diff_detect_type( conflict->type = GIT_MERGE_DIFF_MODIFIED_DELETED; else conflict->type = GIT_MERGE_DIFF_NONE; - + return 0; } @@ -1183,11 +1183,11 @@ GIT_INLINE(int) index_entry_dup( { if (src != NULL) { memcpy(out, src, sizeof(git_index_entry)); - + if ((out->path = git_pool_strdup(pool, src->path)) == NULL) return -1; } - + return 0; } @@ -1208,7 +1208,7 @@ GIT_INLINE(int) merge_delta_type_from_index_entries( else if (git_oid__cmp(&ancestor->oid, &other->oid) || ancestor->mode != other->mode) return GIT_DELTA_MODIFIED; - + return GIT_DELTA_UNMODIFIED; } @@ -1218,20 +1218,20 @@ static git_merge_diff *merge_diff_from_index_entries( { git_merge_diff *conflict; git_pool *pool = &diff_list->pool; - + if ((conflict = git_pool_malloc(pool, sizeof(git_merge_diff))) == NULL) return NULL; - + if (index_entry_dup(&conflict->ancestor_entry, pool, entries[TREE_IDX_ANCESTOR]) < 0 || index_entry_dup(&conflict->our_entry, pool, entries[TREE_IDX_OURS]) < 0 || index_entry_dup(&conflict->their_entry, pool, entries[TREE_IDX_THEIRS]) < 0) return NULL; - + conflict->our_status = merge_delta_type_from_index_entries( entries[TREE_IDX_ANCESTOR], entries[TREE_IDX_OURS]); conflict->their_status = merge_delta_type_from_index_entries( entries[TREE_IDX_ANCESTOR], entries[TREE_IDX_THEIRS]); - + return conflict; } @@ -1243,13 +1243,13 @@ static int merge_index_insert_conflict( const git_index_entry *tree_items[3]) { git_merge_diff *conflict; - + if ((conflict = merge_diff_from_index_entries(diff_list, tree_items)) == NULL || merge_diff_detect_type(conflict) < 0 || merge_diff_detect_df_conflict(merge_df_data, conflict) < 0 || git_vector_insert(&diff_list->conflicts, conflict) < 0) return -1; - + return 0; } @@ -1259,13 +1259,13 @@ static int merge_index_insert_unmodified( { int error = 0; git_index_entry *entry; - + entry = git_pool_malloc(&diff_list->pool, sizeof(git_index_entry)); GITERR_CHECK_ALLOC(entry); - + if ((error = index_entry_dup(entry, &diff_list->pool, tree_items[0])) >= 0) error = git_vector_insert(&diff_list->staged, entry); - + return error; } @@ -1282,40 +1282,40 @@ int git_merge_diff_list__find_differences( int cur_item_modified; size_t i, j; int error = 0; - + assert(diff_list && our_tree && their_tree); if ((error = git_iterator_for_tree(&iterators[TREE_IDX_ANCESTOR], (git_tree *)ancestor_tree, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0 || (error = git_iterator_for_tree(&iterators[TREE_IDX_OURS], (git_tree *)our_tree, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0 || (error = git_iterator_for_tree(&iterators[TREE_IDX_THEIRS], (git_tree *)their_tree, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0) goto done; - + /* Set up the iterators */ for (i = 0; i < 3; i++) { if ((error = git_iterator_current(&items[i], iterators[i])) < 0) goto done; } - + while (true) { for (i = 0; i < 3; i++) cur_items[i] = NULL; best_cur_item = NULL; cur_item_modified = 0; - + /* Find the next path(s) to consume from each iterator */ for (i = 0; i < 3; i++) { if (items[i] == NULL) { cur_item_modified = 1; continue; } - + if (best_cur_item == NULL) { best_cur_item = items[i]; cur_items[i] = items[i]; } else { int path_diff = entry_compare(items[i], best_cur_item); - + if (path_diff < 0) { /* * Found an item that sorts before our current item, make @@ -1332,21 +1332,21 @@ int git_merge_diff_list__find_differences( cur_item_modified = 1; } else if (path_diff == 0) { cur_items[i] = items[i]; - + if (!cur_item_modified) cur_item_modified = index_entry_cmp(best_cur_item, items[i]); } } } - + if (best_cur_item == NULL) break; - + if (cur_item_modified) error = merge_index_insert_conflict(diff_list, &df_data, cur_items); else error = merge_index_insert_unmodified(diff_list, cur_items); - + /* Advance each iterator that participated */ for (i = 0; i < 3; i++) { if (cur_items[i] != NULL && @@ -1354,29 +1354,29 @@ int git_merge_diff_list__find_differences( goto done; } } - + done: for (i = 0; i < 3; i++) git_iterator_free(iterators[i]); - + return error; } git_merge_diff_list *git_merge_diff_list__alloc(git_repository *repo) { git_merge_diff_list *diff_list = git__calloc(1, sizeof(git_merge_diff_list)); - + if (diff_list == NULL) return NULL; - + diff_list->repo = repo; - + if (git_vector_init(&diff_list->staged, 0, NULL) < 0 || git_vector_init(&diff_list->conflicts, 0, NULL) < 0 || git_vector_init(&diff_list->resolved, 0, NULL) < 0 || git_pool_init(&diff_list->pool, 1, 0) < 0) return NULL; - + return diff_list; } @@ -1387,48 +1387,48 @@ static int merge_tree_normalize_opts( { git_config *cfg = NULL; int error = 0; - + assert(repo && opts); - + if ((error = git_repository_config__weakptr(&cfg, repo)) < 0) return error; - + if (given != NULL) memcpy(opts, given, sizeof(git_merge_tree_opts)); else { git_merge_tree_opts init = GIT_MERGE_TREE_OPTS_INIT; memcpy(opts, &init, sizeof(init)); - + opts->flags = GIT_MERGE_TREE_FIND_RENAMES; opts->rename_threshold = GIT_MERGE_TREE_RENAME_THRESHOLD; } - + if (!opts->target_limit) { int32_t limit = 0; - + opts->target_limit = GIT_MERGE_TREE_TARGET_LIMIT; - + if (git_config_get_int32(&limit, cfg, "merge.renameLimit") < 0) { giterr_clear(); - + if (git_config_get_int32(&limit, cfg, "diff.renameLimit") < 0) giterr_clear(); } - + if (limit > 0) opts->target_limit = limit; } - + /* assign the internal metric with whitespace flag as payload */ if (!opts->metric) { opts->metric = git__malloc(sizeof(git_diff_similarity_metric)); GITERR_CHECK_ALLOC(opts->metric); - + opts->metric->file_signature = git_diff_find_similar__hashsig_for_file; opts->metric->buffer_signature = git_diff_find_similar__hashsig_for_buf; opts->metric->free_signature = git_diff_find_similar__hashsig_free; opts->metric->similarity = git_diff_find_similar__calc_similarity; - + if (opts->flags & GIT_DIFF_FIND_IGNORE_WHITESPACE) opts->metric->payload = (void *)GIT_HASHSIG_IGNORE_WHITESPACE; else if (opts->flags & GIT_DIFF_FIND_DONT_IGNORE_WHITESPACE) @@ -1436,7 +1436,7 @@ static int merge_tree_normalize_opts( else opts->metric->payload = (void *)GIT_HASHSIG_SMART_WHITESPACE; } - + return 0; } @@ -1450,20 +1450,20 @@ static int merge_index_insert_reuc( int mode[3] = { 0, 0, 0 }; git_oid const *oid[3] = { NULL, NULL, NULL }; size_t i; - + if (!GIT_MERGE_INDEX_ENTRY_EXISTS(*entry)) return 0; - + if ((reuc = git_index_reuc_get_bypath(index, entry->path)) != NULL) { for (i = 0; i < 3; i++) { mode[i] = reuc->mode[i]; oid[i] = &reuc->oid[i]; } } - + mode[idx] = entry->mode; oid[idx] = &entry->oid; - + return git_index_reuc_add(index, entry->path, mode[0], oid[0], mode[1], oid[1], mode[2], oid[2]); } @@ -1475,58 +1475,58 @@ int index_from_diff_list(git_index **out, git_merge_diff_list *diff_list) git_index_entry *entry; git_merge_diff *conflict; int error = 0; - + *out = NULL; - + if ((error = git_index_new(&index)) < 0) return error; - + git_vector_foreach(&diff_list->staged, i, entry) { if ((error = git_index_add(index, entry)) < 0) goto on_error; } - + git_vector_foreach(&diff_list->conflicts, i, conflict) { const git_index_entry *ancestor = GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->ancestor_entry) ? &conflict->ancestor_entry : NULL; - + const git_index_entry *ours = GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->our_entry) ? &conflict->our_entry : NULL; - + const git_index_entry *theirs = GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->their_entry) ? &conflict->their_entry : NULL; - + if ((error = git_index_conflict_add(index, ancestor, ours, theirs)) < 0) goto on_error; } - + /* Add each rename entry to the rename portion of the index. */ git_vector_foreach(&diff_list->conflicts, i, conflict) { const char *ancestor_path, *our_path, *their_path; - + if (!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->ancestor_entry)) continue; - + ancestor_path = conflict->ancestor_entry.path; - + our_path = GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->our_entry) ? conflict->our_entry.path : NULL; - + their_path = GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->their_entry) ? conflict->their_entry.path : NULL; - + if ((our_path && strcmp(ancestor_path, our_path) != 0) || (their_path && strcmp(ancestor_path, their_path) != 0)) { if ((error = git_index_name_add(index, ancestor_path, our_path, their_path)) < 0) goto on_error; } } - + /* Add each entry in the resolved conflict to the REUC independently, since * the paths may differ due to renames. */ git_vector_foreach(&diff_list->resolved, i, conflict) { @@ -1537,7 +1537,7 @@ int index_from_diff_list(git_index **out, git_merge_diff_list *diff_list) const git_index_entry *ours = GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->our_entry) ? &conflict->our_entry : NULL; - + const git_index_entry *theirs = GIT_MERGE_INDEX_ENTRY_EXISTS(conflict->their_entry) ? &conflict->their_entry : NULL; @@ -1545,22 +1545,22 @@ int index_from_diff_list(git_index **out, git_merge_diff_list *diff_list) if (ancestor != NULL && (error = merge_index_insert_reuc(index, TREE_IDX_ANCESTOR, ancestor)) < 0) goto on_error; - + if (ours != NULL && (error = merge_index_insert_reuc(index, TREE_IDX_OURS, ours)) < 0) goto on_error; - + if (theirs != NULL && (error = merge_index_insert_reuc(index, TREE_IDX_THEIRS, theirs)) < 0) goto on_error; } - + *out = index; return 0; - + on_error: git_index_free(index); - + return error; } @@ -1582,33 +1582,33 @@ int git_merge_trees( assert(out && repo && our_tree && their_tree); *out = NULL; - + if ((error = merge_tree_normalize_opts(repo, &opts, given_opts)) < 0) return error; diff_list = git_merge_diff_list__alloc(repo); GITERR_CHECK_ALLOC(diff_list); - + if ((error = git_merge_diff_list__find_differences(diff_list, ancestor_tree, our_tree, their_tree)) < 0 || (error = git_merge_diff_list__find_renames(repo, diff_list, &opts)) < 0) goto done; - + memcpy(&changes, &diff_list->conflicts, sizeof(git_vector)); git_vector_clear(&diff_list->conflicts); - + git_vector_foreach(&changes, i, conflict) { int resolved = 0; - + if ((error = merge_conflict_resolve(&resolved, diff_list, conflict, opts.automerge_flags)) < 0) goto done; - + if (!resolved) git_vector_insert(&diff_list->conflicts, conflict); } - + if (!given_opts || !given_opts->metric) git__free(opts.metric); - + error = index_from_diff_list(out, diff_list); done: @@ -1621,11 +1621,10 @@ void git_merge_diff_list__free(git_merge_diff_list *diff_list) { if (!diff_list) return; - + git_vector_free(&diff_list->staged); git_vector_free(&diff_list->conflicts); git_vector_free(&diff_list->resolved); git_pool_clear(&diff_list->pool); git__free(diff_list); } - diff --git a/src/merge.h b/src/merge.h index da1fdf472..50538b12b 100644 --- a/src/merge.h +++ b/src/merge.h @@ -24,46 +24,46 @@ typedef enum { /* No conflict - a change only occurs in one branch. */ GIT_MERGE_DIFF_NONE = 0, - + /* Occurs when a file is modified in both branches. */ GIT_MERGE_DIFF_BOTH_MODIFIED = (1 << 0), - + /* Occurs when a file is added in both branches. */ GIT_MERGE_DIFF_BOTH_ADDED = (1 << 1), - + /* Occurs when a file is deleted in both branches. */ GIT_MERGE_DIFF_BOTH_DELETED = (1 << 2), - + /* Occurs when a file is modified in one branch and deleted in the other. */ GIT_MERGE_DIFF_MODIFIED_DELETED = (1 << 3), - + /* Occurs when a file is renamed in one branch and modified in the other. */ GIT_MERGE_DIFF_RENAMED_MODIFIED = (1 << 4), - + /* Occurs when a file is renamed in one branch and deleted in the other. */ GIT_MERGE_DIFF_RENAMED_DELETED = (1 << 5), - + /* Occurs when a file is renamed in one branch and a file with the same * name is added in the other. Eg, A->B and new file B. Core git calls * this a "rename/delete". */ GIT_MERGE_DIFF_RENAMED_ADDED = (1 << 6), - + /* Occurs when both a file is renamed to the same name in the ours and * theirs branches. Eg, A->B and A->B in both. Automergeable. */ GIT_MERGE_DIFF_BOTH_RENAMED = (1 << 7), - + /* Occurs when a file is renamed to different names in the ours and theirs * branches. Eg, A->B and A->C. */ GIT_MERGE_DIFF_BOTH_RENAMED_1_TO_2 = (1 << 8), - + /* Occurs when two files are renamed to the same name in the ours and * theirs branches. Eg, A->C and B->C. */ GIT_MERGE_DIFF_BOTH_RENAMED_2_TO_1 = (1 << 9), - + /* Occurs when an item at a path in one branch is a directory, and an * item at the same path in a different branch is a file. */ GIT_MERGE_DIFF_DIRECTORY_FILE = (1 << 10), - + /* The child of a folder that is in a directory/file conflict. */ GIT_MERGE_DIFF_DF_CHILD = (1 << 11), } git_merge_diff_type_t; @@ -72,20 +72,20 @@ typedef enum { typedef struct { git_repository *repo; git_pool pool; - + /* Vector of git_index_entry that represent the merged items that * have been staged, either because only one side changed, or because * the two changes were non-conflicting and mergeable. These items * will be written as staged entries in the main index. */ git_vector staged; - + /* Vector of git_merge_diff entries that represent the conflicts that * have not been automerged. These items will be written to high-stage * entries in the main index. */ git_vector conflicts; - + /* Vector of git_merge_diff that have been automerged. These items * will be written to the REUC when the index is produced. */ @@ -97,12 +97,12 @@ typedef struct { */ typedef struct { git_merge_diff_type_t type; - + git_index_entry ancestor_entry; - + git_index_entry our_entry; git_delta_t our_status; - + git_index_entry their_entry; git_delta_t their_status; } git_merge_diff; diff --git a/src/merge_file.c b/src/merge_file.c index 4b3f3730b..c3477ccb9 100644 --- a/src/merge_file.c +++ b/src/merge_file.c @@ -28,12 +28,12 @@ GIT_INLINE(const char *) merge_file_best_path( return NULL; } - + if (strcmp(ancestor->path, ours->path) == 0) return theirs->path; else if(strcmp(ancestor->path, theirs->path) == 0) return ours->path; - + return NULL; } @@ -51,15 +51,15 @@ GIT_INLINE(int) merge_file_best_mode( if (ours->mode == GIT_FILEMODE_BLOB_EXECUTABLE || theirs->mode == GIT_FILEMODE_BLOB_EXECUTABLE) return GIT_FILEMODE_BLOB_EXECUTABLE; - + return GIT_FILEMODE_BLOB; } - + if (ancestor->mode == ours->mode) return theirs->mode; else if(ancestor->mode == theirs->mode) return ours->mode; - + return 0; } @@ -70,27 +70,27 @@ int git_merge_file_input_from_index_entry( { git_odb *odb = NULL; int error = 0; - + assert(input && repo && entry); - + if (entry->mode == 0) return 0; - + if ((error = git_repository_odb(&odb, repo)) < 0 || (error = git_odb_read(&input->odb_object, odb, &entry->oid)) < 0) goto done; - + input->mode = entry->mode; input->path = git__strdup(entry->path); input->mmfile.size = git_odb_object_size(input->odb_object); input->mmfile.ptr = (char *)git_odb_object_data(input->odb_object); - + if (input->label == NULL) input->label = entry->path; - + done: git_odb_free(odb); - + return error; } @@ -101,27 +101,27 @@ int git_merge_file_input_from_diff_file( { git_odb *odb = NULL; int error = 0; - + assert(input && repo && file); - + if (file->mode == 0) return 0; - + if ((error = git_repository_odb(&odb, repo)) < 0 || (error = git_odb_read(&input->odb_object, odb, &file->oid)) < 0) goto done; - + input->mode = file->mode; input->path = git__strdup(file->path); input->mmfile.size = git_odb_object_size(input->odb_object); input->mmfile.ptr = (char *)git_odb_object_data(input->odb_object); - + if (input->label == NULL) input->label = file->path; - + done: git_odb_free(odb); - + return error; } @@ -138,12 +138,12 @@ int git_merge_files( int error = 0; assert(out && ancestor && ours && theirs); - + memset(out, 0x0, sizeof(git_merge_file_result)); if (!GIT_MERGE_FILE_SIDE_EXISTS(ours) || !GIT_MERGE_FILE_SIDE_EXISTS(theirs)) return 0; - + memset(&xmparam, 0x0, sizeof(xmparam_t)); xmparam.ancestor = ancestor->label; xmparam.file1 = ours->label; @@ -154,7 +154,7 @@ int git_merge_files( if (flags == GIT_MERGE_AUTOMERGE_FAVOR_OURS) xmparam.favor = XDL_MERGE_FAVOR_OURS; - + if (flags == GIT_MERGE_AUTOMERGE_FAVOR_THEIRS) xmparam.favor = XDL_MERGE_FAVOR_THEIRS; @@ -164,7 +164,7 @@ int git_merge_files( error = -1; goto done; } - + out->automergeable = (xdl_result == 0); out->data = (unsigned char *)mmbuffer.ptr; out->len = mmbuffer.size; @@ -172,4 +172,3 @@ int git_merge_files( done: return error; } - diff --git a/src/merge_file.h b/src/merge_file.h index 1aa34893d..0af2f0a57 100644 --- a/src/merge_file.h +++ b/src/merge_file.h @@ -16,7 +16,7 @@ typedef struct { char *path; unsigned int mode; mmfile_t mmfile; - + git_odb_object *odb_object; } git_merge_file_input; @@ -24,10 +24,10 @@ typedef struct { typedef struct { bool automergeable; - + const char *path; int mode; - + unsigned char *data; size_t len; } git_merge_file_result; diff --git a/src/pathspec.c b/src/pathspec.c index d4eb12582..35c79ce82 100644 --- a/src/pathspec.c +++ b/src/pathspec.c @@ -141,7 +141,7 @@ bool git_pathspec_match_path( git_vector_foreach(vspec, i, match) { int result = (match->flags & GIT_ATTR_FNMATCH_MATCH_ALL) ? 0 : FNM_NOMATCH; - + if (result == FNM_NOMATCH) result = use_strcmp(match->pattern, path) ? FNM_NOMATCH : 0; diff --git a/src/refdb_fs.c b/src/refdb_fs.c index b9df83f81..f964c4182 100644 --- a/src/refdb_fs.c +++ b/src/refdb_fs.c @@ -217,7 +217,7 @@ static int packed_load(refdb_fs_backend *backend) backend->peeling_mode = PEELING_NONE; if (buffer_start[0] == '#') { - static const char *traits_header = "# pack-refs with: "; + static const char *traits_header = "# pack-refs with: "; if (git__prefixcmp(buffer_start, traits_header) == 0) { char *traits = (char *)buffer_start + strlen(traits_header); @@ -1060,7 +1060,7 @@ static void refdb_fs_backend__free(git_refdb_backend *_backend) static int setup_namespace(git_buf *path, git_repository *repo) { - char *parts, *start, *end; + char *parts, *start, *end; /* Not all repositories have a path */ if (repo->path_repository == NULL) @@ -1091,7 +1091,7 @@ static int setup_namespace(git_buf *path, git_repository *repo) free(parts); /* Make sure that the folder with the namespace exists */ - if (git_futils_mkdir_r(git_buf_cstr(path), repo->path_repository, 0777) < 0) + if (git_futils_mkdir_r(git_buf_cstr(path), repo->path_repository, 0777) < 0) return -1; /* Return the root of the namespaced path, i.e. without the trailing '/refs' */ diff --git a/src/reset.c b/src/reset.c index c1e1f865e..cea212a93 100644 --- a/src/reset.c +++ b/src/reset.c @@ -32,7 +32,7 @@ int git_reset_default( int error; git_index *index = NULL; - assert(pathspecs != NULL && pathspecs->count > 0); + assert(pathspecs != NULL && pathspecs->count > 0); memset(&entry, 0, sizeof(git_index_entry)); diff --git a/src/revparse.c b/src/revparse.c index 05231e3fc..97fc91b54 100644 --- a/src/revparse.c +++ b/src/revparse.c @@ -855,4 +855,3 @@ int git_revparse( return error; } - diff --git a/src/signature.c b/src/signature.c index 48bdd81ab..1131fb789 100644 --- a/src/signature.c +++ b/src/signature.c @@ -173,7 +173,7 @@ int git_signature__parse(git_signature *sig, const char **buffer_out, tz_start = time_end + 1; - if ((tz_start[0] != '-' && tz_start[0] != '+') || + if ((tz_start[0] != '-' && tz_start[0] != '+') || git__strtol32(&offset, tz_start + 1, &tz_end, 10) < 0) return signature_error("malformed timezone"); diff --git a/src/trace.c b/src/trace.c index 159ac91cc..ee5039f56 100644 --- a/src/trace.c +++ b/src/trace.c @@ -25,7 +25,7 @@ int git_trace_set(git_trace_level_t level, git_trace_callback callback) git_trace__data.level = level; git_trace__data.callback = callback; GIT_MEMORY_BARRIER; - + return 0; #else GIT_UNUSED(level); @@ -36,4 +36,3 @@ int git_trace_set(git_trace_level_t level, git_trace_callback callback) return -1; #endif } - diff --git a/src/trace.h b/src/trace.h index f4bdff88a..77b1e03ef 100644 --- a/src/trace.h +++ b/src/trace.h @@ -25,14 +25,14 @@ GIT_INLINE(void) git_trace__write_fmt( git_trace_level_t level, const char *fmt, ...) { - git_trace_callback callback = git_trace__data.callback; + git_trace_callback callback = git_trace__data.callback; git_buf message = GIT_BUF_INIT; va_list ap; - + va_start(ap, fmt); git_buf_vprintf(&message, fmt, ap); va_end(ap); - + callback(level, git_buf_cstr(&message)); git_buf_free(&message); diff --git a/src/transports/local.c b/src/transports/local.c index 2530a847f..4bf1c876a 100644 --- a/src/transports/local.c +++ b/src/transports/local.c @@ -348,7 +348,7 @@ static int local_push( if ((error = git_repository_open(&remote_repo, push->remote->url)) < 0) return error; - /* We don't currently support pushing locally to non-bare repos. Proper + /* We don't currently support pushing locally to non-bare repos. Proper non-bare repo push support would require checking configs to see if we should override the default 'don't let this happen' behavior */ if (!remote_repo->is_bare) { diff --git a/src/win32/findfile.c b/src/win32/findfile.c index bc36b6b45..5dd3de13d 100644 --- a/src/win32/findfile.c +++ b/src/win32/findfile.c @@ -235,4 +235,3 @@ int git_win32__find_xdg_dirs(git_buf *out) return win32_find_existing_dirs(out, global_tmpls, temp); } - diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c index b9115836e..f9967e04a 100644 --- a/src/win32/posix_w32.c +++ b/src/win32/posix_w32.c @@ -535,7 +535,7 @@ int p_gettimeofday(struct timeval *tv, struct timezone *tz) /*converting file time to unix epoch*/ tmpres /= 10; /*convert into microseconds*/ - tmpres -= DELTA_EPOCH_IN_MICROSECS; + tmpres -= DELTA_EPOCH_IN_MICROSECS; tv->tv_sec = (long)(tmpres / 1000000UL); tv->tv_usec = (long)(tmpres % 1000000UL); } |