All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: "L. E. Segovia" <amy@amyspark.me>
Cc: git@vger.kernel.org
Subject: Re: [BUG] Clones from local repositories do not work correctly under Windows
Date: Fri, 12 Apr 2024 18:16:35 +0200	[thread overview]
Message-ID: <01cf64db-2ff5-4be5-8968-d280ab0ffc50@kdbg.org> (raw)
In-Reply-To: <e25bbce7-8338-430b-865f-690fe3c94fb6@amyspark.me>

Am 12.04.24 um 15:05 schrieb L. E. Segovia:
> Under a MSYS2 shell, follow these steps (feel free to replace the choice
> of remote repo with any other supporting a Rust crate):
> 
> 1. `cd` to a directory of your choice (let's call it `dirA`).
> 2. `git clone https://gitlab.gnome.org/GNOME/librsvg.git .`
> 3. `git checkout -b cerbero_build`.
> 4. `cd ..`
> 5. `git clone <full path to dirA> -s -b cerbero_build dirB`
> 6. `cd dirB`
> 7. `git status`
> 
> Now switch to any other shell of your choice, such as Git Bash, CMD, or
> PowerShell, and try issuing commands such as `git status`. It will
> result in a wall of "error: unable to normalize..."

Thanks, that is much more helpful. Here are my assumption, my
explanation of the symptoms, and the conclusion (which is basically "if
it hurts, don't do it"):

I assume that you have two installations of Git. One installation is
used when you use the git command from the MSYS2 shell; it is the MSYS2
version. The other installation is Git for Windows or equivalent that is
used by all the other shells.

When you clone a repository with -s, a .git/objects/info/alternates file
is initialized that contains the path to the original repository. You
can see its contents with `git count-objects -v`. I tested the
reproduction recipe with my own build (which is a MinGW build, much like
Git for Windows), and it looks like this:

C:\Temp\repoclone>git count-objects -v
count: 0
size: 0
in-pack: 0
packs: 0
size-pack: 0
prune-packable: 0
garbage: 0
size-garbage: 0
alternate: C:/Temp/repoorig/.git/objects

See the last line? It begins with a drive letter. When you call the
command with the MSYS2 version, it will look more like this:

alternate: /c/Temp/repoorig/.git/objects

This is the MSYS2/Cygwin absolute path with a "drive letter".
Unfortunately, this kind of path is unintelligible for Git for Windows.
It expects absolute paths to begin with drive letter-colon or a
double-slash or double-backslash. For this reason, it reports "unable to
normalize alternate object path".

The conclusion is: Do not use two different flavors of Git on a
repository that is set up with a link to an alternate repository.

BTW, I did not do the followup test with `git am`. (Actually, I did, but
there were no errors.) So, I cannot tell why your MSYS2 version suddenly
also reports the "unable to normalize" error.

-- Hannes


  reply	other threads:[~2024-04-12 16:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11 17:03 [BUG] Clones from local repositories do not work correctly under Windows L. E. Segovia
2024-04-12  6:56 ` Johannes Sixt
2024-04-12 13:05   ` L. E. Segovia
2024-04-12 16:16     ` Johannes Sixt [this message]
2024-04-12 17:19       ` L. E. Segovia
2024-04-12 17:32       ` Junio C Hamano
2024-04-12 17:41         ` rsbecker
2024-04-12 20:10           ` L. E. Segovia
2024-04-12 21:53         ` Johannes Sixt

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=01cf64db-2ff5-4be5-8968-d280ab0ffc50@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=amy@amyspark.me \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.