From: Junio C Hamano <gitster@pobox.com>
To: Lasse Makholm <lasse.makholm@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: attr.c doesn't honor --work-tree option
Date: Thu, 06 Feb 2014 09:54:19 -0800 [thread overview]
Message-ID: <xmqqvbwsyvn8.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAB7pA0_2kLJmRZb8Z_9+xOcrbwMZLgnZwC5f7etbE4OuJ1wgmA@mail.gmail.com> (Lasse Makholm's message of "Thu, 6 Feb 2014 13:48:43 +0100")
Lasse Makholm <lasse.makholm@gmail.com> writes:
> Here's a repro with -DDEBUG_ATTR=1 and a printf() in read_attr_from_file():
>
> $ cd /tmp/
> $ mkdir -p attr-test/repo
> $ cd attr-test/repo
> $ git init
> Initialized empty Git repository in /tmp/attr-test/repo/.git/
> $ echo 'dir/* filter=foo' >.gitattributes
> $
>
> Inside the working tree, it works:
>
> $ ~/src/git.git/git check-attr -a dir/file
Does check-ignore misbehave the same way?
I suspect that is this because check-attr is not a command that
requires a working tree. The command was written primarily as a
debugging aid that can be used anywhere as long as you have a
repository to read strings from either its standard input or its
arguments, and gives them directly to check_attr(), but it does so
without first going to the top of the real working tree like
check-ignore does.
Forcing it to go to the top of the working tree (see the attached
one-liner, but note that I didn't test it) may give you want you
want.
git.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git.c b/git.c
index 7cf2953..314ec9f 100644
--- a/git.c
+++ b/git.c
@@ -342,7 +342,7 @@ static struct cmd_struct commands[] = {
{ "branch", cmd_branch, RUN_SETUP },
{ "bundle", cmd_bundle, RUN_SETUP_GENTLY },
{ "cat-file", cmd_cat_file, RUN_SETUP },
- { "check-attr", cmd_check_attr, RUN_SETUP },
+ { "check-attr", cmd_check_attr, RUN_SETUP | NEED_WORK_TREE },
{ "check-ignore", cmd_check_ignore, RUN_SETUP | NEED_WORK_TREE },
{ "check-mailmap", cmd_check_mailmap, RUN_SETUP },
{ "check-ref-format", cmd_check_ref_format },
next prev parent reply other threads:[~2014-02-06 17:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-06 12:48 attr.c doesn't honor --work-tree option Lasse Makholm
2014-02-06 17:54 ` Junio C Hamano [this message]
2014-02-06 18:40 ` [PATCH 1/2] t0003: do not chdir the whole test process Junio C Hamano
2014-02-06 18:40 ` [PATCH 2/2] check-attr: move to the top of working tree when in non-bare repository Junio C Hamano
2014-02-06 19:53 ` Jonathan Nieder
2014-02-06 20:17 ` Jonathan Nieder
2014-02-06 20:32 ` Junio C Hamano
2014-02-16 11:15 ` Michael Haggerty
2014-02-06 19:45 ` [PATCH 1/2] t0003: do not chdir the whole test process Jonathan Nieder
2014-02-06 20:25 ` Junio C Hamano
2014-02-06 20:31 ` Jonathan Nieder
2014-02-06 21:26 ` Junio C Hamano
2014-02-10 12:57 ` attr.c doesn't honor --work-tree option Lasse Makholm
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=xmqqvbwsyvn8.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=lasse.makholm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.