{"thread":{"id":"15595","subject":"[BUG?]: unpack-file behavior for blobs corresponding to symlinks","startedAt":"2008-09-19T14:31:39Z","lastAt":"2008-09-19T15:50:13Z","messageCount":4,"participants":["Elijah Newren","Mikael Magnusson","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"91121","messageId":"51419b2c0809190731j5a77b8ccmba2feecb9c44cc1c@mail.gmail.com","threadId":"15595","inReplyTo":null,"subject":"[BUG?]: unpack-file behavior for blobs corresponding to symlinks","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2008-09-19T14:31:39Z","receivedAt":"2008-09-19T14:31:39Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi,\n\nunpack-file doesn't create symlinks as I'd expect.  I'm not sure if\nthis is a bug in unpack-file, or in my expectations.\n\nTo reproduce:\n\n$ git init\nInitialized empty Git repository in /home/newren/testing/.git/\n$ echo bla > bar\n$ ln -s bar foo\n$ git add bar foo\n$ git ls-files -s foo\n120000 ba0e162e1c47469e3fe4b393a8bf8c569f302116 0       foo\n$ git unpack-file ba0e162e1c47469e3fe4b393a8bf8c569f302116\n.merge_file_J1hTaV\n$ ls -l foo .merge_file_J1hTaV\nlrwxrwxrwx  1 enewren enewren 3 Sep 19 08:22 foo -> bar\n-rw-------  1 enewren enewren 3 Sep 19 08:23 .merge_file_J1hTaV\n$ echo $(cat .merge_file_J1hTaV)\nbar\n\nWhy is .merge_file_J1hTaV a regular file instead of a symlink?  Is\nthere an alternative command I can use that would create a symlink to\nbar given the information I have from the git ls-files command (and\nwhich also works for creating normal files and other special file\ntypes)?\n\nThanks,\nElijah\n"},{"id":"91122","messageId":"237967ef0809190751k38defaabk9efc74711f7c63c4@mail.gmail.com","threadId":"15595","inReplyTo":"51419b2c0809190731j5a77b8ccmba2feecb9c44cc1c@mail.gmail.com","subject":"Re: [BUG?]: unpack-file behavior for blobs corresponding to symlinks","fromName":"Mikael Magnusson","fromEmail":"mikachu@gmail.com","sentAt":"2008-09-19T14:51:04Z","receivedAt":"2008-09-19T14:51:04Z","isPatch":false,"sender":{"key":"mikachu@gmail.com","avatar":null},"body":"2008/9/19 Elijah Newren <newren@gmail.com>:\n> Hi,\n>\n> unpack-file doesn't create symlinks as I'd expect.  I'm not sure if\n> this is a bug in unpack-file, or in my expectations.\n>\n> To reproduce:\n>\n> $ git init\n> Initialized empty Git repository in /home/newren/testing/.git/\n> $ echo bla > bar\n> $ ln -s bar foo\n> $ git add bar foo\n> $ git ls-files -s foo\n> 120000 ba0e162e1c47469e3fe4b393a8bf8c569f302116 0       foo\n> $ git unpack-file ba0e162e1c47469e3fe4b393a8bf8c569f302116\n> .merge_file_J1hTaV\n> $ ls -l foo .merge_file_J1hTaV\n> lrwxrwxrwx  1 enewren enewren 3 Sep 19 08:22 foo -> bar\n> -rw-------  1 enewren enewren 3 Sep 19 08:23 .merge_file_J1hTaV\n> $ echo $(cat .merge_file_J1hTaV)\n> bar\n>\n> Why is .merge_file_J1hTaV a regular file instead of a symlink?  Is\n> there an alternative command I can use that would create a symlink to\n> bar given the information I have from the git ls-files command (and\n> which also works for creating normal files and other special file\n> types)?\n\nThis is not a bug. The type of a file is in the tree, not the blob, see:\n\n% echo -n foo > file\n% ln -s foo symlink\n% git add file symlink\n% git commit\nCreated initial commit 31ad9b0 on master: file and symlink\n 2 files changed, 2 insertions(+), 0 deletions(-)\n create mode 100644 file\n create mode 120000 symlink\n% git ls-tree HEAD\n100644 blob 19102815663d23f8b75a47e7a01965dcdc96468c\tfile\n120000 blob 19102815663d23f8b75a47e7a01965dcdc96468c\tsymlink\n\n\n-- \nMikael Magnusson\n"},{"id":"91123","messageId":"51419b2c0809190755l2aa01558l30e07c4141f8d4e0@mail.gmail.com","threadId":"15595","inReplyTo":"237967ef0809190751k38defaabk9efc74711f7c63c4@mail.gmail.com","subject":"Re: [BUG?]: unpack-file behavior for blobs corresponding to symlinks","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2008-09-19T14:55:36Z","receivedAt":"2008-09-19T14:55:36Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Sep 19, 2008 at 8:51 AM, Mikael Magnusson <mikachu@gmail.com> wrote:\n> This is not a bug. The type of a file is in the tree, not the blob, see:\n>\n> % echo -n foo > file\n> % ln -s foo symlink\n> % git add file symlink\n> % git commit\n> Created initial commit 31ad9b0 on master: file and symlink\n>  2 files changed, 2 insertions(+), 0 deletions(-)\n>  create mode 100644 file\n>  create mode 120000 symlink\n> % git ls-tree HEAD\n> 100644 blob 19102815663d23f8b75a47e7a01965dcdc96468c    file\n> 120000 blob 19102815663d23f8b75a47e7a01965dcdc96468c    symlink\n\nGood to know.  Given the mode (100644 or 120000) and the sha1sum, is\nthere a git command that will create-my-file for me, or do I need to\njust use git unpack-file and add my own extra logic on top?\n\nThanks,\nElijah\n"},{"id":"91125","messageId":"7v4p4cuocq.fsf@gitster.siamese.dyndns.org","threadId":"15595","inReplyTo":"51419b2c0809190755l2aa01558l30e07c4141f8d4e0@mail.gmail.com","subject":"Re: [BUG?]: unpack-file behavior for blobs corresponding to symlinks","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-19T15:50:13Z","receivedAt":"2008-09-19T15:50:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Elijah Newren\" <newren@gmail.com> writes:\n\n> On Fri, Sep 19, 2008 at 8:51 AM, Mikael Magnusson <mikachu@gmail.com> wrote:\n>> This is not a bug. The type of a file is in the tree, not the blob, see:\n>>\n>> % echo -n foo > file\n>> % ln -s foo symlink\n>> % git add file symlink\n>> % git commit\n>> Created initial commit 31ad9b0 on master: file and symlink\n>>  2 files changed, 2 insertions(+), 0 deletions(-)\n>>  create mode 100644 file\n>>  create mode 120000 symlink\n>> % git ls-tree HEAD\n>> 100644 blob 19102815663d23f8b75a47e7a01965dcdc96468c    file\n>> 120000 blob 19102815663d23f8b75a47e7a01965dcdc96468c    symlink\n>\n> Good to know.  Given the mode (100644 or 120000) and the sha1sum, is\n> there a git command that will create-my-file for me,...\n\n        git checkout -- that-path      ;# from the index\n        git checkout commit that-path  ;# from the commit/tree\n"}]}