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

Re: Add repos but not as normal files, not submodule

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 14, 2010, 20:13 UTC
Message-ID
<20100414201308.GA4118@progeny.tock>
In-Reply-To
<7118B4DB-A95F-424F-87EF-035B36E578FB@gmail.com>
Antony Stubbs wrote:
>> I’d suggest
>> writing a simple script to build the test repository from scratch.
>
> Yup - will probably go down this route.
Ah, good.
>> You can also try using repositories not named .git if you are careful.
>> I don’t really encourage this.
>
> Didn't realize this was possible.
 ; git init foo
 ; git init --bare foo/bar.git
 ; cd foo
 ; git add bar.git
or
 ; git init foo
 ; git init foo/bar
 ; mv foo/bar/.git foo/bar.git
 ; git add bar bar.git
 ; cd bar
 ; GIT_DIR=$(pwd)/../bar.git git status
 ; (ln -s ../bar.git .git && git status && rm .git)

Please, don’t do this. For all I know, some git command will end up chdir()ing into bar.git and getting confused.

> Any pointers? Links?

I’m not aware of the relevant rules being documented anywhere. How much of the current behavior do we want to commit to continuing to support?

Here’s a (very rough) start.  Thoughts?
-- 8< --
Subject: Documentation/update-index: indicate what the index can contain
Based on cache.h.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Documentation/git-update-index.txt |   37 ++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt
index 68dc187..3f74938 100644
--- a/Documentation/git-update-index.txt
+++ b/Documentation/git-update-index.txt
@@ -29,6 +29,12 @@ Modifies the index or directory cache. Each file mentioned is updated
 into the index and any 'unmerged' or 'needs updating' state is
 cleared.
 
+Paths that do not represent directories, regular files, or symlinks
+are ignored (though other file types may be supported in future
+versions of git).  Files and directories named .git are ignored except
+for the sake of detecting subrepositories.  See the "Content model"
+section below for more about what the index can track.
+
 See also linkgit:git-add[1] for a more user-friendly way to do some of
 the most common operations on the index.
 
@@ -159,6 +165,37 @@ you will need to handle the situation manually.
 	cleaner names.
 	The same applies to directories ending '/' and paths with '//'
 
+Content model
+-------------
+Roughly speaking, the index represents the state of the working tree
+at some moment.  Each entry indicates the name of a file, its mode,
+the name of a blob or tree object representing its content (0 for a
+removed file or directory), a stage number, flags, and some lstat(2)
+information that can be used to check if the entry is up-to-date.
+
+Filenames are relative to the top level of the working tree and
+contain no empty path components or path components named ., ..,
+or .git, or symbolic link path components.
+
+Modes are based on the octal values as returned by lstat(2):
+
+. `100644` (regular file)
+. `100755` (executable)
+. `120000` (symbolic link)
+. `040000` (directory)
+. `160000` (git submodule)
+
+All other file types are either reduced to one of these five or
+ignored.
+
+See linkgit:git-read-tree(1) for a description of the stages in
+the index.  When a merge is not in progress, all entries have stage
+number 0.
+
+There are currently three boolean flags that can be set.  See
+the descriptions of the `--asumed-unchanged` and `--skip-worktree`
+options above and the `--intent-to-add` option to linkgit:git-add[1].
+
 Using --refresh
 ---------------
 '--refresh' does not calculate a new sha1 file or bring the index
-- 
1.7.1.rc1
Previous: Antony Stubbs
Message 4 of 4 in “Add repos but not as normal files, not submodule”
  1. Antony StubbsApr 14, 2010
  2. Jonathan NiederApr 14, 2010
  3. Antony StubbsApr 14, 2010
  4. Jonathan NiederApr 14, 2010

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.