git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* --diff-filter=T does not list x changes
@ 2008-10-15 18:42 Anders Melchiorsen
  2008-10-16 10:22 ` Jeff King
  0 siblings, 1 reply; 13+ messages in thread
From: Anders Melchiorsen @ 2008-10-15 18:42 UTC (permalink / raw)
  To: git

>From documentation, I would expect --diff-filter to list changes in
the execute bit, but it does not. I hear on #git that this is
intended, though I still do not know how to filter on the execute bit.
Is it impossible?


Testcase:

  mkdir t && cd t && git init
  touch a && git add -A && git commit -m1
  chmod +x a && git add -A && git commit -m2
  git log --diff-filter=T        # <--- shows nothing
  rm -f a && ln -s b a && git add -A && git commit -m3
  git log --diff-filter=T


Anders

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: --diff-filter=T does not list x changes
  2008-10-15 18:42 --diff-filter=T does not list x changes Anders Melchiorsen
@ 2008-10-16 10:22 ` Jeff King
  2008-10-17  2:00   ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Jeff King @ 2008-10-16 10:22 UTC (permalink / raw)
  To: Anders Melchiorsen; +Cc: git

On Wed, Oct 15, 2008 at 08:42:35PM +0200, Anders Melchiorsen wrote:

> From documentation, I would expect --diff-filter to list changes in
> the execute bit, but it does not. I hear on #git that this is
> intended, though I still do not know how to filter on the execute bit.
> Is it impossible?

Looking at the code, I think it's impossible, and one would have to add
a new --diff-filter letter. However, at the very least, the
documentation should clarify this situation. The --diff-filter
explanation says:

  Select only files [...] have their type (mode) changed (T) [...]

which to me indicates that your test case should work. 

-Peff

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: --diff-filter=T does not list x changes
  2008-10-16 10:22 ` Jeff King
@ 2008-10-17  2:00   ` Junio C Hamano
  2008-10-17  7:08     ` Anders Melchiorsen
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2008-10-17  2:00 UTC (permalink / raw)
  To: Jeff King; +Cc: Anders Melchiorsen, git

Jeff King <peff@peff.net> writes:

> On Wed, Oct 15, 2008 at 08:42:35PM +0200, Anders Melchiorsen wrote:
>
>> From documentation, I would expect --diff-filter to list changes in
>> the execute bit, but it does not. I hear on #git that this is
>> intended, though I still do not know how to filter on the execute bit.
>> Is it impossible?
>
> Looking at the code, I think it's impossible, and one would have to add
> a new --diff-filter letter. However, at the very least, the
> documentation should clarify this situation. The --diff-filter
> explanation says:
>
>   Select only files [...] have their type (mode) changed (T) [...]
>
> which to me indicates that your test case should work. 

That documentation is quite loosely written.  Typechange diff is what T
has always meant, and it never was about the executable bit.  The word
"mode" in that sentence only means the upper bits S_IFREG/S_IFLNK (iow,
masked by S_IFMT).

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: --diff-filter=T does not list x changes
  2008-10-17  2:00   ` Junio C Hamano
@ 2008-10-17  7:08     ` Anders Melchiorsen
  2008-10-17  8:29       ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Anders Melchiorsen @ 2008-10-17  7:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, git

Junio C Hamano <gitster@pobox.com> writes:

> Jeff King <peff@peff.net> writes:
>
>>   Select only files [...] have their type (mode) changed (T) [...]
>>
>> which to me indicates that your test case should work. 
>
> That documentation is quite loosely written. Typechange diff is what
> T has always meant, and it never was about the executable bit. The
> word "mode" in that sentence only means the upper bits
> S_IFREG/S_IFLNK (iow, masked by S_IFMT).

I hope you agree that this reading is not obvious from the
documentation, so I will send a patch later fixing up the prose (if
nobody beats me to it).

How about adding a diff-filter=X for the executable bit? I could
probably look at that during the weekend.


Anders.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: --diff-filter=T does not list x changes
  2008-10-17  7:08     ` Anders Melchiorsen
@ 2008-10-17  8:29       ` Junio C Hamano
  2008-10-17 19:33         ` Anders Melchiorsen
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2008-10-17  8:29 UTC (permalink / raw)
  To: Anders Melchiorsen; +Cc: Jeff King, git

Anders Melchiorsen <mail@cup.kalibalik.dk> writes:

