summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-06-20refactor skip_prefix to return a booleanLibravatar Jeff King18-58/+73
The skip_prefix() function returns a pointer to the content past the prefix, or NULL if the prefix was not found. While this is nice and simple, in practice it makes it hard to use for two reasons: 1. When you want to conditionally skip or keep the string as-is, you have to introduce a temporary variable. For example: tmp = skip_prefix(buf, "foo"); if (tmp) buf = tmp; 2. It is verbose to check the outcome in a conditional, as you need extra parentheses to silence compiler warnings. For example: if ((cp = skip_prefix(buf, "foo")) /* do something with cp */ Both of these make it harder to use for long if-chains, and we tend to use starts_with() instead. However, the first line of "do something" is often to then skip forward in buf past the prefix, either using a magic constant or with an extra strlen(3) (which is generally computed at compile time, but means we are repeating ourselves). This patch refactors skip_prefix() to return a simple boolean, and to provide the pointer value as an out-parameter. If the prefix is not found, the out-parameter is untouched. This lets you write: if (skip_prefix(arg, "foo ", &arg)) do_foo(arg); else if (skip_prefix(arg, "bar ", &arg)) do_bar(arg); Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-18avoid using skip_prefix as a booleanLibravatar Jeff King1-1/+1
There's no point in using: if (skip_prefix(buf, "foo")) over if (starts_with(buf, "foo")) as the point of skip_prefix is to return a pointer to the data after the prefix. Using starts_with is more readable, and will make refactoring skip_prefix easier. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-18daemon: mark some strings as constLibravatar Jeff King1-7/+7
None of these strings is modified; marking them as const will help later refactoring. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-18parse_diff_color_slot: drop ofs parameterLibravatar Jeff King1-10/+10
This function originally took a whole config variable name ("var") and an offset ("ofs"). It checked "var+ofs" against each color slot, but reported errors using the whole "var". However, since 8b8e862 (ignore unknown color configuration, 2009-12-12), it returns -1 rather than printing its own error, and therefore only cares about var+ofs. We can drop the ofs parameter and teach its sole caller to derive the pointer itself. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-16Third batch for 2.1Libravatar Junio C Hamano1-0/+80
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-16Merge branch 'ib/test-selectively-run'Libravatar Junio C Hamano3-12/+617
Allow specifying only certain individual test pieces to be run using a range notation (e.g. "t1234-test.sh --run='1-4 6 8 9-'"). * ib/test-selectively-run: t0000-*.sh: fix the GIT_SKIP_TESTS sub-tests test-lib: '--run' to run only specific tests test-lib: tests skipped by GIT_SKIP_TESTS say so test-lib: document short options in t/README
2014-06-16Merge branch 'ta/string-list-init'Libravatar Junio C Hamano2-2/+4
* ta/string-list-init: string-list: spell all values out that are given to a string_list initializer
2014-06-16Merge branch 'jm/dedup-test-config'Libravatar Junio C Hamano1-5/+0
* jm/dedup-test-config: t/t7810-grep.sh: remove duplicate test_config()
2014-06-16Merge branch 'dt/refs-check-refname-component-optim'Libravatar Junio C Hamano2-29/+44
* dt/refs-check-refname-component-optim: refs.c: optimize check_refname_component()
2014-06-16Merge branch 'sk/test-cmp-bin'Libravatar Junio C Hamano5-22/+28
* sk/test-cmp-bin: t5000, t5003: do not use test_cmp to compare binary files
2014-06-16Merge branch 'sh/enable-preloadindex'Libravatar Junio C Hamano2-3/+3
* sh/enable-preloadindex: environment.c: enable core.preloadindex by default
2014-06-16Merge branch 'rs/read-ref-at'Libravatar Junio C Hamano2-107/+105
* rs/read-ref-at: refs.c: change read_ref_at to use the reflog iterators
2014-06-16Merge branch 'jk/error-resolve-conflict-advice'Libravatar Junio C Hamano1-5/+4
* jk/error-resolve-conflict-advice: error_resolve_conflict: drop quotations around operation error_resolve_conflict: rewrap advice message
2014-06-16Merge branch 'rs/pack-objects-no-unnecessary-realloc'Libravatar Junio C Hamano1-2/+2
Avoid unnecessary copy of previous contents when extending the hashtable used in pack-objects. * rs/pack-objects-no-unnecessary-realloc: pack-objects: use free()+xcalloc() instead of xrealloc()+memset()
2014-06-16Merge branch 'lt/log-auto-decorate'Libravatar Junio C Hamano1-0/+2
* lt/log-auto-decorate: git log: support "auto" decorations
2014-06-16Merge branch 'jm/doc-wording-tweaks'Libravatar Junio C Hamano2-9/+8
* jm/doc-wording-tweaks: Documentation: wording fixes in the user manual and glossary
2014-06-16Merge branch 'jm/format-patch-mail-sig'Libravatar Junio C Hamano4-2/+93
* jm/format-patch-mail-sig: format-patch: add "--signature-file=<file>" option format-patch: make newline after signature conditional
2014-06-16Merge branch 'jk/http-errors'Libravatar Junio C Hamano12-13/+183
Propagate the error messages from the webserver better to the client coming over the HTTP transport. * jk/http-errors: http: default text charset to iso-8859-1 remote-curl: reencode http error messages strbuf: add strbuf_reencode helper http: optionally extract charset parameter from content-type http: extract type/subtype portion of content-type t5550: test display of remote http error messages t/lib-httpd: use write_script to copy CGI scripts test-lib: preserve GIT_CURL_VERBOSE from the environment
2014-06-16Merge branch 'ow/config-mailmap-pathname'Libravatar Junio C Hamano1-1/+1
mailmap.file configuration names a pathname, hence should honor ~/path and ~user/path as its value. * ow/config-mailmap-pathname: config: respect '~' and '~user' in mailmap.file
2014-06-16Merge branch 'fc/remote-helper-refmap'Libravatar Junio C Hamano8-14/+141
Allow remote-helper/fast-import based transport to rename the refs while transferring the history. * fc/remote-helper-refmap: transport-helper: remove unnecessary strbuf resets transport-helper: add support to delete branches fast-export: add support to delete refs fast-import: add support to delete refs transport-helper: add support to push symbolic refs transport-helper: add support for old:new refspec fast-export: add new --refspec option fast-export: improve argument parsing
2014-06-16Merge branch 'nd/daemonize-gc'Libravatar Junio C Hamano1-6/+20
"git gc --auto" was recently changed to run in the background to give control back early to the end-user sitting in front of the terminal, but it forgot that housekeeping involving reflogs should be done without other processes competing for accesses to the refs. * nd/daemonize-gc: gc --auto: do not lock refs in the background
2014-06-16Merge branch 'jm/t9138-style-fix'Libravatar Junio C Hamano1-18/+17
* jm/t9138-style-fix: t9138-git-svn-authors-prog.sh fixups
2014-06-16Merge branch 'jm/instaweb-apache-24'Libravatar Junio C Hamano1-1/+11
* jm/instaweb-apache-24: git-instaweb: add support for Apache 2.4
2014-06-16Merge branch 'jl/remote-rm-prune'Libravatar Junio C Hamano3-9/+52
"git remote rm" and "git remote prune" can involve removing many refs at once, which is not a very efficient thing to do when very many refs exist in the packed-refs file. * jl/remote-rm-prune: remote prune: optimize "dangling symref" check/warning remote: repack packed-refs once when deleting multiple refs remote rm: delete remote configuration as the last
2014-06-16Merge branch 'jk/complete-merge-pull'Libravatar Junio C Hamano1-1/+5
The completion code did not know about quite a few options that are common between "git merge" and "git pull", and a couple of options unique to "git merge". * jk/complete-merge-pull: completion: add missing options for git-merge completion: add a note that merge options are shared
2014-06-16Merge branch 'bg/xcalloc-nmemb-then-size'Libravatar Junio C Hamano12-21/+21
Like calloc(3), xcalloc() takes nmemb and then size. * bg/xcalloc-nmemb-then-size: transport-helper.c: rearrange xcalloc arguments remote.c: rearrange xcalloc arguments reflog-walk.c: rearrange xcalloc arguments pack-revindex.c: rearrange xcalloc arguments notes.c: rearrange xcalloc arguments imap-send.c: rearrange xcalloc arguments http-push.c: rearrange xcalloc arguments diff.c: rearrange xcalloc arguments config.c: rearrange xcalloc arguments commit.c: rearrange xcalloc arguments builtin/remote.c: rearrange xcalloc arguments builtin/ls-remote.c: rearrange xcalloc arguments
2014-06-16Merge branch 'jl/status-added-submodule-is-never-ignored'Libravatar Junio C Hamano5-8/+108
submodule.*.ignore and diff.ignoresubmodules are used to ignore all submodule changes in "diff" output, but it can be confusing to apply these configuration values to status and commit. This is a backward-incompatible change, but should be so in a good way (aka bugfix). * jl/status-added-submodule-is-never-ignored: commit -m: commit staged submodules regardless of ignore config status/commit: show staged submodules regardless of ignore config
2014-06-16Merge branch 'cb/byte-order'Libravatar Junio C Hamano1-9/+24
Compatibility enhancement for Solaris. * cb/byte-order: compat/bswap.h: fix endianness detection compat/bswap.h: restore preference __BIG_ENDIAN over BIG_ENDIAN compat/bswap.h: detect endianness on more platforms that don't use BYTE_ORDER
2014-06-16Merge branch 'jk/strbuf-tolower'Libravatar Junio C Hamano4-7/+13
* jk/strbuf-tolower: strbuf: add strbuf_tolower function
2014-06-16Merge branch 'jk/daemon-tolower'Libravatar Junio C Hamano4-22/+16
* jk/daemon-tolower: daemon/config: factor out duplicate xstrdup_tolower
2014-06-16Merge branch 'as/pretty-truncate'Libravatar Junio C Hamano5-72/+282
* as/pretty-truncate: pretty.c: format string with truncate respects logOutputEncoding t4205, t6006: add tests that fail with i18n.logOutputEncoding set t4205 (log-pretty-format): use `tformat` rather than `format` t4041, t4205, t6006, t7102: don't hardcode tested encoding value t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs
2014-06-16Merge branch 'jk/diff-follow-must-take-one-pathspec'Libravatar Junio C Hamano2-6/+5
* jk/diff-follow-must-take-one-pathspec: move "--follow needs one pathspec" rule to diff_setup_done
2014-06-16Merge branch 'sk/windows-unc-path'Libravatar Junio C Hamano5-8/+30
* sk/windows-unc-path: Windows: allow using UNC path for git repository
2014-06-16Merge branch 'rr/rebase-autostash-fix'Libravatar Junio C Hamano3-3/+27
* rr/rebase-autostash-fix: rebase -i: test "Nothing to do" case with autostash rebase -i: handle "Nothing to do" case with autostash
2014-06-16Merge branch 'jk/report-fail-to-read-objects-better'Libravatar Junio C Hamano1-1/+5
* jk/report-fail-to-read-objects-better: open_sha1_file: report "most interesting" errno
2014-06-16Merge branch 'jk/diff-files-assume-unchanged'Libravatar Junio C Hamano2-12/+32
* jk/diff-files-assume-unchanged: run_diff_files: do not look at uninitialized stat data
2014-06-16Merge branch 'jk/argv-array-for-child-process'Libravatar Junio C Hamano9-107/+57
* jk/argv-array-for-child-process: argv-array: drop "detach" code get_importer: use run-command's internal argv_array get_exporter: use argv_array get_helper: use run-command's internal argv_array git_connect: use argv_array run_column_filter: use argv_array run-command: store an optional argv_array
2014-06-16Merge branch 'sk/wincred'Libravatar Junio C Hamano1-4/+12
* sk/wincred: wincred: avoid overwriting configured variables wincred: add install target
2014-06-16Merge branch 'jk/do-not-run-httpd-tests-as-root'Libravatar Junio C Hamano1-0/+5
* jk/do-not-run-httpd-tests-as-root: t/lib-httpd: require SANITY prereq
2014-06-16Merge branch 'cc/replace-edit'Libravatar Junio C Hamano3-46/+222
"git replace" learns a new "--edit" option. * cc/replace-edit: Documentation: replace: describe new --edit option replace: add --edit to usage string replace: add tests for --edit replace: die early if replace ref already exists replace: refactor checking ref validity replace: make sure --edit results in a different object replace: add --edit option replace: factor object resolution out of replace_object replace: use OPT_CMDMODE to handle modes replace: refactor command-mode determination
2014-06-16Merge branch 'mt/patch-id-stable' (early part)Libravatar Junio C Hamano5-31/+208
* 'mt/patch-id-stable' (early part): patch-id-test: test stable and unstable behaviour patch-id: make it stable against hunk reordering test doc: test_write_lines does not split its arguments test: add test_write_lines helper
2014-06-12Sync with maintLibravatar Junio C Hamano1-2/+0
* maint: pull: do not abuse 'break' inside a shell 'case'
2014-06-12Merge branch 'jc/rev-parse-argh-dashed-multi-words' into maintLibravatar Junio C Hamano2-0/+7
* jc/rev-parse-argh-dashed-multi-words: update-index: fix segfault with missing --cacheinfo argument
2014-06-12pull: do not abuse 'break' inside a shell 'case'Libravatar Jacek Konieczny1-2/+0
It is not C. The code would break under mksh when 'pull.ff' is set: $ git pull /usr/lib/git-core/git-pull[67]: break: can't break Already up-to-date. Signed-off-by: Jacek Konieczny <jajcus@jajcus.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-10Windows: allow using UNC path for git repositoryLibravatar Cezary Zawadka5-8/+30
[efl: moved MinGW-specific part to compat/] [jes: fixed compilation on non-Windows] Eric Sunshine fixed mingw_offset_1st_component() to return consistently "foo" for UNC "//machine/share/foo", cf http://groups.google.com/group/msysgit/browse_thread/thread/c0af578549b5dda0 Author: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Cezary Zawadka <czawadka@gmail.com> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Stepan Kasal <kasal@ucw.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-10patch-id-test: test stable and unstable behaviourLibravatar Michael S. Tsirkin1-11/+91
Verify that patch ID supports an algorithm that is stable against diff split and reordering. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-10patch-id: make it stable against hunk reorderingLibravatar Michael S. Tsirkin2-20/+91
Patch id changes if users reorder file diffs that make up a patch. As the result is functionally equivalent, a different patch id is surprising to many users. In particular, reordering files using diff -O is helpful to make patches more readable (e.g. API header diff before implementation diff). Add an option to change patch-id behaviour making it stable against these kinds of patch change: calculate SHA1 hash for each hunk separately and sum all hashes (using a symmetrical sum) to get patch id We use a 20byte sum and not xor - since xor would give 0 output for patches that have two identical diffs, which isn't all that unlikely (e.g. append the same line in two places). The new behaviour is enabled - when patchid.stable is true - when --stable flag is present Using a new flag --unstable or setting patchid.stable to false force the historical behaviour. In the documentation, clarify that patch ID can now be a sum of hashes, not a hash. Document how command line and config options affect the behaviour. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-10test doc: test_write_lines does not split its argumentsLibravatar Jonathan Nieder1-4/+3
test_write_lines carefully quotes its arguments as "$@", so test_write_lines "a b" c writes two lines as requested, not three. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-10test: add test_write_lines helperLibravatar Michael S. Tsirkin2-0/+27
API and implementation as suggested by Junio. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-09Update draft release notes to 2.1Libravatar Junio C Hamano1-2/+29
Signed-off-by: Junio C Hamano <gitster@pobox.com>