All of lore.kernel.org
 help / color / mirror / Atom feed
* Adding "--ignore-submodules" switch to git-describe
@ 2013-03-01 10:16 Francis Moreau
  2013-03-01 17:46 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Francis Moreau @ 2013-03-01 10:16 UTC (permalink / raw)
  To: git

Hello,

Would it make sense to add the option --ignore-submodules (currently
available in git-status) to git-describe when the later is used with
--dirty option ?

Thanks
-- 
Francis

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

* Re: Adding "--ignore-submodules" switch to git-describe
  2013-03-01 10:16 Adding "--ignore-submodules" switch to git-describe Francis Moreau
@ 2013-03-01 17:46 ` Junio C Hamano
  2013-03-01 19:40   ` Jens Lehmann
  2013-03-08 20:04   ` Francis Moreau
  0 siblings, 2 replies; 5+ messages in thread
From: Junio C Hamano @ 2013-03-01 17:46 UTC (permalink / raw)
  To: Francis Moreau; +Cc: git, Jens Lehmann

Francis Moreau <francis.moro@gmail.com> writes:

> Would it make sense to add the option --ignore-submodules (currently
> available in git-status) to git-describe when the later is used with
> --dirty option ?

I think the spirit of "describe --dirty" is to allow people who
gives out binaries this assurance:

	The version string I got out of "describe --dirty" does not
	say dirty. If the recipient of the binary later reports
	issues, I should be able to reproduce the same binary by
	starting from a pristine checkout of the version (provided
	if I didn't screw up and depended on an untracked file when
	I initially created the binary, or used a custom build
	option, or lost the toolchain, ..., of course).

With that in mind, does --ignore-submodules make sense?

As we do not take untracked content at the superproject level into
account when deciding "--dirty"-ness, I think it is very sensible to
either do one of the following:

 (1) always ignore untracked files in submodule working trees; or

 (2) if we were to introduce some form of --ignore-submodules,
     ignore untracked files in the superproject working tree when we
     use that mechanism to ignore untracked files in submodule
     working trees.

Strictly speaking, (1) is a degenerate case of (2).

Using the same semantics of "--ignore-submodules" as "git status"
would not make much sense. "git status --ignore-submodules" does not
show modified submodules at all (e.g. the gitlink recorded in the
HEAD of the superproject being described does not match what is
checked out), so a clean output from the "describe --dirty" at the
superproject level does not give any assurance on the build
artifact.  It defeats the whole point of "describe --dirty".

I think what is missing from "--dirty" is not "--ignore-submodules",
but "--do-not-ignore-untracked" option [*1*].  "describe --dirty"
ignores untracked files in the superproject by default, and we
should ignore untracked files in submodule working trees, but the
current code does not.  Fixing that is (1) above.

And then when "--do-not-ignore-untracked" is in effect, we should
report a "dirty" revision when the working tree of the superproject
or any of the submodule working trees has untracked cruft.

You might want to argue, in the longer term, that the default should
be "--do-not-ignore-untracked" and people who want the current
toplevel behaviour should ask it with "--ignore-untracked".  I am
somewhat sympathetic to that position, but I do not think it is
practical.  People are not perfect and they do keep untracked and
unignored paths in the working tree; ignoring untracked paths does
have an excuse to be the default from practical point of view.

But when we ignore untracked paths in the superproject, we should
ignore untracked paths in submodule working trees consistently.


[Footnote]

*1* Ignoring any other kind of change in submodules (i.e. "none",
"dirty" or "all" for "git status --ignore-submodules=<when>") in the
context of "describe --dirty" in the superproject tree does not make
any sense, so

	BAD$ git describe --dirty --ignore-submodules=<when>

is not a right thing to do.

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

* Re: Adding "--ignore-submodules" switch to git-describe
  2013-03-01 17:46 ` Junio C Hamano
@ 2013-03-01 19:40   ` Jens Lehmann
  2013-03-08 20:04   ` Francis Moreau
  1 sibling, 0 replies; 5+ messages in thread
From: Jens Lehmann @ 2013-03-01 19:40 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Francis Moreau, git

Am 01.03.2013 18:46, schrieb Junio C Hamano:
> I think what is missing from "--dirty" is not "--ignore-submodules",
> but "--do-not-ignore-untracked" option [*1*].  "describe --dirty"
> ignores untracked files in the superproject by default, and we
> should ignore untracked files in submodule working trees, but the
> current code does not.  Fixing that is (1) above.
>
> And then when "--do-not-ignore-untracked" is in effect, we should
> report a "dirty" revision when the working tree of the superproject
> or any of the submodule working trees has untracked cruft.

