diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-05-20 15:26:55 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-05-20 15:26:55 -0700 |
| commit | 2e969751ec29bf948ce8ab3eef111d01b4293a42 (patch) | |
| tree | fb583b77e158f25f310fdfb85f7e1e777fa88cc5 /diff.c | |
| parent | Merge branch 'kf/p4-multiple-remotes' (diff) | |
| parent | diff: use mks_tempfile_dt() (diff) | |
| download | git-2e969751ec29bf948ce8ab3eef111d01b4293a42.tar.gz git-2e969751ec29bf948ce8ab3eef111d01b4293a42.zip | |
Merge branch 'rs/external-diff-tempfile'
The temporary files fed to external diff command are now generated
inside a new temporary directory under the same basename.
* rs/external-diff-tempfile:
diff: use mks_tempfile_dt()
tempfile: add mks_tempfile_dt()
Diffstat (limited to 'diff.c')
| -rw-r--r-- | diff.c | 8 |
1 files changed, 1 insertions, 7 deletions
@@ -4136,18 +4136,13 @@ static void prep_temp_blob(struct index_state *istate, int mode) { struct strbuf buf = STRBUF_INIT; - struct strbuf tempfile = STRBUF_INIT; char *path_dup = xstrdup(path); const char *base = basename(path_dup); struct checkout_metadata meta; init_checkout_metadata(&meta, NULL, NULL, oid); - /* Generate "XXXXXX_basename.ext" */ - strbuf_addstr(&tempfile, "XXXXXX_"); - strbuf_addstr(&tempfile, base); - - temp->tempfile = mks_tempfile_ts(tempfile.buf, strlen(base) + 1); + temp->tempfile = mks_tempfile_dt("git-blob-XXXXXX", base); if (!temp->tempfile) die_errno("unable to create temp-file"); if (convert_to_working_tree(istate, path, @@ -4162,7 +4157,6 @@ static void prep_temp_blob(struct index_state *istate, oid_to_hex_r(temp->hex, oid); xsnprintf(temp->mode, sizeof(temp->mode), "%06o", mode); strbuf_release(&buf); - strbuf_release(&tempfile); free(path_dup); } |
