From 75194438f412714f4e82ca01e9038dc6714498c4 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 9 Sep 2009 07:38:58 -0400 Subject: push: make non-fast-forward help message configurable This message is designed to help new users understand what has happened when refs fail to push. However, it does not help experienced users at all, and significantly clutters the output, frequently dwarfing the regular status table and making it harder to see. This patch introduces a general configuration mechanism for optional messages, with this push message as the first example. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- advice.h | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 advice.h (limited to 'advice.h') diff --git a/advice.h b/advice.h new file mode 100644 index 0000000000..862bae37b8 --- /dev/null +++ b/advice.h @@ -0,0 +1,8 @@ +#ifndef ADVICE_H +#define ADVICE_H + +extern int advice_push_nonfastforward; + +int git_default_advice_config(const char *var, const char *value); + +#endif /* ADVICE_H */ -- cgit v1.2.1 From edf563fbaa2ab50734db4a61e9092f25fbb5a417 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 9 Sep 2009 07:43:03 -0400 Subject: status: make "how to stage" messages optional These messages are nice for new users, but experienced git users know how to manipulate the index, and these messages waste a lot of screen real estate. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- advice.h | 1 + 1 file changed, 1 insertion(+) (limited to 'advice.h') diff --git a/advice.h b/advice.h index 862bae37b8..e9df8e026c 100644 --- a/advice.h +++ b/advice.h @@ -2,6 +2,7 @@ #define ADVICE_H extern int advice_push_nonfastforward; +extern int advice_status_hints; int git_default_advice_config(const char *var, const char *value); -- cgit v1.2.1 From 4c371f91270792791f867d15f25b03f800ab35a1 Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Sun, 22 Nov 2009 23:26:17 +0100 Subject: 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 Signed-off-by: Junio C Hamano --- advice.h | 1 + 1 file changed, 1 insertion(+) (limited to 'advice.h') diff --git a/advice.h b/advice.h index e9df8e026c..3de5000d8c 100644 --- a/advice.h +++ b/advice.h @@ -3,6 +3,7 @@ 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); -- cgit v1.2.1 From d38a30df7dd54c5c6883af1de1a03ec7d523cee5 Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Tue, 12 Jan 2010 10:54:44 +0100 Subject: Be more user-friendly when refusing to do something because of conflict. Various commands refuse to run in the presence of conflicts (commit, merge, pull, cherry-pick/revert). They all used to provide rough, and inconsistant error messages. A new variable advice.resolveconflict is introduced, and allows more verbose messages, pointing the user to the appropriate solution. For commit, the error message used to look like this: $ git commit foo.txt: needs merge foo.txt: unmerged (c34a92682e0394bc0d6f4d4a67a8e2d32395c169) foo.txt: unmerged (3afcd75de8de0bb5076942fcb17446be50451030) foo.txt: unmerged (c9785d77b76dfe4fb038bf927ee518f6ae45ede4) error: Error building trees The "need merge" line is given by refresh_cache. We add the IN_PORCELAIN option to make the output more consistant with the other porcelain commands, and catch the error in return, to stop with a clean error message. The next lines were displayed by a call to cache_tree_update(), which is not reached anymore if we noticed the conflict. The new output looks like: U foo.txt fatal: 'commit' is not possible because you have unmerged files. Please, fix them up in the work tree, and then use 'git add/rm ' as appropriate to mark resolution and make a commit, or use 'git commit -a'. Pull is slightly modified to abort immediately if $GIT_DIR/MERGE_HEAD exists instead of waiting for merge to complain. The behavior of merge and the test-case are slightly modified to reflect the usual flow: start with conflicts, fix them, and afterwards get rid of MERGE_HEAD, with different error messages at each stage. Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- advice.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'advice.h') diff --git a/advice.h b/advice.h index 3de5000d8c..acd5fdde3f 100644 --- a/advice.h +++ b/advice.h @@ -1,10 +1,15 @@ #ifndef ADVICE_H #define ADVICE_H +#include "git-compat-util.h" + extern int advice_push_nonfastforward; extern int advice_status_hints; extern int advice_commit_before_merge; +extern int advice_resolve_conflict; int git_default_advice_config(const char *var, const char *value); +extern void NORETURN die_resolve_conflict(const char *me); + #endif /* ADVICE_H */ -- cgit v1.2.1 From b706fcfe93262e485976ed2bc648b779cc47981f Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 13 Jan 2010 15:17:08 -0500 Subject: commit: allow suppression of implicit identity advice We now nag the user with a giant warning when their identity was pulled from the username, hostname, and gecos information, in case it is not correct. Most users will suppress this by simply setting up their information correctly. However, there may be some users who consciously want to use that information, because having the value change from host to host contains useful information. These users can now set advice.implicitidentity to false to suppress the message. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- advice.h | 1 + 1 file changed, 1 insertion(+) (limited to 'advice.h') diff --git a/advice.h b/advice.h index 3de5000d8c..728ab90ef1 100644 --- a/advice.h +++ b/advice.h @@ -4,6 +4,7 @@ extern int advice_push_nonfastforward; extern int advice_status_hints; extern int advice_commit_before_merge; +extern int advice_implicit_identity; int git_default_advice_config(const char *var, const char *value); -- cgit v1.2.1 From 13be3e31f1775bd496fc5bc1ab5b745052f4d07d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 29 Jan 2010 22:03:24 -0800 Subject: Reword "detached HEAD" notification The old "advice" message explained how to create a branch after going into a detached HEAD state but didn't make it clear why the user may want to do so. Also "moving to ... which isn't a local branch" was unclear if it is complaining, if it is describing the new state, or if it is explaining why the HEAD is detached (the true reason is the last one). Give the established phrase 'detached HEAD' first to make it easy for users to look up the concept in documentation, and briefly describe what can be done in the state (i.e. play around without having to clean up) before telling the user how to keep what was done during the temporary state. Allow the long description to be hidden by setting advice.detachedHead configuration to false. We might want to customize the advice depending on how the commit to check out was spelled (e.g. instead of "new-branch-name", we way want to say "topic" when "git checkout origin/topic" triggered this message) in later updates, but this encapsulates that into a separate function and it should be a good first step. Signed-off-by: Junio C Hamano --- advice.h | 1 + 1 file changed, 1 insertion(+) (limited to 'advice.h') diff --git a/advice.h b/advice.h index 9b7a3ad1ca..3244ebb5c1 100644 --- a/advice.h +++ b/advice.h @@ -8,6 +8,7 @@ extern int advice_status_hints; extern int advice_commit_before_merge; extern int advice_resolve_conflict; extern int advice_implicit_identity; +extern int advice_detached_head; int git_default_advice_config(const char *var, const char *value); -- cgit v1.2.1