summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2009-11-22 22:26:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-11-23 00:07:27 (GMT)
commit4c371f91270792791f867d15f25b03f800ab35a1 (patch)
tree8ca2bd7efa1e7801039ed90faeb13706d235b492 /merge-recursive.c
parent78d553b7d7b269bb22ebd8b1198657c37484a3a0 (diff)
downloadgit-4c371f91270792791f867d15f25b03f800ab35a1.zip
git-4c371f91270792791f867d15f25b03f800ab35a1.tar.gz
git-4c371f91270792791f867d15f25b03f800ab35a1.tar.bz2
merge-recursive: point the user to commit when file would be overwritten.
The commit-before-pull is well accepted in the DVCS community, but is confusing some new users. This should get them back in the right way when the problem occurs. 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.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index f55b7eb..1870448 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -3,6 +3,7 @@
* Fredrik Kuivinen.
* The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006
*/
+#include "advice.h"
#include "cache.h"
#include "cache-tree.h"
#include "commit.h"
@@ -170,7 +171,7 @@ static int git_merge_trees(int index_only,
int rc;
struct tree_desc t[3];
struct unpack_trees_options opts;
- static const struct unpack_trees_error_msgs msgs = {
+ struct unpack_trees_error_msgs msgs = {
/* would_overwrite */
"Your local changes to '%s' would be overwritten by merge. Aborting.",
/* not_uptodate_file */
@@ -182,6 +183,11 @@ static int git_merge_trees(int index_only,
/* bind_overlap -- will not happen here */
NULL,
};
+ if (advice_commit_before_merge) {
+ msgs.would_overwrite = msgs.not_uptodate_file =
+ "Your local changes to '%s' would be overwritten by merge. Aborting.\n"
+ "Please, commit your changes or stash them before you can merge.";
+ }
memset(&opts, 0, sizeof(opts));
if (index_only)