From 798c35fcd8a71a094ca68ac05d81e08c5ac8166d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 29 May 2013 19:12:42 +0700 Subject: get_sha1: warn about full or short object names that look like refs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we get 40 hex digits, we immediately assume it's an SHA-1. This is the right thing to do because we have no way else to specify an object. If there is a ref with the same object name, it will be ignored. Warn the user about this case because the ref with full object name is likely a mistake, for example git checkout -b $empty_var $(git rev-parse something) advice.object_name_warning is not documented because frankly people should not be aware about it until they encounter this situation. While at there, warn about ambiguation with abbreviated SHA-1 too. Signed-off-by: Nguyễn Thái Ngọc Duy 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 fad36df467..24d5420b7a 100644 --- a/advice.h +++ b/advice.h @@ -15,6 +15,7 @@ extern int advice_commit_before_merge; extern int advice_resolve_conflict; extern int advice_implicit_identity; extern int advice_detached_head; +extern int advice_object_name_warning; int git_default_advice_config(const char *var, const char *value); void advise(const char *advice, ...); -- cgit v1.2.3