Re: [PATCH 2/2] read-tree: at least one tree-ish argument is required

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 2/2] read-tree: at least one tree-ish argument is required

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:55

Jakub Narebski [off-list ref] writes:
Johannes Sixt [off-list ref] writes:
quoted
Running read-tree without any arguments purges the index, but this is not
documented. This behavior is dubious at best because contrary to many
other commands, it does not use HEAD if nothing else is specified.

If one really wants to clear the index, this can be achieved with
'git rm --cached .' or 'rm -f .git/index' in a more explicit way.
One can (I think) also always use "git read-tree <empty tree>",
where <empty tree> = 4b825dc642cb6eb9a060e54bf8d69288fbee4904
Come on.  If you genuinely believe that

    $ git read-tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904

is a better way to purge the index than

    $ git read-tree

then you need to get your head examined.  No, read-tree does not default
to examine HEAD and that will not change ;-).

Besides, read-tree is a plumbing.

Come back with a proof that there has never existed any script that uses
"read-tree" without arguments to purge the index, and I'd immediately
accept and apply the patch to retroactively forbid what the implementation
has allowed users to do for a long time.  Otherwise, I won't be involved
in discussing this before the next release is cut, as a change like this
needs a reasonable transition strategy as usual, and needs to happen after
the next release.

Re: [PATCH 2/2] read-tree: at least one tree-ish argument is required

From: Nanako Shiraishi <hidden>
Date: 2016-06-15 22:47:55

Quoting Junio C Hamano [off-list ref]
Come back with a proof that there has never existed any script that uses
"read-tree" without arguments to purge the index, and I'd immediately
accept and apply the patch to retroactively forbid what the implementation
has allowed users to do for a long time.
For what it's worth, I compiled the very first version of git

 commit e83c5163316f89bfbde7d9ab23ca2e25604af290
 Author: Linus Torvalds [off-list ref]
 Date:   Thu Apr 7 15:13:13 2005 -0700

     Initial revision of "git", the information manager from hell

and its read-tree fails with 

  read-tree: read-tree <key>

Is it a proof enough?

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help