I agree with your analysis. What about teaching describe the
"-u|--untracked-files" option which status already knows? The
two modes could be "no" and "yes" here (as the distinction
between "normal" and "all" doesn't make any sense for describe).
Current default would be "no", using "-u" alone would set mode to
"yes".

> You might want to argue, in the longer term, that the default should
> be "--do-not-ignore-untracked" and people who want the current
> toplevel behaviour should ask it with "--ignore-untracked".  I am
> somewhat sympathetic to that position, but I do not think it is
> practical.  People are not perfect and they do keep untracked and
> unignored paths in the working tree; ignoring untracked paths does
> have an excuse to be the default from practical point of view.

I think the default mostly depends on the habits of the people
using a repo. Personally I would lean towards making "-uyes" the
default, because in my experience untracked files can make a huge
difference when you later try to reproduce a certain version and
its behavior (and additionally that is just what status already
uses as default). But I won't care that much about the default if
we would just reuse the "status.showUntrackedFiles" config option
to set the default for describe too. This should allow to set the
policy per repo or globally to peoples taste. Does that make sense?

> But when we ignore untracked paths in the superproject, we should
> ignore untracked paths in submodule working trees consistently.

Definitely (we fixed that for status some time ago in 3bfc45047).

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

* Re: Adding "--ignore-submodules" switch to git-describe
  2013-03-01 17:46 ` Junio C Hamano
  2013-03-01 19:40   ` Jens Lehmann
@ 2013-03-08 20:04   ` Francis Moreau
  2013-03-08 21:26     ` Junio C Hamano
  1 sibling, 1 reply; 5+ messages in thread
From: Francis Moreau @ 2013-03-08 20:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jens Lehmann

Hi,

Sorry for the long delay, I somehow missed your answer...

On Fri, Mar 1, 2013 at 6:46 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Francis Moreau <francis.moro@gmail.com> writes:
>
>> Would it make sense to add the option --ignore-submodules (currently
>> available in git-status) to git-describe when the later is used with
>> --dirty option ?
>
> I think the spirit of "describe --dirty" is to allow people who
> gives out binaries this assurance:
>
>         The version string I got out of "describe --dirty" does not
>         say dirty. If the recipient of the binary later reports
>         issues, I should be able to reproduce the same binary by
>         starting from a pristine checkout of the version (provided
>         if I didn't screw up and depended on an untracked file when
>         I initially created the binary, or used a custom build
>         option, or lost the toolchain, ..., of course).
>
> With that in mind, does --ignore-submodules make sense?

Well, I wouldn't have thought about this definition of "describe
--dirty". I would have thought that, by default, this command look
only at the files that git knows/tracks. There're too many external
(to the git repo) parameters that could influence the build of a
project: environment variables, components of the toolchain, version
of each components etc... that git doesn't know about.

[...]

>
> But when we ignore untracked paths in the superproject, we should
> ignore untracked paths in submodule working trees consistently.
>
>

yes I agree.

But in the short term, could you suggest a method to workaround this
inconsistency ?

Thanks.
-- 
Francis

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

* Re: Adding "--ignore-submodules" switch to git-describe
  2013-03-08 20:04   ` Francis Moreau
@ 2013-03-08 21:26     ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2013-03-08 21:26 UTC (permalink / raw)
  To: Francis Moreau; +Cc: git, Jens Lehmann

Francis Moreau <francis.moro@gmail.com> writes:

>> But when we ignore untracked paths in the superproject, we should
>> ignore untracked paths in submodule working trees consistently.
>
> yes I agree.
>
> But in the short term, could you suggest a method to workaround this
> inconsistency ?

Hrm, ... didn't I already?

    As we do not take untracked content at the superproject level into
    account when deciding "--dirty"-ness, I think it is very sensible to
    either do one of the following:

     (1) always ignore untracked files in submodule working trees; or

     (2) if we were to introduce some form of --ignore-submodules,
         ignore untracked files in the superproject working tree when we
         use that mechanism to ignore untracked files in submodule
         working trees.

    Strictly speaking, (1) is a degenerate case of (2).

    ...
    I think what is missing from "--dirty" is not "--ignore-submodules",
    but "--do-not-ignore-untracked" option [*1*].  "describe --dirty"
    ignores untracked files in the superproject by default, and we
    should ignore untracked files in submodule working trees, but the
    current code does not.  Fixing that is (1) above.

I think the right first step without any new option is to make
"describe --dirty" to ignore the dirtiness in submodules coming
solely from having untracked files in submodules' working trees.

You could later add --having-untracked-is-dirty option to mark the
output dirty when there is an untracked file in submodules' working
trees or the toplevel working tree, which would be the second step.

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

end of thread, other threads:[~2013-03-08 21:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-01 10:16 Adding "--ignore-submodules" switch to git-describe Francis Moreau
2013-03-01 17:46 ` Junio C Hamano
2013-03-01 19:40   ` Jens Lehmann
2013-03-08 20:04   ` Francis Moreau
2013-03-08 21:26     ` Junio C Hamano

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.