Browse Source

Change to the project directory when using the git wrapper

pull/5/head
Ricardo Barbedo 7 years ago
parent
commit
ca8ff0bc1a
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      scripts/git_wrapper.tcl

+ 12
- 1
scripts/git_wrapper.tcl View File

@ -18,6 +18,17 @@ namespace eval ::git_wrapper {
proc git {args} { proc git {args} {
set command [lindex $args 0] set command [lindex $args 0]
# Change directory project directory if not in it yet
set proj_dir [regsub {\/work$} [get_property DIRECTORY [current_project]] {}]
set current_dir [pwd]
if {
[string compare -nocase $proj_dir $current_dir]
} then {
puts "Not in project directory"
puts "Changing directory to: ${proj_dir}"
cd $proj_dir
}
switch $command { switch $command {
"init" {git_init {*}$args} "init" {git_init {*}$args}
"commit" {git_commit {*}$args} "commit" {git_commit {*}$args}
@ -47,4 +58,4 @@ namespace eval ::git_wrapper {
# Now commit everything # Now commit everything
exec git {*}$args exec git {*}$args
} }
}
}

Loading…
Cancel
Save