diff --git a/scripts/git_wrapper.tcl b/scripts/git_wrapper.tcl index 32e6f7f..c80a08a 100644 --- a/scripts/git_wrapper.tcl +++ b/scripts/git_wrapper.tcl @@ -18,6 +18,17 @@ namespace eval ::git_wrapper { proc git {args} { 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 { "init" {git_init {*}$args} "commit" {git_commit {*}$args} @@ -47,4 +58,4 @@ namespace eval ::git_wrapper { # Now commit everything exec git {*}$args } -} \ No newline at end of file +}