summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2011-10-10Merge branch 'mh/check-ref-format-3'Libravatar Junio C Hamano24-225/+426
* mh/check-ref-format-3: (23 commits) add_ref(): verify that the refname is formatted correctly resolve_ref(): expand documentation resolve_ref(): also treat a too-long SHA1 as invalid resolve_ref(): emit warnings for improperly-formatted references resolve_ref(): verify that the input refname has the right format remote: avoid passing NULL to read_ref() remote: use xstrdup() instead of strdup() resolve_ref(): do not follow incorrectly-formatted symbolic refs resolve_ref(): extract a function get_packed_ref() resolve_ref(): turn buffer into a proper string as soon as possible resolve_ref(): only follow a symlink that contains a valid, normalized refname resolve_ref(): use prefixcmp() resolve_ref(): explicitly fail if a symlink is not readable Change check_refname_format() to reject unnormalized refnames Inline function refname_format_print() Make collapse_slashes() allocate memory for its result Do not allow ".lock" at the end of any refname component Refactor check_refname_format() Change check_ref_format() to take a flags argument Change bad_ref_char() to return a boolean value ...
2011-10-10Merge branch 'mh/iterate-refs'Libravatar Junio C Hamano1-32/+74
* mh/iterate-refs: refs.c: make create_cached_refs() static Retain caches of submodule refs Store the submodule name in struct cached_refs Allocate cached_refs objects dynamically Change the signature of read_packed_refs() Access reference caches only through new function get_cached_refs() Extract a function clear_cached_refs()
2011-10-10Merge branch 'jm/mergetool-pathspec'Libravatar Junio C Hamano3-70/+71
* jm/mergetool-pathspec: mergetool: no longer need to save standard input mergetool: Use args as pathspec to unmerged files
2011-10-10Merge branch 'jc/maint-diffstat-numstat-context'Libravatar Junio C Hamano1-0/+2
* jc/maint-diffstat-numstat-context: diff: teach --stat/--numstat to honor -U$num
2011-10-10Merge branch 'mz/remote-rename'Libravatar Junio C Hamano2-7/+52
* mz/remote-rename: remote: only update remote-tracking branch if updating refspec remote rename: warn when refspec was not updated remote: "rename o foo" should not rename ref "origin/bar" remote: write correct fetch spec when renaming remote 'remote'
2011-10-10Merge branch 'cb/common-prefix-unification'Libravatar Junio C Hamano6-64/+40
* cb/common-prefix-unification: rename pathspec_prefix() to common_prefix() and move to dir.[ch] consolidate pathspec_prefix and common_prefix remove prefix argument from pathspec_prefix
2011-10-10Merge branch 'jn/maint-http-error-message'Libravatar Junio C Hamano1-2/+7
* jn/maint-http-error-message: http: avoid empty error messages for some curl errors http: remove extra newline in error message
2011-10-10Merge branch 'hv/submodule-update-none'Libravatar Junio C Hamano2-1/+69
* hv/submodule-update-none: add update 'none' flag to disable update of submodule by default submodule: move update configuration variable further up
2011-10-10Merge branch 'fg/submodule-git-file-git-dir'Libravatar Junio C Hamano10-67/+244
* fg/submodule-git-file-git-dir: Move git-dir for submodules rev-parse: add option --resolve-git-dir <path> Conflicts: cache.h git-submodule.sh
2011-10-09Fix some "variable might be used uninitialized" warningsLibravatar Ramsay Jones2-2/+2
In particular, gcc complains as follows: CC tree-walk.o tree-walk.c: In function `traverse_trees': tree-walk.c:347: warning: 'e' might be used uninitialized in this \ function CC builtin/revert.o builtin/revert.c: In function `verify_opt_mutually_compatible': builtin/revert.c:113: warning: 'opt2' might be used uninitialized in \ this function Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-09Makefile: fix permissions of mergetools/ checked out with permissive umaskLibravatar Junio C Hamano1-2/+1
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-09Makefile: fix permissions of mergetools/ checked out with permissive umaskLibravatar Jonathan Nieder1-2/+1
Ever since mergetool--lib was split into multiple files in v1.7.7-rc0~3^2~1 (2011-08-18), the Makefile takes care to reset umask and use tar --no-owner when installing merge tool definitions to $(gitexecdir)/mergetools/. Unfortunately it does not take into account the possibility that the permission bits of the files being copied might already be wrong. Rather than fixing the "tar" incantation and making it even more complicated, let's just use the "install" utility. This only means losing the ability to install executables and subdirectories of mergetools/, which wasn't used. Noticed by installing from a copy of git checked out with umask 002. Compare v1.6.0.3~81^2 (Fix permission bits on sources checked out with an overtight umask, 2008-08-21). Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05add_ref(): verify that the refname is formatted correctlyLibravatar Michael Haggerty2-5/+19
In add_ref(), verify that the refname is formatted correctly before adding it to the ref_list. Here we have to allow refname components that start with ".", since (for example) the remote protocol uses synthetic reference name ".have". So add a new REFNAME_DOT_COMPONENT flag that can be passed to check_refname_format() to allow leading dots. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05resolve_ref(): expand documentationLibravatar Michael Haggerty2-13/+33
Record information about resolve_ref(), hard-won via reverse engineering, in a comment for future spelunkers. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05resolve_ref(): also treat a too-long SHA1 as invalidLibravatar Michael Haggerty1-1/+2
If the SHA1 in a reference file is not terminated by a space or end-of-file, consider it malformed and emit a warning. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05resolve_ref(): emit warnings for improperly-formatted referencesLibravatar Michael Haggerty1-2/+4
While resolving references, if a reference is found that is in an unrecognized format, emit a warning (and then fail, as before). Wouldn't *you* want to know? Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05resolve_ref(): verify that the input refname has the right formatLibravatar Michael Haggerty1-0/+3
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05remote: avoid passing NULL to read_ref()Libravatar Michael Haggerty1-2/+4
read_ref() can (and in test t5800, actually *does*) return NULL. Don't pass the NULL along to read_ref(). Coincidentally, this mistake didn't make resolve_ref() blow up, but upcoming changes to resolve_ref() will make it less forgiving. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05remote: use xstrdup() instead of strdup()Libravatar Michael Haggerty2-3/+3
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05resolve_ref(): do not follow incorrectly-formatted symbolic refsLibravatar Michael Haggerty1-0/+5
Emit a warning and fail if a symbolic reference refers to an incorrectly-formatted refname. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05resolve_ref(): extract a function get_packed_ref()Libravatar Michael Haggerty1-13/+34
Making it a function and giving it a name makes the code clearer. I also have a strong suspicion that the function will find other uses in the future. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05resolve_ref(): turn buffer into a proper string as soon as possibleLibravatar Michael Haggerty1-10/+10
Immediately strip off trailing spaces and null-terminate the string holding the contents of the reference file; this allows the use of string functions and avoids the need to keep separate track of the string's length. (get_sha1_hex() fails automatically if the string is too short.) Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05resolve_ref(): only follow a symlink that contains a valid, normalized refnameLibravatar Michael Haggerty1-1/+2
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05resolve_ref(): use prefixcmp()Libravatar Michael Haggerty1-2/+2
Terminate the link content string one step earlier, allowing prefixcmp() to be used instead of the less clear memcmp(). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05resolve_ref(): explicitly fail if a symlink is not readableLibravatar Michael Haggerty1-0/+2
Previously the failure came later, after a few steps in which the length was treated like the actual length of a string. Even though the old code gave the same answers, it was somewhat misleading. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05Change check_refname_format() to reject unnormalized refnamesLibravatar Michael Haggerty5-28/+49
Since much of the infrastructure does not work correctly with unnormalized refnames, change check_refname_format() to reject them. Similarly, change "git check-ref-format" to reject unnormalized refnames by default. But add an option --normalize, which causes "git check-ref-format" to normalize the refname before checking its format, and print the normalized refname. This is exactly the behavior of the old --print option, which is retained but deprecated. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05Inline function refname_format_print()Libravatar Michael Haggerty1-9/+7
Soon we will make printing independent of collapsing. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05Make collapse_slashes() allocate memory for its resultLibravatar Michael Haggerty1-9/+10
This will make upcoming changes a tiny bit easier. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05Do not allow ".lock" at the end of any refname componentLibravatar Michael Haggerty3-9/+7
Allowing any refname component to end with ".lock" is looking for trouble; for example, $ git br foo.lock/bar $ git br foo fatal: Unable to create '[...]/.git/refs/heads/foo.lock': File exists. Therefore, do not allow any refname component to end with ".lock". Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05Refactor check_refname_format()Libravatar Michael Haggerty1-40/+55
Among other things, extract a function check_refname_component(). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05Change check_ref_format() to take a flags argumentLibravatar Michael Haggerty20-126/+69
Change check_ref_format() to take a flags argument that indicates what is acceptable in the reference name (analogous to "git check-ref-format"'s "--allow-onelevel" and "--refspec-pattern"). This is more convenient for callers and also fixes a failure in the test suite (and likely elsewhere in the code) by enabling "onelevel" and "refspec-pattern" to be allowed independently of each other. Also rename check_ref_format() to check_refname_format() to make it obvious that it deals with refnames rather than references themselves. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05Change bad_ref_char() to return a boolean valueLibravatar Michael Haggerty1-9/+6
Previously most bad characters were indicated by returning 1, but "*" was special-cased to return 2 instead of 1. One caller examined the return value to see whether the special case occurred. But it is easier (to document and understand) for bad_ref_char() simply to return a boolean value, treating "*" like any other bad character. Special-case the handling of "*" (which only occurs in very specific circumstances) at the caller. The resulting calling code thereby also becomes more transparent. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05git check-ref-format: add options --allow-onelevel and --refspec-patternLibravatar Michael Haggerty3-21/+152
Also add tests of the new options. (Actually, one big reason to add the new options is to make it easy to test check_ref_format(), though the options should also be useful to other scripts.) Interpret the result of check_ref_format() based on which types of refnames are allowed. However, because check_ref_format() can only return a single value, one test case is still broken. Specifically, the case "git check-ref-format --onelevel '*'" incorrectly succeeds because check_ref_format() returns CHECK_REF_FORMAT_ONELEVEL for this refname even though the refname is also CHECK_REF_FORMAT_WILDCARD. The type of check that leads to this failure is used elsewhere in "real" code and could lead to bugs; it will be fixed over the next few commits. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05t1402: add some more testsLibravatar Michael Haggerty1-0/+9
The new tests reflect the status quo. Soon the rule for "*.lock" in refname components will be tightened up. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05get_sha1_hex(): do not read past a NUL characterLibravatar Michael Haggerty2-1/+18
Previously, get_sha1_hex() would read one character past the end of a null-terminated string whose strlen was an even number less than 40. Although the function correctly returned -1 in these cases, the extra memory access might have been to uninitialized (or even, conceivably, unallocated) memory. Add a check to avoid reading past the end of a string. This problem was discovered by Thomas Rast <trast@student.ethz.ch> using valgrind. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05Post 1.7.7 first waveLibravatar Junio C Hamano3-2/+109
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05Merge branch 'mm/mediawiki-as-a-remote'Libravatar Junio C Hamano2-0/+830
* mm/mediawiki-as-a-remote: git-remote-mediawiki: allow a domain to be set for authentication git-remote-mediawiki: obey advice.pushNonFastForward git-remote-mediawiki: set 'basetimestamp' to let the wiki handle conflicts git-remote-mediawiki: trivial fixes git-remote-mediawiki: allow push to set MediaWiki metadata Add a remote helper to interact with mediawiki (fetch & push)
2011-10-05Merge branch 'js/check-attr-cached'Libravatar Junio C Hamano3-47/+48
* js/check-attr-cached: t0003: remove extra whitespaces Teach '--cached' option to check-attr
2011-10-05Merge branch 'rj/maint-t9159-svn-rev-notation'Libravatar Junio C Hamano1-0/+8
* rj/maint-t9159-svn-rev-notation: t9159-*.sh: skip for mergeinfo test for svn <= 1.4
2011-10-05Merge branch 'cn/eradicate-working-copy'Libravatar Junio C Hamano4-6/+6
* cn/eradicate-working-copy: Remove 'working copy' from the documentation and C code
2011-10-05Merge branch 'jn/gitweb-highlite-sanitise'Libravatar Junio C Hamano1-1/+13
* jn/gitweb-highlite-sanitise: gitweb: Strip non-printable characters from syntax highlighter output
2011-10-05Merge branch 'jc/ls-remote-short-help'Libravatar Junio C Hamano1-0/+3
* jc/ls-remote-short-help: ls-remote: a lone "-h" is asking for help
2011-10-05Merge branch 'sn/doc-update-index-assume-unchanged'Libravatar Junio C Hamano1-2/+5
* sn/doc-update-index-assume-unchanged: Documentation/git-update-index: refer to 'ls-files'
2011-10-05Merge branch 'mg/maint-doc-sparse-checkout'Libravatar Junio C Hamano4-25/+31
* mg/maint-doc-sparse-checkout: git-read-tree.txt: correct sparse-checkout and skip-worktree description git-read-tree.txt: language and typography fixes unpack-trees: print "Aborting" to stderr
2011-10-05Merge branch 'jk/argv-array'Libravatar Junio C Hamano11-107/+261
* jk/argv-array: run_hook: use argv_array API checkout: use argv_array API bisect: use argv_array API quote: provide sq_dequote_to_argv_array refactor argv_array into generic code quote.h: fix bogus comment add sha1_array API docs
2011-10-05Merge branch 'tr/doc-note-rewrite'Libravatar Junio C Hamano1-1/+2
* tr/doc-note-rewrite: Documentation: basic configuration of notes.rewriteRef
2011-10-05Merge branch 'mg/branch-list'Libravatar Junio C Hamano7-39/+160
* mg/branch-list: t3200: clean up checks for file existence branch: -v does not automatically imply --list branch: allow pattern arguments branch: introduce --list option git-branch: introduce missing long forms for the options git-tag: introduce long forms for the options t6040: test branch -vv Conflicts: Documentation/git-tag.txt t/t3200-branch.sh
2011-10-05Merge branch 'cb/send-email-help'Libravatar Junio C Hamano1-1/+4
* cb/send-email-help: send-email: add option -h
2011-10-05Merge branch 'fk/use-kwset-pickaxe-grep-f'Libravatar Junio C Hamano2-9/+8
* fk/use-kwset-pickaxe-grep-f: obstack.c: Fix some sparse warnings sparse: Fix an "Using plain integer as NULL pointer" warning
2011-10-05Merge branch 'jk/for-each-ref'Libravatar Junio C Hamano9-58/+206
* jk/for-each-ref: for-each-ref: add split message parts to %(contents:*). for-each-ref: handle multiline subjects like --pretty for-each-ref: refactor subject and body placeholder parsing t6300: add more body-parsing tests t7004: factor out gpg setup