aboutsummaryrefslogtreecommitdiff
path: root/alias.c
diff options
context:
space:
mode:
authorStefan Beller <stefanbeller@gmail.com>2014-08-12 16:59:31 -0700
committerJunio C Hamano <gitster@pobox.com>2014-08-13 10:32:08 -0700
commit0ecd180a27eab7c576feddc6f2be0626a1e0630b (patch)
treec6215a8a48a1c5514dddfd9f772fb0dbbcf2a9b2 /alias.c
parente6aaa393478bf3ee9f4cde8d82cd258c034cd335 (diff)
downloadgit-0ecd180a27eab7c576feddc6f2be0626a1e0630b.tar.gz
git-0ecd180a27eab7c576feddc6f2be0626a1e0630b.tar.xz
unpack-trees: simplify 'all other failures' case
In the 'if (current)' block of twoway_merge, we handle the boring errors by checking if the entry from the old tree, current index, and new tree are present, to get a pathname for the error message from one of them: if (oldtree) return o->gently ? -1 : reject_merge(oldtree, o); if (current) return o->gently ? -1 : reject_merge(current, o); if (newtree) return o->gently ? -1 : reject_merge(newtree, o); return -1; Since this is guarded by 'if (current)', the second test is guaranteed to succeed. Moreover, any of the three entries, if present, would have the same path because there is no rename detection in this code path. Even if some day in the future the entries' paths differ, the 'current' path used in the index and worktree would presumably be the most recognizable for the end user. Simplify by just using 'current'. Noticed by coverity, Id:290002 Signed-off-by: Stefan Beller <stefanbeller@gmail.com> Improved-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'alias.c')
0 files changed, 0 insertions, 0 deletions