login
Header Space

 
 

[PATCH 6/7] warn on "git pull" without a given branch.<name>.remote value

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git@...>
Cc: <spearce@...>, <gitster@...>, <peff@...>, <johannes.schindelin@...>, <srb@...>
Date: Monday, April 28, 2008 - 11:32 am

This patch deprecates the behavior of "git pull" without a
branch.<name>.remote value in the configuration.  The value
"origin" will be used, but a warning will be printed too.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
---
 Documentation/git-pull.txt |    9 +++++----
 git-parse-remote.sh        |    8 ++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)

	In this case, I think we can warn because branch.*.remote
	lines are created by checkouts made with 1.5 or later.

diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt
index 3405ca0..18898f6 100644
--- a/Documentation/git-pull.txt
+++ b/Documentation/git-pull.txt
@@ -58,10 +58,11 @@ DEFAULT BEHAVIOUR
 -----------------
 
 Often people use `git pull` without giving any parameter.
-Traditionally, this has been equivalent to saying `git pull
-origin`.  However, when configuration `branch.<name>.remote` is
-present while on branch `<name>`, that value is used instead of
-`origin`.
+While on branch `<name>`, this will use the value of configuration
+`branch.<name>.remote` as the branch to pull from.  If the
+value is not present, it will be implicitly considered to be
+`origin`; however, this is deprecated and you consider
+writing the value explicitly in the configuration file.
 
 In order to determine what URL to use to fetch from, the value
 of the configuration `remote.<origin>.url` is consulted
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 695a409..eddb593 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -54,9 +54,17 @@ get_remote_url () {
 	esac
 }
 
+warned_about_default_remote=no
 get_default_remote () {
 	curr_branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||')
 	origin=$(git config --get "branch.$curr_branch.remote")
+	if test -z "$origin" && test "$warned_about_default_remote" = no; then
+	        echo "warning: you asked me to pull without telling me which repository"
+	        echo "warning: you want to pull from, and 'branch.${curr_branch}.remote'"
+	        echo "warning: in your configuration file does not tell me either."
+	        echo "warning: proceeding with 'origin'."
+		warned_about_default_remote=yes
+	fi
 	echo ${origin:-origin}
 }
 
-- 
1.5.5

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/7] add special "matching refs" refspec, Paolo Bonzini, (Mon Apr 28, 11:32 am)
[PATCH 2/7] add push line in git-clone, Paolo Bonzini, (Mon Apr 28, 11:32 am)
Re: [PATCH 2/7] add push line in git-clone, Junio C Hamano, (Thu May 1, 2:28 am)
Re: [PATCH 2/7] add push line in git-clone, Paolo Bonzini, (Tue May 6, 4:37 am)
Re: [PATCH 2/7] add push line in git-clone, Paolo Bonzini, (Wed May 14, 11:20 am)
Re: [PATCH 2/7] add push line in git-clone, Junio C Hamano, (Wed May 14, 2:16 pm)
Re: [PATCH 2/7] add push line in git-clone, Paolo Bonzini, (Wed May 14, 3:07 pm)
Re: [PATCH 2/7] add push line in git-clone, Junio C Hamano, (Wed May 14, 3:23 pm)
Re: [PATCH 2/7] add push line in git-clone, Paolo Bonzini, (Wed May 14, 3:40 pm)
[PATCH 3/7] Add a --push option to "git-remote add", Paolo Bonzini, (Mon Apr 28, 11:32 am)
[PATCH 4/7] make "git push" update all push repositories., Paolo Bonzini, (Mon Apr 28, 11:32 am)
[PATCH 6/7] warn on "git pull" without a given branch.<na..., Paolo Bonzini, (Mon Apr 28, 11:32 am)
[PATCH 7/7] make "git fetch" update all fetch repositories, Paolo Bonzini, (Mon Apr 28, 11:32 am)
Re: [PATCH 7/7] make "git fetch" update all fetch repositories, Johannes Schindelin, (Tue Apr 29, 5:39 pm)
Re: [PATCH 7/7] make "git fetch" update all fetch repositories, Johannes Schindelin, (Tue Apr 29, 6:26 pm)
Re: [PATCH 7/7] make "git fetch" update all fetch repositories, しらいしななこ, (Tue Apr 29, 5:08 pm)
Re: [PATCH 7/7] make "git fetch" update all fetch repositories, Johannes Schindelin, (Tue Apr 29, 12:13 pm)
Re: [PATCH resend] make "git push" update origin and mirrors..., Johannes Schindelin, (Mon Apr 28, 6:33 am)
Re: [PATCH resend] make "git push" update origin and mirrors..., Johannes Schindelin, (Mon Apr 28, 7:57 am)
Re: [PATCH resend] make "git push" update origin and mirrors..., Stephen R. van den Berg, (Mon Apr 28, 2:08 am)
speck-geostationary