diff --git a/clean.do b/clean.do index 69f280e..b519b35 100644 --- a/clean.do +++ b/clean.do @@ -1,2 +1,3 @@ rm -f t/hello t/[by]ellow t/*.o *~ .*~ t/*~ t/.*~ *.pyc t/CC t/LD -rm -rf .redo +rm -rf .redo t/.redo + diff --git a/redo.py b/redo.py index 052286d..fd97abf 100755 --- a/redo.py +++ b/redo.py @@ -173,7 +173,13 @@ assert(not (opt.ifchange and opt.ifcreate)) if not os.environ.get('REDO_BASE', ''): base = os.path.commonprefix([os.path.abspath(os.path.dirname(t)) - for t in targets]) + for t in targets] + [os.getcwd()]) + bsplit = base.split('/') + for i in range(len(bsplit)-1, 0, -1): + newbase = '%s/.redo' % '/'.join(bsplit[:i]) + if os.path.exists(newbase): + base = newbase + break os.environ['REDO_BASE'] = base mkdirp('%s/.redo' % base)