git
8 years agoMerge branch 'en/merge-trivial-fix'
Junio C Hamano [Mon, 25 Apr 2016 22:17:15 +0000 (15:17 -0700)] 
Merge branch 'en/merge-trivial-fix'

When "git merge" notices that the merge can be resolved purely at
the tree level (without having to merge blobs) and the resulting
tree happens to already exist in the object store, it forgot to
update the index, which lead to an inconsistent state for later
operations.

* en/merge-trivial-fix:
  builtin/merge.c: fix a bug with trivial merges
  t7605: add a testcase demonstrating a bug with trivial merges

8 years agoMerge branch 'en/merge-octopus-fix'
Junio C Hamano [Mon, 25 Apr 2016 22:17:15 +0000 (15:17 -0700)] 
Merge branch 'en/merge-octopus-fix'

"merge-octopus" strategy did not ensure that the index is clean
when merge begins.

* en/merge-octopus-fix:
  merge-octopus: abort if index does not match HEAD
  t6044: new merge testcases for when index doesn't match HEAD

8 years agoMerge branch 'dt/pre-refs-backend'
Junio C Hamano [Mon, 25 Apr 2016 22:17:15 +0000 (15:17 -0700)] 
Merge branch 'dt/pre-refs-backend'

Code restructuring around the "refs" area to prepare for pluggable
refs backends.

* dt/pre-refs-backend: (24 commits)
  refs: on symref reflog expire, lock symref not referrent
  refs: move resolve_ref_unsafe into common code
  show_head_ref(): check the result of resolve_ref_namespace()
  check_aliased_update(): check that dst_name is non-NULL
  checkout_paths(): remove unneeded flag variable
  cmd_merge(): remove unneeded flag variable
  fsck_head_link(): remove unneeded flag variable
  read_raw_ref(): change flags parameter to unsigned int
  files-backend: inline resolve_ref_1() into resolve_ref_unsafe()
  read_raw_ref(): manage own scratch space
  files-backend: break out ref reading
  resolve_ref_1(): eliminate local variable "bad_name"
  resolve_ref_1(): reorder code
  resolve_ref_1(): eliminate local variable
  resolve_ref_unsafe(): ensure flags is always set
  resolve_ref_unsafe(): use for loop to count up to MAXDEPTH
  resolve_missing_loose_ref(): simplify semantics
  t1430: improve test coverage of deletion of badly-named refs
  t1430: test for-each-ref in the presence of badly-named refs
  t1430: don't rely on symbolic-ref for creating broken symrefs
  ...

8 years agoMerge branch 'jc/rerere-multi'
Junio C Hamano [Mon, 25 Apr 2016 22:17:14 +0000 (15:17 -0700)] 
Merge branch 'jc/rerere-multi'

"git rerere" can encounter two or more files with the same conflict
signature that have to be resolved in different ways, but there was
no way to record these separate resolutions.

* jc/rerere-multi:
  rerere: adjust 'forget' to multi-variant world order
  rerere: split code to call ll_merge() further
  rerere: move code related to "forget" together
  rerere: gc and clear
  rerere: do use multiple variants
  t4200: rerere a merge with two identical conflicts
  rerere: allow multiple variants to exist
  rerere: delay the recording of preimage
  rerere: handle leftover rr-cache/$ID directory and postimage files
  rerere: scan $GIT_DIR/rr-cache/$ID when instantiating a rerere_id
  rerere: split conflict ID further

8 years agoSixth batch for post 2.8 cycle
Junio C Hamano [Fri, 22 Apr 2016 22:48:03 +0000 (15:48 -0700)] 
Sixth batch for post 2.8 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'ad/cygwin-wants-rename'
Junio C Hamano [Fri, 22 Apr 2016 22:45:10 +0000 (15:45 -0700)] 
Merge branch 'ad/cygwin-wants-rename'

On Cygwin, object creation uses the "create a temporary and then
rename it to the final name" pattern, not "create a temporary,
hardlink it to the final name and then unlink the temporary"
pattern.

This is necessary to use Git on Windows shared directories, and is
already enabled for the MinGW and plain Windows builds.  It also
has been used in Cygwin packaged versions of Git for quite a while.
See http://thread.gmane.org/gmane.comp.version-control.git/291853

($gmane/275680, $gmane/291853).

* ad/cygwin-wants-rename:
  config.mak.uname: Cygwin needs OBJECT_CREATION_USES_RENAMES

8 years agoMerge branch 'jk/use-write-script-more'
Junio C Hamano [Fri, 22 Apr 2016 22:45:09 +0000 (15:45 -0700)] 
Merge branch 'jk/use-write-script-more'

Code clean-up.

* jk/use-write-script-more:
  t3404: use write_script
  t1020: do not overuse printf and use write_script
  t5532: use write_script

8 years agoMerge branch 'jk/do-not-printf-NULL'
Junio C Hamano [Fri, 22 Apr 2016 22:45:09 +0000 (15:45 -0700)] 
Merge branch 'jk/do-not-printf-NULL'

"git config" had a codepath that tried to pass a NULL to
printf("%s"), which nobody seems to have noticed.

* jk/do-not-printf-NULL:
  git_config_set_multivar_in_file: handle "unset" errors
  git_config_set_multivar_in_file: all non-zero returns are errors
  config: lower-case first word of error strings

8 years agoMerge branch 'jc/http-socks5h'
Junio C Hamano [Fri, 22 Apr 2016 22:45:09 +0000 (15:45 -0700)] 
Merge branch 'jc/http-socks5h'

The socks5:// proxy support added back in 2.6.4 days was not aware
that socks5h:// proxies behave differently.

* jc/http-socks5h:
  http: differentiate socks5:// and socks5h://

