OSDN Git Service

git-core/git.git
7 years agoMerge branch 'jk/delta-base-cache'
Junio C Hamano [Wed, 21 Sep 2016 22:15:20 +0000 (15:15 -0700)]
Merge branch 'jk/delta-base-cache'

Recently we updated the code to manage the in-core cache that holds
objects that have recently been used to reconstitute other objects
that are stored as deltas against them, but the update used an
incorrect API function to manage the list of these objects.  This
has been fixed.

* jk/delta-base-cache:
  add_delta_base_cache: use list_for_each_safe

7 years agoMerge branch 'et/add-chmod-x'
Junio C Hamano [Wed, 21 Sep 2016 22:15:19 +0000 (15:15 -0700)]
Merge branch 'et/add-chmod-x'

"git add --chmod=+x" added recently lacked documentation, which has
been corrected.

* et/add-chmod-x:
  add: document the chmod option

7 years agoMerge branch 'js/cat-file-filters'
Junio C Hamano [Wed, 21 Sep 2016 22:15:18 +0000 (15:15 -0700)]
Merge branch 'js/cat-file-filters'

Even though "git hash-objects", which is a tool to take an
on-filesystem data stream and put it into the Git object store,
allowed to perform the "outside-world-to-Git" conversions (e.g.
end-of-line conversions and application of the clean-filter), and
it had the feature on by default from very early days, its reverse
operation "git cat-file", which takes an object from the Git object
store and externalize for the consumption by the outside world,
lacked an equivalent mechanism to run the "Git-to-outside-world"
conversion.  The command learned the "--filters" option to do so.

* js/cat-file-filters:
  cat-file: support --textconv/--filters in batch mode
  cat-file --textconv/--filters: allow specifying the path separately
  cat-file: introduce the --filters option
  cat-file: fix a grammo in the man page

7 years agoMerge branch 'jt/accept-capability-advertisement-when-fetching-from-void'
Junio C Hamano [Wed, 21 Sep 2016 22:15:17 +0000 (15:15 -0700)]
Merge branch 'jt/accept-capability-advertisement-when-fetching-from-void'

JGit can show a fake ref "capabilities^{}" to "git fetch" when it
does not advertise any refs, but "git fetch" was not prepared to
see such an advertisement.  When the other side disconnects without
giving any ref advertisement, we used to say "there may not be a
repository at that URL", but we may have seen other advertisement
like "shallow" and ".have" in which case we definitely know that a
repository is there.  The code to detect this case has also been
updated.

* jt/accept-capability-advertisement-when-fetching-from-void:
  connect: advertized capability is not a ref
  connect: tighten check for unexpected early hang up
  tests: move test_lazy_prereq JGIT to test-lib.sh

7 years agoSync with maint
Junio C Hamano [Mon, 19 Sep 2016 20:55:18 +0000 (13:55 -0700)]
Sync with maint

* maint:
  Start preparing for 2.10.1

7 years agoStart preparing for 2.10.1
Junio C Hamano [Mon, 19 Sep 2016 20:54:50 +0000 (13:54 -0700)]
Start preparing for 2.10.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'sb/diff-cleanup' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:45 +0000 (13:51 -0700)]
Merge branch 'sb/diff-cleanup' into maint

Code cleanup.

* sb/diff-cleanup:
  diff: remove dead code
  diff: omit found pointer from emit_callback
  diff.c: use diff_options directly

7 years agoMerge branch 'ah/misc-message-fixes' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:45 +0000 (13:51 -0700)]
Merge branch 'ah/misc-message-fixes' into maint

Message cleanup.

* ah/misc-message-fixes:
  unpack-trees: do not capitalize "working"
  git-merge-octopus: do not capitalize "octopus"
  git-rebase--interactive: fix English grammar
  cat-file: put spaces around pipes in usage string
  am: put spaces around pipe in usage string

7 years agoMerge branch 'sb/transport-report-missing-submodule-on-stderr' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:45 +0000 (13:51 -0700)]
Merge branch 'sb/transport-report-missing-submodule-on-stderr' into maint

Message cleanup.

* sb/transport-report-missing-submodule-on-stderr:
  transport: report missing submodule pushes consistently on stderr

7 years agoMerge branch 'sb/xdiff-remove-unused-static-decl' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:44 +0000 (13:51 -0700)]
Merge branch 'sb/xdiff-remove-unused-static-decl' into maint

Code cleanup.

* sb/xdiff-remove-unused-static-decl:
  xdiff: remove unneeded declarations

7 years agoMerge branch 'js/t9903-chaining' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:44 +0000 (13:51 -0700)]
Merge branch 'js/t9903-chaining' into maint

Test fix.

* js/t9903-chaining:
  t9903: fix broken && chain

7 years agoMerge branch 'rs/hex2chr' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:43 +0000 (13:51 -0700)]
Merge branch 'rs/hex2chr' into maint

Code cleanup.

* rs/hex2chr:
  introduce hex2chr() for converting two hexadecimal digits to a character

7 years agoMerge branch 'rs/compat-strdup' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:42 +0000 (13:51 -0700)]
Merge branch 'rs/compat-strdup' into maint

Code cleanup.

* rs/compat-strdup:
  compat: move strdup(3) replacement to its own file

7 years agoMerge branch 'jk/squelch-false-warning-from-gcc-o3' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:41 +0000 (13:51 -0700)]
Merge branch 'jk/squelch-false-warning-from-gcc-o3' into maint

