Commit graph

4 commits

Author SHA1 Message Date
Junio C Hamano a9f2c13685 Make git-clone respect branch.autosetuprebase
When git-clone creates an initial branch it was not checking the
branch.autosetuprebase configuration option (which may exist in
~/.gitconfig).  Refactor the code used by "git branch" to create
a new branch, and use it instead of the insufficiently duplicated code
in builtin-clone.

Changes are partly, and the test is mostly, based on the previous work by
Pat Notz.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-03 22:58:52 -08:00
Jay Soffian 9ed36cfa35 branch: optionally setup branch.*.merge from upstream local branches
"git branch" and "git checkout -b" now honor --track option even when
the upstream branch is local.  Previously --track was silently ignored
when forking from a local branch.  Also the command did not error out
when --track was explicitly asked for but the forked point specified
was not an existing branch (i.e. when there is no way to set up the
tracking configuration), but now it correctly does.

The configuration setting branch.autosetupmerge can now be set to
"always", which is equivalent to using --track from the command line.
Setting branch.autosetupmerge to "true" will retain the former behavior
of only setting up branch.*.merge for remote upstream branches.

Includes test cases for the new functionality.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-19 21:17:45 -08:00
Daniel Barkalow c369e7b805 Move code to clean up after a branch change to branch.c
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
2008-02-09 23:16:51 -08:00
Daniel Barkalow e496c00348 Move create_branch into a library file
You can also create branches, in exactly the same way, with checkout -b.

This introduces branch.{c,h} library files for doing porcelain-level
operations on branches (such as creating them with their appropriate
default configuration).

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
2008-02-09 23:16:51 -08:00