Re: `git add <<windows 8.3 path to file inside repo>>` results in "fatal: ... is outside repository"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 11, 2019 at 10:55 AM Torsten Bögershausen <tboegi@xxxxxx> wrote:
>
> On Mon, Mar 11, 2019 at 06:48:11PM +0100, Johannes Sixt wrote:
> > Am 10.03.19 um 23:41 schrieb Anthony Sottile:
> > > git init longname-repo
> > > cd longname-repo
> > > touch f
> > > git add ..\longna~1\f
> > >
> > ...
> > >
> > > C:\Users\Anthony\AppData\Local\Temp\t\pre-commit-hooks\longname-repo>git
> > > add ..\longna~1\f
> > > fatal: ..\longna~1\f: '..\longna~1\f' is outside repository
> >
> > This has nothing to do with long vs. short path names. It would report
> > the same error when you say
> >
> >   git add ..\longname-repo\f
> >
> > -- Hannes
>
> You can probably do another test:
>
>  mkdir longname-rexxx
>  git init longname-repo
>  cd longname-repo
>  touch f
>  git add ..\longna~1\f
>
> And now nobody knows for shure if "longna~1"
> is longname-rexxx or longname-repo
>
> It may happen that it is longname-rep at this point in time,
> at your machine.
> It may happen that it is a complete different directory on another machine,
> or even on your machine.
> For that reason, to avoid that someone tampers data outside a repo,
> "../" (or ..\ under windows) is not accepted by Git.

the same can be said for `git add /full/path/to/repo/file` as any of
those components could be symlinks.

However that is currently allowed

Note also I've updated my report, it isn't about relative paths any
more but about full paths with 8.3 paths

Note that 8.3 filanames do canonically disambiguate themselves, the
number after the tilde is used to refer to filenames alphabetically

This report is very similar to the change that happened to
disambiguate drive letters in
https://github.com/git/git/commit/d8727b3687c1d249e84be71a581cc1fb0581336a


> Oops, I misreported while trying to minimize my reproduction
>
> Here's an accurate bug report
>
> git properly handles this:
>
>     git add C:\full\path\to\longname-repo\file
>
> When the root of the repo root is `C:\full\path\to\longname-repo`
>
> But it does not handle the equivalent 8.3 path:
>
>     git add C:\full\path\to\longna~1\file




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux