blame: factor out get_next_line()

Move the code for finding the start of the next line into a helper
function in order to reduce duplication.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
blame: simplify prepare_lines()

Changing get_next_line() to return the end pointer instead of NULL in
case no newline character is found treats allows us to treat complete
and incomplete lines the same, simplifying the code.  Switching to
counting lines instead of EOLs allows us to start counting at the
first character, instead of having to call get_next_line() first.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'rs/blame-refactor' into jch

* rs/blame-refactor:
  blame: simplify prepare_lines()
  blame: factor out get_next_line()
submodule: document "sync --recursive"

The "git submodule sync" command supports the --recursive flag, but
the documentation does not mention this.  That flag is useful, for
example when a remote is changed in a submodule of a submodule.

Signed-off-by: Matthew Chen <charlesmchen@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'mc/doc-submodule-sync-recurse' into jch

* mc/doc-submodule-sync-recurse:
  submodule: document "sync --recursive"
Merge branch 'rh/prompt-tests' into pu

to be broken with older zsh that are still in the field ($gmane/251231).

* rh/prompt-tests:
  t9904: new __git_ps1 tests for Zsh
  test-lib: make it possible to override how test code is eval'd
  lib-prompt-tests.sh: add variable for string that encodes percent in PS1
  lib-prompt-tests.sh: put all tests inside a function
  t9903: move prompt tests to a new lib-prompt-tests.sh file
  t9903: move PS1 color code variable definitions to lib-bash.sh
  t9903: include "Bash" in test names via new $shellname var
  t9903: run pc mode tests again with PS1 expansion disabled
  t9903: move test name prefix to a separate variable
  t9903: put the Bash pc mode prompt test cases in a function
  t9903: remove Zsh test from the suite of Bash prompt tests
Merge branch 'nd/multiple-work-trees' into pu

A replacement for contrib/workdir/git-new-workdir that does not
rely on symbolic links and make sharing of objects and refs safer
by making the borrowee and borrowers aware of each other.

* nd/multiple-work-trees: (28 commits)
  count-objects: report unused files in $GIT_DIR/repos/...
  gc: support prune --repos
  gc: style change -- no SP before closing bracket
  prune: strategies for linked checkouts
  checkout: detach if the branch is already checked out elsewhere
  checkout: clean up half-prepared directories in --to mode
  checkout: support checking out into a new working directory
  use new wrapper write_file() for simple file writing
  wrapper.c: wrapper to open a file, fprintf then close
  setup.c: support multi-checkout repo setup
  setup.c: detect $GIT_COMMON_DIR check_repository_format_gently()
  setup.c: convert check_repository_format_gently to use strbuf
  setup.c: detect $GIT_COMMON_DIR in is_git_directory()
  setup.c: convert is_git_directory() to use strbuf
  git-stash: avoid hardcoding $GIT_DIR/logs/....
  *.sh: avoid hardcoding $GIT_DIR/hooks/...
  git-sh-setup.sh: use rev-parse --git-path to get $GIT_DIR/objects
  $GIT_COMMON_DIR: a new environment variable
  commit: use SEQ_DIR instead of hardcoding "sequencer"
  fast-import: use git_path() for accessing .git dir instead of get_git_dir()
  ...

# Conflicts:
# 	builtin/checkout.c
# 	builtin/repack.c
# 	refs.h
Merge branch 'mh/lockfile' into pu

Refactor and fix corner-case bugs in the lockfile API, all looked
sensible.

* mh/lockfile: (25 commits)
  trim_last_path_elm(): replace last_path_elm()
  resolve_symlink(): take a strbuf parameter
  resolve_symlink(): use a strbuf for internal scratch space
  change lock_file::filename into a strbuf
  commit_lock_file(): use a strbuf to manage temporary space
  try_merge_strategy(): use a statically-allocated lock_file object
  try_merge_strategy(): remove redundant lock_file allocation
  struct lock_file: declare some fields volatile
  lockfile: avoid transitory invalid states
  commit_lock_file(): die() if called for unlocked lockfile object
  commit_lock_file(): inline temporary variable
  remove_lock_file(): call rollback_lock_file()
  lock_file(): exit early if lockfile cannot be opened
  write_packed_entry_fn(): convert cb_data into a (const int *)
  prepare_index(): declare return value to be (const char *)
  delete_ref_loose(): don't muck around in the lock_file's filename
  cache.h: define constants LOCK_SUFFIX and LOCK_SUFFIX_LEN
  lockfile.c: document the various states of lock_file objects
  lock_file(): always add lock_file object to lock_file_list
  hold_lock_file_for_append(): release lock on errors
  ...
