# git-archive --worktree-attributes (1.8.2)

5 messages from 2013-04-09 to 2013-04-10. Participants: Amit Bakshi, Junio C Hamano, René Scharfe, Eric Sunshine.
Thread: https://gitlist.dev/t/33451

## Amit Bakshi, 2013-04-09 20:43

Subject: git-archive --worktree-attributes (1.8.2)
Message-ID: <CAFGOX=VXifkn4oNkqLLF_WG5Dzf4rjd15EV7C=9a_H9CTM+w2Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAFGOX%3DVXifkn4oNkqLLF_WG5Dzf4rjd15EV7C%3D9a_H9CTM%2Bw2Q%40mail.gmail.com

```
Hi,

 In the help for git-archive it states:

       --worktree-attributes
           Look for attributes in .gitattributes in working directory too.

This doesn't seem to be the case. I have a use case where I need to
archive a remote I don't have write access too (via --remote=), and I
wish to ignore certain paths. When I chdir to a temp dir, create a
.gitattributes file, and call git archive --worktree-attributes, the
bevaviour I see is that it is ignoring .gitattributes. I've tried
setting GIT_WORK_TREE to my temp dir, without success. Is the
documentation wrong about 'working directory'? Did it mean to say
'working tree'? Looking at the source for archive.c, it seems to
assume a GIT_WORK_TREE.


Would you accept a patch that either adds an option to explicitly set
the .gitattributes file or would let --worktree-attributes look in
$PWD.

Thanks,
Amit

```

## Junio C Hamano, 2013-04-09 21:12

Subject: Re: git-archive --worktree-attributes (1.8.2)
Message-ID: <7vk3obpfwc.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vk3obpfwc.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CAFGOX=VXifkn4oNkqLLF_WG5Dzf4rjd15EV7C=9a_H9CTM+w2Q@mail.gmail.com>

```
Amit Bakshi <ambakshi@gmail.com> writes:

> Hi,
>
>  In the help for git-archive it states:
>
>        --worktree-attributes
>            Look for attributes in .gitattributes in working directory too.
> ...

The worktree-attributes should read from the worktree.  It should
not pay any attention to where you are in the directory hierarchy,
i.e. your current working directory (aka $cwd).

> Would you accept a patch that either adds an option to explicitly set
> the .gitattributes file or would let --worktree-attributes look in
> $PWD.

The former, possibly, if accompanied with a good justification and
implemented cleanly.

The latter, definitely not.

```

## René Scharfe, 2013-04-10 17:49

Subject: [PATCH] archive: clarify explanation of --worktree-attributes
Message-ID: <5165A645.9090300@lsrfire.ath.cx>
URL: https://gitlist.dev/e/5165A645.9090300%40lsrfire.ath.cx
In-Reply-To: <7vk3obpfwc.fsf@alter.siamese.dyndns.org>

```
Make it a bit clearer that --worktree-attributes is about files in the
working tree (checked out files, possibly changed) and not the current
working directory ($PDW).  Link to the ATTRIBUTES section, which has
more details.

Reported-by: Amit Bakshi <ambakshi@gmail.com>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
Does this help a bit?

 Documentation/git-archive.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
index b4c2e24..3dd3069 100644
--- a/Documentation/git-archive.txt
+++ b/Documentation/git-archive.txt
@@ -56,7 +56,8 @@ OPTIONS
 	Write the archive to <file> instead of stdout.
 
 --worktree-attributes::
-	Look for attributes in .gitattributes in working directory too.
+	Look for attributes in .gitattributes files in the working tree
+	as well (see <<ATTRIBUTES>>).
 
 <extra>::
 	This can be any options that the archiver backend understands.
-- 
1.8.2.1

```

## Eric Sunshine, 2013-04-10 18:40

Subject: Re: [PATCH] archive: clarify explanation of --worktree-attributes
Message-ID: <CAPig+cTM=ojKgq4HFenAaquRsR5nXL3mm4O4ZBO5CmwEYqk60g@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcTM%3DojKgq4HFenAaquRsR5nXL3mm4O4ZBO5CmwEYqk60g%40mail.gmail.com
In-Reply-To: <5165A645.9090300@lsrfire.ath.cx>

```
On Wed, Apr 10, 2013 at 1:49 PM, René Scharfe
<rene.scharfe@lsrfire.ath.cx> wrote:
> Make it a bit clearer that --worktree-attributes is about files in the
> working tree (checked out files, possibly changed) and not the current
> working directory ($PDW).  Link to the ATTRIBUTES section, which has

s/PDW/PWD/

> more details.
>
> Reported-by: Amit Bakshi <ambakshi@gmail.com>
> Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>

```

## Junio C Hamano, 2013-04-10 18:56

Subject: Re: [PATCH] archive: clarify explanation of --worktree-attributes
Message-ID: <7vd2u2mcyy.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd2u2mcyy.fsf%40alter.siamese.dyndns.org
In-Reply-To: <5165A645.9090300@lsrfire.ath.cx>

```
René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:

> Make it a bit clearer that --worktree-attributes is about files in the
> working tree (checked out files, possibly changed) and not the current
> working directory ($PDW).  Link to the ATTRIBUTES section, which has
> more details.
>
> Reported-by: Amit Bakshi <ambakshi@gmail.com>
> Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
> ---
> Does this help a bit?

I personally thought that the original was already clear enough
(especially when taken in the context of Git), but the new wording
is not too verbose and should help avoiding misinterpretation.

Thanks.

>
>  Documentation/git-archive.txt | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
> index b4c2e24..3dd3069 100644
> --- a/Documentation/git-archive.txt
> +++ b/Documentation/git-archive.txt
> @@ -56,7 +56,8 @@ OPTIONS
>  	Write the archive to <file> instead of stdout.
>  
>  --worktree-attributes::
> -	Look for attributes in .gitattributes in working directory too.
> +	Look for attributes in .gitattributes files in the working tree
> +	as well (see <<ATTRIBUTES>>).
>  
>  <extra>::
>  	This can be any options that the archiver backend understands.

```