Compilation fix.

* jk/squelch-false-warning-from-gcc-o3:
  color_parse_mem: initialize "struct color" temporary
  error_errno: use constant return similar to error()

7 years agoMerge branch 'ep/use-git-trace-curl-in-tests' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:41 +0000 (13:51 -0700)]
Merge branch 'ep/use-git-trace-curl-in-tests' into maint

Update a few tests that used to use GIT_CURL_VERBOSE to use the
newer GIT_TRACE_CURL.

* ep/use-git-trace-curl-in-tests:
  t5551-http-fetch-smart.sh: use the GIT_TRACE_CURL environment var
  t5550-http-fetch-dumb.sh: use the GIT_TRACE_CURL environment var
  test-lib.sh: preserve GIT_TRACE_CURL from the environment
  t5541-http-push-smart.sh: use the GIT_TRACE_CURL environment var

7 years agoMerge branch 'js/t6026-clean-up' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:41 +0000 (13:51 -0700)]
Merge branch 'js/t6026-clean-up' into maint

A test spawned a short-lived background process, which sometimes
prevented the test directory from getting removed at the end of the
script on some platforms.

* js/t6026-clean-up:
  t6026-merge-attr: clean up background process at end of test case

7 years agoMerge branch 'jc/forbid-symbolic-ref-d-HEAD' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:40 +0000 (13:51 -0700)]
Merge branch 'jc/forbid-symbolic-ref-d-HEAD' into maint

"git symbolic-ref -d HEAD" happily removes the symbolic ref, but
the resulting repository becomes an invalid one.  Teach the command
to forbid removal of HEAD.

* jc/forbid-symbolic-ref-d-HEAD:
  symbolic-ref -d: do not allow removal of HEAD

7 years agoMerge branch 'jc/submodule-anchor-git-dir' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:40 +0000 (13:51 -0700)]
Merge branch 'jc/submodule-anchor-git-dir' into maint

Having a submodule whose ".git" repository is somehow corrupt
caused a few commands that recurse into submodules loop forever.

* jc/submodule-anchor-git-dir:
  submodule: avoid auto-discovery in prepare_submodule_repo_env()

7 years agoMerge branch 'jk/test-lib-drop-pid-from-results' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:39 +0000 (13:51 -0700)]
Merge branch 'jk/test-lib-drop-pid-from-results' into maint

The test framework left the number of tests and success/failure
count in the t/test-results directory, keyed by the name of the
test script plus the process ID.  The latter however turned out not
to serve any useful purpose.  The process ID part of the filename
has been removed.