> Junio C Hamano <gitster@pobox.com> writes:
>
>> That documentation is quite loosely written. Typechange diff is what
>> T has always meant, and it never was about the executable bit. The
>> word "mode" in that sentence only means the upper bits
>> S_IFREG/S_IFLNK (iow, masked by S_IFMT).
>
> I hope you agree that this reading is not obvious from the
> documentation,...

Yup, didn't I already say that the documentation is buggy?

> How about adding a diff-filter=X for the executable bit?

I do not think it is a good idea for two reasons.  Backward compatibility
and sane design.

For one thing, "diff --name-status" never shows X, so you would introduce
an unnecessary inconsistency.  If you change "--name-status" to avoid
that, you would be breaking people's existing scripts that expect to see
"M" for such a change.

Even if you were forgiven by these people whose scripts are broken by your
change, you need to decide between "M" and "X" when both contents and
executable bit are changed.  The least surprising logic would probably be
to show "X" when _only_ executable bit is changed and show "M" when
contents changed (even when executable bit also did), but that feels quite
arbitrary.  And the other way around isn't any better.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: --diff-filter=T does not list x changes
  2008-10-17  8:29       ` Junio C Hamano
@ 2008-10-17 19:33         ` Anders Melchiorsen
  2008-10-17 23:58           ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Anders Melchiorsen @ 2008-10-17 19:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, git

Junio C Hamano <gitster@pobox.com> writes:

> Anders Melchiorsen <mail@cup.kalibalik.dk> writes:
>
>> I hope you agree that this reading is not obvious from the
>> documentation,...
>
> Yup, didn't I already say that the documentation is buggy?

Possibly, though not in this thread.


>> How about adding a diff-filter=X for the executable bit?
>
> I do not think it is a good idea for two reasons. Backward
> compatibility and sane design.
>
> For one thing, "diff --name-status" never shows X, so you would
> introduce an unnecessary inconsistency. If you change
> "--name-status" to avoid that, you would be breaking people's
> existing scripts that expect to see "M" for such a change.

(I noticed that X is already used in diff-filter, but will keep it for
this discussion)

I was thinking that X could be a subset of M. So only if you
specifically ask for diff-filter=X (and not M) would you get this new
functionality. That should keep it compatible. It would then pick
files that have had their x flipped, regardless of their change in
content. With diff-filter=M, it would work as it does today.

If name-status output must be consistent, it could even output M for
these changes. That would still be unambiguous (but probably confusing).

...

As you say that this is an unnecessary inconsistency, I wonder whether
you have a different way to pick out the commits that toggle the x
bit? That is a problem that I am facing, with no solution shown so far ...


Anders.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: --diff-filter=T does not list x changes
  2008-10-17 19:33         ` Anders Melchiorsen
@ 2008-10-17 23:58           ` Junio C Hamano
  2008-10-18  8:49             ` [PATCH] Documentation: diff-filter=T only tests for symlink changes Anders Melchiorsen
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2008-10-17 23:58 UTC (permalink / raw)
  To: Anders Melchiorsen; +Cc: Jeff King, git

Anders Melchiorsen <anders@kalibalik.dk> writes:

> ... way to pick out the commits that toggle the x
> bit? That is a problem that I am facing, with no solution shown so far ...

Are you interested in executable-bit only change, or any change that
contains changes to the executable-bit?  If I were looking for the latter,
probably finding "^:100664 100775 " (or the other way around) in log --raw
(or whatchanged) output would be what I would do --- the mode changes are
rare enough in a sane project, so I wouldn't mind having to do such
scripting as needed.

There are other "commit pickers" such as -S<strting> and --diff-filter
that do not absolutely have to exist (iow, they could also be scripted),
but what they pick earned easy shortcuts because the need is very common.
Once you can demonstrate that the need to pick executable-bit changes is
also very common, _and_ if you can come up with a clean solution, we might
add a commit picker that looks for changes in executable-ness in the
future.  I dunno.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] Documentation: diff-filter=T only tests for symlink changes
  2008-10-17 23:58           ` Junio C Hamano
@ 2008-10-18  8:49             ` Anders Melchiorsen
  2008-10-18 13:40               ` Nanako Shiraishi
                                 ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Anders Melchiorsen @ 2008-10-18  8:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

With the previous text, one could get the understanding that
diff-filter=T also tested for changes in the executable bit.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
---

Junio C Hamano <gitster@pobox.com> writes:

> There are other "commit pickers" such as -S<strting> and
> --diff-filter that do not absolutely have to exist (iow, they could
> also be scripted), but what they pick earned easy shortcuts because
> the need is very common. Once you can demonstrate that the need to
> pick executable-bit changes is also very common, _and_ if you can
> come up with a clean solution, we might add a commit picker that
> looks for changes in executable-ness in the future. I dunno.