8 years agoMerge branch 'ky/imap-send-openssl-1.1.0'
Junio C Hamano [Fri, 22 Apr 2016 22:45:08 +0000 (15:45 -0700)] 
Merge branch 'ky/imap-send-openssl-1.1.0'

Upcoming OpenSSL 1.1.0 will break compilation b updating a few APIs
we use in imap-send, which has been adjusted for the change.

* ky/imap-send-openssl-1.1.0:
  configure: remove checking for HMAC_CTX_cleanup
  imap-send: avoid deprecated TLSv1_method()
  imap-send: check NULL return of SSL_CTX_new()
  imap-send: use HMAC() function provided by OpenSSL

8 years agoMerge branch 'ky/imap-send'
Junio C Hamano [Fri, 22 Apr 2016 22:45:08 +0000 (15:45 -0700)] 
Merge branch 'ky/imap-send'

Support for CRAM-MD5 authentication method in "git imap-send" did
not work well.

* ky/imap-send:
  imap-send: fix CRAM-MD5 response calculation
  imap-send: check for NOLOGIN capability only when using LOGIN command

8 years agoMerge branch 'jc/xstrfmt-null-with-prec-0'
Junio C Hamano [Fri, 22 Apr 2016 22:45:07 +0000 (15:45 -0700)] 
Merge branch 'jc/xstrfmt-null-with-prec-0'

* jc/xstrfmt-null-with-prec-0:
  setup.c: do not feed NULL to "%.*s" even with precision 0

8 years agoMerge branch 'ad/commit-have-m-option'
Junio C Hamano [Fri, 22 Apr 2016 22:45:07 +0000 (15:45 -0700)] 
Merge branch 'ad/commit-have-m-option'

"git commit" misbehaved in a few minor ways when an empty message
is given via -m '', all of which has been corrected.

* ad/commit-have-m-option:
  commit: do not ignore an empty message given by -m ''
  commit: --amend -m '' silently fails to wipe message

8 years agoMerge branch 'ew/send-email-drop-data-dumper'
Junio C Hamano [Fri, 22 Apr 2016 22:45:06 +0000 (15:45 -0700)] 
Merge branch 'ew/send-email-drop-data-dumper'

Code clean-up.

* ew/send-email-drop-data-dumper:
  send-email: do not load Data::Dumper

8 years agoMerge branch 'ew/send-email-readable-message-id'
Junio C Hamano [Fri, 22 Apr 2016 22:45:05 +0000 (15:45 -0700)] 
Merge branch 'ew/send-email-readable-message-id'

"git send-email" now uses a more readable timestamps when
formulating a message ID.

* ew/send-email-readable-message-id:
  send-email: more meaningful Message-ID

8 years agoMerge branch 'sb/submodule-helper-clone-regression-fix'
Junio C Hamano [Fri, 22 Apr 2016 22:45:03 +0000 (15:45 -0700)] 
Merge branch 'sb/submodule-helper-clone-regression-fix'

A partial rewrite of "git submodule" in the 2.7 timeframe changed
the way the gitdir: pointer in the submodules point at the real
repository location to use absolute paths by accident.  This has
been corrected.

* sb/submodule-helper-clone-regression-fix:
  submodule--helper, module_clone: catch fprintf failure
  submodule--helper: do not borrow absolute_path() result for too long
  submodule--helper, module_clone: always operate on absolute paths
  submodule--helper clone: create the submodule path just once
  submodule--helper: fix potential NULL-dereference
  recursive submodules: test for relative paths

8 years agoFifth batch for post 2.8 cycle
Junio C Hamano [Mon, 18 Apr 2016 17:51:09 +0000 (10:51 -0700)] 
Fifth batch for post 2.8 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'jk/branch-shortening-funny-symrefs'
Junio C Hamano [Mon, 18 Apr 2016 17:49:14 +0000 (10:49 -0700)] 
Merge branch 'jk/branch-shortening-funny-symrefs'

