From: Junio C Hamano Date: Fri, 29 Jun 2007 10:20:45 GMT Subject: Re: [PATCH] git add: respect core.filemode even with unmerged entriesin the index Message-ID: <7v3b0bf4ea.fsf@assigned-by-dhcp.pobox.com> In-Reply-To: Johannes Schindelin writes: > On Fri, 29 Jun 2007, Johannes Sixt wrote: > >> However, if only two stages are present, the file mode is still taken >> from the file instead of from the index. As that easy to solve (at least >> for the unambiguous case)? > > It might be related to the bug Junio found, i.e. that I assumed stage 1 to > be "ours". Actually it is because (-1-pos) and (1-pos) are two apart. By starting to scan from (1-pos), you are jumping directly to either the next path (in which case you do not pick it up), or "their" version (i.e. stage #3) iff there are three stages for the path in question. I am all for refactoring the funny "pick up an existing entry at any stage, but favor 0 then 2 then 1 and finally 3" into a separate function. It makes sense, although I do not offhand know of a place that we can immediately reuse it (logically, diff-files ought to do that, but I haven't checked).