Commit graph

40539 commits

Author SHA1 Message Date
Junio C Hamano 5d5be8167d Merge branch 'nd/dwim-wildcards-as-pathspecs'
Test updates for Windows.

* nd/dwim-wildcards-as-pathspecs:
  t2019: skip test requiring '*' in a file name non Windows
2015-08-25 14:57:07 -07:00
Junio C Hamano 1302c9f514 Merge branch 'jk/long-error-messages'
The codepath to produce error messages had a hard-coded limit to
the size of the message, primarily to avoid memory allocation while
calling die().

* jk/long-error-messages:
  vreportf: avoid intermediate buffer
  vreportf: report to arbitrary filehandles
2015-08-25 14:57:06 -07:00
Junio C Hamano b590720f2c Merge branch 'ee/clean-remove-dirs'
Test updates for Windows.

* ee/clean-remove-dirs:
  t7300-clean: require POSIXPERM for chmod 0 test
2015-08-25 14:57:06 -07:00
Junio C Hamano 3b281d1281 Merge branch 'jh/strbuf-read-use-read-in-full'
strbuf_read() used to have one extra iteration (and an unnecessary
strbuf_grow() of 8kB), which was eliminated.

* jh/strbuf-read-use-read-in-full:
  strbuf_read(): skip unnecessary strbuf_grow() at eof
2015-08-25 14:57:06 -07:00
Junio C Hamano ff86faf2fa Sync with maint
* maint:
  Start preparing for 2.5.1
2015-08-19 14:49:37 -07:00
Junio C Hamano 8f8d0ecfde Fourth batch for 2.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-19 14:48:57 -07:00
Junio C Hamano 011710a315 Merge branch 'tb/complete-rebase-i-edit-todo'
The command-line completion script (in contrib/) has been updated.

* tb/complete-rebase-i-edit-todo:
  completion: offer '--edit-todo' during interactive rebase
2015-08-19 14:48:56 -07:00
Junio C Hamano 8c9155e031 Merge branch 'jk/git-path'
git_path() and mkpath() are handy helper functions but it is easy
to misuse, as the callers need to be careful to keep the number of
active results below 4.  Their uses have been reduced.

* jk/git-path:
  memoize common git-path "constant" files
  get_repo_path: refactor path-allocation
  find_hook: keep our own static buffer
  refs.c: remove_empty_directories can take a strbuf
  refs.c: avoid git_path assignment in lock_ref_sha1_basic
  refs.c: avoid repeated git_path calls in rename_tmp_log
  refs.c: simplify strbufs in reflog setup and writing
  path.c: drop git_path_submodule
  refs.c: remove extra git_path calls from read_loose_refs
  remote.c: drop extraneous local variable from migrate_file
  prefer mkpathdup to mkpath in assignments
  prefer git_pathdup to git_path in some possibly-dangerous cases
  add_to_alternates_file: don't add duplicate entries
  t5700: modernize style
  cache.h: complete set of git_path_submodule helpers
  cache.h: clarify documentation for git_path, et al
2015-08-19 14:48:56 -07:00
Junio C Hamano 51a22ce147 Merge branch 'jc/finalize-temp-file'
Long overdue micro clean-up.

* jc/finalize-temp-file:
  sha1_file.c: rename move_temp_to_file() to finalize_object_file()
