Browse code

don't leave ourselves inside git directories

to ensure that we don't accidentally do the wrong thing to the
wrong git directory, make sure we return to the original directory
after doing a checkout.

Change-Id: I15d97bee86388f12ee1768123cd8fece78157ba6

Sean Dague authored on 2014/03/13 01:05:23
Showing 1 changed files
... ...
@@ -569,11 +569,14 @@ function git_clone {
569 569
     GIT_REF=$3
570 570
     RECLONE=$(trueorfalse False $RECLONE)
571 571
 
572
+    local orig_dir=`pwd`
573
+
572 574
     if [[ "$OFFLINE" = "True" ]]; then
573 575
         echo "Running in offline mode, clones already exist"
574 576
         # print out the results so we know what change was used in the logs
575 577
         cd $GIT_DEST
576 578
         git show --oneline | head -1
579
+        cd $orig_dir
577 580
         return
578 581
     fi
579 582
 
... ...
@@ -622,6 +625,7 @@ function git_clone {
622 622
     # print out the results so we know what change was used in the logs
623 623
     cd $GIT_DEST
624 624
     git show --oneline | head -1
625
+    cd $orig_dir
625 626
 }
626 627
 
627 628