aboutsummaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2010-08-11 10:38:06 +0200
committerJunio C Hamano <gitster@pobox.com>2010-08-11 10:36:05 -0700
commit08402b0409bc501deb97cf4388a78ee9f87092c6 (patch)
treec0b4207f0ae69970a21b4e94725d4318dc6ea6f5 /merge-recursive.c
parent23cbf11b5c08c6d0ab0fd0d6f2dc5a32ca31c745 (diff)
downloadgit-08402b0409bc501deb97cf4388a78ee9f87092c6.tar.gz
git-08402b0409bc501deb97cf4388a78ee9f87092c6.tar.xz
merge-recursive: distinguish "removed" and "overwritten" messages
To limit the number of possible error messages, the error messages for the case would_lose_untracked_file and would_lose_orphaned in unpack_trees_options.msgs were handled with a single string, parameterized by an action string ("overwritten" or "removed"). Instead, we consider them as two different cases, with unparameterized string. This will make it easier to make separate lists sorted by error types later. Only the bind_overlap case still takes two %s parameters, but that's unavoidable. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index b1e526b0d..697d948e8 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1197,13 +1197,16 @@ void set_porcelain_error_msgs(const char **msgs, const char *cmd)
"Updating '%s' would lose untracked files in it. Aborting.";
if (advice_commit_before_merge)
- msg = "Untracked working tree file '%%s' would be %%s by %s. Aborting"
+ msg = "Untracked working tree file '%%s' would be %s by %s. Aborting"
"Please move or remove them before you can %s.";
else
- msg = "Untracked working tree file '%%s' would be %%s by %s. Aborting";
- tmp = xmalloc(strlen(msg) + strlen(cmd) + strlen(cmd2) - 3);
- sprintf(tmp, msg, cmd, cmd2);
- msgs[ERROR_WOULD_LOSE_UNTRACKED] = tmp;
+ msg = "Untracked working tree file '%%s' would be %s by %s. Aborting";
+ tmp = xmalloc(strlen(msg) + strlen(cmd) + strlen("removed") + strlen(cmd2) - 4);
+ sprintf(tmp, msg, "removed", cmd, cmd2);
+ msgs[ERROR_WOULD_LOSE_UNTRACKED_REMOVED] = tmp;
+ tmp = xmalloc(strlen(msg) + strlen(cmd) + strlen("overwritten") + strlen(cmd2) - 4);
+ sprintf(tmp, msg, "overwritten", cmd, cmd2);
+ msgs[ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN] = tmp;
}
int merge_trees(struct merge_options *o,