2015-08-19 14:48:55 -07:00
Junio C Hamano 4bfab58ce2 Merge branch 'ps/guess-repo-name-at-root'
"git clone $URL", when cloning from a site whose sole purpose is to
host a single repository (hence, no path after <scheme>://<site>/),
tried to use the site name as the new repository name, but did not
remove username or password when <site> part was of the form
<user>@<pass>:<host>.  The code is taught to redact these.

* ps/guess-repo-name-at-root:
  clone: abort if no dir name could be guessed
  clone: do not use port number as dir name
  clone: do not include authentication data in guessed dir
2015-08-19 14:48:54 -07:00
Junio C Hamano 8259da5ea3 Merge branch 'jk/guess-repo-name-regression-fix'
"git clone $URL" in recent releases of Git contains a regression in
the code that invents a new repository name incorrectly based on
the $URL.  This has been corrected.

* jk/guess-repo-name-regression-fix:
  clone: use computed length in guess_dir_name
  clone: add tests for output directory
2015-08-19 14:48:54 -07:00
Junio C Hamano 824a0be6be Merge branch 'jk/negative-hiderefs'
A negative !ref entry in multi-value transfer.hideRefs
configuration can be used to say "don't hide this one".

* jk/negative-hiderefs:
  refs: support negative transfer.hideRefs
  docs/config.txt: reorder hideRefs config
2015-08-19 14:48:54 -07:00
Junio C Hamano 138014c3cf Merge branch 'jk/test-with-x'
Running tests with the "-x" option to make them verbose had some
unpleasant interactions with other features of the test suite.

* jk/test-with-x:
  test-lib: disable trace when test is not verbose
  test-lib: turn off "-x" tracing during chain-lint check
2015-08-19 14:48:53 -07:00
Junio C Hamano 034603f0a3 Merge branch 'ps/t1509-chroot-test-fixup'
t1509 test that requires a dedicated VM environment had some
bitrot, which has been corrected.

* ps/t1509-chroot-test-fixup:
  tests: fix cleanup after tests in t1509-root-worktree
  tests: fix broken && chains in t1509-root-worktree
2015-08-19 14:48:52 -07:00
Junio C Hamano 1d82ef5b16 Merge branch 'sb/check-return-from-read-ref'
* sb/check-return-from-read-ref:
  transport-helper: die on errors reading refs.
2015-08-19 14:48:52 -07:00
Junio C Hamano d772def9c8 Merge branch 'mm/pull-upload-pack'
"git pull" in recent releases of Git has a regression in the code
that allows custom path to the --upload-pack=<program>.  This has
been corrected.

Note that this is irrelevant for 'master' with "git pull" rewritten
in C.

* mm/pull-upload-pack:
  pull.sh: quote $upload_pack when passing it to git-fetch
2015-08-19 14:48:51 -07:00
Junio C Hamano 552a736de7 Start preparing for 2.5.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-19 14:48:13 -07:00
Junio C Hamano 91db0091c0 Merge branch 'ta/docfix-index-format-tech' into maint
* ta/docfix-index-format-tech:
  typofix for index-format.txt
2015-08-19 14:41:34 -07:00
Junio C Hamano b994b9bc0b Merge branch 'sb/parse-options-codeformat' into maint
* sb/parse-options-codeformat:
  parse-options: align curly braces for all options
2015-08-19 14:41:34 -07:00
Junio C Hamano 223b55a577 Merge branch 'sb/remove-unused-var-from-builtin-add' into maint
* sb/remove-unused-var-from-builtin-add:
  add: remove dead code
2015-08-19 14:41:33 -07:00
Junio C Hamano 24493ff5d8 Merge branch 'kn/tag-doc-fix' into maint
* kn/tag-doc-fix:
  Documentation/tag: remove double occurance of "<pattern>"
2015-08-19 14:41:32 -07:00
Junio C Hamano cacee08cd2 Merge branch 'es/doc-clean-outdated-tools' into maint
* es/doc-clean-outdated-tools:
  Documentation/git-tools: retire manually-maintained list
  Documentation/git-tools: drop references to defunct tools
  Documentation/git-tools: fix item text formatting
  Documentation/git-tools: improve discoverability of Git wiki
  Documentation/git: drop outdated Cogito reference
2015-08-19 14:41:31 -07:00
Junio C Hamano 25a294e44d Merge branch 'nd/export-worktree' into maint
Running an aliased command from a subdirectory when the .git thing
in the working tree is a gitfile pointing elsewhere did not work.

* nd/export-worktree:
  setup: set env $GIT_WORK_TREE when work tree is set, like $GIT_DIR
2015-08-19 14:41:30 -07:00
Junio C Hamano f9610bcae9 Merge branch 'mh/fast-import-optimize-current-from' into maint
Often a fast-import stream builds a new commit on top of the
previous commit it built, and it often unconditionally emits a
"from" command to specify the first parent, which can be omitted in
such a case.  This caused fast-import to forget the tree of the
previous commit and then re-read it from scratch, which was
inefficient.  Optimize for this common case.

* mh/fast-import-optimize-current-from:
  fast-import: do less work when given "from" matches current branch head
2015-08-19 14:41:29 -07:00
Junio C Hamano d3ac359841 Merge branch 'ib/scripted-parse-opt-better-hint-string' into maint
The "rev-parse --parseopt" mode parsed the option specification
and the argument hint in a strange way to allow '=' and other
special characters in the option name while forbidding them from
the argument hint.  This made it impossible to define an option
like "--pair <key>=<value>" with "pair=key=value" specification,
which instead would have defined a "--pair=key <value>" option.

* ib/scripted-parse-opt-better-hint-string:
  rev-parse --parseopt: allow [*=?!] in argument hints
2015-08-19 14:41:29 -07:00
Junio C Hamano 204ea3cad4 Merge branch 'se/doc-checkout-ours-theirs' into maint
A "rebase" replays changes of the local branch on top of something
else, as such they are placed in stage #3 and referred to as
"theirs", while the changes in the new base, typically a foreign
work, are placed in stage #2 and referred to as "ours".  Clarify
the "checkout --ours/--theirs".

* se/doc-checkout-ours-theirs:
  checkout: document subtlety around --ours/--theirs
2015-08-19 14:41:28 -07:00
Junio C Hamano b083703ce3 Merge branch 'cb/uname-in-untracked' into maint
An experimental "untracked cache" feature used uname(2) in a
slightly unportable way.

* cb/uname-in-untracked:
  untracked: fix detection of uname(2) failure
2015-08-19 14:41:28 -07:00
Junio C Hamano 4f66e44300 Merge branch 'as/sparse-checkout-removal' into maint
"sparse checkout" misbehaved for a path that is excluded from the
checkout when switching between branches that differ at the path.

* as/sparse-checkout-removal:
  unpack-trees: don't update files with CE_WT_REMOVE set
2015-08-19 14:41:27 -07:00
Junio C Hamano 7e7ce32f7a Merge branch 'db/send-pack-user-signingkey' into maint
The low-level "git send-pack" did not honor 'user.signingkey'
configuration variable when sending a signed-push.

* db/send-pack-user-signingkey:
  builtin/send-pack.c: respect user.signingkey
2015-08-19 14:41:26 -07:00
Junio C Hamano 17850efa5f Merge branch 'jx/do-not-crash-receive-pack-wo-head' into maint
An attempt to delete a ref by pushing into a repositorywhose HEAD
symbolic reference points at an unborn branch that cannot be
created due to ref D/F conflict (e.g. refs/heads/a/b exists, HEAD
points at refs/heads/a) failed.

* jx/do-not-crash-receive-pack-wo-head:
  receive-pack: crash when checking with non-exist HEAD
2015-08-19 14:41:26 -07:00
Junio C Hamano 5a30374a29 Merge branch 'da/subtree-date-confusion' into maint
"git subtree" (in contrib/) depended on "git log" output to be
stable, which was a no-no.  Apply a workaround to force a
particular date format.

* da/subtree-date-confusion:
  contrib/subtree: ignore log.date configuration
2015-08-19 14:41:25 -07:00
Junio C Hamano 44e02239f4 Third batch for 2.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-17 15:09:25 -07:00
Junio C Hamano 1c09276e34 Merge branch 'dt/untracked-sparse'
Allow untracked cache (experimental) to be used when sparse
checkout (experimental) is also in use.

* dt/untracked-sparse:
  untracked-cache: support sparse checkout
2015-08-17 15:07:52 -07:00
Junio C Hamano 2e8ef44ee5 Merge branch 'ta/docfix-index-format-tech'
* ta/docfix-index-format-tech:
  typofix for index-format.txt
2015-08-17 15:07:52 -07:00
Junio C Hamano 66873d4065 Merge branch 'mh/get-remote-group-fix'
An off-by-one error made "git remote" to mishandle a remote with a
single letter nickname.

* mh/get-remote-group-fix:
  get_remote_group(): use skip_prefix()
  get_remote_group(): eliminate superfluous call to strcspn()
  get_remote_group(): rename local variable "space" to "wordlen"
  get_remote_group(): handle remotes with single-character names
2015-08-17 15:07:51 -07:00
Junio C Hamano e69b408280 Merge branch 'kd/pull-rebase-autostash'
"git pull --rebase" has been taught to pay attention to
rebase.autostash configuration.

* kd/pull-rebase-autostash:
  pull: allow dirty tree when rebase.autostash enabled
2015-08-17 15:07:50 -07:00
Junio C Hamano 130be8eeb8 Second batch for 2.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-12 14:16:31 -07:00
Junio C Hamano fde61a0f72 Merge branch 'sb/remove-unused-var-from-builtin-add'
* sb/remove-unused-var-from-builtin-add:
  add: remove dead code
2015-08-12 14:09:58 -07:00
Junio C Hamano 535efaf6be Merge branch 'sb/parse-options-codeformat'
* sb/parse-options-codeformat:
  parse-options: align curly braces for all options
2015-08-12 14:09:57 -07:00
Junio C Hamano 9ad8474b98 Merge branch 'dt/unpack-trees-cache-tree-revalidate'
The code to perform multi-tree merges has been taught to repopulate
the cache-tree upon a successful merge into the index, so that
subsequent "diff-index --cached" (hence "status") and "write-tree"
(hence "commit") will go faster.

The same logic in "git checkout" may now be removed, but that is a
separate issue.

* dt/unpack-trees-cache-tree-revalidate:
  unpack-trees: populate cache-tree on successful merge
2015-08-12 14:09:57 -07:00
Junio C Hamano 0188f32304 Merge branch 'dt/reflog-tests'
Tests that assume how reflogs are represented on the filesystem too
much have been corrected.

* dt/reflog-tests:
  tests: remove some direct access to .git/logs
  t/t7509: remove unnecessary manipulation of reflog
2015-08-12 14:09:56 -07:00
Junio C Hamano 53860f0392 Merge branch 'es/worktree-add-cleanup'
The "new-worktree-mode" hack in "checkout" that was added in
nd/multiple-work-trees topic has been removed by updating the
implementation of new "worktree add".

* es/worktree-add-cleanup: (25 commits)
  Documentation/git-worktree: fix duplicated 'from'
  Documentation/config: mention "now" and "never" for 'expire' settings
  Documentation/git-worktree: fix broken 'linkgit' invocation
  checkout: drop intimate knowledge of newly created worktree
  worktree: populate via "git reset --hard" rather than "git checkout"
  worktree: avoid resolving HEAD unnecessarily
  worktree: make setup of new HEAD distinct from worktree population
  worktree: detect branch-name/detached and error conditions locally
  worktree: add_worktree: construct worktree-population command locally
  worktree: elucidate environment variables intended for child processes
  worktree: make branch creation distinct from worktree population
  worktree: add: suppress auto-vivication with --detach and no <branch>
  worktree: make --detach mutually exclusive with -b/-B
  worktree: introduce options container
  worktree: simplify new branch (-b/-B) option checking
  worktree: improve worktree setup message
  branch: publish die_if_checked_out()
  checkout: teach check_linked_checkout() about symbolic link HEAD
  checkout: check_linked_checkout: simplify symref parsing
  checkout: check_linked_checkout: improve "already checked out" aesthetic
  ...
2015-08-12 14:09:56 -07:00
Junio C Hamano 7aa2da6162 Merge branch 'pt/am-builtin'
Rewrite "am" in "C".

* pt/am-builtin: (46 commits)
  git-am: add am.threeWay config variable
  builtin-am: remove redirection to git-am.sh
  builtin-am: check for valid committer ident
  builtin-am: implement legacy -b/--binary option
  builtin-am: implement -i/--interactive
  builtin-am: support and auto-detect mercurial patches
  builtin-am: support and auto-detect StGit series files
  builtin-am: support and auto-detect StGit patches
  builtin-am: rerere support
  builtin-am: invoke post-applypatch hook
  builtin-am: invoke pre-applypatch hook
  builtin-am: invoke applypatch-msg hook
  builtin-am: support automatic notes copying
  builtin-am: invoke post-rewrite hook
  builtin-am: implement -S/--gpg-sign, commit.gpgsign
  builtin-am: implement --committer-date-is-author-date
  builtin-am: implement --ignore-date
  builtin-am: pass git-apply's options to git-apply
  builtin-am: implement --[no-]scissors
  builtin-am: support --keep-cr, am.keepcr
  ...
2015-08-12 14:09:55 -07:00
Junio C Hamano c1e5ca90db Merge branch 'es/worktree-add'
Remove remaining cruft from  "git checkout --to", which
transitioned to "git worktree add".

* es/worktree-add:
  config: rename "gc.pruneWorktreesExpire" to "gc.worktreePruneExpire"
  Documentation/git-worktree: wordsmith worktree-related manpages
  Documentation/config: fix stale "git prune --worktree" reference
  Documentation/git-worktree: fix incorrect reference to file "locked"
  Documentation/git-worktree: consistently use term "linked working tree"
2015-08-12 14:09:55 -07:00
Junio C Hamano 71cc60070f Merge branch 'ad/bisect-cleanup'
Code and documentation clean-up to "git bisect".

* ad/bisect-cleanup:
  bisect: don't mix option parsing and non-trivial code
  bisect: simplify the addition of new bisect terms
  bisect: replace hardcoded "bad|good" by variables
  Documentation/bisect: revise overall content
  Documentation/bisect: move getting help section to the end
  bisect: correction of typo
2015-08-12 14:09:53 -07:00
Johannes Sixt b3325dfc64 t2019: skip test requiring '*' in a file name non Windows
A test case introduced by ae454f61 (Add tests for wildcard "path vs ref"
disambiguation) allocates a file named '*.c'. This does not work on
Windows, because the OS forbids file names containing wildcard
characters. The test case fails where the shell attempts to allocate the
file. Skip the test on Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-11 15:17:30 -07:00
Johannes Sixt fbf2fecf50 t7300-clean: require POSIXPERM for chmod 0 test
A test case introduced by 91479b9c (t7300: add tests to document
behavior of clean and nested git) uses 'chmod 0' to verify that a
subdirectory that has an unreadable .git file is not removed. This can
work only when the system pays attention to the permissions set with
'chmod'. Therefore, set the POSIXPERM prerequisite on the test case.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-11 15:17:07 -07:00
Jeff King f4c3edc0b1 vreportf: avoid intermediate buffer
When we call "die(fmt, args...)", we end up in vreportf with
two pieces of information:

  1. The prefix "fatal: "

  2. The original fmt and va_list of args.

We format item (2) into a temporary buffer, and then fprintf
the prefix and the temporary buffer, along with a newline.
This has the unfortunate side effect of truncating any error
messages that are longer than 4096 bytes.

Instead, let's use separate calls for the prefix and
newline, letting us hand the item (2) directly to vfprintf.
This is essentially undoing d048a96 (print
warning/error/fatal messages in one shot, 2007-11-09), which
tried to have the whole output end up in a single `write`
call.

But we can address this instead by explicitly requesting
line-buffering for the output handle, and by making sure
that the buffer is empty before we start (so that outputting
the prefix does not cause a flush due to hitting the buffer
limit).

We may still break the output into two writes if the content
is larger than our buffer, but there's not much we can do
there; depending on the stdio implementation, that might
have happened even with a single fprintf call.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-11 14:29:36 -07:00
Jeff King 3b331e9267 vreportf: report to arbitrary filehandles
The vreportf function always goes to stderr, but run-command
wants child errors to go to the parent's original stderr. To
solve this, commit a5487dd duplicates the stderr fd and
installs die and error handlers to direct the output
appropriately (which later turned into the vwritef
function). This has two downsides, though:

  - we make multiple calls to write(), which contradicts the
    "write at once" logic from d048a96 (print
    warning/error/fatal messages in one shot, 2007-11-09).

  - the custom handlers basically duplicate the normal
    handlers.  They're only a few lines of code, but we
    should not have to repeat the magic "exit(128)", for
    example.

We can solve the first by using fdopen() on the duplicated
descriptor. We can't pass this to vreportf, but we could
introduce a new vreportf_to to handle it.

However, to fix the second problem, we instead introduce a
new "set_error_handle" function, which lets the normal
vreportf calls output to a handle besides stderr. Thus we
can get rid of our custom handlers entirely, and just ask
the regular handlers to output to our new descriptor.

And as vwritef has no more callers, it can just go away.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-11 14:24:50 -07:00
Jeff King f932729cc7 memoize common git-path "constant" files
One of the most common uses of git_path() is to pass a
constant, like git_path("MERGE_MSG"). This has two
drawbacks:

  1. The return value is a static buffer, and the lifetime
     is dependent on other calls to git_path, etc.

  2. There's no compile-time checking of the pathname. This
     is OK for a one-off (after all, we have to spell it
     correctly at least once), but many of these constant
     strings appear throughout the code.

This patch introduces a series of functions to "memoize"
these strings, which are essentially globals for the
lifetime of the program. We compute the value once, take
ownership of the buffer, and return the cached value for
subsequent calls.  cache.h provides a helper macro for
defining these functions as one-liners, and defines a few
common ones for global use.

Using a macro is a little bit gross, but it does nicely
document the purpose of the functions. If we need to touch
them all later (e.g., because we learned how to change the
git_dir variable at runtime, and need to invalidate all of
the stored values), it will be much easier to have the
complete list.

Note that the shared-global functions have separate, manual
declarations. We could do something clever with the macros
(e.g., expand it to a declaration in some places, and a
declaration _and_ a definition in path.c). But there aren't
that many, and it's probably better to stay away from
too-magical macros.

Likewise, if we abandon the C preprocessor in favor of
generating these with a script, we could get much fancier.
E.g., normalizing "FOO/BAR-BAZ" into "git_path_foo_bar_baz".
But the small amount of saved typing is probably not worth
the resulting confusion to readers who want to grep for the
function's definition.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-10 15:37:14 -07:00