commit 0f01ac5d813fe34a941ee33dbb19dba78ddbe966 from: Stefan Sperling date: Fri Aug 29 14:57:09 2025 UTC make 'tog diff' show the repository name in names of patches written to /tmp ok op@ commit - a906b277aa501d5897960b8e9f4466450d91dcac commit + 0f01ac5d813fe34a941ee33dbb19dba78ddbe966 blob - 0ccc6a0f788f55d0c7f1bd60778f977402cfd4d8 blob + 44b2d7f8b746631a2dcc8691478e5b582881c5e3 --- tog/tog.c +++ tog/tog.c @@ -7003,6 +7003,7 @@ diff_write_patch(struct tog_view *view) FILE *f = NULL; char buf[BUFSIZ], pathbase[PATH_MAX]; char *idstr1, *idstr2 = NULL, *path = NULL; + char *repo_name = NULL; size_t r; off_t pos; int rc; @@ -7035,8 +7036,13 @@ diff_write_patch(struct tog_view *view) if (err != NULL) goto done; - rc = snprintf(pathbase, sizeof(pathbase), "%s/tog-%.8s-%.8s", - GOT_TMPDIR_STR, idstr1 != NULL ? idstr1 : "empty", idstr2); + err = got_path_basename(&repo_name, got_repo_get_path(s->repo)); + if (err) + goto done; + + rc = snprintf(pathbase, sizeof(pathbase), "%s/tog-%s-%.8s-%.8s", + GOT_TMPDIR_STR, repo_name, + idstr1 != NULL ? idstr1 : "empty", idstr2); if (rc < 0 || (size_t)rc >= sizeof(pathbase)) { err = got_error(rc < 0 ? GOT_ERR_IO : GOT_ERR_NO_SPACE); goto done; @@ -7080,6 +7086,7 @@ done: free(path); free(idstr1); free(idstr2); + free(repo_name); return err; }