summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Beller <stefanbeller@gmail.com>2014-08-11 21:44:28 +0200
committerJunio C Hamano <gitster@pobox.com>2014-08-12 11:24:12 -0700
commit4f1870801c8b993e25aa0ead8250d580953207a1 (patch)
treea089c67750b26769d8915559495d645e69b3a6f2
parente6aaa393478bf3ee9f4cde8d82cd258c034cd335 (diff)
downloadgit-4f1870801c8b993e25aa0ead8250d580953207a1.tar.gz
unpack-tree.c: remove dead code
In line 1763 of unpack-tree.c we have a condition on the current tree if (current) { ... Within this block of code we can assume current to be non NULL, hence the code after the statement in line 1796: if (current) return ... cannot be reached. The proposed patch here changes the order of the current tree and the newtree part. I'm not sure if that's the right way to handle it. All referenced lines have been introduced in the same commit 076b0adc (2006-07-30, read-tree: move merge functions to the library), which was just moving the code around. The outer condition on the current tree (now in line 1763) was introduced in c859600954df4c292e, June 2005, [PATCH] read-tree: save more user hassles during fast-forward. The inner condition on the current tree was introduced in ee6566e8d70da682ac4926d, Sept. 2005, [PATCH] Rewrite read-tree This issue was found by coverity, Id:290002 Signed-off-by: Stefan Beller <stefanbeller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--unpack-trees.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index ad3e9a04fe..6bc0b280f5 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1795,11 +1795,10 @@ int twoway_merge(const struct cache_entry * const *src,
/* all other failures */
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;
+ /* current is definitely exists here */
+ return o->gently ? -1 : reject_merge(current, o);
}
}
else if (newtree) {