From: Victoria Dye Date: Mon, 17 Jun 2024 19:23:39 GMT Subject: Re: [PATCH 14/16] mktree: optionally add to an existing tree Message-ID: <55e06e1b-580e-45fe-a914-d1ef252d5981@github.com> In-Reply-To: Patrick Steinhardt wrote: > On Tue, Jun 11, 2024 at 06:24:46PM +0000, Victoria Dye via GitGitGadget wrote: >> diff --git a/Documentation/git-mktree.txt b/Documentation/git-mktree.txt >> index afbc846d077..99abd3c31a6 100644 >> --- a/Documentation/git-mktree.txt >> +++ b/Documentation/git-mktree.txt >> @@ -40,6 +40,11 @@ OPTIONS >> optional. Note - if the `-z` option is used, lines are terminated >> with NUL. >> >> +:: >> + If provided, the tree entries provided in stdin are added to this tree >> + rather than a new empty one, replacing existing entries with identical >> + names. Not compatible with `--literally`. > > I think it'd be a bit more intuitive is this was an option, like > `--base-tree=` or just `--base=`. To me, the positional '' is more intuitive; it's reminiscent of 'read-tree' (but with '--empty' being the default, since there's no equivalent to the existing index to overwrite). I consider 'read-tree' relevant in this case because the updated 'mktree' allows a users to create trees like: $ git read-tree $ git update-index > One question that comes up naturally in this context: when I have a base > tree, how do I remove entries from it? In patch 16 [1], entries with mode "0" are removed from the tree (similar to 'update-index'). [1] https://lore.kernel.org/git/a90d6d0c943283e9e7bd181cd6e9bb6d4572aaeb.1718130288.git.gitgitgadget@gmail.com/ > > Patrick