Re: [PATCH] git status: Show detailed dirty status of submodules in long format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jens Lehmann <Jens.Lehmann@xxxxxx> 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.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]