summaryrefslogtreecommitdiff
path: root/init-db.c
AgeCommit message (Collapse)Author
2005-12-24git-init-db: initialize shared repositories with --sharedJohannes Schindelin
Now you can say git-init-db --shared if you want other users to be able to push into that repository. [jc: info/ and objects/info/ need to be group writable if the repository is shared --- otherwise packs and refs files cannot be updated.] Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-06init-db: check extra arguments and complain.Junio C Hamano
"git-init-db junk" does not complain but just ignores "junk". Die with the usage string in such a case. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27init-db: check template and repository format.Junio C Hamano
This makes init-db repository version aware. It checks if an existing config file says the repository being reinitialized is of a wrong version and aborts before doing further harm. When copying the templates, it makes sure the they are of the right repository format version. Otherwise the templates are ignored with an warning message. It copies the templates before creating the HEAD, and if the config file is copied from the template directory, reads it, primarily to pick up the value of core.symrefsonly. It changes the way the result of the filemode reliability test is written to the configuration file using git_config_set(). The test is done even if the config file was copied from the templates. And finally, our own repository format version is written to the config file. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-05init-db::copy_file() - use copy_fd()Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-28Create object subdirectories on demand (phase II)Linus Torvalds
This removes the unoptimization. The previous round does not mind missing fan-out directories, but still makes sure they exist, lest older versions choke on a repository created/packed by it. This round does not play that nicely anymore -- empty fan-out directories are not created by init-db, and will stay removed by prune-packed. The prune command also removes empty fan-out directories. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-26Test in git-init-db if the filemode can be trustedJohannes Schindelin
... and if not, write an appropriate .git/config. Of course, that happens only if no config file was yet created (by a template or a hook). Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-02Add git-symbolic-refJunio C Hamano
This adds the counterpart of git-update-ref that lets you read and create "symbolic refs". By default it uses a symbolic link to represent ".git/HEAD -> refs/heads/master", but it can be compiled to use the textfile symbolic ref. The places that did 'readlink .git/HEAD' and 'ln -s refs/heads/blah .git/HEAD' have been converted to use new git-symbolic-ref command, so that they can deal with either implementation. Signed-off-by: Junio C Hamano <junio@twinsun.com>
2005-09-20[PATCH] Fix git-init-db creating crap directories.Petr Baudis
The base target directory for the templates copying was initialized to git_dir, but git_dir[len] is not zero but / at the time we do the initialization. This is not what we want for our target directory string since we pass it to mkdir(), so make it zero-terminated manually. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-09Retire support for old environment variables.Junio C Hamano
We have deprecated the old environment variable names for quite a while and now it's time to remove them. Gone are: SHA1_FILE_DIRECTORIES AUTHOR_DATE AUTHOR_EMAIL AUTHOR_NAME COMMIT_AUTHOR_EMAIL COMMIT_AUTHOR_NAME SHA1_FILE_DIRECTORY Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-20Create objects/info/ directory in init-db.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-06Redo the templates generation and installation.Junio C Hamano
Per discussion with people interested in binary packaging, change the default template location from /etc/git-core to /usr/share/git-core hierarchy. If a user wants to run git before installing for whatever reason, in addition to adding $src to the PATH environment variable, git-init-db can be run with --template=$src/templates/blt/ parameter. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-05git-init-db: brown paper bag bugfix.Junio C Hamano
OK, I admit I am an idiot. I ended up creating bunch of garbage directories like .git/HEADbranch/ .git/HEADrefs/... Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-03Install sample hooksJunio C Hamano
A template mechanism to populate newly initialized repository with default set of files is introduced. Use it to ship example hooks that can be used for update and post update checks, as Josef Weidendorfer suggests. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-06[PATCH] Let umask do its work upon filesystem object creation.Junio C Hamano
IIRC our strategy was to let the users' umask take care of the final mode bits. This patch fixes places that deviate from it. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-28git-init-db: create "pack" subdirectory under objectsLinus Torvalds
Don't make the user have to mkdir it just because he's excited about the new object pack functionality, do it for him.
2005-05-30git-init-db: set up the full default environmentLinus Torvalds
Create .git/refs/{heads,tags} and make .git/HEAD be a symlink to (the as yet non-existent) .git/refs/heads/master.
2005-05-20sparse cleanupLinus Torvalds
Fix various things that sparse complains about: - use NULL instead of 0 - make sure we declare everything properly, or mark it static - use proper function declarations ("fn(void)" instead of "fn()") Sparse is always right.
2005-05-10Introduce GIT_DIR environment variable.Junio C Hamano
During the mailing list discussion on renaming GIT_ environment variables, people felt that having one environment that lets the user (or Porcelain) specify both SHA1_FILE_DIRECTORY (now GIT_OBJECT_DIRECTORY) and GIT_INDEX_FILE for the default layout would be handy. This change introduces GIT_DIR environment variable, from which the defaults for GIT_INDEX_FILE and GIT_OBJECT_DIRECTORY are derived. When GIT_DIR is not defined, it defaults to ".git". GIT_INDEX_FILE defaults to "$GIT_DIR/index" and GIT_OBJECT_DIRECTORY defaults to "$GIT_DIR/objects". Special thanks for ideas and discussions go to Petr Baudis and Daniel Barkalow. Bugs are mine ;-) Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-10Rename environment variables.Junio C Hamano
H. Peter Anvin mentioned that using SHA1_whatever as an environment variable name is not nice and we should instead use names starting with "GIT_" prefix to avoid conflicts. Here is what this patch does: * Renames the following environment variables: New name Old Name GIT_AUTHOR_DATE AUTHOR_DATE GIT_AUTHOR_EMAIL AUTHOR_EMAIL GIT_AUTHOR_NAME AUTHOR_NAME GIT_COMMITTER_EMAIL COMMIT_AUTHOR_EMAIL GIT_COMMITTER_NAME COMMIT_AUTHOR_NAME GIT_ALTERNATE_OBJECT_DIRECTORIES SHA1_FILE_DIRECTORIES GIT_OBJECT_DIRECTORY SHA1_FILE_DIRECTORY * Introduces a compatibility macro, gitenv(), which does an getenv() and if it fails calls gitenv_bc(), which in turn picks up the value from old name while giving a warning about using an old name. * Changes all users of the environment variable to fetch environment variable with the new name using gitenv(). * Updates the documentation and scripts shipped with Linus GIT distribution. The transition plan is as follows: * We will keep the backward compatibility list used by gitenv() for now, so the current scripts and user environments continue to work as before. The users will get warnings when they have old name but not new name in their environment to the stderr. * The Porcelain layers should start using new names. However, just in case it ends up calling old Plumbing layer implementation, they should also export old names, taking values from the corresponding new names, during the transition period. * After a transition period, we would drop the compatibility support and drop gitenv(). Revert the callers to directly call getenv() but keep using the new names. The last part is probably optional and the transition duration needs to be set to a reasonable value. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-04-26[PATCH] introduce xmalloc and xreallocChristopher Li
Introduce xmalloc and xrealloc to die gracefully with a descriptive message when out of memory, rather than taking a SIGSEGV. Signed-off-by: Christopher Li<chrislgit@chrisli.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-20[PATCH] init-db.c: create and use safe_create_dir helperZach Welch
Factor mkdir calls into common safe_create_dir subroutine. Signed-Off-By: Zach Welch <zw@superlucidity.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-20[PATCH] init-db.c: normalize env var handling.Zach Welch
Normalize init-db environment variable handling, allowing the creation of object directories with something other than DEFAULT_DB_ENVIRONMENT. Signed-Off-By: Zach Welch <zw@superlucidity.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-20[PATCH] init-db.c: cleanup commentsZach Welch
Consolidate comments at top of main. Signed-Off-By: Zach Welch <zw@superlucidity.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-19Remove duplicate getenv(DB_ENVIRONMENT) callLinus Torvalds
Noted by Tony Luck.
2005-04-19Fix init-db shared database caseLinus Torvalds
Noted by Aaron Straus
2005-04-13[PATCH] Whitespace FixesIngo Molnar
Trivial whitespace fixes. From: Ingo Molnar <mingo@elte.hu> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-11Rename ".dircache" directory to ".git"Linus Torvalds
I started out calling the tool "dircache". That's clearly moronic.
2005-04-11Make the default directory permissions more lax.Linus Torvalds
After all, if you want to not allow others to read your stuff, set your "umask" appropriately or make sure the parent directories aren't readable/executable.
2005-04-08Use "-Wall -O2" for the compiler to get more warnings.Linus Torvalds
And fix up the warnings that it pointed out. Let's keep the tree clean from early on. Not that the code is very beautiful anyway ;)
2005-04-07Add copyright notices.Linus Torvalds
The tool interface sucks (especially "committing" information, which is just me doing everything by hand from the command line), but I think this is in theory actually a viable way of describing the world. So copyright it.
2005-04-07Initial revision of "git", the information manager from hellLinus Torvalds