aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Sync with 1.7.0 seriesJunio C Hamano2010-07-27
|\
| * Git 1.7.0.7v1.7.0.7Junio C Hamano2010-07-27
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * config --get --path: check for unset $HOMEJonathan Nieder2010-07-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If $HOME is unset (as in some automated build situations), currently git config --path path.home "~" git config --path --get path.home segfaults. Error out with Failed to expand user dir in: '~/' instead. Reported-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'maint-1.7.0' into maint-1.7.1Junio C Hamano2010-07-25
|\ \ | |/ | | | | | | | | * maint-1.7.0: request-pull.txt: Document -p option Check size of path buffer before writing into it
| * Merge branch 'maint-1.6.6' into maint-1.7.0Junio C Hamano2010-07-25
| |\ | | | | | | | | | | | | | | | | | | * maint-1.6.6: request-pull.txt: Document -p option Check size of path buffer before writing into it rev-parse: fix --parse-opt --keep-dashdash --stop-at-non-option
| | * Merge branch 'maint-1.6.5' into maint-1.6.6Junio C Hamano2010-07-25
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | * maint-1.6.5: request-pull.txt: Document -p option Check size of path buffer before writing into it rev-parse: fix --parse-opt --keep-dashdash --stop-at-non-option
| | | * request-pull.txt: Document -p optionStephen Boyd2010-07-25
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| | | * Merge branch 'maint-1.6.4' into maint-1.6.5Junio C Hamano2010-07-25
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | * maint-1.6.4: Check size of path buffer before writing into it rev-parse: fix --parse-opt --keep-dashdash --stop-at-non-option
| | | | * Check size of path buffer before writing into itGreg Brockman2010-07-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This prevents a buffer overrun that could otherwise be triggered by creating a file called '.git' with contents gitdir: (something really long) Signed-off-by: Greg Brockman <gdb@mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | t/README: clarify test_must_fail descriptionBrandon Casey2010-07-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some have found the wording of the description to be somewhat ambiguous with respect to when it is desirable to use test_must_fail instead of "! <git-command>". Tweak the wording somewhat to hopefully clarify that it is _because_ test_must_fail can detect segmentation fault that it is desirable to use it instead of "! <git-command>". Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Check size of path buffer before writing into itGreg Brockman2010-07-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This prevents a buffer overrun that could otherwise be triggered by creating a file called '.git' with contents gitdir: (something really long) Signed-off-by: Greg Brockman <gdb@mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | update-server-info: Shorten read_pack_info_file()Ralf Thielow2010-07-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The correct responses to a D and a T line in .git/objects/info/packs are the same, so combine their case arms. In both cases we already ‘goto’ out of the switch so while at it, remove a redundant ‘break’ to avoid yet another line of code. Signed-off-by: Ralf Thielow <ralf.thielow@googlemail.com> Reviewed-by: Jonathan Nieder <jrnieder <at> gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Documentation: Explain git-mergetool's use of temporary filesDavid Aguilar2010-07-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'git mergetool' creates '*.orig' backup files in its default configuration. Mention this in its documentation. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Documentation: add submodule.* to the big configuration variable listJonathan Nieder2010-07-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The url, path, and the update items in [submodule "foo"] stanzas are nicely explained in the .gitmodules and ‘git submodule’ documentation. Point there from the config documentation. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | gitmodules.5: url can be a relative pathJonathan Nieder2010-07-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is already excellent documentation for this facility in git-submodule.1, but it is not so discoverable. Relative paths in .gitmodules can be useful for serving the same repository over multiple protocols, for example. Thanks to Peter for pointing this out. Cc: Peter Krefting <peter@softwolves.pp.se> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | gitweb: fix esc_urlPavan Kumar Sunkara2010-07-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Earlier, 452e225 (gitweb: fix esc_param, 2009-10-13) fixed CGI escaping rules used in esc_url. A very similar logic exists in esc_param and needs to be fixed the same way. Signed-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | git fetch documentation: describe short '-p' synonym to '--prune' optionOren Held2010-07-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's already implemented, just undocumented. Signed-off-by: Oren Held <orenhe@il.ibm.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | format-patch: document the format.to configuration settingMiklos Vajna2010-07-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [jc: with simplification from Jonathan Nieder] Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Documentation: Spelling fix in protocol-capabilities.txtFredrik Skolmli2010-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Fredrik Skolmli <fredrik@frsk.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | checkout: accord documentation to what git doesNicolas Sebrecht2010-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Nicolas Sebrecht <nicolas.s.dev@gmx.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | t0005: work around strange $? in ksh when program terminated by a signalJohannes Sixt2010-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ksh93 is known to report $? of programs that terminated by a signal as 256 + signal number instead of 128 + signal number like other POSIX compliant shells (ksh's behavior is still POSIX compliant in this regard). Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | backmerge a few more fixes to 1.7.1.X seriesJunio C Hamano2010-07-07
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Merge branch 'maint-1.6.4' into maintJunio C Hamano2010-07-07
|\ \ \ \ \ | | |_|_|/ | |/| | | | | | | | | | | | | * maint-1.6.4: rev-parse: fix --parse-opt --keep-dashdash --stop-at-non-option
| * | | | rev-parse: fix --parse-opt --keep-dashdash --stop-at-non-optionUwe Kleine-König2010-07-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ?: operator has a lower priority than |, so the implicit associativity made the 6th argument of parse_options be PARSE_OPT_KEEP_DASHDASH if keep_dashdash was true discarding PARSE_OPT_STOP_AT_NON_OPTION and PARSE_OPT_SHELL_EVAL. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Merge branch 'mg/doc-rev-parse-treepath-syntax' into maintJunio C Hamano2010-07-07
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * mg/doc-rev-parse-treepath-syntax: git-rev-parse.txt: Add more examples for caret and colon git-rev-parse.txt: Document ":path" specifier
| * | | | | git-rev-parse.txt: Add more examples for caret and colonMichael J Gruber2010-06-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several items in the caret, colon and friends section contain examples already. Make sure they all come with examples, and that examples come early so that they serve as a visual guide, as well. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | git-rev-parse.txt: Document ":path" specifierMichael J Gruber2010-06-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The empty treeish in ":path" means "index". This is actually a special case of the ":stage:path" syntax where it is documented, but mentioning it also together with "treeish:path" is helpful, so do it. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | Merge branch 'tr/receive-pack-aliased-update-fix' into maintJunio C Hamano2010-07-07
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tr/receive-pack-aliased-update-fix: check_aliased_update: strcpy() instead of strcat() to copy receive-pack: detect aliased updates which can occur with symrefs receive-pack: switch global variable 'commands' to a parameter Conflicts: t/t5516-fetch-push.sh
| * | | | | | check_aliased_update: strcpy() instead of strcat() to copyThomas Rast2010-06-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | da3efdb (receive-pack: detect aliased updates which can occur with symrefs, 2010-04-19) introduced two strcat() into uninitialized strings. The intent was clearly make a copy of the static buffer used by find_unique_abbrev(), so use strcpy() instead. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Tested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | receive-pack: detect aliased updates which can occur with symrefsJay Soffian2010-04-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When pushing to a remote repo the sending side filters out aliased updates (e.g., foo:baz bar:baz). However, it is not possible for the sender to know if two refs are aliased on the receiving side via symrefs. Here is one such scenario: $ git init origin $ (cd origin && touch file && git add file && git commit -a -m intial) $ git clone --bare origin origin.git $ rm -rf origin $ git clone origin.git client $ git clone --mirror client backup.git && $ (cd backup.git && git remote set-head origin --auto) $ (cd client && git remote add --mirror backup ../backup.git && echo change1 > file && git commit -a -m change1 && git push origin && git push backup ) The push to backup fails with: Counting objects: 5, done. Writing objects: 100% (3/3), 244 bytes, done. Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. error: Ref refs/remotes/origin/master is at ef3... but expected 262... remote: error: failed to lock refs/remotes/origin/master To ../backup.git 262cd57..ef307ff master -> master 262cd57..ef307ff origin/HEAD -> origin/HEAD ! [remote rejected] origin/master -> origin/master (failed to lock) error: failed to push some refs to '../backup.git' The reason is that refs/remotes/origin/HEAD is a symref to refs/remotes/origin/master, but it is not possible for the sending side to unambiguously know this. This commit fixes the issue by having receive-pack ignore any update to a symref whose target is being identically updated. If a symref and its target are being updated inconsistently, then the update for both fails with an error message ("refusing inconsistent update...") to help diagnose the situation. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | receive-pack: switch global variable 'commands' to a parameterJay Soffian2010-04-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Receive-pack is inconsistent in its usage of the 'commands' variable; though it is setup as a global and accessed that way by execute_commands(), report(), and run_receive_hook(), it is also passed as a parameter to delete_only() and run_update_post_hook(). For consistency, make it local to cmd_receive_pack and pass it as a parameter. As long as we're cleaning up, also make our use of the names 'commands' and 'cmd' consistent. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | fix git branch -m in presence of cross devicesPierre Habouzit2010-07-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you have for example a bare repository stored on NFS, and that you create new workdirs locally (using contrib's git-new-workdir), logs/refs is a symlink to a different device. Hence when the reflogs are renamed, all must happen below logs/refs or one gets cross device rename errors like: git branch -m foo error: unable to move logfile logs/refs/heads/master to tmp-renamed-log: Invalid cross-device link fatal: Branch rename failed The fix is hence to use logs/refs/.tmp-renamed-log as a temporary log name, instead of just tmp-renamed-log. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | add missing && to submodule-merge testcaseHeiko Voigt2010-07-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | test-date: fix sscanf type conversionJeff King2010-07-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reading into a time_t isn't portable, since we don't know the exact type. Instead, use an unsigned long, which is what show_date wants, anyway. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | xdiff: optimise for no whitespace difference when ignoring whitespace.Dylan Reid2010-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In xdl_recmatch, do the memcmp to check if the two lines are equal before checking if whitespace flags are set. If the lines are identical, then there is no need to check if they differ only in whitespace. This makes the common case (there is no whitespace difference) faster. It costs the case where lines are the same length and contain whitespace differences, but the common case is more than 20% faster. Signed-off-by: Dylan Reid <dgreid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | t0006: test timezone parsingJeff King2010-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, test-date simply ignored the parsed timezone and told show_date() to use UTC. Instead, let's print out what we actually parsed. While we're at it, let's make it easy for tests to work in a specific timezone. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | rerere.txt: Document forget subcommandMichael J Gruber2010-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dea4562 (rerere forget path: forget recorded resolution, 2009-12-25) introduced the forget subcommand for rerere. Document it. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | Documentation/git-gc.txt: add reference to githooksChris Packham2010-07-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This advertises the existence of the 'pre-auto-gc' hook and adds a cross reference to where the hook is documented. Signed-off-by: Chris Packham <judge.packham@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | Git 1.7.1.1v1.7.1.1Junio C Hamano2010-06-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | t/t9001: use egrep when regular expressions are involvedBrandon Casey2010-06-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Supplying backslashed, extended regular expressions to grep is not portable. Use egrep instead. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | Update draft release notes to 1.7.1.1Junio C Hamano2010-06-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | Merge branch 'tr/send-email-8bit' into maintJunio C Hamano2010-06-28
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tr/send-email-8bit: send-email: ask about and declare 8bit mails
| * | | | | | | send-email: ask about and declare 8bit mailsThomas Rast2010-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git-send-email passes on an 8bit mail as-is even if it does not declare a content-type. Because the user can edit email between format-patch and send-email, such invalid mails are unfortunately not very hard to come by. Make git-send-email stop and ask about the encoding to use if it encounters any such mail. Also provide a configuration setting to permanently configure an encoding. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | Merge branch 'pb/maint-perl-errmsg-no-dir' into maintJunio C Hamano2010-06-28
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * pb/maint-perl-errmsg-no-dir: Git.pm: better error message
| * | | | | | | | Git.pm: better error messagePhilippe Bruhat (BooK)2010-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide the bad directory name alongside with $! Note: $! is set if there is "No such file or directory", but isn't set if the file exists but is not a directory. Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | | Merge branch 'js/maint-am-rebase-invalid-author' into maintJunio C Hamano2010-06-28
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * js/maint-am-rebase-invalid-author: am: use get_author_ident_from_commit instead of mailinfo when rebasing
| * | | | | | | | | am: use get_author_ident_from_commit instead of mailinfo when rebasingJay Soffian2010-06-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In certain situations, commit authorship can consist of an invalid e-mail address. For example, this is the case when working with git svn repos where the author email has had the svn repo UUID appended such as: author@example.com <author@example.com@deadbeef-dead-beef-dead-beefdeadbeef> Given such an address, mailinfo extracts the authorship incorrectly as it assumes a valid domain. However, when rebasing the original authorship should be preserved irrespective of its validity as an email address. Using get_author_ident_from_commit instead of mailinfo when rebasing preserves the original authorship. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | | | Merge branch 'jc/maint-simpler-common-prefix' into maintJunio C Hamano2010-06-28
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jc/maint-simpler-common-prefix: common_prefix: simplify and fix scanning for prefixes
| * | | | | | | | | | common_prefix: simplify and fix scanning for prefixesJunio C Hamano2010-06-16
| |/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | common_prefix() scans backwards from the far end of each 'next' pathspec, starting from 'len', shortening the 'prefix' using 'path' as a reference. However, there is a small opportunity for an out-of-bounds access because len is unconditionally set to prefix-1 after a "direct match" test failed. This means that if 'next' is shorter than prefix+2, we read past it. Instead of a minimal fix, simplify the loop: scan *forward* over the 'next' entry, remembering the last '/' where it matched the prefix known so far. This is far easier to read and also has the advantage that we only scan over each entry once. Acked-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | | | Merge branch 'bd/maint-unpack-trees-parawalk-fix' into maintJunio C Hamano2010-06-28
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bd/maint-unpack-trees-parawalk-fix: unpack-trees: Make index lookahead less pessimal