You are right that this should be a rare need.

I didn't mean to push for this feature. I just offered to implement
it, as I needed it myself and din't see other ways. A script will work
fine for me, I should have thought of that.

The documentation patch that I promised is here.


Thanks,
Anders.


 Documentation/diff-options.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 7788d4f..7604a13 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -137,7 +137,7 @@ endif::git-format-patch[]
 --diff-filter=[ACDMRTUXB*]::
 	Select only files that are Added (`A`), Copied (`C`),
 	Deleted (`D`), Modified (`M`), Renamed (`R`), have their
-	type (mode) changed (`T`), are Unmerged (`U`), are
+	type (symlink/regular file) changed (`T`), are Unmerged (`U`), are
 	Unknown (`X`), or have had their pairing Broken (`B`).
 	Any combination of the filter characters may be used.
 	When `*` (All-or-none) is added to the combination, all
-- 
1.6.0.2.514.g23abd3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] Documentation: diff-filter=T only tests for symlink changes
  2008-10-18  8:49             ` [PATCH] Documentation: diff-filter=T only tests for symlink changes Anders Melchiorsen
@ 2008-10-18 13:40               ` Nanako Shiraishi
  2008-10-18 18:37                 ` Junio C Hamano
  2008-10-18 18:08               ` Junio C Hamano
  2008-10-19  1:04               ` Nanako Shiraishi
  2 siblings, 1 reply; 13+ messages in thread
From: Nanako Shiraishi @ 2008-10-18 13:40 UTC (permalink / raw)
  To: Anders Melchiorsen; +Cc: Junio C Hamano, git

Quoting Anders Melchiorsen <mail@cup.kalibalik.dk>:

> diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
> index 7788d4f..7604a13 100644
> --- a/Documentation/diff-options.txt
> +++ b/Documentation/diff-options.txt
> @@ -137,7 +137,7 @@ endif::git-format-patch[]
>  --diff-filter=[ACDMRTUXB*]::
>  	Select only files that are Added (`A`), Copied (`C`),
>  	Deleted (`D`), Modified (`M`), Renamed (`R`), have their
> -	type (mode) changed (`T`), are Unmerged (`U`), are
> +	type (symlink/regular file) changed (`T`), are Unmerged (`U`), are
>  	Unknown (`X`), or have had their pairing Broken (`B`).
>  	Any combination of the filter characters may be used.
>  	When `*` (All-or-none) is added to the combination, all
> -- 
> 1.6.0.2.514.g23abd3

Are symlinks and regular files the only kind of object you can see in diff? What happens when a file or directory changes to a submodule?

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Documentation: diff-filter=T only tests for symlink changes
  2008-10-18  8:49             ` [PATCH] Documentation: diff-filter=T only tests for symlink changes Anders Melchiorsen
  2008-10-18 13:40               ` Nanako Shiraishi
@ 2008-10-18 18:08               ` Junio C Hamano
  2008-10-19  1:04               ` Nanako Shiraishi
  2 siblings, 0 replies; 13+ messages in thread
From: Junio C Hamano @ 2008-10-18 18:08 UTC (permalink / raw)
  To: Anders Melchiorsen; +Cc: git

Thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Documentation: diff-filter=T only tests for symlink changes
  2008-10-18 13:40               ` Nanako Shiraishi
@ 2008-10-18 18:37                 ` Junio C Hamano
  0 siblings, 0 replies; 13+ messages in thread
From: Junio C Hamano @ 2008-10-18 18:37 UTC (permalink / raw)
  To: Nanako Shiraishi; +Cc: Anders Melchiorsen, git

Nanako Shiraishi <nanako3@lavabit.com> writes:

> Quoting Anders Melchiorsen <mail@cup.kalibalik.dk>:
>
>> diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
>> index 7788d4f..7604a13 100644
>> --- a/Documentation/diff-options.txt
>> +++ b/Documentation/diff-options.txt
>> @@ -137,7 +137,7 @@ endif::git-format-patch[]
>>  --diff-filter=[ACDMRTUXB*]::
>>  	Select only files that are Added (`A`), Copied (`C`),
>>  	Deleted (`D`), Modified (`M`), Renamed (`R`), have their
>> -	type (mode) changed (`T`), are Unmerged (`U`), are
>> +	type (symlink/regular file) changed (`T`), are Unmerged (`U`), are
>>  	Unknown (`X`), or have had their pairing Broken (`B`).
>>  	Any combination of the filter characters may be used.
>>  	When `*` (All-or-none) is added to the combination, all
>> -- 
>> 1.6.0.2.514.g23abd3
>
> Are symlinks and regular files the only kind of object you can see in
> diff? What happens when a file or directory changes to a submodule?

Oops.  I've already applied Anders's patch, but you are right.  A change
from a blob to submodule also shows up as a typechange event.

Perhaps we should just remove the parenthesised comment from there
instead.  I'll rewind and rebuild, as I haven't pushed the results out
yet (lucky me).

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Documentation: diff-filter=T only tests for symlink changes
  2008-10-18  8:49             ` [PATCH] Documentation: diff-filter=T only tests for symlink changes Anders Melchiorsen
  2008-10-18 13:40               ` Nanako Shiraishi
  2008-10-18 18:08               ` Junio C Hamano
