git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: "Nguyen Thai Ngoc Duy" <pclouds@gmail.com>
Cc: "Git Mailing List" <git@vger.kernel.org>
Subject: Re: git-archive and unwanted .gitattributes
Date: Sat, 07 Jun 2008 08:47:35 -0700 (PDT)	[thread overview]
Message-ID: <m33anpxn63.fsf@localhost.localdomain> (raw)
In-Reply-To: <fcaeb9bf0806070821r5ba650c2x1fef7947fc4a2de5@mail.gmail.com>

"Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes:

> Currently attr.c will read .gitattributes on disk no matter there is a
> real worktree or not. 

Currently .gitattributes are read _only_ from the work tree.
There isn't even infrastructure to read .gitattributes for commit
(from a tree); git-check-attr, and I guess also internal git API,
deals only with in-tree .gitattribute file.

> This can lead to strange behavior. For example when I do
> 
> mkdir a && cd a
> git init
> echo '$Format:%s$' > a
> git add a && git commit -m initial
> cd ..
> echo 'a export-subst' > .gitattributes # let's assume this is an accident.
> git --git-dir=a/.git archive --format=tar HEAD|tar xO a
> 
> I expect it to show '$Format:%s$', not "initial". git-archive should
> not bother reading that .gitattributes. I thought an
> is_inside_work_tree() check would be enough. Unfortunately, setting
> --git-dir will automatically set worktree too. Any ideas?

And it doesn't work at all for bare repositories.

I guess that might have been caused by the fact, that .gitattributes
are similar to .gitignore file; but in this they are different.  Of
course there is chicken-and-egg problem with attributes affecting
checkout...

-- 
Jakub Narebski
Poland
ShadeHawk on #git

  reply	other threads:[~2008-06-07 15:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-07 15:21 git-archive and unwanted .gitattributes Nguyen Thai Ngoc Duy
2008-06-07 15:47 ` Jakub Narebski [this message]
2008-06-07 16:19   ` Nguyen Thai Ngoc Duy
2008-06-08 15:24   ` René Scharfe
2008-06-08 15:16 ` [PATCH] fix attribute handling in bare repositories René Scharfe
2008-06-08 20:46   ` Junio C Hamano
2008-06-08 21:31     ` René Scharfe
2008-06-09  4:24     ` Nguyen Thai Ngoc Duy

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=m33anpxn63.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).