From: Jeff King <peff@peff.net>
To: Sebastian Staudt <koraktor@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Duy Nguyen <pclouds@gmail.com>
Subject: Re: [PATCH v3 2/3] Setup working tree in describe
Date: Tue, 29 Jan 2019 08:11:51 -0500 [thread overview]
Message-ID: <20190129131151.GB22211@sigill.intra.peff.net> (raw)
In-Reply-To: <20190129051859.12830-2-koraktor@gmail.com>
On Tue, Jan 29, 2019 at 06:18:58AM +0100, Sebastian Staudt wrote:
> Subject: Re: [PATCH v3 2/3] Setup working tree in describe
We usually write subjects as "area: do some thing" which is a little
easier when scanning big lists of "git log --oneline".
I think it's key, too, that we only do this for the --dirty case, not
always. So maybe:
describe: setup working tree for --dirty
or something?
> This ensures the given working tree is used for --dirty.
There's been a lot of digging and discussion on the list about what
happens if we don't do this. Could we summarize it here?
Perhaps:
We don't use NEED_WORK_TREE when running the git-describe builtin,
since you should be able to describe a commit even in a bare
repository. However, the --dirty flag does need a working tree. Since
we don't call setup_work_tree(), it uses whatever directory we happen
to be in. That's unlikely to match our index, meaning we'd say "dirty"
even when the real working tree is clean.
We can fix that by calling setup_work_tree() once we know that the
user has asked for --dirty.
> The implementation of --broken uses diff-index which calls
> setup_work_tree() itself.
If I hadn't just read the rest of the thread, I'd probably wonder why we
are talking about --broken at all. Maybe:
The --broken option similarly needs a working tree. But because the
current implementation calls an external diff-index to do the work,
we don't have to bother setting up the working tree in the
git-describe process.
> diff --git a/builtin/describe.c b/builtin/describe.c
> index cc118448ee..b5b7abdc8f 100644
> --- a/builtin/describe.c
> +++ b/builtin/describe.c
> @@ -629,6 +629,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
> struct argv_array args = ARGV_ARRAY_INIT;
> int fd, result;
>
> + setup_work_tree();
> read_cache();
> refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED,
> NULL, NULL, NULL);
The patch itself looks good. :)
-Peff
next prev parent reply other threads:[~2019-01-29 13:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-29 5:18 [PATCH v3 1/3] Add tests for describe with --work-tree Sebastian Staudt
2019-01-29 5:18 ` [PATCH v3 2/3] Setup working tree in describe Sebastian Staudt
2019-01-29 13:11 ` Jeff King [this message]
2019-01-29 17:39 ` Junio C Hamano
2019-01-29 20:53 ` Eric Sunshine
2019-01-29 22:35 ` Jeff King
2019-01-30 10:31 ` Sebastian Staudt
2019-01-30 12:44 ` Jeff King
2019-01-29 5:18 ` [PATCH v3 3/3] Add test for describe with a bare repository Sebastian Staudt
2019-01-29 13:12 ` Jeff King
2019-01-30 10:23 ` Sebastian Staudt
2019-01-29 13:00 ` [PATCH v3 1/3] Add tests for describe with --work-tree Jeff King
2019-01-29 17:47 ` Junio C Hamano
2019-01-30 10:23 ` Sebastian Staudt
2019-01-30 12:43 ` Jeff King
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190129131151.GB22211@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=koraktor@gmail.com \
--cc=pclouds@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).