@ 2008-10-19  1:04               ` Nanako Shiraishi
  2008-10-19 10:29                 ` Anders Melchiorsen
  2 siblings, 1 reply; 13+ messages in thread
From: Nanako Shiraishi @ 2008-10-19  1:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Anders Melchiorsen, git

Quoting Junio C Hamano <gitster@pobox.com>:
>
> Nanako Shiraishi <nanako3@lavabit.com> writes:
>
>> Quoting Anders Melchiorsen <mail@cup.kalibalik.dk>:
>>
>>> diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
>>> index 7788d4f..7604a13 100644
>>> --- a/Documentation/diff-options.txt
>>> +++ b/Documentation/diff-options.txt
>>> @@ -137,7 +137,7 @@ endif::git-format-patch[]
>>>  --diff-filter=[ACDMRTUXB*]::
>>>  	Select only files that are Added (`A`), Copied (`C`),
>>>  	Deleted (`D`), Modified (`M`), Renamed (`R`), have their
>>> -	type (mode) changed (`T`), are Unmerged (`U`), are
>>> +	type (symlink/regular file) changed (`T`), are Unmerged (`U`), are
>>>  	Unknown (`X`), or have had their pairing Broken (`B`).
>>>  	Any combination of the filter characters may be used.
>>>  	When `*` (All-or-none) is added to the combination, all
>>> -- 
>>> 1.6.0.2.514.g23abd3
>>
>> Are symlinks and regular files the only kind of object you can see in
>> diff? What happens when a file or directory changes to a submodule?
>
> Oops.  I've already applied Anders's patch, but you are right.  A change
> from a blob to submodule also shows up as a typechange event.
>
> Perhaps we should just remove the parenthesised comment from there
> instead.  I'll rewind and rebuild, as I haven't pushed the results out
> yet (lucky me).

I see that you pushed out this change already, and you changed your mind and described them all.  I think the result reads better.

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Documentation: diff-filter=T only tests for symlink changes
  2008-10-19  1:04               ` Nanako Shiraishi
@ 2008-10-19 10:29                 ` Anders Melchiorsen
  0 siblings, 0 replies; 13+ messages in thread
From: Anders Melchiorsen @ 2008-10-19 10:29 UTC (permalink / raw)
  To: Nanako Shiraishi; +Cc: Junio C Hamano, git

Nanako Shiraishi <nanako3@lavabit.com> writes:

> I see that you pushed out this change already, and you changed your
> mind and described them all. I think the result reads better.

While we are fixing up that paragraph, this part could also use some
elaboration:

  Unknown (`X`), or have had their pairing Broken (`B`).

I would do it, but I have no idea what these two mean.


Regards,
Anders

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-10-19 10:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-15 18:42 --diff-filter=T does not list x changes Anders Melchiorsen
2008-10-16 10:22 ` Jeff King
2008-10-17  2:00   ` Junio C Hamano
2008-10-17  7:08     ` Anders Melchiorsen
2008-10-17  8:29       ` Junio C Hamano
2008-10-17 19:33         ` Anders Melchiorsen
2008-10-17 23:58           ` Junio C Hamano
2008-10-18  8:49             ` [PATCH] Documentation: diff-filter=T only tests for symlink changes Anders Melchiorsen
2008-10-18 13:40               ` Nanako Shiraishi
2008-10-18 18:37                 ` Junio C Hamano
2008-10-18 18:08               ` Junio C Hamano
2008-10-19  1:04               ` Nanako Shiraishi
2008-10-19 10:29                 ` Anders Melchiorsen

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).