summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-10-10alternates: use a separate scratch spaceLibravatar Jeff King6-37/+24
The alternate_object_database struct uses a single buffer both for storing the path to the alternate, and as a scratch buffer for forming object names. This is efficient (since otherwise we'd end up storing the path twice), but it makes life hard for callers who just want to know the path to the alternate. They have to remember to stop reading after "alt->name - alt->base" bytes, and to subtract one for the trailing '/'. It would be much simpler if they could simply access a NUL-terminated path string. We could encapsulate this in a function which puts a NUL in the scratch buffer and returns the string, but that opens up questions about the lifetime of the result. The first time another caller uses the alternate, the scratch buffer may get other data tacked onto it. Let's instead just store the root path separately from the scratch buffer. There aren't enough alternates being stored for the duplicated data to matter for performance, and this keeps things simple and safe for the callers. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-10alternates: encapsulate alt->base mungingLibravatar Jeff King1-6/+13
The alternate_object_database struct holds a path to the alternate objects, but we also use that buffer as scratch space for forming loose object filenames. Let's pull that logic into a helper function so that we can more easily modify it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-10alternates: provide helper for allocating alternateLibravatar Jeff King3-15/+26
Allocating a struct alternate_object_database is tricky, as we must over-allocate the buffer to provide scratch space, and then put in particular '/' and NUL markers. Let's encapsulate this in a function so that the complexity doesn't leak into callers (and so that we can modify it later). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-10alternates: provide helper for adding to alternates listLibravatar Jeff King3-23/+25
The submodule code wants to temporarily add an alternate object store to our in-memory alt_odb list, but does it manually. Let's provide a helper so it can reuse the code in link_alt_odb_entry(). While we're adding our new add_to_alternates_memory(), let's document add_to_alternates_file(), as the two are related. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-10link_alt_odb_entry: refactor string handlingLibravatar Jeff King1-38/+45
The string handling in link_alt_odb_entry() is mostly an artifact of the original version, which took the path as a ptr/len combo, and did not have a NUL-terminated string until we created one in the alternate_object_database struct. But since 5bdf0a8 (sha1_file: normalize alt_odb path before comparing and storing, 2011-09-07), the first thing we do is put the path into a strbuf, which gives us some easy opportunities for cleanup. In particular: - we call strlen(pathbuf.buf), which is silly; we can look at pathbuf.len. - even though we have a strbuf, we don't maintain its "len" field when chomping extra slashes from the end, and instead keep a separate "pfxlen" variable. We can fix this and then drop "pfxlen" entirely. - we don't check whether the path is usable until after we allocate the new struct, making extra cleanup work for ourselves. Since we have a NUL-terminated string, we can bump the "is it usable" checks higher in the function. While we're at it, we can move that logic to its own helper, which makes the flow of link_alt_odb_entry() easier to follow. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-10link_alt_odb_entry: handle normalize_path errorsLibravatar Jeff King3-2/+37
When we add a new alternate to the list, we try to normalize out any redundant "..", etc. However, we do not look at the return value of normalize_path_copy(), and will happily continue with a path that could not be normalized. Worse, the normalizing process is done in-place, so we are left with whatever half-finished working state the normalizing function was in. Fortunately, this cannot cause us to read past the end of our buffer, as that working state will always leave the NUL from the original path in place. And we do tend to notice problems when we check is_directory() on the path. But you can see the nonsense that we feed to is_directory with an entry like: this/../../is/../../way/../../too/../../deep/../../to/../../resolve in your objects/info/alternates, which yields: error: object directory /to/e/deep/too/way//ects/this/../../is/../../way/../../too/../../deep/../../to/../../resolve does not exist; check .git/objects/info/alternates. We can easily fix this just by checking the return value. But that makes it hard to generate a good error message, since we're normalizing in-place and our input value has been overwritten by cruft. Instead, let's provide a strbuf helper that does an in-place normalize, but restores the original contents on error. This uses a second buffer under the hood, which is slightly less efficient, but this is not a performance-critical code path. The strbuf helper can also properly set the "len" parameter of the strbuf before returning. Just doing: normalize_path_copy(buf.buf, buf.buf); will shorten the string, but leave buf.len at the original length. That may be confusing to later code which uses the strbuf. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-10t5613: clarify "too deep" recursion testsLibravatar Jeff King1-8/+19
These tests are just trying to show that we allow recursion up to a certain depth, but not past it. But the counting is a bit non-intuitive, and rather than test at the edge of the breakage, we test "OK" cases in the middle of the chain. Let's explain what's going on, and explicitly test the switch between "OK" and "too deep". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-03t5613: do not chdir in main processLibravatar Jeff King1-59/+33
Our usual style when working with subdirectories is to chdir inside a subshell or to use "git -C", which means we do not have to constantly return to the main test directory. Let's convert this old test, which does not follow that style. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-03t5613: whitespace/style cleanupsLibravatar Jeff King1-52/+62
Our normal test style these days puts the opening quote of the body on the description line, and indents the body with a single tab. This ancient test did not follow this. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-03t5613: use test_must_failLibravatar Jeff King1-6/+6
Besides being our normal style, this correctly checks for an error exit() versus signal death. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-03t5613: drop test_valid_repo functionLibravatar Jeff King1-12/+7
This function makes sure that "git fsck" does not report any errors. But "--full" has been the default since f29cd39 (fsck: default to "git fsck --full", 2009-10-20), and we can use the exit code (instead of counting the lines) since e2b4f63 (fsck: exit with non-zero status upon errors, 2007-03-05). So we can just use "git fsck", which is shorter and more flexible (e.g., we can use "git -C"). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-03t5613: drop reachable_via functionLibravatar Jeff King1-10/+0
This function was never used since its inception in dd05ea1 (test case for transitive info/alternates, 2006-05-07). Which is just as well, since it mutates the repo state in a way that would invalidate further tests, without cleaning up after itself. Let's get rid of it so that nobody is tempted to use it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-03Sync with 2.10.1Libravatar Junio C Hamano2-1/+13
* maint: Git 2.10.1
2016-10-03Seventh batch for 2.11Libravatar Junio C Hamano1-0/+40
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-03Merge branch 'pb/rev-list-reverse-with-count'Libravatar Junio C Hamano1-2/+3
Doc update to clarify what "log -3 --reverse" does. * pb/rev-list-reverse-with-count: rev-list-options: clarify the usage of --reverse
2016-10-03Merge branch 'dt/tree-fsck'Libravatar Junio C Hamano5-20/+130
The codepath in "git fsck" to detect malformed tree objects has been updated not to die but keep going after detecting them. * dt/tree-fsck: fsck: handle bad trees like other errors tree-walk: be more specific about corrupt tree errors
2016-10-03Merge branch 'kd/mailinfo-quoted-string'Libravatar Junio C Hamano6-33/+159
An author name, that spelled a backslash-quoted double quote in the human readable part "My \"double quoted\" name", was not unquoted correctly while applying a patch from a piece of e-mail. * kd/mailinfo-quoted-string: mailinfo: unescape quoted-pair in header fields t5100-mailinfo: replace common path prefix with variable
2016-10-03Merge branch 'mh/diff-indent-heuristic'Libravatar Junio C Hamano1-7/+7
Clean-up for a recently graduated topic. * mh/diff-indent-heuristic: xdiff: rename "struct group" to "struct xdlgroup"
2016-10-03Merge branch 'dt/mailinfo'Libravatar Junio C Hamano1-0/+1
* dt/mailinfo: add David Turner's Two Sigma address
2016-10-03Merge branch 'va/git-gui-i18n'Libravatar Junio C Hamano3-3/+3012
"git gui" l10n to Portuguese. * va/git-gui-i18n: git-gui: l10n: add Portuguese translation git-gui i18n: mark strings for translation
2016-10-03Merge branch 'rs/git-gui-use-modern-git-merge-syntax'Libravatar Junio C Hamano1-6/+1
The original command line syntax for "git merge", which was "git merge <msg> HEAD <parent>...", has been deprecated for quite some time, and "git gui" was the last in-tree user of the syntax. This is finally fixed, so that we can move forward with the deprecation. * rs/git-gui-use-modern-git-merge-syntax: git-gui: stop using deprecated merge syntax
2016-10-03Merge branch 'jc/verify-loose-object-header'Libravatar Junio C Hamano2-8/+30
Codepaths that read from an on-disk loose object were too loose in validating what they are reading is a proper object file and sometimes read past the data they read from the disk, which has been corrected. H/t to Gustavo Grieco for reporting. * jc/verify-loose-object-header: unpack_sha1_header(): detect malformed object header streaming: make sure to notice corrupt object
2016-10-03Merge branch 'nd/init-core-worktree-in-multi-worktree-world'Libravatar Junio C Hamano4-50/+57
"git init" tried to record core.worktree in the repository's 'config' file when GIT_WORK_TREE environment variable was set and it was different from where GIT_DIR appears as ".git" at its top, but the logic was faulty when .git is a "gitdir:" file that points at the real place, causing trouble in working trees that are managed by "git worktree". This has been corrected. * nd/init-core-worktree-in-multi-worktree-world: init: kill git_link variable init: do not set unnecessary core.worktree init: kill set_git_dir_init() init: call set_git_dir_init() from within init_db() init: correct re-initialization from a linked worktree
2016-10-03Merge branch 'ik/gitweb-force-highlight'Libravatar Junio C Hamano3-14/+29
"gitweb" can spawn "highlight" to show blob contents with (programming) language-specific syntax highlighting, but only when the language is known. "highlight" can however be told to make the guess itself by giving it "--force" option, which has been enabled. * ik/gitweb-force-highlight: gitweb: use highlight's shebang detection gitweb: remove unused guess_file_syntax() parameter
2016-10-03Merge branch 'rs/copy-array'Libravatar Junio C Hamano7-9/+40
Code cleanup. * rs/copy-array: use COPY_ARRAY add COPY_ARRAY
2016-10-03Git 2.10.1Libravatar Junio C Hamano3-2/+14
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-03Merge branch 'jk/ident-ai-canonname-could-be-null' into maintLibravatar Junio C Hamano1-1/+1
In the codepath that comes up with the hostname to be used in an e-mail when the user didn't tell us, we looked at ai_canonname field in struct addrinfo without making sure it is not NULL first. * jk/ident-ai-canonname-could-be-null: ident: handle NULL ai_canonname
2016-10-03Merge branch 'jk/doc-cvs-update' into maintLibravatar Junio C Hamano2-2/+6
Documentation around tools to import from CVS was fairly outdated. * jk/doc-cvs-update: docs/cvs-migration: mention cvsimport caveats docs/cvs-migration: update link to cvsps homepage docs/cvsimport: prefer cvs-fast-export to parsecvs
2016-10-03Merge branch 'jk/pack-tag-of-tag' into maintLibravatar Junio C Hamano2-30/+95
"git pack-objects --include-tag" was taught that when we know that we are sending an object C, we want a tag B that directly points at C but also a tag A that points at the tag B. We used to miss the intermediate tag B in some cases. * jk/pack-tag-of-tag: pack-objects: walk tag chains for --include-tag t5305: simplify packname handling t5305: use "git -C" t5305: drop "dry-run" of unpack-objects t5305: move cleanup into test block
2016-09-29Sync with maintLibravatar Junio C Hamano1-0/+87
* maint: Prepare for 2.10.1
2016-09-29Sixth batch for 2.11Libravatar Junio C Hamano1-0/+28
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-29Merge branch 'jc/worktree-config'Libravatar Junio C Hamano1-0/+2
"git worktree", even though it used the default_abbrev setting that ought to be affected by core.abbrev configuration variable, ignored the variable setting. The command has been taught to read the default set of configuration variables to correct this. * jc/worktree-config: worktree: honor configuration variables
2016-09-29Merge branch 'jk/ident-ai-canonname-could-be-null'Libravatar Junio C Hamano1-1/+1
In the codepath that comes up with the hostname to be used in an e-mail when the user didn't tell us, we looked at ai_canonname field in struct addrinfo without making sure it is not NULL first. * jk/ident-ai-canonname-could-be-null: ident: handle NULL ai_canonname
2016-09-29Merge branch 'jt/fetch-pack-in-vain-count-with-stateless'Libravatar Junio C Hamano1-2/+9
When "git fetch" tries to find where the history of the repository it runs in has diverged from what the other side has, it has a mechanism to avoid digging too deep into irrelevant side branches. This however did not work well over the "smart-http" transport due to a design bug, which has been fixed. * jt/fetch-pack-in-vain-count-with-stateless: fetch-pack: do not reset in_vain on non-novel acks
2016-09-29Merge branch 'jk/verify-packfile-gently'Libravatar Junio C Hamano1-5/+2
A low-level function verify_packfile() was meant to show errors that were detected without dying itself, but under some conditions it didn't and died instead, which has been fixed. * jk/verify-packfile-gently: verify_packfile: check pack validity before accessing data
2016-09-29Merge branch 'jt/mailinfo-fold-in-body-headers'Libravatar Junio C Hamano12-36/+159
When "git format-patch --stdout" output is placed as an in-body header and it uses the RFC2822 header folding, "git am" failed to put the header line back into a single logical line. The underlying "git mailinfo" was taught to handle this properly. * jt/mailinfo-fold-in-body-headers: mailinfo: handle in-body header continuations mailinfo: make is_scissors_line take plain char * mailinfo: separate in-body header processing
2016-09-29Prepare for 2.10.1Libravatar Junio C Hamano1-0/+87
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-29Merge branch 'tg/add-chmod+x-fix' into maintLibravatar Junio C Hamano8-49/+136
"git add --chmod=+x <pathspec>" added recently only toggled the executable bit for paths that are either new or modified. This has been corrected to flip the executable bit for all paths that match the given pathspec. * tg/add-chmod+x-fix: t3700-add: do not check working tree file mode without POSIXPERM t3700-add: create subdirectory gently add: modify already added files when --chmod is given read-cache: introduce chmod_index_entry update-index: add test for chmod flags
2016-09-29Merge branch 'et/add-chmod-x' into maintLibravatar Junio C Hamano1-1/+6
"git add --chmod=+x" added recently lacked documentation, which has been corrected. * et/add-chmod-x: add: document the chmod option
2016-09-29Merge branch 'rt/rebase-i-broken-insn-advise' into maintLibravatar Junio C Hamano2-4/+4
When "git rebase -i" is given a broken instruction, it told the user to fix it with "--edit-todo", but didn't say what the step after that was (i.e. "--continue"). * rt/rebase-i-broken-insn-advise: rebase -i: improve advice on bad instruction lines
2016-09-29Merge branch 'ls/travis-homebrew-path-fix' into maintLibravatar Junio C Hamano1-1/+1
The procedure to build Git on Mac OS X for Travis CI hardcoded the internal directory structure we assumed HomeBrew uses, which was a no-no. The procedure has been updated to ask HomeBrew things we need to know to fix this. * ls/travis-homebrew-path-fix: travis-ci: ask homebrew for its path instead of hardcoding it
2016-09-29Merge branch 'js/regexec-buf' into maintLibravatar Junio C Hamano7-33/+53
Some codepaths in "git diff" used regexec(3) on a buffer that was mmap(2)ed, which may not have a terminating NUL, leading to a read beyond the end of the mapped region. This was fixed by introducing a regexec_buf() helper that takes a <ptr,len> pair with REG_STARTEND extension. * js/regexec-buf: regex: use regexec_buf() regex: add regexec_buf() that can work on a non NUL-terminated string regex: -G<pattern> feeds a non NUL-terminated string to regexec() and fails
2016-09-29Merge branch 'nd/checkout-disambiguation' into maintLibravatar Junio C Hamano4-3/+36
"git checkout <word>" does not follow the usual disambiguation rules when the <word> can be both a rev and a path, to allow checking out a branch 'foo' in a project that happens to have a file 'foo' in the working tree without having to disambiguate. This was poorly documented and the check was incorrect when the command was run from a subdirectory. * nd/checkout-disambiguation: checkout: fix ambiguity check in subdir checkout.txt: document a common case that ignores ambiguation rules checkout: add some spaces between code and comment
2016-09-29Merge branch 'ep/doc-check-ref-format-example' into maintLibravatar Junio C Hamano1-2/+2
A shell script example in check-ref-format documentation has been fixed. * ep/doc-check-ref-format-example: git-check-ref-format.txt: fixup documentation
2016-09-29Merge branch 'mm/config-color-ui-default-to-auto' into maintLibravatar Junio C Hamano1-6/+12
Documentation for individual configuration variables to control use of color (like `color.grep`) said that their default value is 'false', instead of saying their default is taken from `color.ui`. When we updated the default value for color.ui from 'false' to 'auto' quite a while ago, all of them broke. This has been corrected. * mm/config-color-ui-default-to-auto: Documentation/config: default for color.* is color.ui
2016-09-29Merge branch 'jk/reduce-gc-aggressive-depth' into maintLibravatar Junio C Hamano2-2/+2
"git gc --aggressive" used to limit the delta-chain length to 250, which is way too deep for gaining additional space savings and is detrimental for runtime performance. The limit has been reduced to 50. * jk/reduce-gc-aggressive-depth: gc: default aggressive depth to 50
2016-09-29Merge branch 'jk/rebase-i-drop-ident-check' into maintLibravatar Junio C Hamano2-3/+47
Even when "git pull --rebase=preserve" (and the underlying "git rebase --preserve") can complete without creating any new commit (i.e. fast-forwards), it still insisted on having a usable ident information (read: user.email is set correctly), which was less than nice. As the underlying commands used inside "git rebase" would fail with a more meaningful error message and advice text when the bogus ident matters, this extra check was removed. * jk/rebase-i-drop-ident-check: rebase-interactive: drop early check for valid ident
2016-09-29Merge branch 'jt/format-patch-base-info-above-sig' into maintLibravatar Junio C Hamano2-9/+30
"git format-patch --base=..." feature that was recently added showed the base commit information after "-- " e-mail signature line, which turned out to be inconvenient. The base information has been moved above the signature line. * jt/format-patch-base-info-above-sig: format-patch: show base info before email signature
2016-09-29Merge branch 'ks/perf-build-with-autoconf' into maintLibravatar Junio C Hamano1-1/+7
Performance tests done via "t/perf" did not use the same set of build configuration if the user relied on autoconf generated configuration. * ks/perf-build-with-autoconf: t/perf/run: copy config.mak.autogen & friends to build area
2016-09-29Merge branch 'rs/xdiff-merge-overlapping-hunks-for-W-context' into maintLibravatar Junio C Hamano2-1/+26
"git diff -W" output needs to extend the context backward to include the header line of the current function and also forward to include the body of the entire current function up to the header line of the next one. This process may have to merge to adjacent hunks, but the code forgot to do so in some cases. * rs/xdiff-merge-overlapping-hunks-for-W-context: xdiff: fix merging of hunks with -W context and -u context