commit 3363f42b92e1cfb43e378c65e8f7d5f9f3f8f92e68e2102e6549ad848b9e03c8 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 - 223a6550c748d4197032951c1eacf87694482f411a6d39bc1d9bbc2afe477792 commit + 3363f42b92e1cfb43e378c65e8f7d5f9f3f8f92e68e2102e6549ad848b9e03c8 blob - 52daa873c21da576d336ced7d1ef7a2e7a4daf332d7765c49df856873fadf0eb blob + c4b7314dfc88c88bab267816ed105c2096fdd29699a2dea7e4e13e73efc4c49c --- 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; }