Francis Moreau <francis.m...@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
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.
*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.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html