summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'sb/prepare-revision-walk-error-check'Junio C Hamano2014-09-093-3/+7
|\ | | | | | | | | * sb/prepare-revision-walk-error-check: prepare_revision_walk(): check for return value in all places
| * prepare_revision_walk(): check for return value in all placessb/prepare-revision-walk-error-checkStefan Beller2014-08-123-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Even the documentation tells us: You should check if it returns any error (non-zero return code) and if it does not, you can start using get_revision() to do the iteration. In preparation for this commit, I grepped all occurrences of prepare_revision_walk and added error messages, when there were none. Signed-off-by: Stefan Beller <stefanbeller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'sb/blame-msg-i18n'Junio C Hamano2014-09-091-1/+1
|\ \ | | | | | | | | | | | | * sb/blame-msg-i18n: builtin/blame.c: add translation to warning about failed revision walk
| * | builtin/blame.c: add translation to warning about failed revision walksb/blame-msg-i18nStefan Beller2014-08-121-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Stefan Beller <stefanbeller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'nd/strbuf-utf8-replace'Junio C Hamano2014-09-092-0/+10
|\ \ \ | | | | | | | | | | | | | | | | * nd/strbuf-utf8-replace: utf8.c: fix strbuf_utf8_replace() consuming data beyond input string
| * | | utf8.c: fix strbuf_utf8_replace() consuming data beyond input stringnd/strbuf-utf8-replaceNguyễn Thái Ngọc Duy2014-08-112-0/+10
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main loop in strbuf_utf8_replace() could summed up as: while ('src' is still valid) { 1) advance 'src' to copy ANSI escape sequences 2) advance 'src' to copy/replace visible characters } The problem is after #1, 'src' may have reached the end of the string (so 'src' points to NUL) and #2 will continue to copy that NUL as if it's a normal character. Because the output is stored in a strbuf, this NUL accounted in the 'len' field as well. Check after #1 and break the loop if necessary. The test does not look obvious, but the combination of %>>() should make a call trace like this show_log() pretty_print_commit() format_commit_message() strbuf_expand() format_commit_item() format_and_pad_commit() strbuf_utf8_replace() where %C(auto)%d would insert a color reset escape sequence in the end of the string given to strbuf_utf8_replace() and show_log() uses fwrite() to send everything to stdout (including the incorrect NUL inserted by strbuf_utf8_replace) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'sb/plug-leaks'Junio C Hamano2014-09-092-3/+5
|\ \ \ | | | | | | | | | | | | | | | | | | | | * sb/plug-leaks: clone.c: don't leak memory in cmd_clone remote.c: don't leak the base branch name in format_tracking_info
| * | | clone.c: don't leak memory in cmd_clonesb/plug-leaksStefan Beller2014-08-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Free the refspec. Found by scan.coverity.com (Id: 1127806) Signed-off-by: Stefan Beller <stefanbeller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | remote.c: don't leak the base branch name in format_tracking_infoStefan Beller2014-08-101-3/+3
| |/ / | | | | | | | | | | | | | | | | | | Found by scan.coverity.com (Id: 1127809) Signed-off-by: Stefan Beller <stefanbeller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'rs/refresh-beyond-symlink'Junio C Hamano2014-09-092-0/+51
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | "git add x" where x that used to be a directory has become a symbolic link to a directory misbehaved. * rs/refresh-beyond-symlink: read-cache: check for leading symlinks when refreshing index
| * | | read-cache: check for leading symlinks when refreshing indexrs/refresh-beyond-symlinkRené Scharfe2014-08-102-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't add paths with leading symlinks to the index while refreshing; we only track those symlinks themselves. We already ignore them while preloading (see read_index_preload.c). Reported-by: Nikolay Avdeev <avdeev@math.vsu.ru> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'la/init-doc'Junio C Hamano2014-09-091-39/+46
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * la/init-doc: Documentation: git-init: flesh out example Documentation: git-init: template directory: reword and cross-reference Documentation: git-init: reword parenthetical statements Documentation: git-init: --separate-git-dir: clarify Documentation: git-init: template directory: reword Documentation: git-init: list items facelift Documentation: git-init: typographical fixes
| * | | | Documentation: git-init: flesh out examplela/init-docLinus Arver2014-08-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a third step `git commit` after adding files for the first time. Signed-off-by: Linus Arver <linusarver@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | Documentation: git-init: template directory: reword and cross-referenceLinus Arver2014-08-081-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Linus Arver <linusarver@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | Documentation: git-init: reword parenthetical statementsLinus Arver2014-08-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Linus Arver <linusarver@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | Documentation: git-init: --separate-git-dir: clarifyLinus Arver2014-08-081-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use shorter sentences to describe what actually happens. We describe what the term "Git symbolic link" actually means. Also, we separate out the description of the behavioral change upon reinitialization into its own paragraph. Signed-off-by: Linus Arver <linusarver@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | Documentation: git-init: template directory: rewordLinus Arver2014-08-081-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Linus Arver <linusarver@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | Documentation: git-init: list items faceliftLinus Arver2014-08-081-21/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No textual change. Signed-off-by: Linus Arver <linusarver@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | Documentation: git-init: typographical fixesLinus Arver2014-08-081-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use backticks when we quote something that the user should literally use. Signed-off-by: Linus Arver <linusarver@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Merge branch 'jk/stash-list-p'Junio C Hamano2014-09-092-1/+43
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Teach "git stash list -p" to show the difference between the base commit version and the working tree version, which is in line with what "git show" gives. * jk/stash-list-p: stash: default listing to working-tree diff
| * | | | | stash: default listing to working-tree diffjk/stash-list-pJeff King2014-08-072-1/+43
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you list stashes, you can provide arbitrary git-log options to change the display. However, adding just "-p" does nothing, because each stash is actually a merge commit. This implementation detail is easy to forget, leading to confused users who think "-p" is not working. We can make this easier by defaulting to "--first-parent -m", which will show the diff against the working tree. This omits the index portion of the stash entirely, but it's simple and it matches what "git stash show" provides. People who are more clueful about stash's true form can use "--cc" to override the "-m", and the "--first-parent" will then do nothing. For diffs, it only affects non-combined diffs, so "--cc" overrides it. And for the traversal, we are walking the linear reflog anyway, so we do not even care about the parents. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Merge branch 'mm/log-branch-desc-plug-leak'Junio C Hamano2014-09-091-0/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * mm/log-branch-desc-plug-leak: builtin/log.c: fix minor memory leak
| * | | | | builtin/log.c: fix minor memory leakmm/log-branch-desc-plug-leakMatthieu Moy2014-08-071-0/+1
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Merge branch 'lf/bundle-exclusion'Junio C Hamano2014-09-092-3/+6
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "git bundle create" with date-range specification were meant to exclude tags outside the range * lf/bundle-exclusion: bundle: fix exclusion of annotated tags
| * | | | | bundle: fix exclusion of annotated tagslf/bundle-exclusionLukas Fleischer2014-08-072-3/+6
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit c9a42c4 (bundle: allow rev-list options to exclude annotated tags, 2009-01-02), support for excluding annotated tags outside the specified date range was added. However, the wrong order of parameters was chosen when calling memchr(). Fix this by swapping the character to search for with the maximum length parameter. Also cover this behavior with an additional test. Signed-off-by: Lukas Fleischer <git@cryptocrack.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Merge branch 'jc/apply-ws-prefix'Junio C Hamano2014-09-093-63/+96
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Applying a patch not generated by Git in a subdirectory used to check the whitespace breakage using the attributes for incorrect paths. Also whitespace checks were performed even for paths excluded via "git apply --exclude=<path>" mechanism. * jc/apply-ws-prefix: apply: omit ws check for excluded paths apply: hoist use_patch() helper for path exclusion up apply: use the right attribute for paths in non-Git patches
| * | | | | apply: omit ws check for excluded pathsjc/apply-ws-prefixJunio C Hamano2014-08-072-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whitespace breakages are checked while the patch is being parsed. Disable them at the beginning of parse_chunk(), where each individual patch is parsed, immediately after we learn the name of the file the patch applies to and before we start parsing the diff contained in the patch. One may naively think that we should be able to not just skip the whitespace checks but simply fast-forward to the next patch without doing anything once use_patch() tells us that this patch is not going to be used. But in reality we cannot really skip much of the parsing in order to do such a "fast-forward", primarily because parsing "@@ -k,l +m,n @@" lines and counting the input lines is how we determine the boundaries of individual patches. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | apply: hoist use_patch() helper for path exclusion upJunio C Hamano2014-08-071-38/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We will be adding a caller to the function a bit earlier in this file in a later patch. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | apply: use the right attribute for paths in non-Git patchesJunio C Hamano2014-08-072-22/+36
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We parse each patchfile and find the name of the path the patch applies to, and then use that name to consult the attribute system to find the whitespace rules to be used, and also the target file (either in the working tree or in the index) to replay the changes against. Unlike a Git-generated patch, a non-Git patch is taken to have the pathnames relative to the current working directory. The names found in such a patch are modified by prepending the prefix by the prefix_patches() helper function introduced in 56185f49 (git-apply: require -p<n> when working in a subdirectory., 2007-02-19). However, this prefixing is done after the patch is fully parsed and affects only what target files are patched. Because the attributes are checked against the names found in the patch during the parsing, not against the final pathname, the whitespace check that is done during parsing ends up using attributes for a wrong path for non-Git patches. Fix this by doing the prefix much earlier, immediately after the header part of each patch is parsed and we learn the name of the path the patch affects. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Merge branch 'jk/command-line-config-empty-string'Junio C Hamano2014-09-093-2/+26
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "git -c section.var command" and "git -c section.var= command" should pass the configuration differently (the former should be a boolean true, the latter should be an empty string). * jk/command-line-config-empty-string: config: teach "git -c" to recognize an empty string
| * | | | | config: teach "git -c" to recognize an empty stringjk/command-line-config-empty-stringJunio C Hamano2014-08-053-2/+26
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a config file, you can do: [foo] bar to turn the "foo.bar" boolean flag on, and you can do: [foo] bar= to set "foo.bar" to the empty string. However, git's "-c" parameter treats both: git -c foo.bar and git -c foo.bar= as the boolean flag, and there is no way to set a variable to the empty string. This patch enables the latter form to do that. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Merge branch 'bc/imap-send-doc'Junio C Hamano2014-09-091-4/+3
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * bc/imap-send-doc: imap-send doc: omit confusing "to use imap-send" modifier
| * | | | | imap-send doc: omit confusing "to use imap-send" modifierbc/imap-send-docbrian m. carlson2014-08-051-4/+3
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It wouldn't make sense for these configuration variables to be required for Git in general to function. 'Required' in this context means required for git imap-send to work. Noticed while trying to figure out what the sentence describing imap.tunnel meant. [jn: expanded to also simplify explanation of imap.folder and imap.host in the same way] Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Merge branch 'jc/not-mingw-cygwin'Junio C Hamano2014-09-0915-60/+56
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have been using NOT_{MINGW,CYGWIN} test prerequisites long before Peff invented support for negated prerequisites e.g. !MINGW and we still add more uses of the former. Convert them to the latter to avoid confusion. * jc/not-mingw-cygwin: test prerequisites: enumerate with commas test prerequisites: eradicate NOT_FOO
| * | | | | test prerequisites: enumerate with commasjc/not-mingw-cygwinJunio C Hamano2014-07-212-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | test_have_prereq does understand multiple predicates given as separate arguments, but that is by accident. We should list the prerequisites just like we use them as the (first) optional parameter for test_expect_success, concatenated with commas, for consistency. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | test prerequisites: eradicate NOT_FOOJunio C Hamano2014-07-2115-60/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support for Back when bdccd3c1 (test-lib: allow negation of prerequisites, 2012-11-14) introduced negated predicates (e.g. "!MINGW,!CYGWIN"), we already had 5 test files that use NOT_MINGW (and a few MINGW) as prerequisites. Let's not add NOT_FOO and rewrite existing ones as !FOO for both MINGW and CYGWIN. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | Start the post-2.1 cycleJunio C Hamano2014-09-023-2/+54
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | Merge branch 'rs/strbuf-getcwd'Junio C Hamano2014-09-0215-178/+191
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduce the use of fixed sized buffer passed to getcwd() calls by introducing xgetcwd() helper. * rs/strbuf-getcwd: use strbuf_add_absolute_path() to add absolute paths abspath: convert absolute_path() to strbuf use xgetcwd() to set $GIT_DIR use xgetcwd() to get the current directory or die wrapper: add xgetcwd() abspath: convert real_path_internal() to strbuf abspath: use strbuf_getcwd() to remember original working directory setup: convert setup_git_directory_gently_1 et al. to strbuf unix-sockets: use strbuf_getcwd() strbuf: add strbuf_getcwd()
| * | | | | | use strbuf_add_absolute_path() to add absolute pathsrs/strbuf-getcwdRené Scharfe2014-08-261-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | abspath: convert absolute_path() to strbufRené Scharfe2014-08-264-42/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move most of the code of absolute_path() into the new function strbuf_add_absolute_path() and in the process transform it to use struct strbuf and xgetcwd() instead of a PATH_MAX-sized buffer, which can be too small on some file systems. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | use xgetcwd() to set $GIT_DIRRené Scharfe2014-08-262-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of dying of a segmentation fault if getcwd() returns NULL, use xgetcwd() to make sure to write a useful error message and then exit in an orderly fashion. Suggested-by: Jeff King <peff@peff.net> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | use xgetcwd() to get the current directory or dieRené Scharfe2014-08-265-22/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert several calls of getcwd() and die() to use xgetcwd() instead. This way we get rid of fixed-size buffers (which can be too small depending on the used file system) and gain consistent error messages. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | wrapper: add xgetcwd()René Scharfe2014-08-262-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the helper function xgetcwd(), which returns the current directory or dies. The returned string has to be free()d after use. Helped-by: Duy Nguyen <pclouds@gmail.com> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | abspath: convert real_path_internal() to strbufRené Scharfe2014-08-261-44/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use strbuf instead of fixed-sized buffers in real_path() in order to avoid the size limitations of the latter. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | abspath: use strbuf_getcwd() to remember original working directoryRené Scharfe2014-08-261-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Store the original working directory in a strbuf instead of in a fixed-sized buffer, in order to be able to handle longer paths. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | setup: convert setup_git_directory_gently_1 et al. to strbufRené Scharfe2014-08-261-43/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert setup_git_directory_gently_1() and its helper functions setup_explicit_git_dir(), setup_discovered_git_dir() and setup_bare_git_dir() to use a struct strbuf to hold the current working directory. Replacing the PATH_MAX-sized buffer used before removes a path length limition on some file systems. The functions are converted all in one go because they all read and write the variable cwd. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | unix-sockets: use strbuf_getcwd()René Scharfe2014-07-281-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using a PATH_MAX-sized buffer, which can be too small on some file systems, use strbuf_getcwd(), which handles any path getcwd() returns. Also preserve the errno set by strbuf_getcwd() instead of setting it to ENAMETOOLONG; that way a more appropriate error message can be shown based on the actual reason for failing. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | strbuf: add strbuf_getcwd()René Scharfe2014-07-283-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add strbuf_getcwd(), which puts the current working directory into a strbuf. Because it doesn't use a fixed-size buffer it supports arbitrarily long paths, provided the platform's getcwd() does as well. At least on Linux and FreeBSD it handles paths longer than PATH_MAX just fine. Suggested-by: Karsten Blees <karsten.blees@gmail.com> Helped-by: Duy Nguyen <pclouds@gmail.com> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | Merge branch 'ta/pretty-parse-config'Junio C Hamano2014-09-021-1/+3
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ta/pretty-parse-config: pretty.c: make git_pretty_formats_config return -1 on git_config_string failure
| * | | | | | | pretty.c: make git_pretty_formats_config return -1 on git_config_string failureta/pretty-parse-configTanay Abhra2014-08-041-1/+3
| | |_|_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `git_pretty_formats_config()` continues without checking git_config_string's return value which can lead to a SEGFAULT. Instead return -1 when git_config_string fails signalling `git_config()` to die printing the location of the erroneous variable. Signed-off-by: Tanay Abhra <tanayabh@gmail.com> Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>