summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d375ef9)
raw | patch | inline | side by side (parent: d375ef9)
author | Alexander Gavrilov <angavrilov@gmail.com> | |
Wed, 8 Oct 2008 07:05:35 +0000 (11:05 +0400) | ||
committer | Paul Mackerras <paulus@samba.org> | |
Tue, 21 Oct 2008 11:37:36 +0000 (22:37 +1100) |
If gitk knows that the branch the user tries to create exists,
it should ask whether it should overwrite it. This way the user
can either decide to choose a new name, or move the head while
preserving the reflog.
Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
it should ask whether it should overwrite it. This way the user
can either decide to choose a new name, or move the head while
preserving the reflog.
Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk | patch | blob | history |
index bcebc87f7d3800c20108ab1ae9aec0577e7c2cc7..5830941b7a9649505e668dd03ae2fe79aeb585be 100755 (executable)
--- a/gitk
+++ b/gitk
set name [$top.name get]
set id [$top.sha1 get]
+ set cmdargs {}
+ set old_id {}
if {$name eq {}} {
error_popup [mc "Please specify a name for the new branch"]
return
}
+ if {[info exists headids($name)]} {
+ if {![confirm_popup [mc \
+ "Branch '%s' already exists. Overwrite?" $name]]} {
+ return
+ }
+ set old_id $headids($name)
+ lappend cmdargs -f
+ }
catch {destroy $top}
+ lappend cmdargs $name $id
nowbusy newbranch
update
if {[catch {
- exec git branch $name $id
+ eval exec git branch $cmdargs
} err]} {
notbusy newbranch
error_popup $err
} else {
- set headids($name) $id
- lappend idheads($id) $name
- addedhead $id $name
notbusy newbranch
- redrawtags $id
+ if {$old_id ne {}} {
+ movehead $id $name
+ movedhead $id $name
+ redrawtags $old_id
+ redrawtags $id
+ } else {
+ set headids($name) $id
+ lappend idheads($id) $name
+ addedhead $id $name
+ redrawtags $id
+ }
dispneartags 0
run refill_reflist
}