From: Junio C Hamano Date: Sat, 15 Oct 2005 22:34:29 GMT Subject: Re: getting rid of extra directories Message-ID: <7v8xwummtm.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <20051015192720.GA11364@tumblerings.org> Zack Brown writes: >> I do not know exactly what Cogito "seek back and forth" does, > > It means to "cg-seek" back to an earlier state of the repo, and forward to a > more recent state of the repo. "seeking back and forth" means doing a lot of > "cg-seek" commands. Sorry that wasn't clear. > >> but updating to git-core "master" branch may help. > > I already use that branch. I usually do not use Cogito, so I updated to the latest and tried it myself. No wonder. cg-seek does not use "git-read-tree -m -u $old $new", which was updated by that commit I mentioned to remove the empty directories. It does "git-read-tree -m $new" and does the removal part manually by reading from diff-tree $old $new. I suspect the code was there before the two-tree read-tree was invented. A similar sequence as you did, in pure git, would remove empty directory d/ when switching branches between. $ mkdir junkproj $ cd junkproj $ git-init-db $ ls >a $ git-add a $ git-commit -a -m 'Add a' $ git-checkout -b adddir $ mkdir d $ mv a d/a $ git-add d $ git-commit -a -m 'Move a to d/a' $ git-checkout master I suspect cg-Xlib::tree_timewarp, which currently does "git-read-tree -m $branch" followed by diff-tree piped to xargs, can be taught to use "git-read-tree -m -u $base $branch" (and lose the git-checkout-index -f -a immediately after that while we are at it), but I do not do Porcelain, so...