Commit Diff


commit - 9fae180de0b682e0d81ac5a1a47685fc68574d6c
commit + d3dd90c6c9567eb0a4f0bd45fd3375a7447fb991
blob - eeeaf674438fcb6535713a5673c82658840f9501
blob + b7c7b60522b129a194803938a92d77fa65e52a0a
--- tog/tog.c
+++ tog/tog.c
@@ -7006,6 +7006,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;
@@ -7038,8 +7039,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;
@@ -7083,6 +7089,7 @@ done:
 	free(path);
 	free(idstr1);
 	free(idstr2);
+	free(repo_name);
 	return err;
 }