~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
StGIT bash completion
[stgit]
/
stgit
/
basedir.py
diff --git
a/stgit/basedir.py
b/stgit/basedir.py
index
5abe0ff
..
81f2b40
100644
(file)
--- a/
stgit/basedir.py
+++ b/
stgit/basedir.py
@@
-20,14
+20,11
@@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import os
import os
-class BaseDirException(Exception):
- pass
-
def __output(cmd):
f = os.popen(cmd, 'r')
string = f.readline().rstrip()
if f.close():
def __output(cmd):
f = os.popen(cmd, 'r')
string = f.readline().rstrip()
if f.close():
- r
aise BaseDirException, 'Error: failed to execute "%s"' % cmd
+ r
eturn ''
return string
# GIT_DIR value cached
return string
# GIT_DIR value cached
@@
-42,6
+39,12
@@
def get():
if 'GIT_DIR' in os.environ:
__base_dir = os.environ['GIT_DIR']
else:
if 'GIT_DIR' in os.environ:
__base_dir = os.environ['GIT_DIR']
else:
- __base_dir = __output('git-rev-parse --git-dir')
+ __base_dir = __output('git-rev-parse --git-dir
2> /dev/null
')
return __base_dir
return __base_dir
+
+def clear_cache():
+ """Clear the cached location of .git
+ """
+ global __base_dir
+ __base_dir = None