summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 259cd0f)
raw | patch | inline | side by side (parent: 259cd0f)
author | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 9 May 2008 00:16:43 +0000 (20:16 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 9 May 2008 00:20:27 +0000 (20:20 -0400) |
When creating new branches if branch.autosetupmerge is not set, or
is set to true or always and we have been given a remote tracking
branch as the starting point for a new branch we want to create the
necessary configuration options in .git/config for the new branch
so that a no argument git-pull on the command line pulls from the
remote repository's branch.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
is set to true or always and we have been given a remote tracking
branch as the starting point for a new branch we want to create the
necessary configuration options in .git/config for the new branch
so that a no argument git-pull on the command line pulls from the
remote repository's branch.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh | patch | blob | history | |
lib/branch_create.tcl | patch | blob | history | |
lib/checkout_op.tcl | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index 7c25bb98089ec4c0a57993020a30d2d1afad8dae..9df49710e1b378af1f49c5ce3c8c8c48731d7d38 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
}
}
+set default_config(branch.autosetupmerge) true
set default_config(merge.diffstat) true
set default_config(merge.summary) false
set default_config(merge.verbosity) 2
diff --git a/lib/branch_create.tcl b/lib/branch_create.tcl
index 53dfb4ce6bb053349fbed39af8ffaf5a143b6567..3817771b944cc363205b86c91f7b4801c1d568f9 100644 (file)
--- a/lib/branch_create.tcl
+++ b/lib/branch_create.tcl
if {$spec ne {} && $opt_fetch} {
$co enable_fetch $spec
}
+ if {$spec ne {}} {
+ $co remote_source $spec
+ }
if {[$co run]} {
destroy $w
diff --git a/lib/checkout_op.tcl b/lib/checkout_op.tcl
index 6e1411711bd46df08c09fd2bc371b017050a8368..caca88831b7066c573917542d24a52e832dcff34 100644 (file)
--- a/lib/checkout_op.tcl
+++ b/lib/checkout_op.tcl
field fetch_spec {}; # refetch tracking branch if used?
field checkout 1; # actually checkout the branch?
field create 0; # create the branch if it doesn't exist?
+field remote_source {}; # same as fetch_spec, to setup tracking
field reset_ok 0; # did the user agree to reset?
field fetch_ok 0; # did the fetch succeed?
set fetch_spec $spec
}
+method remote_source {spec} {
+ set remote_source $spec
+}
+
method enable_checkout {co} {
set checkout $co
}
}
method _update_ref {} {
- global null_sha1 current_branch
+ global null_sha1 current_branch repo_config
set ref $new_ref
set new $new_hash
set reflog_msg "branch: Created from $new_expr"
set cur $null_sha1
+
+ if {($repo_config(branch.autosetupmerge) eq {true}
+ || $repo_config(branch.autosetupmerge) eq {always})
+ && $remote_source ne {}
+ && "refs/heads/$newbranch" eq $ref} {
+
+ set c_remote [lindex $remote_source 1]
+ set c_merge [lindex $remote_source 2]
+ if {[catch {
+ git config branch.$newbranch.remote $c_remote
+ git config branch.$newbranch.merge $c_merge
+ } err]} {
+ _error $this [strcat \
+ [mc "Failed to configure simplified git-pull for '%s'." $newbranch] \
+ "\n\n$err"]
+ }
+ }
} elseif {$create && $merge_type eq {none}} {
# We were told to create it, but not do a merge.
# Bad. Name shouldn't have existed.