Re: [PATCH 4/7] submodule.c: port is_submodule_modified to use porcelain 2
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Mar 24, 2017, 22:41 UTC
- Message-ID
- <20170324224124.GI31294@aiede.mtv.corp.google.com>
- In-Reply-To
- <20170324182902.19280-5-sbeller@google.com>
Stefan Beller wrote:
[...]
> --- a/submodule.c > +++ b/submodule.c
[...]
> @@ -1070,11 +1070,12 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
[...]
Show 7 quoted lines
> while (strbuf_getwholeline(&buf, fp, '\n') != EOF) {
> - if ((buf.buf[0] == '?') && (buf.buf[1] == '?'))
> + /* regular untracked files */
> + if (buf.buf[0] == '?')
> dirty_submodule |= DIRTY_SUBMODULE_UNTRACKED;
> else
> dirty_submodule |= DIRTY_SUBMODULE_MODIFIED;At first I didn't believe it could be so simple. :)
Unlike ordinary files that use 1, 2, or u, ignored files use '!'. You're not passing --ignored so you don't have to worry about them.
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Very nice.