- 04 3月, 2014 1 次提交
-
-
由 Nguyễn Thái Ngọc Duy 提交于
Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 11 4月, 2013 1 次提交
-
-
由 Antoine Pelisse 提交于
Humanization of downloaded size is done in the same function as text formatting in 'process.c'. The code cannot be reused easily elsewhere. Separate text formatting from size simplification and make the function public in strbuf so that it can easily be used by other callers. We now can use strbuf_humanise_bytes() for both downloaded size and download speed calculation. One of the drawbacks is that speed will now look like this when download is stalled: "0 bytes/s" instead of "0 KiB/s". Signed-off-by: NAntoine Pelisse <apelisse@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 17 1月, 2013 1 次提交
-
-
由 Junio C Hamano 提交于
Some users do want to write a line that begin with a pound sign, #, in their commit log message. Many tracking system recognise a token of #<bugid> form, for example. The support we offer these use cases is not very friendly to the end users. They have a choice between - Don't do it. Avoid such a line by rewrapping or indenting; and - Use --cleanup=whitespace but remove all the hint lines we add. Give them a way to set a custom comment char, e.g. $ git -c core.commentchar="%" commit so that they do not have to do either of the two workarounds. [jc: although I started the topic, all the tests and documentation updates, many of the call sites of the new strbuf_add_commented_*() functions, and the change to git-submodule.sh scripted Porcelain are from Ralf.] Signed-off-by: NJunio C Hamano <gitster@pobox.com> Signed-off-by: NRalf Thielow <ralf.thielow@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 27 11月, 2012 1 次提交
-
-
由 Michael Haggerty 提交于
Substantially the same code is present in http-push.c and imap-send.c, so make a library function out of it. Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 04 11月, 2012 2 次提交
-
-
由 Michael Haggerty 提交于
Document strbuf_split_buf(), strbuf_split_str(), strbuf_split_max(), strbuf_split(), and strbuf_list_free() in the header file and in api-strbuf.txt. (These functions were previously completely undocumented.) Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu> Signed-off-by: NJeff King <peff@peff.net>
-
由 Michael Haggerty 提交于
The word "delimiter" suggests that the argument separates the substrings, whereas in fact (1) the delimiter characters are included in the output, and (2) if the input string ends with the delimiter, then the output does not include a final empty string. So rename the "delim" arguments of the strbuf_split() family of functions to "terminator", which is more suggestive of how it is used. Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu> Signed-off-by: NJeff King <peff@peff.net>
-
- 16 9月, 2012 1 次提交
-
-
由 Junio C Hamano 提交于
Also remove an unused function. Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 25 4月, 2012 1 次提交
-
-
由 Nguyễn Thái Ngọc Duy 提交于
These functions are helpful when we do not want to expose \n to translators. For example printf("hello world\n"); can be converted to printf_ln(_("hello world")); Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 23 2月, 2012 1 次提交
-
-
由 Thomas Rast 提交于
The comment even said that it should eventually go there. While at it, match the calling convention and name of the function to the strbuf_get*line family. So it now is strbuf_getwholeline_fd. Signed-off-by: NThomas Rast <trast@student.ethz.ch> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 13 12月, 2011 1 次提交
-
-
由 Jeff King 提交于
This just follows the rfc3986 rules for percent-encoding url data into a strbuf. Signed-off-by: NJeff King <peff@peff.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 09 11月, 2011 1 次提交
-
-
由 Junio C Hamano 提交于
When a contributor asks the integrator to merge her history, a signed tag can be a good vehicle to communicate the authenticity of the request while conveying other information such as the purpose of the topic. E.g. a signed tag "for-linus" can be created, and the integrator can run: $ git pull git://example.com/work.git/ for-linus This would allow the integrator to run "git verify-tag FETCH_HEAD" to validate the signed tag. Update fmt-merge-msg so that it pre-fills the merge message template with the body (but not signature) of the tag object to help the integrator write a better merge message, in the same spirit as the existing merge.log summary lines. The message that comes from GPG signature validation is also included in the merge message template to help the integrator verify it, but they are prefixed with "#" to make them comments. Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 23 6月, 2011 2 次提交
-
-
由 Jeff King 提交于
The strbuf_split function takes a strbuf as input, and outputs a list of strbufs. However, there is no reason that the input has to be a strbuf, and not an arbitrary buffer. This patch adds strbuf_split_buf for a length-delimited buffer, and strbuf_split_str for NUL-terminated strings. Signed-off-by: NJeff King <peff@peff.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Jeff King 提交于
Sometimes when splitting, you only want a limited number of fields, and for the final field to contain "everything else", even if it includes the delimiter. This patch introduces strbuf_split_max, which provides a "max number of fields" parameter; it behaves similarly to perl's "split" with a 3rd field. The existing 2-argument form of strbuf_split is retained for compatibility and ease-of-use. Signed-off-by: NJeff King <peff@peff.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 28 4月, 2011 1 次提交
-
-
由 René Scharfe 提交于
Commit a8f3e221 introduced the strbuf_grow() call to strbuf_setlen() to make ensure that there was at least one byte available to write the mandatory trailing NUL, even for previously unallocated strbufs. Then b315c5c0 added strbuf_slopbuf for the same reason, only globally for all uses of strbufs. Thus the strbuf_grow() call can be removed now. This avoids readers of strbuf.h from mistakenly thinking that strbuf_setlen() can be used to extend a strbuf. The following assert() needs to be changed to cope with the fact that sb->alloc can now be zero, which is OK as long as len is also zero. As suggested by Junio, use the chance to convert it to a die() with a short explanatory message. The pattern of 'die("BUG: ...")' is already used in strbuf.c. This was the only assert() in strbuf.[ch], so assert.h doesn't have to be included anymore either. Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 31 3月, 2011 1 次提交
-
-
由 Michael Witten 提交于
Signed-off-by: NMichael Witten <mfwitten@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 26 2月, 2011 1 次提交
-
-
由 Jeff King 提交于
In a variable-args function, the code for writing into a strbuf is non-trivial. We ended up cutting and pasting it in several places because there was no vprintf-style function for strbufs (which in turn was held up by a lack of va_copy). Now that we have a fallback va_copy, we can add strbuf_vaddf, the strbuf equivalent of vsprintf. And we can clean up the cut and paste mess. Signed-off-by: NJeff King <peff@peff.net> Improved-by: NChristian Couder <christian.couder@gmail.com> Signed-off-by: NJonathan Nieder <jrnieder@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 28 9月, 2010 1 次提交
-
-
由 Pat Notz 提交于
Signed-off-by: NPat Notz <patnotz@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 15 1月, 2010 1 次提交
-
-
由 Jeff King 提交于
This is handy for creating strings which will be fed to printf() or strbuf_expand(). Signed-off-by: NJeff King <peff@peff.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 14 1月, 2010 1 次提交
-
-
由 Junio C Hamano 提交于
If sb and sb2 are the same (i.e. doubling the string), the underlying strbuf_add() can make sb2->buf invalid by calling strbuf_grow(sb) at the beginning; if realloc(3) done by strbuf_grow() needs to move the string, strbuf_add() will read from an already freed buffer. Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 12 1月, 2010 1 次提交
-
-
由 Junio C Hamano 提交于
strbuf_tolower() is not used anywhere. Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 16 11月, 2009 1 次提交
-
-
由 Tarmigan Casebolt 提交于
We already have these checks in many printf-type functions that have prototypes which are in header files. Add these same checks to some more prototypes in header functions and to static functions in .c files. cc: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: NTarmigan Casebolt <tarmigan+git@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 06 8月, 2009 1 次提交
-
-
由 Brandon Casey 提交于
This function is just like strbuf_getline() except it retains the line-termination character. This function will be used by the mailinfo and mailsplit builtins which require the entire line for parsing. Signed-off-by: NBrandon Casey <drafnel@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 23 4月, 2009 1 次提交
-
-
由 Mike Ralphson 提交于
Signed-off-by: NMike Ralphson <mike@abacus.co.uk> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 23 3月, 2009 2 次提交
-
-
由 Junio C Hamano 提交于
This allows a common calling sequence strbuf_branchname(&ref, name); strbuf_splice(&ref, 0, 0, "refs/heads/", 11); if (check_ref_format(ref.buf)) die(...); to be refactored into if (strbuf_check_branch_ref(&ref, name)) die(...); Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Junio C Hamano 提交于
The function takes a user-supplied string that is supposed to be a branch name, and puts it in a strbuf after expanding possible shorthand notation. A handful of open coded sequence to do this in the existing code have been changed to use this helper function. Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 18 12月, 2008 1 次提交
-
-
由 Linus Torvalds 提交于
It was already what 'git apply' did in read_old_data(), just export it as a real function, and make it be more generic. In particular, this handles the case of the lstat() st_size data not matching the readlink() return value properly (which apparently happens at least on NTFS under Linux). But as a result of this you could also use the new function without even knowing how big the link is going to be, and it will allocate an appropriately sized buffer. So we pass in the st_size of the link as just a hint, rather than a fixed requirement. Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 24 11月, 2008 1 次提交
-
-
由 René Scharfe 提交于
The new callback function strbuf_expand_dict_cb() can be used together with strbuf_expand() if there is only a small number of placeholders for static replacement texts. It expects its dictionary as an array of placeholder+value pairs as context parameter, terminated by an entry with the placeholder member set to NULL. The new helper is intended to aid converting the remaining calls of interpolate(). strbuf_expand() is smaller, more flexible and can be used to go faster than interpolate(), so it should replace the latter. Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 26 7月, 2008 1 次提交
-
-
由 Stephan Beyer 提交于
This patch removes exit()/die() calls and builtin-specific messages from launch_editor(), so that it can be used as a general libgit.a function to launch an editor. Signed-off-by: NStephan Beyer <s-beyer@gmx.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 14 7月, 2008 2 次提交
-
-
由 Lukas Sandström 提交于
Signed-off-by: NLukas Sandström <lukass@etek.chalmers.se> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Lukas Sandström 提交于
Signed-off-by: NLukas Sandström <lukass@etek.chalmers.se> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 10 2月, 2008 1 次提交
-
-
由 Marco Costalba 提交于
Currently, the --pretty=format prefix is looked up in a tight loop in strbuf_expand(), if prefix is found it is then used as argument for format_commit_item() that does another search by a switch statement to select the proper operation. Because the switch statement is already able to discard unknown matches we don't need the prefix lookup before to call format_commit_item(). Signed-off-by: NMarco Costalba <mcostalba@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 27 11月, 2007 1 次提交
-
-
由 Pierre Habouzit 提交于
The editor program to let the user edit the log message used to get GIT_INDEX_FILE environment variable pointing at the right file, but this was lost when git-commit was rewritten in C. Signed-off-by: NPierre Habouzit <madcoder@debian.org> Acked-by: NKristian Høgsberg <krh@redhat.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 23 11月, 2007 1 次提交
-
-
由 Kristian Høgsberg 提交于
Signed-off-by: NKristian Høgsberg <krh@redhat.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 11 11月, 2007 1 次提交
-
-
由 René Scharfe 提交于
Add a new function, strbuf_adddup(), that appends a duplicate of a part of a struct strbuf to end of the latter. Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 09 11月, 2007 1 次提交
-
-
由 René Scharfe 提交于
Some of the --pretty=format placeholders expansions are expensive to calculate. This is made worse by the current code's use of interpolate(), which requires _all_ placeholders are to be prepared up front. One way to speed this up is to check which placeholders are present in the format string and to prepare only the expansions that are needed. That still leaves the allocation overhead of interpolate(). Another way is to use a callback based approach together with the strbuf library to keep allocations to a minimum and avoid string copies. That's what this patch does. It introduces a new strbuf function, strbuf_expand(). The function takes a format string, list of placeholder strings, a user supplied function 'fn', and an opaque pointer 'context' to tell 'fn' what thingy to operate on. The function 'fn' is expected to accept a strbuf, a parsed placeholder string and the 'context' pointer, and append the interpolated value for the 'context' thingy, according to the format specified by the placeholder. Thanks to Pierre Habouzit for his suggestion to use strchrnul() and the code surrounding its callsite. And thanks to Junio for most of this commit message. :) Here my measurements of most of Paul Mackerras' test cases that highlighted the performance problem (best of three runs): (master) $ time git log --pretty=oneline >/dev/null real 0m0.390s user 0m0.340s sys 0m0.040s (master) $ time git log --pretty=raw >/dev/null real 0m0.434s user 0m0.408s sys 0m0.016s (master) $ time git log --pretty="format:%H {%P} %ct" >/dev/null real 0m1.347s user 0m0.080s sys 0m1.256s (interp_find_active -- Dscho) $ time ./git log --pretty="format:%H {%P} %ct" >/dev/null real 0m0.694s user 0m0.020s sys 0m0.672s (strbuf_expand -- this patch) $ time ./git log --pretty="format:%H {%P} %ct" >/dev/null real 0m0.395s user 0m0.352s sys 0m0.028s Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 06 11月, 2007 1 次提交
-
-
由 Steffen Prohaska 提交于
Signed-off-by: NSteffen Prohaska <prohaska@zib.de> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 30 9月, 2007 1 次提交
-
-
由 Pierre Habouzit 提交于
* make strbuf_read_file take a size hint (works like strbuf_read) * use it in a couple of places. Signed-off-by: NPierre Habouzit <madcoder@debian.org> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 29 9月, 2007 1 次提交
-
-
由 Pierre Habouzit 提交于
For that purpose, the ->buf is always initialized with a char * buf living in the strbuf module. It is made a char * so that we can sloppily accept things that perform: sb->buf[0] = '\0', and because you can't pass "" as an initializer for ->buf without making gcc unhappy for very good reasons. strbuf_init/_detach/_grow have been fixed to trust ->alloc and not ->buf anymore. as a consequence strbuf_detach is _mandatory_ to detach a buffer, copying ->buf isn't an option anymore, if ->buf is going to escape from the scope, and eventually be free'd. API changes: * strbuf_setlen now always works, so just make strbuf_reset a convenience macro. * strbuf_detatch takes a size_t* optional argument (meaning it can be NULL) to copy the buffer's len, as it was needed for this refactor to make the code more readable, and working like the callers. Signed-off-by: NPierre Habouzit <madcoder@debian.org> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 27 9月, 2007 2 次提交
-
-
由 Kristian Høgsberg 提交于
Signed-off-by: NKristian Høgsberg <krh@redhat.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Kristian Høgsberg 提交于
Signed-off-by: NKristian Høgsberg <krh@redhat.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-