summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 78d553b)
raw | patch | inline | side by side (parent: 78d553b)
author | Matthieu Moy <Matthieu.Moy@imag.fr> | |
Sun, 22 Nov 2009 22:26:17 +0000 (23:26 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 23 Nov 2009 00:07:27 +0000 (16:07 -0800) |
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>
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>
Documentation/config.txt | patch | blob | history | |
advice.c | patch | blob | history | |
advice.h | patch | blob | history | |
merge-recursive.c | patch | blob | history |
index cd1781498eb92d7dd0d3648a8fe188fc75a6df8c..0b550dc4905a2deb54c1f4756fa975039c6a3570 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
Directions on how to stage/unstage/add shown in the
output of linkgit:git-status[1] and the template shown
when writing commit messages. Default: true.
+ commitBeforeMerge::
+ Advice shown when linkgit:git-merge[1] refuses to
+ merge to avoid overwritting local changes.
+ Default: true.
--
core.fileMode::
diff --git a/advice.c b/advice.c
index ae4b1e81dfea0f63db10691ba0005c8888fd6dc7..cb666acc3cf8fdda777febbefac455f3667759f1 100644 (file)
--- a/advice.c
+++ b/advice.c
int advice_push_nonfastforward = 1;
int advice_status_hints = 1;
+int advice_commit_before_merge = 1;
static struct {
const char *name;
} advice_config[] = {
{ "pushnonfastforward", &advice_push_nonfastforward },
{ "statushints", &advice_status_hints },
+ { "commitbeforemerge", &advice_commit_before_merge },
};
int git_default_advice_config(const char *var, const char *value)
diff --git a/advice.h b/advice.h
index e9df8e026c301767b12217ba0374860a15742f2e..3de5000d8cb35c1d2c31867b942a54b487bed836 100644 (file)
--- a/advice.h
+++ b/advice.h
extern int advice_push_nonfastforward;
extern int advice_status_hints;
+extern int advice_commit_before_merge;
int git_default_advice_config(const char *var, const char *value);
diff --git a/merge-recursive.c b/merge-recursive.c
index f55b7ebe11bbd54f00a84dd1eb9d34f60d74a1c3..1870448d98d56fea31af56953dc33f6529d1d380 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
* 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"
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 */
/* 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)