1
0
mirror of https://github.com/git/git.git synced 2024-10-21 12:48:32 +02:00
git/builtin
Elijah Newren 40d71940b6 builtin/merge.c: fix a bug with trivial merges
If read_tree_trivial() succeeds and produces a tree that is already
in the object store, then the index is not written to disk, leaving
it out-of-sync with both HEAD and the working tree.

In order to write the index back out to disk after a merge,
write_index_locked() needs to be called.  For most merge strategies, this
is done from try_merge_strategy().  For fast forward updates, this is
done from checkout_fast_forward().  When trivial merges work, the call to
write_index_locked() is buried a little deeper:

  merge_trivial()
  -> write_tree_trivial()
     -> write_cache_as_tree()
        -> write_index_as_tree()
           -> write_locked_index()

However, it is only called when !cache_tree_fully_valid(), which is how
this bug is triggered.  But that also shows why this bug doesn't affect
any other merge strategies or cases.

Add a direct call to write_index_locked() from merge_trivial() to fix
this issue.  Since the indirect call to write_locked_index() was
conditional on cache_tree_fully_valid(), it won't be written twice.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-12 18:33:59 -07:00
..
add.c
am.c Merge branch 'jc/am-i-v-fix' into maint 2016-03-10 11:13:41 -08:00
annotate.c
apply.c apply: report patch skipping in verbose mode 2016-03-24 10:18:31 -07:00
archive.c
bisect--helper.c
blame.c Merge branch 'jk/tighten-alloc' into maint 2016-03-10 11:13:43 -08:00
branch.c
bundle.c
cat-file.c
check-attr.c
check-ignore.c
check-mailmap.c
check-ref-format.c
checkout-index.c
checkout.c Merge branch 'nd/dwim-wildcards-as-pathspecs' into maint 2016-03-10 11:13:39 -08:00
clean.c Merge branch 'jk/tighten-alloc' 2016-02-26 13:37:16 -08:00
clone.c Merge branch 'sb/submodule-parallel-update' 2016-04-06 11:39:01 -07:00
column.c
commit-tree.c
commit.c Merge branch 'ss/commit-squash-msg' 2016-04-06 11:39:10 -07:00
config.c Merge branch 'jk/config-get-urlmatch' 2016-04-03 10:29:26 -07:00
count-objects.c
credential.c
describe.c
diff-files.c
diff-index.c
diff-tree.c
diff.c diff: activate diff.renames by default 2016-02-25 11:31:02 -08:00
fast-export.c
fetch-pack.c fetch-pack: fix object_id of exact sha1 2016-03-01 11:19:19 -08:00
fetch.c Merge branch 'sb/submodule-parallel-update' 2016-04-06 11:39:01 -07:00
fmt-merge-msg.c
for-each-ref.c
fsck.c
gc.c
get-tar-commit-id.c
grep.c Merge branch 'jk/tighten-alloc' into maint 2016-03-10 11:13:43 -08:00
hash-object.c
help.c
index-pack.c Merge branch 'jc/index-pack' 2016-04-03 10:29:31 -07:00
init-db.c setup: set startup_info->have_repository more reliably 2016-03-06 17:18:16 -08:00
interpret-trailers.c
log.c diff: activate diff.renames by default 2016-02-25 11:31:02 -08:00
ls-files.c
ls-remote.c
ls-tree.c
mailinfo.c
mailsplit.c
merge-base.c
merge-file.c
merge-index.c
merge-ours.c
merge-recursive.c
merge-tree.c
merge.c builtin/merge.c: fix a bug with trivial merges 2016-04-12 18:33:59 -07:00
mktag.c
mktree.c Merge branch 'jk/tighten-alloc' 2016-02-26 13:37:16 -08:00
mv.c
name-rev.c
notes.c
pack-objects.c Merge branch 'jk/path-name-safety-2.6' into jk/path-name-safety-2.7 2016-03-16 10:42:32 -07:00
pack-redundant.c
pack-refs.c
patch-id.c
prune-packed.c
prune.c
pull.c
push.c Merge branch 'mm/push-default-warning' 2016-02-26 13:37:25 -08:00
read-tree.c
receive-pack.c builtin/receive-pack.c: use parse_options API 2016-03-01 13:38:45 -08:00
reflog.c
remote-ext.c
remote-fd.c
remote.c Merge branch 'ps/config-error' 2016-02-26 13:37:19 -08:00
repack.c
replace.c
rerere.c
reset.c
rev-list.c Merge branch 'jk/path-name-safety-2.6' into jk/path-name-safety-2.7 2016-03-16 10:42:32 -07:00
rev-parse.c Merge branch 'jk/rev-parse-local-env-vars' 2016-04-03 10:29:27 -07:00
revert.c
rm.c
send-pack.c
shortlog.c
show-branch.c
show-ref.c
stripspace.c
submodule--helper.c Merge branch 'jk/submodule-c-credential' 2016-04-06 11:39:12 -07:00
symbolic-ref.c
tag.c tag: add the option to force signing of annotated tags 2016-03-22 15:13:40 -07:00
unpack-file.c
unpack-objects.c
update-index.c
update-ref.c
update-server-info.c
upload-archive.c
var.c
verify-commit.c
verify-pack.c
verify-tag.c
worktree.c Merge branch 'jk/tighten-alloc' 2016-02-26 13:37:16 -08:00
write-tree.c