summaryrefslogtreecommitdiff
path: root/quote.c
AgeCommit message (Collapse)Author
2007-06-24Add core.quotepath configuration variable.Junio C Hamano
We always quote "unusual" byte values in a pathname using C-string style, to make it safer for parsing scripts that do not handle NUL separated records well (or just too lazy to bother). The absolute minimum bytes that need to be quoted for this purpose are TAB, LF (and other control characters), double quote and backslash. However, we have also always quoted the bytes in high 8-bit range; this was partly because we were lazy and partly because we were being cautious. This introduces an internal "quote_path_fully" variable, and core.quotepath configuration variable to control it. When set to false, it does not quote bytes in high 8-bit range anymore but passes them intact. The variable defaults to "true" to retain the traditional behaviour for now. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-08Even more missing staticJunio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-01-28Teach for-each-ref about a little language called Tcl.Shawn O. Pearce
Love it or hate it, some people actually still program in Tcl. Some of those programs are meant for interfacing with Git. Programs such as gitk and git-gui. It may be useful to have Tcl-safe output available from for-each-ref, just like shell, Perl and Python already enjoy. Thanks to Sergey Vlasov for pointing out the horrible flaws in the first and second version of this patch, and steering me in the right direction for Tcl value quoting. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-31Merge branch 'maint'Junio C Hamano
* maint: revision traversal: --unpacked does not limit commit list anymore. Continue traversal when rev-list --unpacked finds a packed commit. Use memmove instead of memcpy for overlapping areas quote.c: ensure the same quoting across platforms. Surround "#define DEBUG 0" with "#ifndef DEBUG..#endif"
2006-10-31quote.c: ensure the same quoting across platforms.Junio C Hamano
We read a byte from "char *" and compared it with ' ' to decide if it needs quoting to protect textual output. With a platform where char is unsigned char that would give different result. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-16Add git-for-each-ref: helper for language bindingsJunio C Hamano
This adds a new command, git-for-each-ref. You can have it iterate over refs and have it output various aspects of the objects they refer to. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-11Move add_to_string to "quote.c" and make it extern.Christian Couder
So that this function may be used in places other than "rsh.c". Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31Trace into open fd and refactor tracing code.Christian Couder
Now if GIT_TRACE is set to an integer value greater than 1 and lower than 10, we interpret this as an open fd value and we trace into it. Note that this behavior is not compatible with the previous one. We also trace whole messages using one write(2) call to make sure messages from processes do net get mixed up in the middle. It's now possible to run the tests like this: GIT_TRACE=9 make test 9>/var/tmp/trace.log Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-09GIT_TRACE: show which built-in/external commands are executedMatthias Lederhofer
With the environment variable GIT_TRACE set git will show - alias expansion - built-in command execution - external command execution on stderr. Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28quote.c: silence compiler warnings from EMIT macroJeff King
Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19Remove ranges from switch statements.Florian Forster
Though very nice and readable, the "case 'a'...'z':" construct is not ANSI C99 compliant. This patch unfolds the range in `quote.c' and substitutes the switch-statement with an if-statement in `http-fetch.c' and `http-push.c'. Signed-off-by: Florian Forster <octo@verplant.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17cleanups: Remove impossible case in quote.cSerge E. Hallyn
The switch is inside an if statement which is false if the character is ' '. Either the if should be <=' ' instead of <' ', or the case should be removed as it could be misleading. Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21[PATCH] quote.c: Make loop control more readable.Pavel Roskin
quote_c_style_counted() in quote.c uses a hard-to-read construct. Convert this to a more traditional form of the for loop. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-29write_name_quoted(): make one of the path a counted string.Junio C Hamano
This is to prepare for ls-tree updates. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-24Add git-shell.Linus Torvalds
This adds a very git specific restricted shell, that can be added to /etc/shells and set to the pw_shell in the /etc/passwd file, to give users ability to push into repositories over ssh without giving them full interactive shell acount. [jc: I updated Linus' patch to match what the current sq_quote() does.] Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-18Do not quote SP.Junio C Hamano
Follow the "encode minimally" principle -- our tools, including git-apply and git-status, can handle pathnames with embedded SP just fine. The only problematic ones are TAB and LF, and we need to quote the metacharacters introduced for quoting. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-18Functions to quote and unquote pathnames in C-style.Junio C Hamano
Following the list discussion, define two functions, quote_c_style and unquote_c_style, to help adopting the proposed way for quoting funny pathname letters for GNU patch. The rule is described in: http://marc.theaimsgroup.com/?l=git&m=112927316408690&w=2 Currently we do not support the leading '!', but we probably should barf upon seeing it. Rule B4. is interpreted to require always 3 octal digits in \XYZ notation. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-10Enhanced sq_quote()H. Peter Anvin
Create function to sq_quote into a buffer Handle !'s for csh-based shells Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-08[PATCH] Make sq_expand() available as sq_quote().Junio C Hamano
A useful shell safety helper sq_expand() was hidden as a static function in diff.c. Extract it out and make it available as sq_quote(). Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>