From: Emily Shaffer Date: Fri, 14 Feb 2020 01:53:28 GMT Subject: [PATCH v7 00/15] add git-bugreport tool Message-ID: <20200214015343.201946-1-emilyshaffer@google.com> In-Reply-To: <20200206004108.261317-1-emilyshaffer@google.com> This patchset is based on mr/show-config-scope, which looks close to ready for 'next'. Since v6: - Applied Danh's suggestion[1] (with modifications recommended by Eric and Junio downthread) - Fixed a missed end-of-macro in the Asciidoctor config which was pointed out most recently by SZEDER[2] - Fixed generate-bugreport-safelist-config.sh to be more friendly to BSD-derived 'sed' and to capture trailing ' ' when extra whitespace is present(patch 9/15). This now uses POSIX character classes and {} notation instead of + and has been tested on OSX; I'd love to hear if it's still not working correctly. - Applied Junio's patch[3] to make GIT_TEST_GETTEXT_POISON happy and to make the tests more idiomatic. - Stop globbing into variables, start making the output directory if it doesn't exist before[4] - Add an entry in 'command-list.txt'[5]. I sure wish someone had explained how to do this somewhere in a tutorial about writing new commands ;) - Added a test to ensure that git-bugreport runs gracefully in a non-repo directory. - Added nongit_ok flags to relevant pieces of info to ensure the above test passes. [1] https://lore.kernel.org/git/20200206013533.GA3993@danh.dev [2] https://lore.kernel.org/git/20200207153042.GI2868@szeder.dev [3] https://lore.kernel.org/git/xmqq36bfvfwr.fsf@gitster-ct.c.googlers.com [4] https://lore.kernel.org/git/20200207141802.GE2868@szeder.dev [5] https://lore.kernel.org/git/20200207145409.GG2868@szeder.dev Emily Shaffer (15): help: move list_config_help to builtin/help help: add shell-path to --build-options bugreport: add tool to generate debugging info bugreport: gather git version and build info bugreport: add uname info bugreport: add compiler info bugreport: add git-remote-https version bugreport: include user interactive shell bugreport: generate config safelist based on docs bugreport: add config values from safelist bugreport: collect list of populated hooks bugreport: count loose objects bugreport: add packed object summary bugreport: list contents of $OBJDIR/info bugreport: summarize contents of alternates file .gitignore | 3 + Documentation/asciidoc.conf | 9 + Documentation/asciidoctor-extensions.rb | 7 + Documentation/config/sendemail.txt | 56 ++-- Documentation/git-bugreport.txt | 55 ++++ Makefile | 27 +- bugreport.c | 418 ++++++++++++++++++++++++ builtin/help.c | 86 +++++ command-list.txt | 1 + compat/compiler.h | 24 ++ generate-bugreport-config-safelist.sh | 18 + generate-cmdlist.sh | 19 -- generate-configlist.sh | 21 ++ help.c | 132 ++------ help.h | 2 +- object-store.h | 6 + packfile.c | 3 +- remote-curl.c | 8 + t/t0091-bugreport.sh | 55 ++++ 19 files changed, 794 insertions(+), 156 deletions(-) create mode 100644 Documentation/git-bugreport.txt create mode 100644 bugreport.c create mode 100644 compat/compiler.h create mode 100755 generate-bugreport-config-safelist.sh create mode 100755 generate-configlist.sh create mode 100755 t/t0091-bugreport.sh v6 to v7 range-diff: diff --git a/Documentation/asciidoctor-extensions.rb b/Documentation/asciidoctor-extensions.rb index 382bd8f6f4..03c80af0e5 100644 --- a/Documentation/asciidoctor-extensions.rb +++ b/Documentation/asciidoctor-extensions.rb @@ -37,6 +37,8 @@ module Git output = output.sub(/<\/refmeta>/, new_tags + "") end output + end + end class AnnotateProcessor < Asciidoctor::Extensions::InlineMacroProcessor def process(parent, target, attrs) diff --git a/bugreport.c b/bugreport.c index 9d4d5c8e6f..3bc8cb3579 100644 --- a/bugreport.c +++ b/bugreport.c @@ -368,6 +368,15 @@ int cmd_main(int argc, const char **argv) if (!stat(report_path.buf, &statbuf)) die("'%s' already exists", report_path.buf); + switch (safe_create_leading_directories(report_path.buf)) { + case SCLD_OK: + case SCLD_EXISTS: + break; + default: + die(_("could not create leading directories for '%s'"), + report_path.buf); + } + get_bug_template(&buffer); get_header(&buffer, "System Info"); diff --git a/command-list.txt b/command-list.txt index 2087894655..185e5e3f05 100644 --- a/command-list.txt +++ b/command-list.txt @@ -54,6 +54,7 @@ git-archive mainporcelain git-bisect mainporcelain info git-blame ancillaryinterrogators complete git-branch mainporcelain history +git-bugreport ancillaryinterrogators git-bundle mainporcelain git-cat-file plumbinginterrogators git-check-attr purehelpers diff --git a/generate-bugreport-config-safelist.sh b/generate-bugreport-config-safelist.sh index 17d92a91c5..2794a8ae77 100755 --- a/generate-bugreport-config-safelist.sh +++ b/generate-bugreport-config-safelist.sh @@ -10,7 +10,8 @@ EOF # cat all regular files in Documentation/config find Documentation/config -type f -exec cat {} \; | # print the command name which matches the annotate-bugreport macro -sed -n 's/^\(.*\) \+annotate:bugreport\[include\].* ::$/ "\1",/p' | sort +sed -n 's/^\([^[:blank:]]*\)[[:blank:]]\{1,\}annotate:bugreport\[include\].* ::$/ "\1",/p' \ + | sort cat <>git-bugreport-duplicate.txt && test_must_fail git bugreport --suffix duplicate && - rm git-bugreport-duplicate.txt + test_when_finished rm git-bugreport-duplicate.txt ' test_expect_success '--output-directory puts the report in the provided dir' ' - mkdir foo/ && git bugreport -o foo/ && test_path_is_file foo/git-bugreport-* && - rm -fr foo/ + test_when_finished rm -fr foo/ ' test_expect_success 'incorrect arguments abort with usage' ' test_must_fail git bugreport --false 2>output && - grep usage output && + test_i18ngrep usage output && test_path_is_missing git-bugreport-* ' +test_expect_success 'runs outside of a git dir' ' + nongit git bugreport && + test_when_finished rm non-repo/git-bugreport-* +' + test_done -- 2.25.0.265.gbab2e86ba0-goog