* jk/test-lib-drop-pid-from-results:
  test-lib: drop PID from test-results/*.count

7 years agoMerge branch 'bh/diff-highlight-graph' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:38 +0000 (13:51 -0700)]
Merge branch 'bh/diff-highlight-graph' into maint

"diff-highlight" script (in contrib/) learned to work better with
"git log -p --graph" output.

* bh/diff-highlight-graph:
  diff-highlight: avoid highlighting combined diffs
  diff-highlight: add multi-byte tests
  diff-highlight: ignore test cruft
  diff-highlight: add support for --graph output
  diff-highlight: add failing test for handling --graph output
  diff-highlight: add some tests

7 years agoMerge branch 'po/range-doc' into maint
Junio C Hamano [Mon, 19 Sep 2016 20:51:37 +0000 (13:51 -0700)]
Merge branch 'po/range-doc' into maint

Clarify various ways to specify the "revision ranges" in the
documentation.

* po/range-doc:
  doc: revisions: sort examples and fix alignment of the unchanged
  doc: revisions: show revision expansion in examples
  doc: revisions - clarify reachability examples
  doc: revisions - define `reachable`
  doc: gitrevisions - clarify 'latter case' is revision walk
  doc: gitrevisions - use 'reachable' in page description
  doc: revisions: single vs multi-parent notation comparison
  doc: revisions: extra clarification of <rev>^! notation effects
  doc: revisions: give headings for the two and three dot notations
  doc: show the actual left, right, and boundary marks
  doc: revisions - name the left and right sides
  doc: use 'symmetric difference' consistently

7 years agoThird batch for 2.11
Junio C Hamano [Mon, 19 Sep 2016 20:48:25 +0000 (13:48 -0700)]
Third batch for 2.11

This round they are somewhat bigger topics.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'bc/object-id'
Junio C Hamano [Mon, 19 Sep 2016 20:47:19 +0000 (13:47 -0700)]
Merge branch 'bc/object-id'

The "unsigned char sha1[20]" to "struct object_id" conversion
continues.  Notable changes in this round includes that ce->sha1,
i.e. the object name recorded in the cache_entry, turns into an
object_id.

It had merge conflicts with a few topics in flight (Christian's
"apply.c split", Dscho's "cat-file --filters" and Jeff Hostetler's
"status --porcelain-v2").  Extra sets of eyes double-checking for
mismerges are highly appreciated.

* bc/object-id:
  builtin/reset: convert to use struct object_id
  builtin/commit-tree: convert to struct object_id
  builtin/am: convert to struct object_id
  refs: add an update_ref_oid function.
  sha1_name: convert get_sha1_mb to struct object_id
  builtin/update-index: convert file to struct object_id
  notes: convert init_notes to use struct object_id
  builtin/rm: convert to use struct object_id
  builtin/blame: convert file to use struct object_id
  Convert read_mmblob to take struct object_id.
  notes-merge: convert struct notes_merge_pair to struct object_id
  builtin/checkout: convert some static functions to struct object_id
  streaming: make stream_blob_to_fd take struct object_id
  builtin: convert textconv_object to use struct object_id
  builtin/cat-file: convert some static functions to struct object_id
  builtin/cat-file: convert struct expand_data to use struct object_id
  builtin/log: convert some static functions to use struct object_id
  builtin/blame: convert struct origin to use struct object_id
  builtin/apply: convert static functions to struct object_id
  cache: convert struct cache_entry to use struct object_id

7 years agoMerge branch 'mh/ref-store'
Junio C Hamano [Mon, 19 Sep 2016 20:47:19 +0000 (13:47 -0700)]
Merge branch 'mh/ref-store'

The ref-store abstraction was introduced to the refs API so that we
can plug in different backends to store references.

* mh/ref-store: (38 commits)
  refs: implement iteration over only per-worktree refs
  refs: make lock generic
  refs: add method to rename refs
  refs: add methods to init refs db
  refs: make delete_refs() virtual
  refs: add method for initial ref transaction commit
  refs: add methods for reflog
  refs: add method iterator_begin
  files_ref_iterator_begin(): take a ref_store argument
  split_symref_update(): add a files_ref_store argument
  lock_ref_sha1_basic(): add a files_ref_store argument
  lock_ref_for_update(): add a files_ref_store argument
  commit_ref_update(): add a files_ref_store argument
  lock_raw_ref(): add a files_ref_store argument
  repack_without_refs(): add a files_ref_store argument
  refs: make peel_ref() virtual
  refs: make create_symref() virtual
  refs: make pack_refs() virtual
  refs: make verify_refname_available() virtual
  refs: make read_raw_ref() virtual
  ...

7 years agoMerge branch 'cc/apply-am'
Junio C Hamano [Mon, 19 Sep 2016 20:47:17 +0000 (13:47 -0700)]
Merge branch 'cc/apply-am'

"git am" has been taught to make an internal call to "git apply"'s
innards without spawning the latter as a separate process.

* cc/apply-am: (41 commits)
  builtin/am: use apply API in run_apply()
  apply: learn to use a different index file
  apply: pass apply state to build_fake_ancestor()
  apply: refactor `git apply` option parsing
  apply: change error_routine when silent
  usage: add get_error_routine() and get_warn_routine()
  usage: add set_warn_routine()
  apply: don't print on stdout in verbosity_silent mode
  apply: make it possible to silently apply
  apply: use error_errno() where possible
  apply: make some parsing functions static again
  apply: move libified code from builtin/apply.c to apply.{c,h}
  apply: rename and move opt constants to apply.h
  builtin/apply: rename option parsing functions
  builtin/apply: make create_one_file() return -1 on error
  builtin/apply: make try_create_file() return -1 on error
  builtin/apply: make write_out_results() return -1 on error
  builtin/apply: make write_out_one_result() return -1 on error
  builtin/apply: make create_file() return -1 on error
  builtin/apply: make add_index_file() return -1 on error
  ...

7 years agoSecond batch for 2.11
Junio C Hamano [Thu, 15 Sep 2016 21:13:06 +0000 (14:13 -0700)]
Second batch for 2.11

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'js/git-gui-commit-gpgsign'
Junio C Hamano [Thu, 15 Sep 2016 21:11:16 +0000 (14:11 -0700)]
Merge branch 'js/git-gui-commit-gpgsign'

"git commit-tree" stopped reading commit.gpgsign configuration
variable that was meant for Porcelain "git commit" in Git 2.9; we
forgot to update "git gui" to look at the configuration to match
this change.

* js/git-gui-commit-gpgsign:
  git-gui: respect commit.gpgsign again

7 years agoMerge branch 'js/sequencer-wo-die'
Junio C Hamano [Thu, 15 Sep 2016 21:11:16 +0000 (14:11 -0700)]
Merge branch 'js/sequencer-wo-die'

Lifts calls to exit(2) and die() higher in the callchain in
sequencer.c files so that more helper functions in it can be used
by callers that want to handle error conditions themselves.

* js/sequencer-wo-die:
  sequencer: ensure to release the lock when we could not read the index
  sequencer: lib'ify checkout_fast_forward()
  sequencer: lib'ify fast_forward_to()
  sequencer: lib'ify save_opts()
  sequencer: lib'ify save_todo()
  sequencer: lib'ify save_head()
  sequencer: lib'ify create_seq_dir()
  sequencer: lib'ify read_populate_opts()
  sequencer: lib'ify read_populate_todo()
  sequencer: lib'ify read_and_refresh_cache()
  sequencer: lib'ify prepare_revs()
  sequencer: lib'ify walk_revs_populate_todo()
  sequencer: lib'ify do_pick_commit()
  sequencer: lib'ify do_recursive_merge()
  sequencer: lib'ify write_message()
  sequencer: do not die() in do_pick_commit()
  sequencer: lib'ify sequencer_pick_revisions()

7 years agoMerge branch 'sb/diff-cleanup'
Junio C Hamano [Thu, 15 Sep 2016 21:11:15 +0000 (14:11 -0700)]
Merge branch 'sb/diff-cleanup'

Code cleanup.

* sb/diff-cleanup:
  diff: remove dead code
  diff: omit found pointer from emit_callback
  diff.c: use diff_options directly

7 years agoMerge branch 'jk/fix-remote-curl-url-wo-proto'
Junio C Hamano [Thu, 15 Sep 2016 21:11:15 +0000 (14:11 -0700)]
Merge branch 'jk/fix-remote-curl-url-wo-proto'

"git fetch http::/site/path" did not die correctly and segfaulted
instead.

* jk/fix-remote-curl-url-wo-proto:
  remote-curl: handle URLs without protocol

7 years agoMerge branch 'ah/misc-message-fixes'
Junio C Hamano [Thu, 15 Sep 2016 21:11:15 +0000 (14:11 -0700)]
Merge branch 'ah/misc-message-fixes'

Message cleanup.

* ah/misc-message-fixes:
  unpack-trees: do not capitalize "working"
  git-merge-octopus: do not capitalize "octopus"
  git-rebase--interactive: fix English grammar
  cat-file: put spaces around pipes in usage string
  am: put spaces around pipe in usage string

7 years agoMerge branch 'sy/git-gui-i18n-ja'
Junio C Hamano [Thu, 15 Sep 2016 21:11:14 +0000 (14:11 -0700)]
Merge branch 'sy/git-gui-i18n-ja'

Update Japanese translation for "git-gui".

* sy/git-gui-i18n-ja:
  git-gui: update Japanese information
  git-gui: update Japanese translation
  git-gui: add Japanese language code
  git-gui: apply po template to Japanese translation
  git-gui: consistently use the same word for "blame" in Japanese
  git-gui: consistently use the same word for "remote" in Japanese

7 years agoMerge branch 'jk/pack-tag-of-tag'
Junio C Hamano [Thu, 15 Sep 2016 21:11:14 +0000 (14:11 -0700)]
Merge branch 'jk/pack-tag-of-tag'

"git pack-objects --include-tag" was taught that when we know that
we are sending an object C, we want a tag B that directly points at
C but also a tag A that points at the tag B.  We used to miss the
intermediate tag B in some cases.

* jk/pack-tag-of-tag:
  pack-objects: walk tag chains for --include-tag
  t5305: simplify packname handling
  t5305: use "git -C"
  t5305: drop "dry-run" of unpack-objects
  t5305: move cleanup into test block

7 years agoSync with maint
Junio C Hamano [Mon, 12 Sep 2016 22:35:14 +0000 (15:35 -0700)]
Sync with maint

* maint:
  l10n: zh_CN: review for git v2.10.0 l10n
  l10n: zh_CN: fixed some typos for git 2.10.0
  l10n: pt_PT: update Portuguese repository info
  l10n: pt_PT: update Portuguese translation

7 years agoFirst batch for 2.11
Junio C Hamano [Mon, 12 Sep 2016 22:35:05 +0000 (15:35 -0700)]
First batch for 2.11

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'sb/transport-report-missing-submodule-on-stderr'
Junio C Hamano [Mon, 12 Sep 2016 22:34:38 +0000 (15:34 -0700)]
Merge branch 'sb/transport-report-missing-submodule-on-stderr'

Message cleanup.

* sb/transport-report-missing-submodule-on-stderr:
  transport: report missing submodule pushes consistently on stderr

7 years agoMerge branch 'ep/use-git-trace-curl-in-tests'
Junio C Hamano [Mon, 12 Sep 2016 22:34:38 +0000 (15:34 -0700)]
Merge branch 'ep/use-git-trace-curl-in-tests'

Update a few tests that used to use GIT_CURL_VERBOSE to use the
newer GIT_TRACE_CURL.

* ep/use-git-trace-curl-in-tests:
  t5551-http-fetch-smart.sh: use the GIT_TRACE_CURL environment var
  t5550-http-fetch-dumb.sh: use the GIT_TRACE_CURL environment var
  test-lib.sh: preserve GIT_TRACE_CURL from the environment
  t5541-http-push-smart.sh: use the GIT_TRACE_CURL environment var

7 years agoMerge branch 'sb/xdiff-remove-unused-static-decl'
Junio C Hamano [Mon, 12 Sep 2016 22:34:38 +0000 (15:34 -0700)]
Merge branch 'sb/xdiff-remove-unused-static-decl'

Code cleanup.

* sb/xdiff-remove-unused-static-decl:
  xdiff: remove unneeded declarations

7 years agoMerge branch 'js/t6026-clean-up'
Junio C Hamano [Mon, 12 Sep 2016 22:34:37 +0000 (15:34 -0700)]
Merge branch 'js/t6026-clean-up'

A test spawned a short-lived background process, which sometimes
prevented the test directory from getting removed at the end of the
script on some platforms.

* js/t6026-clean-up:
  t6026-merge-attr: clean up background process at end of test case

7 years agoMerge branch 'js/t9903-chaining'
Junio C Hamano [Mon, 12 Sep 2016 22:34:37 +0000 (15:34 -0700)]
Merge branch 'js/t9903-chaining'

* js/t9903-chaining:
  t9903: fix broken && chain

7 years agoMerge branch 'rs/hex2chr'
Junio C Hamano [Mon, 12 Sep 2016 22:34:36 +0000 (15:34 -0700)]
Merge branch 'rs/hex2chr'

* rs/hex2chr:
  introduce hex2chr() for converting two hexadecimal digits to a character

7 years agoMerge branch 'rs/compat-strdup'
Junio C Hamano [Mon, 12 Sep 2016 22:34:36 +0000 (15:34 -0700)]
Merge branch 'rs/compat-strdup'

* rs/compat-strdup:
  compat: move strdup(3) replacement to its own file

7 years agoMerge branch 'jc/forbid-symbolic-ref-d-HEAD'
Junio C Hamano [Mon, 12 Sep 2016 22:34:35 +0000 (15:34 -0700)]
Merge branch 'jc/forbid-symbolic-ref-d-HEAD'

"git symbolic-ref -d HEAD" happily removes the symbolic ref, but
the resulting repository becomes an invalid one.  Teach the command
to forbid removal of HEAD.

* jc/forbid-symbolic-ref-d-HEAD:
  symbolic-ref -d: do not allow removal of HEAD

7 years agoMerge branch 'jc/submodule-anchor-git-dir'
Junio C Hamano [Mon, 12 Sep 2016 22:34:34 +0000 (15:34 -0700)]
Merge branch 'jc/submodule-anchor-git-dir'

Having a submodule whose ".git" repository is somehow corrupt
caused a few commands that recurse into submodules loop forever.

* jc/submodule-anchor-git-dir:
  submodule: avoid auto-discovery in prepare_submodule_repo_env()

7 years agoMerge branch 'jk/squelch-false-warning-from-gcc-o3'
Junio C Hamano [Mon, 12 Sep 2016 22:34:33 +0000 (15:34 -0700)]
Merge branch 'jk/squelch-false-warning-from-gcc-o3'

* jk/squelch-false-warning-from-gcc-o3:
  color_parse_mem: initialize "struct color" temporary
  error_errno: use constant return similar to error()

7 years agoMerge branch 'jk/test-lib-drop-pid-from-results'
Junio C Hamano [Mon, 12 Sep 2016 22:34:33 +0000 (15:34 -0700)]
Merge branch 'jk/test-lib-drop-pid-from-results'

The test framework left the number of tests and success/failure
count in the t/test-results directory, keyed by the name of the
test script plus the process ID.  The latter however turned out not
to serve any useful purpose.  The process ID part of the filename
has been removed.

* jk/test-lib-drop-pid-from-results:
  test-lib: drop PID from test-results/*.count

7 years agoMerge branch 'jc/am-read-author-file'
Junio C Hamano [Mon, 12 Sep 2016 22:34:32 +0000 (15:34 -0700)]
Merge branch 'jc/am-read-author-file'

Extract a small helper out of the function that reads the authors
script file "git am" internally uses.

* jc/am-read-author-file:
  am: refactor read_author_script()

7 years agoMerge branch 'jk/diff-submodule-diff-inline'
Junio C Hamano [Mon, 12 Sep 2016 22:34:31 +0000 (15:34 -0700)]
Merge branch 'jk/diff-submodule-diff-inline'

The "git diff --submodule={short,log}" mechanism has been enhanced
to allow "--submodule=diff" to show the patch between the submodule
commits bound to the superproject.

* jk/diff-submodule-diff-inline:
  diff: teach diff to display submodule difference with an inline diff
  submodule: refactor show_submodule_summary with helper function
  submodule: convert show_submodule_summary to use struct object_id *
  allow do_submodule_path to work even if submodule isn't checked out
  diff: prepare for additional submodule formats
  graph: add support for --line-prefix on all graph-aware output
  diff.c: remove output_prefix_length field
  cache: add empty_tree_oid object and helper function

7 years agoMerge tag 'l10n-2.10.0-rnd2.3' of git://github.com/git-l10n/git-po into maint
Junio C Hamano [Mon, 12 Sep 2016 22:23:42 +0000 (15:23 -0700)]
Merge tag 'l10n-2.10.0-rnd2.3' of git://github.com/git-l10n/git-po into maint

l10n-2.10.0-rnd2.3

* tag 'l10n-2.10.0-rnd2.3' of git://github.com/git-l10n/git-po:
  l10n: zh_CN: review for git v2.10.0 l10n
  l10n: zh_CN: fixed some typos for git 2.10.0
  l10n: pt_PT: update Portuguese repository info
  l10n: pt_PT: update Portuguese translation

7 years agoadd: document the chmod option
Thomas Gummerer [Mon, 12 Sep 2016 21:08:15 +0000 (22:08 +0100)]
add: document the chmod option

The git add --chmod option was introduced in 4e55ed3 ("add: add
--chmod=+x / --chmod=-x options", 2016-05-31), but was never
documented.  Document the feature.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoadd_delta_base_cache: use list_for_each_safe
Jeff King [Mon, 12 Sep 2016 16:46:17 +0000 (12:46 -0400)]
add_delta_base_cache: use list_for_each_safe

We may remove elements from the list while we are iterating,
which requires using a second temporary pointer. Otherwise
stepping to the next element of the list might involve
looking at freed memory (which generally works in practice,
as we _just_ freed it, but of course is wrong to rely on;
valgrind notices it).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'js/commit-gpgsign' of ../git-gui into js/git-gui-commit-gpgsign
Junio C Hamano [Sun, 11 Sep 2016 21:53:26 +0000 (14:53 -0700)]
Merge branch 'js/commit-gpgsign' of ../git-gui into js/git-gui-commit-gpgsign

* 'js/commit-gpgsign' of ../git-gui:
  git-gui: respect commit.gpgsign again

7 years agogit-gui: respect commit.gpgsign again
Johannes Schindelin [Fri, 9 Sep 2016 12:28:24 +0000 (14:28 +0200)]
git-gui: respect commit.gpgsign again

As of v2.9.0, `git commit-tree` no longer heeds the `commit.gpgsign`
config setting. This broke committing with GPG signature in Git GUI.

This fixes https://github.com/git-for-windows/git/issues/850

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocat-file: support --textconv/--filters in batch mode
Johannes Schindelin [Fri, 9 Sep 2016 10:10:54 +0000 (12:10 +0200)]
cat-file: support --textconv/--filters in batch mode

With this patch, --batch can be combined with --textconv or --filters.
For this to work, the input needs to have the form

<object name><single white space><path>

so that the filters can be chosen appropriately.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocat-file --textconv/--filters: allow specifying the path separately
Johannes Schindelin [Fri, 9 Sep 2016 10:10:50 +0000 (12:10 +0200)]
cat-file --textconv/--filters: allow specifying the path separately

There are circumstances when it is relatively easy to figure out the
object name for a given path, but not the name of the containing tree.
For example, when looking at a diff generated by Git, the object names
are recorded, but not the revision. As a matter of fact, the revisions
from which the diff was generated may not even exist locally.

In such a case, the user would have to generate a fake revision just to
be able to use --textconv or --filters.

Let's simplify this dramatically, because we do not really need that
revision at all: all we care about is that we know the path. In the
scenario described above, we do know the path, and we just want to
specify it separately from the object name.

Example usage:

git cat-file --textconv --path=main.c 0f1937fd

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocat-file: introduce the --filters option
Johannes Schindelin [Wed, 24 Aug 2016 12:23:39 +0000 (14:23 +0200)]
cat-file: introduce the --filters option

The --filters option applies the convert_to_working_tree() filter for
the path when showing the contents of a regular file blob object;
the contents are written out as-is for other types of objects.

This feature comes in handy when a 3rd-party tool wants to work with
the contents of files from past revisions as if they had been checked
out, but without detouring via temporary files.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agol10n: zh_CN: review for git v2.10.0 l10n
Ray Chen [Wed, 7 Sep 2016 10:03:04 +0000 (18:03 +0800)]
l10n: zh_CN: review for git v2.10.0 l10n

Signed-off-by: Ray Chen <oldsharp@gmail.com>
7 years agol10n: zh_CN: fixed some typos for git 2.10.0
Jiang Xin [Mon, 5 Sep 2016 15:26:21 +0000 (23:26 +0800)]
l10n: zh_CN: fixed some typos for git 2.10.0

Reviewed-by: Ray <tvvocold@163.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
7 years agorefs: implement iteration over only per-worktree refs
David Turner [Sun, 4 Sep 2016 16:08:44 +0000 (18:08 +0200)]
refs: implement iteration over only per-worktree refs

Alternate refs backends might still use files to store per-worktree
refs. So provide a way to iterate over only the per-worktree references
in a ref_store. The other backend can set up a files ref_store and
iterate using the new DO_FOR_EACH_PER_WORKTREE_ONLY flag when iterating.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: make lock generic
David Turner [Sun, 4 Sep 2016 16:08:43 +0000 (18:08 +0200)]
refs: make lock generic

Instead of including a files-backend-specific struct ref_lock, change
the generic ref_update struct to include a void pointer that backends
can use for their own arbitrary data.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: add method to rename refs
David Turner [Sun, 4 Sep 2016 16:08:42 +0000 (18:08 +0200)]
refs: add method to rename refs

This removes the last caller of function get_files_ref_store(), so
remove it.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: add methods to init refs db
David Turner [Sun, 4 Sep 2016 16:08:41 +0000 (18:08 +0200)]
refs: add methods to init refs db

Alternate refs backends might not need the refs/heads directory and so
on, so we make ref db initialization part of the backend.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: make delete_refs() virtual
David Turner [Sun, 4 Sep 2016 16:08:40 +0000 (18:08 +0200)]
refs: make delete_refs() virtual

In the file-based backend, delete_refs has some special optimization
to deal with packed refs.  In other backends, we might be able to make
ref deletion faster by putting all deletions into a single
transaction.  So we need a special backend function for this.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: add method for initial ref transaction commit
David Turner [Sun, 4 Sep 2016 16:08:39 +0000 (18:08 +0200)]
refs: add method for initial ref transaction commit

Signed-off-by: Ronnie Sahlberg <rsahlberg@google.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: add methods for reflog
David Turner [Sun, 4 Sep 2016 16:08:38 +0000 (18:08 +0200)]
refs: add methods for reflog

In the file-based backend, the reflog piggybacks on the ref lock.
Since other backends won't have the same sort of ref lock, ref backends
must also handle reflogs.

Signed-off-by: Ronnie Sahlberg <rsahlberg@google.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: add method iterator_begin
Michael Haggerty [Sun, 4 Sep 2016 16:08:37 +0000 (18:08 +0200)]
refs: add method iterator_begin

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofiles_ref_iterator_begin(): take a ref_store argument
Michael Haggerty [Sun, 4 Sep 2016 16:08:36 +0000 (18:08 +0200)]
files_ref_iterator_begin(): take a ref_store argument

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosplit_symref_update(): add a files_ref_store argument
Michael Haggerty [Sun, 4 Sep 2016 16:08:35 +0000 (18:08 +0200)]
split_symref_update(): add a files_ref_store argument

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agolock_ref_sha1_basic(): add a files_ref_store argument
Michael Haggerty [Sun, 4 Sep 2016 16:08:34 +0000 (18:08 +0200)]
lock_ref_sha1_basic(): add a files_ref_store argument

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agolock_ref_for_update(): add a files_ref_store argument
Michael Haggerty [Sun, 4 Sep 2016 16:08:33 +0000 (18:08 +0200)]
lock_ref_for_update(): add a files_ref_store argument

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocommit_ref_update(): add a files_ref_store argument
Michael Haggerty [Sun, 4 Sep 2016 16:08:32 +0000 (18:08 +0200)]
commit_ref_update(): add a files_ref_store argument

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agolock_raw_ref(): add a files_ref_store argument
Michael Haggerty [Sun, 4 Sep 2016 16:08:31 +0000 (18:08 +0200)]
lock_raw_ref(): add a files_ref_store argument

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorepack_without_refs(): add a files_ref_store argument
Michael Haggerty [Sun, 4 Sep 2016 16:08:30 +0000 (18:08 +0200)]
repack_without_refs(): add a files_ref_store argument

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: make peel_ref() virtual
Michael Haggerty [Sun, 4 Sep 2016 16:08:29 +0000 (18:08 +0200)]
refs: make peel_ref() virtual

For now it only supports the main reference store.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: make create_symref() virtual
Michael Haggerty [Sun, 4 Sep 2016 16:08:28 +0000 (18:08 +0200)]
refs: make create_symref() virtual

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: make pack_refs() virtual
Michael Haggerty [Sun, 4 Sep 2016 16:08:27 +0000 (18:08 +0200)]
refs: make pack_refs() virtual

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: make verify_refname_available() virtual
Michael Haggerty [Sun, 4 Sep 2016 16:08:26 +0000 (18:08 +0200)]
refs: make verify_refname_available() virtual

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: make read_raw_ref() virtual
Michael Haggerty [Sun, 4 Sep 2016 16:08:25 +0000 (18:08 +0200)]
refs: make read_raw_ref() virtual

Reference backends will be able to customize this function to implement
reference reading.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoresolve_gitlink_ref(): rename path parameter to submodule
Michael Haggerty [Sun, 4 Sep 2016 16:08:24 +0000 (18:08 +0200)]
resolve_gitlink_ref(): rename path parameter to submodule

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoresolve_gitlink_ref(): avoid memory allocation in many cases
Michael Haggerty [Sun, 4 Sep 2016 16:08:23 +0000 (18:08 +0200)]
resolve_gitlink_ref(): avoid memory allocation in many cases

If we don't have to strip trailing '/' from the submodule path, then
don't allocate and copy the submodule name.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoresolve_gitlink_ref(): implement using resolve_ref_recursively()
Michael Haggerty [Sun, 4 Sep 2016 16:08:22 +0000 (18:08 +0200)]
resolve_gitlink_ref(): implement using resolve_ref_recursively()

resolve_ref_recursively() can handle references in arbitrary files
reference stores, so use it to resolve "gitlink" (i.e., submodule)
references. Aside from removing redundant code, this allows submodule
lookups to benefit from the much more robust code that we use for
reading non-submodule references. And, since the code is now agnostic
about reference backends, it will work for any future references
backend (so move its definition to refs.c).

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoresolve_ref_recursively(): new function
Michael Haggerty [Sun, 4 Sep 2016 16:08:21 +0000 (18:08 +0200)]
resolve_ref_recursively(): new function

Add a new function, resolve_ref_recursively(), which is basically like
the old resolve_ref_unsafe() except that it takes a (ref_store *)
argument and also works for submodules.

Re-implement resolve_ref_unsafe() as a thin wrapper around
resolve_ref_recursively().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoread_raw_ref(): take a (struct ref_store *) argument
Michael Haggerty [Sun, 4 Sep 2016 16:08:20 +0000 (18:08 +0200)]
read_raw_ref(): take a (struct ref_store *) argument

And make the function work for submodules.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoresolve_gitlink_packed_ref(): remove function
Michael Haggerty [Sun, 4 Sep 2016 16:08:19 +0000 (18:08 +0200)]
resolve_gitlink_packed_ref(): remove function

Now that resolve_packed_ref() can work with an arbitrary
files_ref_store, there is no need to have a separate
resolve_gitlink_packed_ref() function.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoresolve_packed_ref(): rename function from resolve_missing_loose_ref()
Michael Haggerty [Sun, 4 Sep 2016 16:08:18 +0000 (18:08 +0200)]
resolve_packed_ref(): rename function from resolve_missing_loose_ref()

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: reorder definitions
Michael Haggerty [Sun, 4 Sep 2016 16:08:17 +0000 (18:08 +0200)]
refs: reorder definitions

Move resolve_gitlink_ref() and related functions lower in the file to
avoid the need for forward declarations in the next step.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: add a transaction_commit() method
Ronnie Sahlberg [Sun, 4 Sep 2016 16:08:16 +0000 (18:08 +0200)]
refs: add a transaction_commit() method

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years ago{lock,commit,rollback}_packed_refs(): add files_ref_store arguments
Michael Haggerty [Sun, 4 Sep 2016 16:08:15 +0000 (18:08 +0200)]
{lock,commit,rollback}_packed_refs(): add files_ref_store arguments

These functions currently only work in the main repository, so add an
assert_main_repository() check to each function.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoresolve_missing_loose_ref(): add a files_ref_store argument
Michael Haggerty [Sun, 4 Sep 2016 16:08:14 +0000 (18:08 +0200)]
resolve_missing_loose_ref(): add a files_ref_store argument

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoget_packed_ref(): add a files_ref_store argument
Michael Haggerty [Sun, 4 Sep 2016 16:08:13 +0000 (18:08 +0200)]
get_packed_ref(): add a files_ref_store argument

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoadd_packed_ref(): add a files_ref_store argument
Michael Haggerty [Sun, 4 Sep 2016 16:08:12 +0000 (18:08 +0200)]
add_packed_ref(): add a files_ref_store argument

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: create a base class "ref_store" for files_ref_store
Michael Haggerty [Sun, 4 Sep 2016 16:08:11 +0000 (18:08 +0200)]
refs: create a base class "ref_store" for files_ref_store

We want ref_stores to be polymorphic, so invent a base class of which
files_ref_store is a derived class. For now there is exactly one
ref_store for the main repository and one for any submodules whose
references have been accessed.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: add a backend method structure
Ronnie Sahlberg [Sun, 4 Sep 2016 16:08:10 +0000 (18:08 +0200)]
refs: add a backend method structure

Add a `struct ref_storage_be` to represent types of reference stores. In
OO notation, this is the class, and will soon hold some class
methods (e.g., a factory to create new ref_store instances) and will
also serve as the vtable for ref_store instances of that type.

As yet, the backends cannot do anything.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: rename struct ref_cache to files_ref_store
Michael Haggerty [Sun, 4 Sep 2016 16:08:09 +0000 (18:08 +0200)]
refs: rename struct ref_cache to files_ref_store

The greater goal of this patch series is to develop the concept of a
reference store, which is a place that references, their values, and
their reflogs are stored, and to virtualize the reference interface so
that different types of ref_stores can be implemented. We will then, for
example, use ref_store instances to access submodule references and
worktree references.

Currently, we keep a ref_cache for each submodule that has had its
references iterated over. It is a far cry from a ref_store, but they are
stored the way we will want to store ref_stores, and ref_stores will
eventually have to hold the reference caches. So let's treat ref_caches
as embryo ref_stores, and build them out from there.

As the first step, simply rename `ref_cache` to `files_ref_store`, and
rename some functions and attributes correspondingly.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorename_ref_available(): add docstring
David Turner [Sun, 4 Sep 2016 16:08:08 +0000 (18:08 +0200)]
rename_ref_available(): add docstring

And improve the internal variable names.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoresolve_gitlink_ref(): eliminate temporary variable
Michael Haggerty [Sun, 4 Sep 2016 16:08:07 +0000 (18:08 +0200)]
resolve_gitlink_ref(): eliminate temporary variable

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconnect: advertized capability is not a ref
Jonathan Tan [Fri, 9 Sep 2016 17:36:30 +0000 (10:36 -0700)]
connect: advertized capability is not a ref

When cloning an empty repository served by standard git, "git clone" produces
the following reassuring message:

$ git clone git://localhost/tmp/empty
Cloning into 'empty'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.

Meanwhile when cloning an empty repository served by JGit, the output is more
haphazard:

$ git clone git://localhost/tmp/empty
Cloning into 'empty'...
Checking connectivity... done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.

This is a common command to run immediately after creating a remote repository
as preparation for adding content to populate it and pushing. The warning is
confusing and needlessly worrying.

The cause is that, since v3.1.0.201309270735-rc1~22 (Advertise capabilities
with no refs in upload service., 2013-08-08), JGit's ref advertisement includes
a ref named capabilities^{} to advertise its capabilities on, while git's ref
advertisement is empty in this case. This allows the client to learn about the
server's capabilities and is needed, for example, for fetch-by-sha1 to work
when no refs are advertised.

This also affects "ls-remote". For example, against an empty repository served
by JGit:

$ git ls-remote git://localhost/tmp/empty
0000000000000000000000000000000000000000        capabilities^{}

Git advertises the same capabilities^{} ref in its ref advertisement for push
but since it never did so for fetch, the client didn't need to handle this
case.  Handle it.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconnect: tighten check for unexpected early hang up
Jonathan Nieder [Fri, 9 Sep 2016 17:36:29 +0000 (10:36 -0700)]
connect: tighten check for unexpected early hang up

A server hanging up immediately to mark access being denied does not
send any .have refs, shallow lines, or anything else before hanging
up.  If the server has sent anything, then the hangup is unexpected.

That is, if the server hangs up after a shallow line but before sending
any refs, then git should tell me so:

fatal: The remote end hung up upon initial contact

instead of suggesting an access control problem:

fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

Noticed while examining this code.  This case isn't likely to come up
in practice but tightening the check makes the code easier to read and
manipulate.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotests: move test_lazy_prereq JGIT to test-lib.sh
Jonathan Tan [Fri, 9 Sep 2016 17:36:28 +0000 (10:36 -0700)]
tests: move test_lazy_prereq JGIT to test-lib.sh

This enables JGIT to be used as a prereq in invocations of
test_expect_success (and other functions) in other test scripts.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosequencer: ensure to release the lock when we could not read the index
Johannes Schindelin [Fri, 9 Sep 2016 14:38:20 +0000 (16:38 +0200)]
sequencer: ensure to release the lock when we could not read the index

A future caller of read_and_refresh_cache() may want to do more than just
print some helpful advice in case of failure.

Suggested by Junio Hamano.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>