A change back in version 2.7 to "git branch" broke display of a
symbolic ref in a non-standard place in the refs/ hierarchy (we
expect symbolic refs to appear in refs/remotes/*/HEAD to point at
the primary branch the remote has, and as .git/HEAD to point at the
branch we locally checked out).

* jk/branch-shortening-funny-symrefs:
  branch: fix shortening of non-remote symrefs

8 years agoMerge branch 'ky/branch-m-worktree'
Junio C Hamano [Mon, 18 Apr 2016 17:48:11 +0000 (10:48 -0700)] 
Merge branch 'ky/branch-m-worktree'

When "git worktree" feature is in use, "git branch -m" renamed a
branch that is checked out in another worktree without adjusting
the HEAD symbolic ref for the worktree.

* ky/branch-m-worktree:
  set_worktree_head_symref(): fix error message
  branch -m: update all per-worktree HEADs
  refs: add a new function set_worktree_head_symref

8 years agoMerge branch 'maint'
Junio C Hamano [Fri, 15 Apr 2016 01:59:09 +0000 (18:59 -0700)] 
Merge branch 'maint'

* maint:
  Prepare for 2.8.2
  Start preparing for 2.8.2

8 years agoPrepare for 2.8.2
Junio C Hamano [Fri, 15 Apr 2016 01:58:11 +0000 (18:58 -0700)] 
Prepare for 2.8.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'jv/merge-nothing-into-void' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:49 +0000 (18:57 -0700)] 
Merge branch 'jv/merge-nothing-into-void' into maint

"git merge FETCH_HEAD" dereferenced NULL pointer when merging
nothing into an unborn history (which is arguably unusual usage,
which perhaps was the reason why nobody noticed it).

* jv/merge-nothing-into-void:
  merge: fix NULL pointer dereference when merging nothing into void

8 years agoMerge branch 'ss/commit-squash-msg' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:48 +0000 (18:57 -0700)] 
Merge branch 'ss/commit-squash-msg' into maint

When "git merge --squash" stopped due to conflict, the concluding
"git commit" failed to read in the SQUASH_MSG that shows the log
messages from all the squashed commits.

* ss/commit-squash-msg:
  commit: do not lose SQUASH_MSG contents

8 years agoMerge branch 'jk/send-email-rtrim-mailrc-alias' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:47 +0000 (18:57 -0700)] 
Merge branch 'jk/send-email-rtrim-mailrc-alias' into maint

"git send-email" had trouble parsing alias file in mailrc format
when lines in it had trailing whitespaces on them.

* jk/send-email-rtrim-mailrc-alias:
  send-email: ignore trailing whitespace in mailrc alias file

8 years agoMerge branch 'da/mergetool-delete-delete-conflict' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:47 +0000 (18:57 -0700)] 
Merge branch 'da/mergetool-delete-delete-conflict' into maint

"git mergetool" did not work well with conflicts that both sides
deleted.

* da/mergetool-delete-delete-conflict:
  mergetool: honor tempfile configuration when resolving delete conflicts
  mergetool: support delete/delete conflicts

8 years agoMerge branch 'jk/startup-info' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:46 +0000 (18:57 -0700)] 
Merge branch 'jk/startup-info' into maint

The startup_info data, which records if we are working inside a
repository (among other things), are now uniformly available to Git
subcommand implementations, and Git avoids attempting to touch
references when we are not in a repository.

* jk/startup-info:
  use setup_git_directory() in test-* programs
  grep: turn off gitlink detection for --no-index
  mailmap: do not resolve blobs in a non-repository
  remote: don't resolve HEAD in non-repository
  setup: set startup_info->have_repository more reliably
  setup: make startup_info available everywhere

8 years agoMerge branch 'jk/getwholeline-getdelim-empty' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:46 +0000 (18:57 -0700)] 
Merge branch 'jk/getwholeline-getdelim-empty' into maint

strbuf_getwholeline() did not NUL-terminate the buffer on certain
corner cases in its error codepath.

* jk/getwholeline-getdelim-empty:
  strbuf_getwholeline: NUL-terminate getdelim buffer on error

8 years agoMerge branch 'rj/xdiff-prepare-plug-leak-on-error-codepath' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:45 +0000 (18:57 -0700)] 
Merge branch 'rj/xdiff-prepare-plug-leak-on-error-codepath' into maint

A small memory leak in an error codepath has been plugged in xdiff
code.

* rj/xdiff-prepare-plug-leak-on-error-codepath:
  xdiff/xprepare: fix a memory leak
  xdiff/xprepare: use the XDF_DIFF_ALG() macro to access flag bits

8 years agoMerge branch 'gf/fetch-pack-direct-object-fetch' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:44 +0000 (18:57 -0700)] 
Merge branch 'gf/fetch-pack-direct-object-fetch' into maint

Fetching of history by naming a commit object name directly didn't
work across remote-curl transport.

* gf/fetch-pack-direct-object-fetch:
  fetch-pack: update the documentation for "<refs>..." arguments
  fetch-pack: fix object_id of exact sha1

8 years agoMerge branch 'jk/rev-parse-local-env-vars' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:44 +0000 (18:57 -0700)] 
Merge branch 'jk/rev-parse-local-env-vars' into maint

The "--local-env-vars" and "--resolve-git-dir" options of "git
rev-parse" failed to work outside a repository when the command's
option parsing was rewritten in 1.8.5 era.

* jk/rev-parse-local-env-vars:
  rev-parse: let some options run outside repository
  t1515: add tests for rev-parse out-of-repo helpers

8 years agoMerge branch 'jk/config-get-urlmatch' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:43 +0000 (18:57 -0700)] 
Merge branch 'jk/config-get-urlmatch' into maint

"git config --get-urlmatch", unlike other variants of the "git
config --get" family, did not signal error with its exit status
when there was no matching configuration.

* jk/config-get-urlmatch:
  Documentation/git-config: fix --get-all description
  Documentation/git-config: use bulleted list for exit codes
  config: fail if --get-urlmatch finds no value

8 years agoMerge branch 'pb/t7502-drop-dup' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:18 +0000 (18:37 -0700)] 
Merge branch 'pb/t7502-drop-dup' into maint

Code clean-up.

* pb/t7502-drop-dup:
  t/t7502 : drop duplicate test

8 years agoMerge branch 'jk/test-httpd-config-nosystem' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:17 +0000 (18:37 -0700)] 
Merge branch 'jk/test-httpd-config-nosystem' into maint

The tests that involve running httpd leaked the system-wide
configuration in /etc/gitconfig to the tested environment.

* jk/test-httpd-config-nosystem:
  t/lib-httpd: pass through GIT_CONFIG_NOSYSTEM env

8 years agoMerge branch 'sb/clone-t57-t56' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:16 +0000 (18:37 -0700)] 
Merge branch 'sb/clone-t57-t56' into maint

Rename bunch of tests on "git clone" for better organization.

* sb/clone-t57-t56:
  clone tests: rename t57* => t56*

8 years agoMerge branch 'jk/credential-cache-comment-exit' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:16 +0000 (18:37 -0700)] 
Merge branch 'jk/credential-cache-comment-exit' into maint

A code clarification.

* jk/credential-cache-comment-exit:
  credential-cache--daemon: clarify "exit" action semantics

8 years agoMerge branch 'jc/index-pack' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:15 +0000 (18:37 -0700)] 
Merge branch 'jc/index-pack' into maint

Code clean-up.

* jc/index-pack:
  index-pack: add a helper function to derive .idx/.keep filename
  index-pack: correct --keep[=<msg>]

8 years agoMerge branch 'ss/exc-flag-is-a-collection-of-bits' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:15 +0000 (18:37 -0700)] 
Merge branch 'ss/exc-flag-is-a-collection-of-bits' into maint

Code clean-up.

* ss/exc-flag-is-a-collection-of-bits:
  dir: store EXC_FLAG_* values in unsigned integers

8 years agoMerge branch 'mp/upload-pack-use-embedded-args' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:14 +0000 (18:37 -0700)] 
Merge branch 'mp/upload-pack-use-embedded-args' into maint

The embedded args argv-array in the child process is used to build
the command line to run pack-objects instead of using a separate
array of strings.

* mp/upload-pack-use-embedded-args:
  upload-pack: use argv_array for pack_objects

8 years agoMerge branch 'oa/doc-diff-check' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:14 +0000 (18:37 -0700)] 
Merge branch 'oa/doc-diff-check' into maint

A minor documentation update.

* oa/doc-diff-check:
  Documentation: git diff --check detects conflict markers

8 years agoMerge branch 'pb/opt-cmdmode-doc' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:13 +0000 (18:37 -0700)] 
Merge branch 'pb/opt-cmdmode-doc' into maint

Minor API documentation update.

* pb/opt-cmdmode-doc:
  api-parse-options.txt: document OPT_CMDMODE()

8 years agoMerge branch 'nd/apply-doc' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:13 +0000 (18:37 -0700)] 
Merge branch 'nd/apply-doc' into maint

A minor documentation update.

* nd/apply-doc:
  git-apply.txt: mention the behavior inside a subdir
  git-apply.txt: remove a space

8 years agoMerge branch 'cc/doc-recommend-performance-trace-to-file' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:12 +0000 (18:37 -0700)] 
Merge branch 'cc/doc-recommend-performance-trace-to-file' into maint

A minor documentation update.

* cc/doc-recommend-performance-trace-to-file:
  Documentation: talk about pager in api-trace.txt

8 years agoMerge branch 'mm/lockfile-error-message' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:12 +0000 (18:37 -0700)] 
Merge branch 'mm/lockfile-error-message' into maint

* mm/lockfile-error-message:
  lockfile: improve error message when lockfile exists
  lockfile: mark strings for translation

8 years agoStart preparing for 2.8.2
Junio C Hamano [Wed, 13 Apr 2016 23:30:00 +0000 (16:30 -0700)] 
Start preparing for 2.8.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoimap-send: fix CRAM-MD5 response calculation
Kazuki Yamaguchi [Fri, 8 Apr 2016 14:02:30 +0000 (23:02 +0900)] 
imap-send: fix CRAM-MD5 response calculation

Remove extra + 1 from resp_len, the length of the byte sequence to be
Base64 encoded and passed to the server as the response. Or the response
incorrectly contains an extra \0.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoimap-send: check for NOLOGIN capability only when using LOGIN command
Kazuki Yamaguchi [Fri, 8 Apr 2016 14:02:24 +0000 (23:02 +0900)] 
imap-send: check for NOLOGIN capability only when using LOGIN command

Don't check for NOLOGIN (LOGINDISABLED) capability when imap.authMethod
is specified.

LOGINDISABLED capability doesn't forbid using AUTHENTICATE, so it should
be allowed, or we can't connect to IMAP servers which only accepts
AUTHENTICATE command.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoFourth batch for post 2.8 cycle
Junio C Hamano [Wed, 13 Apr 2016 21:19:29 +0000 (14:19 -0700)] 
Fourth batch for post 2.8 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'tb/blame-force-read-cache-to-workaround-safe-crlf'
Junio C Hamano [Wed, 13 Apr 2016 21:12:40 +0000 (14:12 -0700)] 
Merge branch 'tb/blame-force-read-cache-to-workaround-safe-crlf'

When running "git blame $path" with unnormalized data in the index
for the path, the data in the working tree was blamed, even though
"git add" would not have changed what is already in the index, due
to "safe crlf" that disables the line-end conversion.  It has been
corrected.

* tb/blame-force-read-cache-to-workaround-safe-crlf:
  correct blame for files commited with CRLF

8 years agoMerge branch 'mg/complete-cherry-mark-to-log'
Junio C Hamano [Wed, 13 Apr 2016 21:12:39 +0000 (14:12 -0700)] 
Merge branch 'mg/complete-cherry-mark-to-log'

The completion scripts (in contrib/) did not include the
"--cherry-mark" option when completing "git log <HT>".

* mg/complete-cherry-mark-to-log:
  completion: complete --cherry-mark for git log

8 years agoMerge branch 'ep/trace-doc-sample-fix'
Junio C Hamano [Wed, 13 Apr 2016 21:12:38 +0000 (14:12 -0700)] 
Merge branch 'ep/trace-doc-sample-fix'

Fix a typo in an example in the trace API documentation.

* ep/trace-doc-sample-fix:
  api-trace.txt: fix typo

8 years agoMerge branch 'jc/makefile-redirection-stderr'
Junio C Hamano [Wed, 13 Apr 2016 21:12:37 +0000 (14:12 -0700)] 
Merge branch 'jc/makefile-redirection-stderr'

A minor fix in the Makefile.

* jc/makefile-redirection-stderr:
  Makefile: fix misdirected redirections

8 years agoMerge branch 'lt/pretty-expand-tabs'
Junio C Hamano [Wed, 13 Apr 2016 21:12:36 +0000 (14:12 -0700)] 
Merge branch 'lt/pretty-expand-tabs'

When "git log" shows the log message indented by 4-spaces, the
remainder of a line after a HT does not align in the way the author
originally intended.  The command now expands tabs by default in
such a case, and allows the users to override it with a new option,
'--no-expand-tabs'.

* lt/pretty-expand-tabs:
  pretty: test --expand-tabs
  pretty: allow tweaking tabwidth in --expand-tabs
  pretty: enable --expand-tabs by default for selected pretty formats
  pretty: expand tabs in indented logs to make things line up properly

8 years agoMerge branch 'mj/pull-rebase-autostash'
Junio C Hamano [Wed, 13 Apr 2016 21:12:36 +0000 (14:12 -0700)] 
Merge branch 'mj/pull-rebase-autostash'

"git pull --rebase" learned "--[no-]autostash" option, so that
the rebase.autostash configuration variable set to true can be
overridden from the command line.

* mj/pull-rebase-autostash:
  t5520: test --[no-]autostash with pull.rebase=true
  t5520: reduce commom lines of code
  t5520: factor out common "failing autostash" code
  t5520: factor out common "successful autostash" code
  t5520: use better test to check stderr output
  t5520: ensure consistent test conditions
  t5520: use consistent capitalization in test titles
  pull --rebase: add --[no-]autostash flag
  git-pull.c: introduce git_pull_config()

8 years agoMerge branch 'jn/mergetools-examdiff'
Junio C Hamano [Wed, 13 Apr 2016 21:12:36 +0000 (14:12 -0700)] 
Merge branch 'jn/mergetools-examdiff'

"git mergetools" learned to drive ExamDiff.

* jn/mergetools-examdiff:
  mergetools: add support for ExamDiff
  mergetools: create mergetool_find_win32_cmd() helper function for winmerge

8 years agoMerge branch 'es/format-patch-doc-hide-no-patch'
Junio C Hamano [Wed, 13 Apr 2016 21:12:35 +0000 (14:12 -0700)] 
Merge branch 'es/format-patch-doc-hide-no-patch'

"git format-patch --help" showed `-s` and `--no-patch` as if these
are valid options to the command.  We already hide `--patch` option
from the documentation, because format-patch is about showing the
diff, and the documentation now hides these options as well.

* es/format-patch-doc-hide-no-patch:
  git-format-patch.txt: don't show -s as shorthand for multiple options

8 years agoMerge branch 'js/mingw-tests-2.8'
Junio C Hamano [Wed, 13 Apr 2016 21:12:34 +0000 (14:12 -0700)] 
Merge branch 'js/mingw-tests-2.8'

Code clean-up.

* js/mingw-tests-2.8:
  Windows: shorten code by re-using convert_slashes()

8 years agoMerge branch 'cc/apply'
Junio C Hamano [Wed, 13 Apr 2016 21:12:34 +0000 (14:12 -0700)] 
Merge branch 'cc/apply'

Minor code clean-up.

* cc/apply:
  builtin/apply: free patch when parse_chunk() fails
  builtin/apply: handle parse_binary() failure
  apply: remove unused call to free() in gitdiff_{old,new}name()
  builtin/apply: get rid of useless 'name' variable

8 years agoMerge branch 'sb/misc-cleanups'
Junio C Hamano [Wed, 13 Apr 2016 21:12:34 +0000 (14:12 -0700)] 
Merge branch 'sb/misc-cleanups'

Assorted minor clean-ups.

* sb/misc-cleanups:
  credential-cache, send_request: close fd when done
  bundle: don't leak an fd in case of early return
  abbrev_sha1_in_line: don't leak memory
  notes: don't leak memory in git_config_get_notes_strategy

8 years agoMerge branch 'sk/send-pack-all-fix'
Junio C Hamano [Wed, 13 Apr 2016 21:12:33 +0000 (14:12 -0700)] 
Merge branch 'sk/send-pack-all-fix'

"git send-pack --all <there>" was broken when its command line
option parsing was written in the 2.6 timeframe.

* sk/send-pack-all-fix:
  git-send-pack: fix --all option when used with directory

8 years agoMerge branch 'sg/diff-multiple-identical-renames'
Junio C Hamano [Wed, 13 Apr 2016 21:12:32 +0000 (14:12 -0700)] 
Merge branch 'sg/diff-multiple-identical-renames'

"git diff -M" used to work better when two originally identical
files A and B got renamed to X/A and X/B by pairing A to X/A and B
to X/B, but this was broken in the 2.0 timeframe.

* sg/diff-multiple-identical-renames:
  diffcore: fix iteration order of identical files during rename detection

8 years agoMerge branch 'kn/for-each-tag-branch'
Junio C Hamano [Wed, 13 Apr 2016 21:12:31 +0000 (14:12 -0700)] 
Merge branch 'kn/for-each-tag-branch'

A minor documentation update.

* kn/for-each-tag-branch:
  for-each-ref: fix description of '--contains' in manpage

8 years agoMerge branch 'ky/branch-d-worktree'
Junio C Hamano [Wed, 13 Apr 2016 21:12:30 +0000 (14:12 -0700)] 
Merge branch 'ky/branch-d-worktree'

When "git worktree" feature is in use, "git branch -d" allowed
deletion of a branch that is checked out in another worktree

* ky/branch-d-worktree:
  branch -d: refuse deleting a branch which is currently checked out

8 years agoMerge branch 'rz/worktree-no-checkout'
Junio C Hamano [Wed, 13 Apr 2016 21:12:30 +0000 (14:12 -0700)] 
Merge branch 'rz/worktree-no-checkout'

"git worktree add" can be given "--no-checkout" option to only
create an empty worktree without checking out the files.

* rz/worktree-no-checkout:
  worktree: add: introduce --checkout option

8 years agoMerge branch 'rt/rebase-i-shorten-stop-report'
Junio C Hamano [Wed, 13 Apr 2016 21:12:30 +0000 (14:12 -0700)] 
Merge branch 'rt/rebase-i-shorten-stop-report'

The commit object name reported when "rebase -i" stops has been
shortened.

* rt/rebase-i-shorten-stop-report:
  rebase-i: print an abbreviated hash when stop for editing

8 years agoMerge branch 'rt/completion-help'
Junio C Hamano [Wed, 13 Apr 2016 21:12:29 +0000 (14:12 -0700)] 
Merge branch 'rt/completion-help'

Shell completion (in contrib/) updates.

* rt/completion-help:
  completion: add 'revisions' and 'everyday' to 'git help'
  completion: add option '--guides' to 'git help'

8 years agoMerge branch 'ak/use-hashmap-iter-first-in-submodule-config'
Junio C Hamano [Wed, 13 Apr 2016 21:12:29 +0000 (14:12 -0700)] 
Merge branch 'ak/use-hashmap-iter-first-in-submodule-config'

Minor code cleanup.

* ak/use-hashmap-iter-first-in-submodule-config:
  submodule-config: use hashmap_iter_first()

8 years agoMerge branch 'jk/check-repository-format'
Junio C Hamano [Wed, 13 Apr 2016 21:12:28 +0000 (14:12 -0700)] 
Merge branch 'jk/check-repository-format'

The repository set-up sequence has been streamlined (the biggest
change is that there is no longer git_config_early()), so that we
do not attempt to look into refs/* when we know we do not have a
Git repository.

* jk/check-repository-format:
  verify_repository_format: mark messages for translation
  setup: drop repository_format_version global
  setup: unify repository version callbacks
  init: use setup.c's repo version verification
  setup: refactor repo format reading and verification
  config: drop git_config_early
  check_repository_format_gently: stop using git_config_early
  lazily load core.sharedrepository
  wrap shared_repository global in get/set accessors
  setup: document check_repository_format()

8 years agomerge-octopus: abort if index does not match HEAD
Elijah Newren [Sun, 10 Apr 2016 06:13:38 +0000 (23:13 -0700)] 
merge-octopus: abort if index does not match HEAD

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot6044: new merge testcases for when index doesn't match HEAD
Elijah Newren [Sun, 10 Apr 2016 06:13:37 +0000 (23:13 -0700)] 
t6044: new merge testcases for when index doesn't match HEAD

With one exception, we require the index to exactly match the
current HEAD commit at the time git merge is invoked.  This
expectation was even documented in git-merge.txt until commit
ebef7e5 (Documentation: simplify How Merge Works, 2010-01-23).

Most merge strategies enforced this requirement, but it turns out
not all did.  The current exceptions were the following two:

  * ff updates
  * octopus merges

ff updates actually will error out if the staged change is to a path
modified between HEAD and the commit being merged.  If the path(s)
that are staged are files unrelated to the changes between these two
commits, though, then an ff update will just keep these staged
changes around after the merge.  This is the one exception we
expected to the abort-merge-if- index-doesn't-match-HEAD rule.

For octopus merges, the rule should be enforced.  Unfortunately, the
current behavior of the code is to ignore the difference and use the
staged changes in place of whatever is in HEAD as it proceeds to
perform the merge.  So if the staged changes can be cleanly merged
with all the other heads, then the staged changes will just be
incorported into the resulting commit.  If the staged changes cannot
be cleanly merged with all the other heads, the merge is not aborted
-- merge conflicts are simply reported as if HEAD had originally
contained whatever the index did.

Add testcases that check our expectations.  A subsequent commit will
correct the erroneous octopus merge behavior.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin/merge.c: fix a bug with trivial merges
Elijah Newren [Sun, 10 Apr 2016 06:13:40 +0000 (23:13 -0700)] 
builtin/merge.c: fix a bug with trivial merges

If read_tree_trivial() succeeds and produces a tree that is already
in the object store, then the index is not written to disk, leaving
it out-of-sync with both HEAD and the working tree.

In order to write the index back out to disk after a merge,
write_index_locked() needs to be called.  For most merge strategies, this
is done from try_merge_strategy().  For fast forward updates, this is
done from checkout_fast_forward().  When trivial merges work, the call to
write_index_locked() is buried a little deeper:

  merge_trivial()
  -> write_tree_trivial()
     -> write_cache_as_tree()
        -> write_index_as_tree()
           -> write_locked_index()

However, it is only called when !cache_tree_fully_valid(), which is how
this bug is triggered.  But that also shows why this bug doesn't affect
any other merge strategies or cases.

Add a direct call to write_index_locked() from merge_trivial() to fix
this issue.  Since the indirect call to write_locked_index() was
conditional on cache_tree_fully_valid(), it won't be written twice.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot7605: add a testcase demonstrating a bug with trivial merges
Elijah Newren [Sun, 10 Apr 2016 06:13:39 +0000 (23:13 -0700)] 
t7605: add a testcase demonstrating a bug with trivial merges

Repeating a trivial merge more than once will leave the index out of
sync, despite being clean before the merge and operating on the
exact same heads as the first run.  The recorded merge has the
correct tree and the working tree is brought up to date, it is just
the index that is left as it was before the merge.  Every attempt to
repeat the merge beyond the first will leave the index in the same
weird out-of-sync state.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot3404: use write_script
Junio C Hamano [Tue, 12 Apr 2016 16:59:59 +0000 (09:59 -0700)] 
t3404: use write_script

The test uses hardcoded #!/bin/sh to create a pre-commit hook
script.  Because the generated script uses $(command substitution),
which is not supported by /bin/sh on some platforms (e.g. Solaris),
the resulting pre-commit always fails.

Which is not noticeable as the test that uses the hook is about
checking the behaviour of the command when the hook fails ;-), but
nevertheless it is not testing what we wanted to test.

Use write_script so that the resulting script is run under the same
shell our scripted Porcelain commands are run, which must support
the necessary $(construct).

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot1020: do not overuse printf and use write_script
Junio C Hamano [Sun, 10 Apr 2016 19:01:30 +0000 (12:01 -0700)] 
t1020: do not overuse printf and use write_script

The test prepares a sample file "dir/two" with a single incomplete
line in it with "printf", and also prepares a small helper script
"diff" to create a file with a single incomplete line in it, again
with "printf".  The output from the latter is compared with an
expected output, again prepared with "printf" hence lacking the
final LF.  There is no reason for this test to be using files with
an incomplete line at the end, and these look more like a mistake
of not using

printf "%s\n" "string to be written"

and using

printf "string to be written"

Depending on what would be in $GIT_PREFIX, using the latter form
could be a bug waiting to happen.  Correct them.

Also, the test uses hardcoded #!/bin/sh to create a small helper
script.  For a small task like what the generated script does, it
does not matter too much in that what appears as /bin/sh would not
be _so_ broken, but while we are at it, use write_script instead,
which happens to make the result easier to read by reducing need
of one level of quoting.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot5532: use write_script
Jeff King [Sat, 9 Apr 2016 21:04:30 +0000 (17:04 -0400)] 
t5532: use write_script

The recent cleanup in b7cbbff switched t5532's use of
backticks to $(). This matches our normal shell style, which
is good. But it also breaks the test on Solaris, where
/bin/sh does not understand $().

Our normal shell style assumes a modern-ish shell which
knows about $(). However, some tests create small helper
scripts and just write "#!/bin/sh" into them. These scripts
either need to go back to using backticks, or they need to
respect $SHELL_PATH. The easiest way to do the latter is to
use write_script.

While we're at it, let's also stick the script creation
inside a test_expect block (our usual style), and split the
perl snippet into its own script (to prevent quoting
madness).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorefs: on symref reflog expire, lock symref not referrent
David Turner [Thu, 7 Apr 2016 19:03:11 +0000 (15:03 -0400)] 
refs: on symref reflog expire, lock symref not referrent

When locking a symbolic ref to expire a reflog, lock the symbolic
ref (using REF_NODEREF) instead of its referent.

Add a test for this.

Signed-off-by: David Turner <dturner@twopensource.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorefs: move resolve_ref_unsafe into common code
David Turner [Thu, 7 Apr 2016 19:03:10 +0000 (15:03 -0400)] 
refs: move resolve_ref_unsafe into common code

Now that resolve_ref_unsafe's only interaction with the backend is
through read_raw_ref, we can move it into the common code. Later,
we'll replace read_raw_ref with a backend function.

Signed-off-by: David Turner <dturner@twopensource.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoshow_head_ref(): check the result of resolve_ref_namespace()
Michael Haggerty [Thu, 7 Apr 2016 19:03:09 +0000 (15:03 -0400)] 
show_head_ref(): check the result of resolve_ref_namespace()

Only use the result of resolve_ref_namespace() if it is non-NULL.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocheck_aliased_update(): check that dst_name is non-NULL
Michael Haggerty [Thu, 7 Apr 2016 19:03:08 +0000 (15:03 -0400)] 
check_aliased_update(): check that dst_name is non-NULL

If there is an error in resolve_ref_unsafe(), it returns NULL. We check
for this case, but not until after calling strip_namespace(). Instead,
call strip_namespace() *after* the NULL check.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocheckout_paths(): remove unneeded flag variable
Michael Haggerty [Thu, 7 Apr 2016 19:03:07 +0000 (15:03 -0400)] 
checkout_paths(): remove unneeded flag variable

It is never read, so we can pass NULL to resolve_ref_unsafe().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocmd_merge(): remove unneeded flag variable
Michael Haggerty [Thu, 7 Apr 2016 19:03:06 +0000 (15:03 -0400)] 
cmd_merge(): remove unneeded flag variable

It is never read, so we can pass NULL to resolve_ref_unsafe().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agofsck_head_link(): remove unneeded flag variable
Michael Haggerty [Thu, 7 Apr 2016 19:03:05 +0000 (15:03 -0400)] 
fsck_head_link(): remove unneeded flag variable

It is never read, so we can pass NULL to resolve_ref_unsafe().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoread_raw_ref(): change flags parameter to unsigned int
Michael Haggerty [Thu, 7 Apr 2016 19:03:04 +0000 (15:03 -0400)] 
read_raw_ref(): change flags parameter to unsigned int

read_raw_ref() is going to be part of the vtable for reference backends,
so clean up its interface to use "unsigned int flags" rather than "int
flags". Its caller still uses signed int for its flags arguments. But
changing that would touch a lot of code, so leave it for now.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agofiles-backend: inline resolve_ref_1() into resolve_ref_unsafe()
Michael Haggerty [Thu, 7 Apr 2016 19:03:03 +0000 (15:03 -0400)] 
files-backend: inline resolve_ref_1() into resolve_ref_unsafe()

resolve_ref_unsafe() wasn't doing anything useful anymore.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoread_raw_ref(): manage own scratch space
Michael Haggerty [Thu, 7 Apr 2016 19:03:02 +0000 (15:03 -0400)] 
read_raw_ref(): manage own scratch space

Instead of creating scratch space in resolve_ref_unsafe() and passing
it down through resolve_ref_1 to read_raw_ref(), teach read_raw_ref()
to manage its own scratch space. This reduces coupling across the
functions at the cost of some extra allocations.

Also, when read_raw_ref() is implemented for different reference
backends, the other implementations might have different scratch
space requirements.

Note that we now preserve errno across the calls to strbuf_release(),
which calls free() and can thus theoretically overwrite errno.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agofiles-backend: break out ref reading
David Turner [Thu, 7 Apr 2016 19:03:01 +0000 (15:03 -0400)] 
files-backend: break out ref reading

Refactor resolve_ref_1 in terms of a new function read_raw_ref, which
is responsible for reading ref data from the ref storage.

Later, we will make read_raw_ref a pluggable backend function, and make
resolve_ref_unsafe common.

Signed-off-by: David Turner <dturner@twopensource.com>
Helped-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoresolve_ref_1(): eliminate local variable "bad_name"
Michael Haggerty [Thu, 7 Apr 2016 19:03:00 +0000 (15:03 -0400)] 
resolve_ref_1(): eliminate local variable "bad_name"

We can use (*flags & REF_BAD_NAME) for that purpose.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoresolve_ref_1(): reorder code
Michael Haggerty [Thu, 7 Apr 2016 19:02:59 +0000 (15:02 -0400)] 
resolve_ref_1(): reorder code

There is no need to adjust *flags if we're just about to fail.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoresolve_ref_1(): eliminate local variable
Michael Haggerty [Thu, 7 Apr 2016 19:02:58 +0000 (15:02 -0400)] 
resolve_ref_1(): eliminate local variable

In place of `buf`, use `refname`, which is anyway a better description
of what is being pointed at.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoresolve_ref_unsafe(): ensure flags is always set
Michael Haggerty [Thu, 7 Apr 2016 19:02:57 +0000 (15:02 -0400)] 
resolve_ref_unsafe(): ensure flags is always set

If the caller passes flags==NULL, then set it to point at a local
scratch variable. This removes the need for a lot of "if (flags)"
guards in resolve_ref_1() and resolve_missing_loose_ref().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoresolve_ref_unsafe(): use for loop to count up to MAXDEPTH
Michael Haggerty [Thu, 7 Apr 2016 19:02:56 +0000 (15:02 -0400)] 
resolve_ref_unsafe(): use for loop to count up to MAXDEPTH

The loop's there anyway; we might as well use it.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoresolve_missing_loose_ref(): simplify semantics
Michael Haggerty [Thu, 7 Apr 2016 19:02:55 +0000 (15:02 -0400)] 
resolve_missing_loose_ref(): simplify semantics

Make resolve_missing_loose_ref() only responsible for looking up a
packed reference, without worrying about whether we want to read or
write the reference and without setting errno on failure. Move the other
logic to the caller.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot1430: improve test coverage of deletion of badly-named refs
Michael Haggerty [Thu, 7 Apr 2016 19:02:54 +0000 (15:02 -0400)] 
t1430: improve test coverage of deletion of badly-named refs

Check "branch -d broken...ref"

Check various combinations of

* Deleting using "update-ref -d"
* Deleting using "update-ref --no-deref -d"
* Deleting using "branch -d"

in the following combinations of symref -> ref:

* badname -> broken...ref
* badname -> broken...ref (dangling)
* broken...symref -> master
* broken...symref -> idonotexist (dangling)

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot1430: test for-each-ref in the presence of badly-named refs
Michael Haggerty [Thu, 7 Apr 2016 19:02:53 +0000 (15:02 -0400)] 
t1430: test for-each-ref in the presence of badly-named refs

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot1430: don't rely on symbolic-ref for creating broken symrefs
Michael Haggerty [Thu, 7 Apr 2016 19:02:52 +0000 (15:02 -0400)] 
t1430: don't rely on symbolic-ref for creating broken symrefs

It's questionable whether it should even work.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot1430: clean up broken refs/tags/shadow
Michael Haggerty [Thu, 7 Apr 2016 19:02:51 +0000 (15:02 -0400)] 
t1430: clean up broken refs/tags/shadow

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot1430: test the output and error of some commands more carefully
Michael Haggerty [Thu, 7 Apr 2016 19:02:50 +0000 (15:02 -0400)] 
t1430: test the output and error of some commands more carefully

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorefs: move for_each_*ref* functions into common code
David Turner [Thu, 7 Apr 2016 19:02:49 +0000 (15:02 -0400)] 
refs: move for_each_*ref* functions into common code

Make do_for_each_ref take a submodule as an argument instead of a
ref_cache.  Since all for_each_*ref* functions are defined in terms of
do_for_each_ref, we can then move them into the common code.

Later, we can simply make do_for_each_ref into a backend function.

Signed-off-by: David Turner <dturner@twopensource.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorefs: move head_ref{,_submodule} to the common code
David Turner [Thu, 7 Apr 2016 19:02:48 +0000 (15:02 -0400)] 
refs: move head_ref{,_submodule} to the common code

These don't use any backend-specific functions.  These were previously
defined in terms of the do_head_ref helper function, but since they
are otherwise identical, we don't need that function.

Signed-off-by: David Turner <dturner@twopensource.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit_config_set_multivar_in_file: handle "unset" errors
Jeff King [Sat, 9 Apr 2016 17:43:54 +0000 (13:43 -0400)] 
git_config_set_multivar_in_file: handle "unset" errors

We pass off to the "_gently" form to do the real work, and
just die() if it returned an error. However, our die message
de-references "value", which may be NULL if the request was
to unset a variable. Nobody using glibc noticed, because it
simply prints "(null)", which is good enough for the test
suite (and presumably very few people run across this in
practice). But other libc implementations (like Solaris) may
segfault.

Let's not only fix that, but let's make the message more
clear about what is going on in the "unset" case.

Reported-by: "Tom G. Christensen" <tgc@jupiterrise.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit_config_set_multivar_in_file: all non-zero returns are errors
Jeff King [Sat, 9 Apr 2016 17:42:54 +0000 (13:42 -0400)] 
git_config_set_multivar_in_file: all non-zero returns are errors

This function is just a thin wrapper for the "_gently" form
of the function. But the gently form is designed to feed
builtin/config.c, which passes our return code directly to
its exit status, and thus uses positive error values for
some cases. We check only negative values, meaning we would
fail to die in some cases (e.g., a malformed key).

This may or may not be triggerable in practice; we tend to
use this non-gentle form only when setting internal
variables, which would not have malformed keys.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>