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

Re: [PATCH] fix compare symlink against readlink not data

From
Junio C Hamano <junkio@cox.net>
Date
May 6, 2005, 16:26 UTC
Message-ID
<7vy8ascod4.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20050506160359.GB6904@kroah.com>
>>>>> "GKH" == Greg KH <greg@kroah.com> writes:
GKH> On Fri, May 06, 2005 at 03:45:01PM +0200, Kay Sievers wrote:
>> Thanks to Greg for recognizing this while he added our list of symlinks
>> back to the udev repository.

GKH> Hm, even with this patch applied (it's in Linus's tree right now), I GKH> still get the following with a clean checked out udev tree: GKH> $ cg-diff GKH> Index: test/sys/block/cciss!c0d0/device GKH> =================================================================== GKH> Index: test/sys/block/rd!c0d0/device GKH> ===================================================================

GKH> Any idea?

I do not use Cogito but probably it is this piece of code in cg-Xdiffdo. It is assuming that a valid SHA1 means it can diff against the filesystem object that resides there. It used to be the case before symlinks but not anymore.

    mkbanner () {
            loc=$1; treeid=$2; fname=$3; mode=$4; sha1=$5;
            if [ "$sha1" != "0000000000000000000000000000000000000000" ]; then
                    git-cat-file blob $sha1 >$loc
            else
                    ln -s "$(pwd)/$fname" "$loc"
                    sha1="!"
            fi

Maybe changing the if to (I'm writing this in e-mail editor so completely untested) something like:

    if expr "$sha1" : '0*$' >/dev/null ||
       expr "$mode" : '.*120000$' >/dev/null
    then
        git-cat-file blob "$sha1" >$loc
would help?

Also could you try the low-level git command, git-diff-cache -p, against the tree you are comparing? The built-in diff stuff might get this wrong too.

Previous: Greg KHNext: Greg KH
Message 8 of 9 in “fix compare symlink against readlink not data”
  1. fix compare symlink against readlink not dataKay Sievers, May 6, 2005
  2. Greg KHMay 6, 2005
  3. Kay SieversMay 6, 2005
  4. Greg KHMay 6, 2005
  5. Kay SieversMay 6, 2005
  6. Linus TorvaldsMay 6, 2005
  7. Greg KHMay 6, 2005
  8. Junio C HamanoMay 6, 2005
  9. Greg KHMay 6, 2005

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.