git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: getting rid of extra directories

From
Junio C Hamano <junkio@cox.net>
Date
Oct 15, 2005, 22:34 UTC
Message-ID
<7v8xwummtm.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20051015192720.GA11364@tumblerings.org>
Zack Brown <zbrown@tumblerings.org> writes:
Show 9 quoted lines
>> 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...

Previous: Zack BrownNext: Petr Baudis
Message 4 of 9 in “getting rid of extra directories”
  1. Zack BrownOct 15, 2005
  2. Junio C HamanoOct 15, 2005
  3. Zack BrownOct 15, 2005
  4. Junio C HamanoOct 15, 2005
  5. Three-way merge with the index as one wayPetr Baudis, Nov 3, 2005
  6. Junio C HamanoNov 3, 2005
  7. Petr BaudisNov 3, 2005
  8. Junio C HamanoNov 3, 2005
  9. Junio C HamanoNov 4, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.