Subject: Re: [PATCH v7 03/15] bugreport: add tool to generate debugging info

From: Emily Shaffer <[email-masked]>
Date: Fri, 14 Feb 2020 17:57:29 -0800

On Fri, Feb 14, 2020 at 09:25:12AM -0800, Junio C Hamano wrote:
> Emily Shaffer <[email-masked]> writes:
> 
> > +	switch (safe_create_leading_directories(report_path.buf)) {
> 
> This helper is about creating paths in the working tree and Git
> repository,

It's also used by cmd_format_patch() with --output-directory specified,
which is how I found it. My usual workflow is to run format-patch with
-o ~/mailed-patches/topic/ specified so I don't clutter my repo, so I'm
surprised to hear the intent of safe_create_leading_directores() is for
paths in the working tree or repo.

> hence it has a call to adjust_shared_perm() which in
> turn calls get_shared_repo(), i.e. requiring a repository.

Hmmm. I was able to run it pretty happily from a nongit dir:

  emilyshaffer@podkayne:~$ tg bugreport -o other/very/deep/path/
  Created new report at 'other/very/deep/path/git-bugreport-2020-02-14-1721.txt'.
  emilyshaffer@podkayne:~$ cat other/very/deep/path/git-bugreport-2020-02-14-1721.txt
  Thank you for filling out a Git bug report!

> I thought I read somewhere that this tool is meant to be usable
> outside a repository?  If that is not the case, then the use of this
> helper is OK.  If not, we may want to make sure that it will stay to
> be safe to use the helper (I think it happens to be OK right now,
> but if the reason why the user is trying to run the tool is because
> the user broke Git by writing garbage into .git/config, we may
> die("your configuration file is broken") before this helper returns).

Can you explain a little more about what you mean? A broken local
.git/config seems to be preventing git.c from dispatching the
'bugreport' subcommand (lots of other Git commands are broken) at all -
breakpoints in cmd_main() right after the variable declarations are not
being hit.

With junk in the .git/config, I can't run bugreport from within that
repo. With junk in ~/.gitconfig, I can't run bugreport anywhere.

(To make the configs invalid, I leaned on my keyboard and added a line
'garbaghe~*~$%)%)(@' to the bottom of the config file. Most commands
terminate early with "fatal: bad config line 37 in file .git/config".)

Do you mean there's some specific config that could be misconfigured and
prevent that utility from working?

 - Emily