git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug: git add with absolute path fails if repo root dir is a symlink

From
Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe>
Date
Dec 27, 2010, 08:13 UTC
Message-ID
<20101227081312.GA12735@sajinet.com.pe>
In-Reply-To
<AANLkTimPxhqwMebfTw9oHucuvABmSBynpZgG1zp6uwVz@mail.gmail.com>
On Mon, Dec 27, 2010 at 10:23:12AM +0300, Alexander Gladysh wrote:
Show 6 quoted lines
> 
> > I can't run git add with absolute path if the repository's root
> > directory is a symlink.
> 
> Note that this issue is also triggered if *any* of the directories in
> path above of my repo are symlinks.

When using absolute path names, git will compare the path given with the git work tree and any name that is referred through a symlink in that will trigger a mismatch.

> Is there a way to quickly workaround this somehow?
use relative paths (implemented below through an alias named "myadd") :
[alias]
        myadd = "!sh -c 'cd `dirname \"$1\"` && git add `basename \"$1\"`' -"

so in your workflow you would use "myadd" instead of "add" to convert your absolute paths (with symlinks) into relative paths

Carlo
Previous: Alexander Gladysh
Message 3 of 3 in “Bug: git add with absolute path fails if repo root dir is a symlink”
  1. Alexander GladyshDec 27, 2010
  2. Alexander GladyshDec 27, 2010
  3. Carlo Marcelo Arenas BelonDec 27, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.