diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-01-29 20:47:56 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-29 20:47:56 (GMT) |
commit | 7fa92ba40abbe4236226e7d91e664bbeab8c43f2 (patch) | |
tree | a006af88cbd92c2d303387447e8120a046338d24 | |
parent | 371820d5f1bb3c3e691ad21cee652c02c36ea758 (diff) | |
parent | fa6f225e0141ec0df1e131e894a3a7d7dea168f5 (diff) | |
download | git-7fa92ba40abbe4236226e7d91e664bbeab8c43f2.zip git-7fa92ba40abbe4236226e7d91e664bbeab8c43f2.tar.gz git-7fa92ba40abbe4236226e7d91e664bbeab8c43f2.tar.bz2 |
Merge branch 'js/add-e-clear-patch-before-stating'
"git add -e" got confused when the change it wants to let the user
edit is smaller than the previous change that was left over in a
temporary file.
* js/add-e-clear-patch-before-stating:
add --edit: truncate the patch file
-rw-r--r-- | builtin/add.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/add.c b/builtin/add.c index 12247b4..d461ba0 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -239,7 +239,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix) rev.diffopt.output_format = DIFF_FORMAT_PATCH; rev.diffopt.use_color = 0; rev.diffopt.flags.ignore_dirty_submodules = 1; - out = open(file, O_CREAT | O_WRONLY, 0666); + out = open(file, O_CREAT | O_WRONLY | O_TRUNC, 0666); if (out < 0) die(_("Could not open '%s' for writing."), file); rev.diffopt.file = xfdopen(out, "w"); |