git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Madhu <enometh@meer.net>, git@vger.kernel.org
Subject: Re: [PATCH] init: don't reset core.filemode on git-new-workdirs.
Date: Tue, 23 Mar 2021 21:31:24 +0100	[thread overview]
Message-ID: <20210323203124.oxzqad2wmedelstu@tb-raspi4> (raw)
In-Reply-To: <xmqqo8f93gsd.fsf@gitster.g>

On Tue, Mar 23, 2021 at 10:45:38AM -0700, Junio C Hamano wrote:
> Torsten Bögershausen <tboegi@web.de> writes:
>
> > In the very long run, there may be room for improvements:
> > While core.filemode works for a loal repo on a local disk,
> > there are lots of cases where I whish a better handling.
>
> But that is why we have multiple worktrees and per worktree
> configuration, no?
>
> Fundamentally, you cannot share a worktree from two systems and let
> one work with filemode on while the other with filemode off, as you
> summarized here:
>
> > Exporting a git repo from e.g.
> > Linux/ext4 to MacOs : Linux sees the execute-bit as is, MacOs has it always on
> > Linux/ext4 to Windows : Linux sees the execute-bit as is, MacOs has it always off
> >
> > Visiting the same repo under Git-for-Windows and cygwin:
> > cygwin supports the executable bit, Git-for-Windows does not.
>
> The "new-workdirs" was a cute hack that was quite useful before the
> multiple worktree support materialized, and it and (proper) worktree
> share the quirk that by default the per-repo configuration file is
> shared.
>
> > And now we have the worktree (which may cross filesytem borders)
> >
> > Today there are many use cases, where a single config variable is not ideal.
> >
> > If there is a chance to have a "core.filemode=auto", which does probe the
> > filemode for this very OS/filesytem/worktree combination:
> > I would be happy to test/review/mentor such a code change.
>
> I do not think we want to go there.  filemode is not the only thing
> that would be shared.  What do you want to do with core.eol=native,
> for example?  Paths touched while switching branches get the 'native'
> line endings on the system that the user happened to be on when the
> "switch" command was run, and working tree files end up with mixture?

I don't intend to solve all possible confusions caused by sharing all
config variables - just this very one.

After some thinking, the following may illustrate a brute-force method,
not nice, neither optimized, nor perfect or bug free:

$ alias
alias git='~/bin2/git.sh'

cat ~/bin2/git.sh

#!/bin/sh

probe_executable()
{
  touch $$.xxx
  if test -x $$.xxx; then
    rm $$.xxx
    echo "-c core.filemode=false"
    return
  fi
  chmod +x $$.xxx
  if ! test -x $$.xxx; then
    rm $$.xxx
    echo "-c core.filemode=false"
    return
  fi
  rm $$.xxx
  return
}
git $(probe_executable) "$@"

  reply	other threads:[~2021-03-23 20:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-21 12:28 [PATCH] init: don't reset core.filemode on git-new-workdirs Madhu
2021-03-21 21:58 ` Junio C Hamano
2021-03-22  2:40   ` Madhu
2021-03-22  4:53     ` Junio C Hamano
2021-03-22  9:04       ` Madhu
2021-03-22 18:02         ` Junio C Hamano
2021-03-23  3:57           ` Madhu
2021-03-23  6:39             ` Junio C Hamano
2021-03-23 16:53               ` Torsten Bögershausen
2021-03-23 17:45                 ` Junio C Hamano
2021-03-23 20:31                   ` Torsten Bögershausen [this message]
2021-03-23 20:50                     ` Junio C Hamano
2021-06-18  4:18               ` Madhu

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20210323203124.oxzqad2wmedelstu@tb-raspi4 \
    --to=tboegi@web.de \
    --cc=enometh@meer.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).