|
11 | 11 | #include "dir.h"
|
12 | 12 | #include "packfile.h"
|
13 | 13 | #include "help.h"
|
14 |
| -#include "diagnose.h" |
15 | 14 |
|
16 | 15 | /*
|
17 | 16 | * Remove the deepest subdirectory in the provided path string. Path must not
|
@@ -510,34 +509,19 @@ static int cmd_diagnose(int argc, const char **argv)
|
510 | 509 | N_("scalar diagnose [<enlistment>]"),
|
511 | 510 | NULL
|
512 | 511 | };
|
513 |
| - struct strbuf zip_path = STRBUF_INIT; |
514 |
| - time_t now = time(NULL); |
515 |
| - struct tm tm; |
| 512 | + struct strbuf diagnostics_root = STRBUF_INIT; |
516 | 513 | int res = 0;
|
517 | 514 |
|
518 | 515 | argc = parse_options(argc, argv, NULL, options,
|
519 | 516 | usage, 0);
|
520 | 517 |
|
521 |
| - setup_enlistment_directory(argc, argv, usage, options, &zip_path); |
522 |
| - |
523 |
| - strbuf_addstr(&zip_path, "/.scalarDiagnostics/scalar_"); |
524 |
| - strbuf_addftime(&zip_path, |
525 |
| - "%Y%m%d_%H%M%S", localtime_r(&now, &tm), 0, 0); |
526 |
| - strbuf_addstr(&zip_path, ".zip"); |
527 |
| - switch (safe_create_leading_directories(zip_path.buf)) { |
528 |
| - case SCLD_EXISTS: |
529 |
| - case SCLD_OK: |
530 |
| - break; |
531 |
| - default: |
532 |
| - error_errno(_("could not create directory for '%s'"), |
533 |
| - zip_path.buf); |
534 |
| - goto diagnose_cleanup; |
535 |
| - } |
| 518 | + setup_enlistment_directory(argc, argv, usage, options, &diagnostics_root); |
| 519 | + strbuf_addstr(&diagnostics_root, "/.scalarDiagnostics"); |
536 | 520 |
|
537 |
| - res = create_diagnostics_archive(&zip_path, DIAGNOSE_ALL); |
| 521 | + res = run_git("diagnose", "--mode=all", "-s", "%Y%m%d_%H%M%S", |
| 522 | + "-o", diagnostics_root.buf, NULL); |
538 | 523 |
|
539 |
| -diagnose_cleanup: |
540 |
| - strbuf_release(&zip_path); |
| 524 | + strbuf_release(&diagnostics_root); |
541 | 525 | return res;
|
542 | 526 | }
|
543 | 527 |
|
|
0 commit comments