git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jens Lehmann <Jens.Lehmann@web.de>
Cc: Sergio Callegari <sergio.callegari@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] git status: Show detailed dirty status of submodules in long format
Date: Sat, 06 Mar 2010 21:41:14 -0800	[thread overview]
Message-ID: <7vtyssadtx.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4B90EB19.2070300@web.de> (Jens Lehmann's message of "Fri\, 05 Mar 2010 12\:29\:29 +0100")

Jens Lehmann <Jens.Lehmann@web.de> writes:

> # Changed but not updated:
> #   (use "git add <file>..." to update what will be committed)
> #   (use "git checkout -- <file>..." to discard changes in working directory)
> #   (commit or discard the untracked or modified content in submodules)

Can we do this additional line only when there is a submodule involved in
the changes?  The whole point of "collect first and then print" is so that
we can compute things like "has_deleted" before starting to emit any
output to intelligently give an appropriate advice message, and it feels
silly to say submodules to users who don't even use any submodule.  I have
a suspicion that the majority of users may not even know nor care what a
submodule is.

> I am not so proud of DIFF_FORMAT_DIRTY_SUBMODULES, the new flag i
> introduced to tell run_diff_files() it should gather the information
> needed even if we don't want patch output. It isn't a "format" per se,
> but i couldn't come up with a better way to do this. Opinions?

It indeed does sound like DIFF_OPT_* than DIFF_FORMAT_*.  In any case, we
probably would want to have a small helper function that encapsulates this
part that appear twice:

	changed = ce_match_stat(ce, &st, ce_option);
	if (S_ISGITLINK(ce->ce_mode)
	    && !DIFF_OPT_TST(&revs->diffopt, IGNORE_SUBMODULES)
	    && (!changed || (revs->diffopt.output_format & DIFF_FORMAT_PATCH)
		|| (revs->diffopt.output_format & DIFF_FORMAT_DIRTY_SUBMODULES))) {
		dirty_submodule = is_submodule_modified(ce->name);
		if (dirty_submodule)
			changed = 1;
	}

to something like

	changed = match_stat_with_submodule(&revs->diffopt, ce, &st,
        					ce_option, &dirty_submodule);

and the implementation of match_stat_with_submodule() a bit more heavily
commented so that people will know what it is for.

  reply	other threads:[~2010-03-07  5:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-05 11:29 [PATCH] git status: Show detailed dirty status of submodules in long format Jens Lehmann
2010-03-07  5:41 ` Junio C Hamano [this message]
2010-03-07 20:03   ` [PATCH v2] " Jens Lehmann
2010-03-08  8:33     ` Junio C Hamano
2010-03-08 12:53       ` [PATCH v3] " Jens Lehmann

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=7vtyssadtx.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=sergio.callegari@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 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).