summaryrefslogtreecommitdiff
path: root/refs.c
AgeCommit message (Collapse)Author
2006-03-09refs.c::do_for_each_ref(): Finish error message lines with "\n"Junio C Hamano
We used fprintf() to show an error message without terminating it with LF; use error() for that. cf. c401cb48e77459a4ccad76888ad31bef252facc5 Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-01Warn about invalid refsJohannes Schindelin
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-23Give no terminating LF to error() function.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-20Disable USE_SYMLINK_HEAD by defaultPavel Roskin
Disable USE_SYMLINK_HEAD by default. Recommend using it only for compatibility with older software. Treat USE_SYMLINK_HEAD like other optional defines - check whether it's defined, not its value. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-18Revert "We do not like "HEAD" as a new branch name"Junio C Hamano
This reverts ee34518d629331dadd58b1a75294369d679eda8b commit.
2005-12-18Revert "refs.c: off-by-one fix."Junio C Hamano
This reverts 06bf6ac4248e834a229027908d405f5e42ac96d7 commit.
2005-12-17Forbid pattern maching characters in refnames.Junio C Hamano
by marking '?', '*', and '[' as bad_ref_char(). Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-16refs.c: off-by-one fix.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-16We do not like "HEAD" as a new branch nameJohannes Schindelin
This makes git-check-ref-format fail for "HEAD". Since the check is only executed when creating refs, the existing symbolic ref is safe. Otherwise these commands, most likely are pilot errors, would do pretty funky stuff: git checkout -b HEAD git pull . other:HEAD Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-08refs.c: make sure leading directories exist before writing a ref.Junio C Hamano
Otherwise cloning a repository with hierarchical branch/tag over http would fail. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-20Do not DWIM in userpath library under strict mode.Junio C Hamano
This should force git-daemon administrator's job a bit harder because the exact paths need to be given in the whitelist, but at the same time makes the auditing easier. This moves validate_symref() from refs.c to path.c, because we need to link path.c with git-daemon for its "enter_repo()", but we do not want to link the daemon with the rest of git libraries and its requirements. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-15Add config variable core.symrefsonlyJohannes Schindelin
This allows you to force git to avoid symlinks for refs. Just add something like [core] symrefsonly = true to .git/config. DonĀ“t forget to "git checkout your_branch", or it does not do anything... Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-26create_symref: if symlink fails, fall back to writing a "symbolic ref"Johannes Schindelin
There are filesystems out there which do not understand symlinks, even if the OS is perfectly capable of writing them. So, do not fail right away, but try to write a symbolic ref first. If that fails, you can die(). Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-15git-check-ref-format: reject funny ref names.Junio C Hamano
Update check_ref_format() function to reject ref names that: * has a path component that begins with a ".", or * has a double dots "..", or * has ASCII control character, "~", "^", ":" or SP, anywhere, or * ends with a "/". Use it in 'git-checkout -b', 'git-branch', and 'git-tag' to make sure that newly created refs are well-formed. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-15Unlocalized isspace and friendsLinus Torvalds
Do our own ctype.h, just to get the sane semantics: we want locale-independence, _and_ we want the right signed behaviour. Plus we only use a very small subset of ctype.h anyway (isspace, isalpha, isdigit and isalnum). Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-05[PATCH] Fix symbolic ref validationJonas Fonseca
Use the correct buffer when validating 'ref: refs/...' Signed-off-by: Jonas Fonseca <fonseca@diku.dk> 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-10-02Use resolve_ref() to implement read_ref().Junio C Hamano
Symbolic refs are understood by resolve_ref(), so existing read_ref() users will automatically understand them as well. Signed-off-by: Junio C Hamano <junio@twinsun.com>
2005-10-02[PATCH] Allow reading "symbolic refs" that point to other refsLinus Torvalds
This extends the ref reading to understand a "symbolic ref": a ref file that starts with "ref: " and points to another ref file, and thus introduces the notion of ref aliases. This is in preparation of allowing HEAD to eventually not be a symlink, but one of these symbolic refs instead. [jc: Linus originally required the prefix to be "ref: " five bytes and nothing else, but I changed it to allow and strip any number of leading whitespaces to match what update-ref.c does.] Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-17[PATCH] Make do_each_ref() follow symlinks.Matt Draisey
Because there is no reason not to, and this makes things a bit safer when running "git prune". [jc: I do not necessarily agree with the reasoning of the original author that it is a good way to keep "git prune" from stomping on objects to have a symlink that points at .git/refs of the repository A in the .git/refs of the repository B when repository A borrows object database from repository B. For one thing, the object database that everybody borrows objects from may not even have its own .git/refs hierarchy. Come to think of it, maybe we should disallow symlink inside .git/refs hierarchy; we update the files there by creat/rename pair, so having symlinks would not work anyway when you do anything that would update them.] Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-10[PATCH] -Werror fixesTimo Sirainen
GCC's format __attribute__ is good for checking errors, especially with -Wformat=2 parameter. This fixes most of the reported problems against 2005-08-09 snapshot.
2005-07-08Make "for_each_ref()" always use the "canonical" refname.Linus Torvalds
It always uses a git-relative pathname, ie "refs/heads/master" instead of ".git/refs/heads/master" or whatever your GIT_DIR might be. This way when we send refs back-and-forth between repositories, there's never any question about GIT_DIR on either side.
2005-07-05Fix silly thinko in "head_ref()"Linus Torvalds
It did a "for_each_ref()" in addition to the HEAD case, which was a left-over from an early broken test.
2005-07-05Add "git_path()" and "head_ref()" helper functions.Linus Torvalds
"git_path()" returns a static pathname pointer into the git directory using a printf-like format specifier. "head_ref()" works like "for_each_ref()", except for just the HEAD.
2005-07-04Clean up output of "for_each_ref()" when GIT_DIR is "."Linus Torvalds
Remove the "./" at the head, it just looks much nicer.
2005-07-03Fix up "for_each_ref()" to be more usable, and use it in git-fsck-cacheLinus Torvalds
It needed to take the GIT_DIR information into account, something that the original receive-pack usage just never cared about.
2005-07-03Generalize the "show each ref" code in receice-packLinus Torvalds
This turns it into a generic "do xyz for each ref" library function.
2005-06-07[PATCH] Operations on refsDaniel Barkalow
This patch adds code to read a hash out of a specified file under {GIT_DIR}/refs/, and to write such files atomically and optionally with an compare and lock. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>