git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC/PATCH 1/3] remote: don't override default if cur head remote is '.'

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 16, 2013, 03:43 UTC
Message-ID
<1368675828-27418-2-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1368675828-27418-1-git-send-email-felipe.contreras@gmail.com>

'git fetch .' makes no sense, so let's keep using the default ('origin') when the current branch's remote is '.'.

Also update 'git pull' so that pulling works the same way as before.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 git-pull.sh | 9 ++++++++-
 remote.c    | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/git-pull.sh b/git-pull.sh
index 638aabb..75297c7 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -220,7 +220,14 @@ test true = "$rebase" && {
 	done
 }
 orig_head=$(git rev-parse -q --verify HEAD)
-git fetch $verbosity $progress $dry_run $recurse_submodules --update-head-ok "$@" || exit 1
+# get the default remote
+remote="$(git config "branch.$curr_branch_short.remote")"
+if test $# == 0 && test -n "$remote"
+then
+	git fetch $verbosity $progress $dry_run $recurse_submodules --update-head-ok "$remote" || exit 1
+else
+	git fetch $verbosity $progress $dry_run $recurse_submodules --update-head-ok "$@" || exit 1
+fi
 test -z "$dry_run" || exit 0
 
 curr_head=$(git rev-parse -q --verify HEAD)
diff --git a/remote.c b/remote.c
index 68eb99b..322a1b6 100644
--- a/remote.c
+++ b/remote.c
@@ -360,7 +360,7 @@ static int handle_config(const char *key, const char *value, void *cb)
 		if (!strcmp(subkey, ".remote")) {
 			if (git_config_string(&branch->remote_name, key, value))
 				return -1;
-			if (branch == current_branch) {
+			if (branch == current_branch && strcmp(branch->remote_name, ".")) {
 				default_remote_name = branch->remote_name;
 				explicit_default_remote_name = 1;
 			}
-- 
1.8.3.rc1.579.g184e698
Previous: Felipe ContrerasNext: Felipe Contreras
Message 2 of 28 in “New kind of upstream branch: downstream branch”
  1. 0/3 New kind of upstream branch: downstream branchFelipe Contreras, May 16, 2013
  2. 1/3 remote: don't override default if cur head remote is '.'Felipe Contreras, May 16, 2013
  3. 2/3 pull: trivial cleanupsFelipe Contreras, May 16, 2013
  4. Ramkumar RamachandraMay 16, 2013
  5. Felipe ContrerasMay 16, 2013
  6. Ramkumar RamachandraMay 16, 2013
  7. Felipe ContrerasMay 16, 2013
  8. Ramkumar RamachandraMay 16, 2013
  9. Felipe ContrerasMay 16, 2013
  10. Ramkumar RamachandraMay 16, 2013
  11. Felipe ContrerasMay 16, 2013
  12. Antoine PelisseMay 16, 2013
  13. Felipe ContrerasMay 16, 2013
  14. 3/3 push: add separate 'downstream' branchFelipe Contreras, May 16, 2013
  15. Junio C HamanoMay 16, 2013
  16. Felipe ContrerasMay 16, 2013
  17. Junio C HamanoMay 16, 2013
  18. Junio C HamanoMay 16, 2013
  19. Ramkumar RamachandraMay 16, 2013
  20. Felipe ContrerasMay 16, 2013
  21. Ramkumar RamachandraMay 16, 2013
  22. Felipe ContrerasMay 16, 2013
  23. Ramkumar RamachandraMay 16, 2013
  24. Felipe ContrerasMay 16, 2013
  25. Ramkumar RamachandraMay 16, 2013
  26. Felipe ContrerasMay 16, 2013
  27. Ramkumar RamachandraMay 16, 2013
  28. Felipe ContrerasMay 16, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.