Commit 8036f53b authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit-clone: no longer create symbolic-ref origin/HEAD by default

Actually, since `git clone' always creates that symbolic-ref,
automatically *remove* that symbolic-ref right after cloning.

The default is to remove that symbolic-ref because it isn't actually
very useful.  Right after running `git clone' one knows which of the
remote branches is the "remote HEAD" without having to rely on that
symbolic-ref, because the local branch is automatically setup to use
that as upstream.  At all other times that symbolic-ref is unreliable
because it is not automatically updated then the "remote HEAD" changes.

But some users might want it anyway, so add a new option
`magit-clone-set-remote-head', which can be set to `t' to preserve the
symbolic-ref.
parent d6b8ea24
......@@ -12,6 +12,14 @@ Updates since v2.4.1
* Added new commands `magit-remote-set-head' and
`magit-remote-unset-head'.
* By default `magit-clone' now deletes the symbolic-ref "origin/HEAD"
right after running `git clone', which insists on creating it.
The new option `magit-clone-set-remote-head' can be set to `t' go
back to keeping that symbolic-ref. We default to removing it,
because it does not actually get automatically updated when the
HEAD of the remote changes, and that makes it rather pointless.
Fixes since v2.4.1
------------------
......
......@@ -33,6 +33,12 @@
;;; Clone
(defcustom magit-clone-set-remote-head nil
"Whether cloning creates the symbolic-ref `<remote>/HEAD'."
:package-version '(magit . "2.4.2")
:group 'magit-commands
:type 'boolean)
(defcustom magit-clone-set-remote.pushDefault 'ask
"Whether to set the value of `remote.pushDefault' after cloning.
......@@ -65,6 +71,8 @@ Then show the status buffer for the new repository."
(y-or-n-p "Set `remote.pushDefault' to \"origin\"? ")))
(let ((default-directory directory))
(magit-call-git "config" "remote.pushDefault" "origin")))
(unless magit-clone-set-remote-head
(magit-remote-unset-head "origin"))
(message "Cloning %s...done" repository)
(magit-status-internal directory)))
......@@ -151,7 +159,8 @@ doing that."
(let ((remote (magit-read-remote "Set HEAD for remote")))
(list remote
(and current-prefix-arg
(magit-read-remote-branch (format "Set %s/HEAD to" remote))))))
(magit-read-remote-branch (format "Set %s/HEAD to" remote)
remote nil nil t)))))
(magit-run-git "remote" "set-head" remote (or branch "--auto")))
;;;###autoload
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment