path: root/read-cache.c
diff options
authorJunio C Hamano <>2019-10-15 04:48:00 (GMT)
committerJunio C Hamano <>2019-10-15 04:48:00 (GMT)
commit6d5291be450594d453759650f466174f39953c4f (patch)
treebc8f0616f6748e59e43105c78f5c4505565ab76d /read-cache.c
parentccc289915af00b44346cbf007f4f82ec2131f1a1 (diff)
parent46689317ac009ef4ae91235354b6df7bf6d11d17 (diff)
Merge branch 'js/azure-pipelines-msvc'
CI updates. * js/azure-pipelines-msvc: ci: also build and test with MS Visual Studio on Azure Pipelines ci: really use shallow clones on Azure Pipelines tests: let --immediate and --write-junit-xml play well together test-tool run-command: learn to run (parts of) the testsuite vcxproj: include more generated files vcxproj: only copy `git-remote-http.exe` once it was built msvc: work around a bug in GetEnvironmentVariable() msvc: handle DEVELOPER=1 msvc: ignore some libraries when linking compat/win32/path-utils.h: add #include guards winansi: use FLEX_ARRAY to avoid compiler warning msvc: avoid using minus operator on unsigned types push: do not pretend to return `int` from `die_push_simple()`
Diffstat (limited to 'read-cache.c')
1 files changed, 2 insertions, 2 deletions
diff --git a/read-cache.c b/read-cache.c
index 2c14094..133f790 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1276,7 +1276,7 @@ static int add_index_entry_with_check(struct index_state *istate, struct cache_e
if (istate->cache_nr > 0 &&
strcmp(ce->name, istate->cache[istate->cache_nr - 1]->name) > 0)
- pos = -istate->cache_nr - 1;
+ pos = index_pos_to_insert_pos(istate->cache_nr);
pos = index_name_stage_pos(istate, ce->name, ce_namelen(ce), ce_stage(ce));
@@ -1915,7 +1915,7 @@ static size_t estimate_cache_size(size_t ondisk_size, unsigned int entries)
* Account for potential alignment differences.
- per_entry += align_padding_size(sizeof(struct cache_entry), -sizeof(struct ondisk_cache_entry));
+ per_entry += align_padding_size(per_entry, 0);
return ondisk_size + entries * per_entry;