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

Re: [PATCH] doc: fix location of index in worktree scenatio

From
Andreas Heiduk <asheiduk@gmail.com>
Date
Jun 10, 2017, 17:24 UTC
Message-ID
<d2b21102-eb32-7061-14ee-aa8906fe9eeb@gmail.com>
In-Reply-To
<xmqqmv9g1487.fsf@gitster.mtv.corp.google.com>
Am 10.06.2017 um 13:17 schrieb Junio C Hamano:
Show 5 quoted lines
> Andreas Heiduk <asheiduk@gmail.com> writes:
> 
>> When setting `.gitattributes` in a second worktree, a plain `rm .git/index`
>> does not actually delete the index.
>>
[...]
Show 7 quoted lines
> Right.  
> 
> I however have to wonder if we can do the same without futzing
> directly with the "index" file as a filesystem entity.  With or
> without your update, what is taught in the document feels like
> munging a disk block with binary editor to correct a corrupted
> filesystem X-<.

IMO `rm .git/index` is like munging a disk block WITHOUT a binary editor but with plain `dd seek=... skip=... count=...`, `hexdump`, `ed` and back - every step is clear in principle but painful and dangerous. :-)

> For example, can we do this "empty the index" step with things like
> 
>     $ git rm --cached .
That would be `git rm --cached -rq .`?

Executing this in the git repo gives me an index file with 2.1kb. I don't know whether or not this index still contains something relevant for this case.

Show 5 quoted lines
> or
> 
>     $ git read-tree --empty
> 
> instead?
Nice! The `index` file contains 46 bytes.

For me THAT one is like a nice binary editor apt for the job :-) I'll queue that.

Previous: Junio C HamanoNext: Andreas Heiduk
Message 3 of 12 in “doc: fix location of index in worktree scenatio”
  1. doc: fix location of index in worktree scenatioAndreas Heiduk, Jun 10, 2017
  2. Junio C HamanoJun 10, 2017
  3. Andreas HeidukJun 10, 2017
  4. doc: fix location of index in worktree scenatioAndreas Heiduk, Jun 10, 2017
  5. Torsten BögershausenJun 12, 2017
  6. Andreas HeidukJun 12, 2017
  7. Junio C HamanoJun 12, 2017
  8. Torsten BögershausenJun 13, 2017
  9. Junio C HamanoJun 13, 2017
  10. doc: do not use `rm .git/index` when normalizing line endingsAndreas Heiduk, Jun 13, 2017
  11. Torsten BögershausenJun 14, 2017
  12. doc: do not use `rm .git/index` when normalizing line endingsAndreas Heiduk, Jun 14, 2017

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.