git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: lists@haller-berlin.de (Stefan Haller)
To: git@vger.kernel.org
Cc: Johannes.Schindelin@gmx.de (Johannes Schindelin),
	j.sixt@viscovery.net (Johannes Sixt)
Subject: Re: [PATCH] Add tests to demonstrate update-index bug with core.symlinks/core.filemode
Date: Sun, 24 Oct 2010 20:53:13 +0200	[thread overview]
Message-ID: <1jqvvxl.1e5c93nipc126M%lists@haller-berlin.de> (raw)
In-Reply-To: <1jqvbx3.1icsj8j1jf26lfM%lists@haller-berlin.de>

Stefan Haller <lists@haller-berlin.de> wrote:

> Stefan Haller <lists@haller-berlin.de> wrote:
> 
> > There's a bug with the handling of the executable bit when core.filemode
> > is false: when you have an executable file that has unmerged changes,
> > and you stage it with "git update-index", the executable bit is lost.
> > If you stage it with "git add" instead, it works fine.
> 
> It turns out that the same bug exists for symlinks when core.symlink is
> false. Here's a patch that adds two tests that demonstrate the problems.
> (I suspect both have a similar cause, and/or a similar solution.)

OK, so I found commit 2031427 (git add: respect core.filemode with
unmerged entries), and the corresponding email thread at
<http://article.gmane.org/gmane.comp.version-control.git/51182/>, that
fixed the same bug for git add in 2007.

So maybe the fix for update-index is as simple as replacing the
cache_name_pos call in process_path() with index_name_pos_also_unmerged,
but I'm afraid of breaking something else in that area.  Advice welcome.

BTW, I'm not convinced that the logic in index_name_pos_also_unmerged of
always preferring stage 2 over stage 3 is good in all cases.  For the
case where a regular file is changed into a symlink or vice versa it
probably doesn't matter, as the resolution will always require human
intervention, but if the mode just changes from 644 to 755 or back, it
seems wrong to always pick the mode of "ours" over "theirs".  Instead,
it should pick whichever mode differs from stage 1, if the other
doesn't.


-- 
Stefan Haller
Berlin, Germany
http://www.haller-berlin.de/

  reply	other threads:[~2010-10-24 18:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-22 17:28 git-update-index loses executable bit for unmerged files when core.filemode is false Stefan Haller
2010-10-24 11:40 ` [PATCH] Add tests to demonstrate update-index bug with core.symlinks/core.filemode Stefan Haller
2010-10-24 18:53   ` Stefan Haller [this message]
2010-10-25  7:34     ` Junio C Hamano
2010-10-24 23:41   ` Jakub Narebski
2010-10-25  8:59     ` Stefan Haller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1jqvvxl.1e5c93nipc126M%lists@haller-berlin.de \
    --to=lists@haller-berlin.de \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).