Merge branch 'bg/rebase-off-of-previous-branch' into pu

Teach "git rebase -" to report the concrete name of the branch
(i.e. the previous one).

But it stops short and does not do the same for "git rebase @{-1}".

* bg/rebase-off-of-previous-branch:
  git-rebase: print name of rev when using shorthand
Merge branch 'nd/split-index' into pu

* nd/split-index: (32 commits)
  t1700: new tests for split-index mode
  t2104: make sure split index mode is off for the version test
  read-cache: force split index mode with GIT_TEST_SPLIT_INDEX
  read-tree: note about dropping split-index mode or index version
  read-tree: force split-index mode off on --index-output
  rev-parse: add --shared-index-path to get shared index path
  update-index --split-index: do not split if $GIT_DIR is read only
  update-index: new options to enable/disable split index mode
  split-index: strip pathname of on-disk replaced entries
  split-index: do not invalidate cache-tree at read time
  split-index: the reading part
  split-index: the writing part
  read-cache: mark updated entries for split index
  read-cache: save deleted entries in split index
  read-cache: mark new entries for split index
  read-cache: split-index mode
  read-cache: save index SHA-1 after reading
  entry.c: update cache_changed if refresh_cache is set in checkout_entry()
  cache-tree: mark istate->cache_changed on prime_cache_tree()
  cache-tree: mark istate->cache_changed on cache tree update
  ...

# Conflicts:
# 	builtin/merge.c
# 	lockfile.c
# 	read-cache.c
Merge branch 'po/everyday-doc' into pu

This may make the said command to emit something, but the source is
not meant to be formatted into a manual pages to begin with, and
also its contents are a bit stale.  It may be a good first step in
the right direction, but needs more work to at least get the
mark-up right before public consumption.

Will hold.

* po/everyday-doc:
  Make 'git help everyday' work

# Conflicts:
# 	Documentation/Makefile
Merge branch 'rb/merge-prepare-commit-msg-hook' into pu

Expose more merge states (e.g. $GIT_DIR/MERGE_MODE) to hooks that
run during "git merge".  The log message stresses too much on one
hook, prepare-commit-msg, but it would equally apply to other hooks
like post-merge, I think.

* rb/merge-prepare-commit-msg-hook:
  merge: drop unused arg from abort_commit method signature
  merge: make prepare_to_commit responsible for write_merge_state
  t7505: ensure cleanup after hook blocks merge
  t7505: add missing &&

# Conflicts:
# 	builtin/merge.c
# 	t/t7505-prepare-commit-msg-hook.sh
Merge branch 'jc/show-branch' into pu

* jc/show-branch:
  show-branch: use commit slab to represent bitflags of arbitrary width
  show-branch.c: remove "all_mask"
  show-branch.c: abstract out "flags" operation
  show-branch.c: lift all_mask/all_revs to a global static
  show-branch.c: update comment style
Merge branch 'tr/merge-recursive-index-only' into pu

Will hold.

* tr/merge-recursive-index-only:
  merge-recursive: -Xindex-only to leave worktree unchanged
  merge-recursive: internal flag to avoid touching the worktree
  merge-recursive: remove dead conditional in update_stages()
Merge branch 'tg/perf-lib-test-perf-cleanup' into pu

Add test_perf_cleanup shell function to the perf suite, that allows
the script writers to define a test with a clean-up action.

Will hold.

* tg/perf-lib-test-perf-cleanup:
  perf-lib: add test_perf_cleanup target
  perf-lib: split starting the test from the execution
Merge branch 'jh/submodule-tests' into pu

More or less abandoned.  Will drop.

* jh/submodule-tests:
  t7410: 210 tests for various 'git submodule update' scenarios
Merge branch 'ab/add-interactive-show-diff-func-name' into pu

* ab/add-interactive-show-diff-func-name:
  SQUASH??? git-add--interactive: Preserve diff heading when splitting hunks
  git-add--interactive: Preserve diff heading when splitting hunks
Merge branch 'ss/userdiff-update-csharp-java' into pu

Reviews sent; waiting for a response.

* ss/userdiff-update-csharp-java:
  userdiff: support Java try keyword
  userdiff: support C# async methods and correct C# keywords
Merge branch 'jn/gitweb-utf8-in-links' into pu

$gmane/250758?

* jn/gitweb-utf8-in-links:
  gitweb: Harden UTF-8 handling in generated links
Merge branch 'jl/gitk-show-added-submodule-changes' into pu

Tentatively queued what I expect to receive via Paul Mackerras.

* jl/gitk-show-added-submodule-changes:
  gitk: show staged submodules regardless of ignore config
  l10n: Init Vietnamese translation