git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Documentation/git-update-index: caution about tree objects
@ 2012-12-21  1:35 Greg Troxel
  2012-12-21  2:56 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Troxel @ 2012-12-21  1:35 UTC (permalink / raw)
  To: git; +Cc: Greg Troxel

While one can add tree objects to the index, this is not currently
useful.  Therefore, use "git ls-tree -r" as the example to be fed to
--index-info.  Add a section explaining about expected index contents.
(Thanks to Junio for explaining this to me in August of 2011.)

Signed-off-by: Greg Troxel <gdt@ir.bbn.com>
---
 Documentation/git-update-index.txt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt
index 9d0b151..6ce65fa 100644
--- a/Documentation/git-update-index.txt
+++ b/Documentation/git-update-index.txt
@@ -29,6 +29,11 @@ Modifies the index or directory cache. Each file mentioned is updated
 into the index and any 'unmerged' or 'needs updating' state is
 cleared.
 
+Note that update-index does not check that the modifications preserve
+the expected invariants.  In particular, an index normally holds
+regular blobs, executable blobs, symlink blobs, and gitlinks.
+Therefore, adding a tree object is not likely useful.
+
 See also linkgit:git-add[1] for a more user-friendly way to do some of
 the most common operations on the index.
 
@@ -210,7 +215,7 @@ back on 3-way merge.
 
     . mode SP type SP sha1          TAB path
 +
-The second format is to stuff 'git ls-tree' output
+The second format is to stuff 'git ls-tree -r' output
 into the index file.
 
     . mode         SP sha1 SP stage TAB path
-- 
1.8.0.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Documentation/git-update-index: caution about tree objects
  2012-12-21  1:35 [PATCH] Documentation/git-update-index: caution about tree objects Greg Troxel
@ 2012-12-21  2:56 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2012-12-21  2:56 UTC (permalink / raw)
  To: Greg Troxel; +Cc: git

Greg Troxel <gdt@ir.bbn.com> writes:

> While one can add tree objects to the index, this is not currently
> useful.  Therefore, use "git ls-tree -r" as the example to be fed to
> --index-info.  Add a section explaining about expected index contents.
> (Thanks to Junio for explaining this to me in August of 2011.)
>
> Signed-off-by: Greg Troxel <gdt@ir.bbn.com>
> ---
>  Documentation/git-update-index.txt | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt
> index 9d0b151..6ce65fa 100644
> --- a/Documentation/git-update-index.txt
> +++ b/Documentation/git-update-index.txt
> @@ -29,6 +29,11 @@ Modifies the index or directory cache. Each file mentioned is updated
>  into the index and any 'unmerged' or 'needs updating' state is
>  cleared.
>  
> +Note that update-index does not check that the modifications preserve
> +the expected invariants.  In particular, an index normally holds
> +regular blobs, executable blobs, symlink blobs, and gitlinks.
> +Therefore, adding a tree object is not likely useful.
> +

I find this unnecessarily alarmist as a description meant for
general audiences.  For the normal mode of operations of the command
(e.g. "git update-index --add --remove hello.c"), whatever you mean
by "expected invariants" are fully preserved.

I think you meant this for --cacheinfo and --index-info options,
which are primarily meant for people who know what they are doing
(that includes the use of this command in scripted Porceains) or Git
developers who want to work on enhancing the index (and to them,
being able to record anything is more convenient).

> @@ -210,7 +215,7 @@ back on 3-way merge.
>  
>      . mode SP type SP sha1          TAB path
>  +
> -The second format is to stuff 'git ls-tree' output
> +The second format is to stuff 'git ls-tree -r' output
>  into the index file.

This hunk is good.

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-21  2:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-21  1:35 [PATCH] Documentation/git-update-index: caution about tree objects Greg Troxel
2012-12-21  2:56 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).