Commit graph

48471 commits

Author SHA1 Message Date
Jonathan Tan 4f39cd821d pack: move pack name-related functions
Currently, sha1_file.c and cache.h contain many functions, both related
to and unrelated to packfiles. This makes both files very large and
causes an unclear separation of concerns.

Create a new file, packfile.c, to hold all packfile-related functions
currently in sha1_file.c. It has a corresponding header packfile.h.

In this commit, the pack name-related functions are moved. Subsequent
commits will move the other functions.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-23 15:12:06 -07:00
Junio C Hamano 3956649422 Sync with maint
* maint:
  Prepare for 2.14.2
2017-08-23 14:36:38 -07:00
Junio C Hamano edc74bc7f0 Prepare for 2.14.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-23 14:36:03 -07:00
Junio C Hamano 0f41b92c79 Merge branch 'jt/t1450-fsck-corrupt-packfile' into maint
A test update.

* jt/t1450-fsck-corrupt-packfile:
  tests: ensure fsck fails on corrupt packfiles
2017-08-23 14:33:52 -07:00
Junio C Hamano 86bf8e45b2 Merge branch 'jb/t8008-cleanup' into maint
Code clean-up.

* jb/t8008-cleanup:
  t8008: rely on rev-parse'd HEAD instead of sha1 value
2017-08-23 14:33:52 -07:00
Junio C Hamano df2dd28316 Merge branch 'jt/subprocess-handshake' into maint
Code cleanup.

* jt/subprocess-handshake:
  sub-process: refactor handshake to common function
  Documentation: migrate sub-process docs to header
  convert: add "status=delayed" to filter process protocol
  convert: refactor capabilities negotiation
  convert: move multiple file filter error handling to separate function
  convert: put the flags field before the flag itself for consistent style
  t0021: write "OUT <size>" only on success
  t0021: make debug log file name configurable
  t0021: keep filter log files on comparison
2017-08-23 14:33:52 -07:00
Junio C Hamano de55703672 Merge branch 'dc/fmt-merge-msg-microcleanup' into maint
Code cleanup.

* dc/fmt-merge-msg-microcleanup:
  fmt-merge-msg: fix coding style
2017-08-23 14:33:52 -07:00
Junio C Hamano b55b936038 Merge branch 'ah/doc-wserrorhighlight' into maint
Doc update.

* ah/doc-wserrorhighlight:
  doc: add missing values "none" and "default" for diff.wsErrorHighlight
2017-08-23 14:33:51 -07:00
Junio C Hamano d0dffcacf3 Merge branch 'cc/ref-is-hidden-microcleanup' into maint
Code cleanup.

* cc/ref-is-hidden-microcleanup:
  refs: use skip_prefix() in ref_is_hidden()
2017-08-23 14:33:50 -07:00
Junio C Hamano 0869277033 Merge branch 'js/run-process-parallel-api-fix' into maint
API fix.

* js/run-process-parallel-api-fix:
  run_processes_parallel: change confusing task_cb convention
2017-08-23 14:33:49 -07:00
Junio C Hamano e22a48c4c0 Merge branch 'rs/pack-objects-pbase-cleanup' into maint
Code clean-up.

* rs/pack-objects-pbase-cleanup:
  pack-objects: remove unnecessary NULL check
2017-08-23 14:33:48 -07:00
Junio C Hamano 697f11b638 Merge branch 'jt/fsck-code-cleanup' into maint
Code clean-up.

* jt/fsck-code-cleanup:
  fsck: cleanup unused variable
  object: remove "used" field from struct object
  fsck: remove redundant parse_tree() invocation
2017-08-23 14:33:48 -07:00
Junio C Hamano 0d824bc7f6 Merge branch 'rs/stat-data-unaligned-reads-fix' into maint
Code clean-up.

* rs/stat-data-unaligned-reads-fix:
  dir: support platforms that require aligned reads
2017-08-23 14:33:48 -07:00
Junio C Hamano d3b7ee087e Merge branch 'rs/move-array' into maint
Code clean-up.

* rs/move-array:
  ls-files: don't try to prune an empty index
  apply: use COPY_ARRAY and MOVE_ARRAY in update_image()
  use MOVE_ARRAY
  add MOVE_ARRAY
2017-08-23 14:33:46 -07:00
Junio C Hamano 752732c6d8 Merge branch 'rs/bswap-ubsan-fix' into maint
Code clean-up.

* rs/bswap-ubsan-fix:
  bswap: convert get_be16, get_be32 and put_be32 to inline functions
  bswap: convert to unsigned before shifting in get_be32
2017-08-23 14:33:46 -07:00
Junio C Hamano cdc55aad7d Merge branch 'dl/credential-cache-socket-in-xdg-cache' into maint
A recently added test for the "credential-cache" helper revealed
that EOF detection done around the time the connection to the cache
daemon is torn down were flaky.  This was fixed by reacting to
ECONNRESET and behaving as if we got an EOF.

* dl/credential-cache-socket-in-xdg-cache:
  credential-cache: interpret an ECONNRESET as an EOF
2017-08-23 14:33:45 -07:00
Junio C Hamano b9e56be086 Merge branch 'hb/gitweb-project-list' into maint
When a directory is not readable, "gitweb" fails to build the
project list.  Work this around by skipping such a directory.

It might end up hiding a problem under the rug and a better
solution might be to loudly complain to the administrator pointing
out the problematic directory, but this will at least make it
"work".

* hb/gitweb-project-list:
  gitweb: skip unreadable subdirectories
2017-08-23 14:33:44 -07:00
Junio C Hamano 01ced48994 Merge branch 'ks/commit-abort-on-empty-message-fix' into maint
"git commit" when seeing an totally empty message said "you did not
edit the message", which is clearly wrong.  The message has been
corrected.

* ks/commit-abort-on-empty-message-fix:
  commit: check for empty message before the check for untouched template
2017-08-23 14:33:44 -07:00
Junio C Hamano 0cb526e031 Merge branch 'jk/reflog-walk' into maint
Numerous bugs in walking of reflogs via "log -g" and friends have
been fixed.

* jk/reflog-walk:
  reflog-walk: apply --since/--until to reflog dates
  reflog-walk: stop using fake parents
  rev-list: check reflog_info before showing usage
  get_revision_1(): replace do-while with an early return
  log: do not free parents when walking reflog
  log: clarify comment about reflog cycles
  revision: disallow reflog walking with revs->limited
  t1414: document some reflog-walk oddities
2017-08-23 14:33:44 -07:00
Junio C Hamano 72140a7319 Merge branch 'jc/http-sslkey-and-ssl-cert-are-paths' into maint
The http.{sslkey,sslCert} configuration variables are to be
interpreted as a pathname that honors "~[username]/" prefix, but
weren't, which has been fixed.

* jc/http-sslkey-and-ssl-cert-are-paths:
  http.c: http.sslcert and http.sslkey are both pathnames
2017-08-23 14:33:43 -07:00
Junio C Hamano 447f80f508 Merge branch 'jk/ref-filter-colors' into maint
"%C(color name)" in the pretty print format always produced ANSI
color escape codes, which was an early design mistake.  They now
honor the configuration (e.g. "color.ui = never") and also tty-ness
of the output medium.

* jk/ref-filter-colors:
  ref-filter: consult want_color() before emitting colors
  pretty: respect color settings for %C placeholders
  rev-list: pass diffopt->use_colors through to pretty-print
  for-each-ref: load config earlier
  color: check color.ui in git_default_config()
  ref-filter: pass ref_format struct to atom parsers
  ref-filter: factor out the parsing of sorting atoms
  ref-filter: make parse_ref_filter_atom a private function
  ref-filter: provide a function for parsing sort options
  ref-filter: move need_color_reset_at_eol into ref_format
  ref-filter: abstract ref format into its own struct
  ref-filter: simplify automatic color reset
  t: use test_decode_color rather than literal ANSI codes
  docs/for-each-ref: update pointer to color syntax
  check return value of verify_ref_format()
2017-08-23 14:33:42 -07:00
Junio C Hamano f613b251da Merge branch 'js/git-gui-msgfmt-on-windows' into maint
Because recent Git for Windows do come with a real msgfmt, the
build procedure for git-gui has been updated to use it instead of a
hand-rolled substitute.

* js/git-gui-msgfmt-on-windows:
  git-gui (MinGW): make use of MSys2's msgfmt
  git gui: allow for a long recentrepo list
  git gui: de-dup selected repo from recentrepo history
  git gui: cope with duplicates in _get_recentrepo
  git-gui: remove duplicate entries from .gitconfig's gui.recentrepo
2017-08-23 14:33:42 -07:00
Junio C Hamano ab86f93d68 The third batch post 2.14
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-23 14:16:00 -07:00
Junio C Hamano 883bac8f7f Merge branch 'mg/format-ref-doc-fix'
Doc fix.

* mg/format-ref-doc-fix:
  Documentation/git-for-each-ref: clarify peeling of tags for --format
  Documentation: use proper wording for ref format strings
2017-08-23 14:13:15 -07:00
Junio C Hamano 4add209e2c Merge branch 'sb/submodule-parallel-update'
Code clean-up.

* sb/submodule-parallel-update:
  submodule.sh: remove unused variable
2017-08-23 14:13:14 -07:00
Junio C Hamano 0f8472a497 Merge branch 'jc/diff-sane-truncate-no-more'
Code clean-up.

* jc/diff-sane-truncate-no-more:
  diff: retire sane_truncate_fn
2017-08-23 14:13:13 -07:00
Junio C Hamano 45121b9e30 Merge branch 'hv/t5526-andand-chain-fix'
Test fix.

* hv/t5526-andand-chain-fix:
  t5526: fix some broken && chains
2017-08-23 14:13:13 -07:00
Junio C Hamano 85c81a74e2 Merge branch 'as/grep-quiet-no-match-exit-code-fix'
"git grep -L" and "git grep --quiet -L" reported different exit
codes; this has been corrected.

* as/grep-quiet-no-match-exit-code-fix:
  git-grep: correct exit code with --quiet and -L
2017-08-23 14:13:12 -07:00
Junio C Hamano c3e034f0f0 Merge branch 'kw/commit-keep-index-when-pre-commit-is-not-run'
"git commit" used to discard the index and re-read from the filesystem
just in case the pre-commit hook has updated it in the middle; this
has been optimized out when we know we do not run the pre-commit hook.

* kw/commit-keep-index-when-pre-commit-is-not-run:
  commit: skip discarding the index if there is no pre-commit hook
2017-08-23 14:13:11 -07:00
Junio C Hamano 3830759c1c Merge branch 'sb/sha1-file-cleanup'
Code clean-up.

* sb/sha1-file-cleanup:
  sha1_file: make read_info_alternates static
2017-08-23 14:13:10 -07:00
Junio C Hamano 8a43d3bae5 Merge branch 'rs/t1002-do-not-use-sum'
Test simplification.

* rs/t1002-do-not-use-sum:
  t1002: stop using sum(1)
2017-08-23 14:13:09 -07:00
Junio C Hamano ef9408cfb5 Merge branch 'kd/stash-with-bash-4.4'
bash 4.4 or newer gave a warning on NUL byte in command
substitution done in "git stash"; this has been squelched.

* kd/stash-with-bash-4.4:
  stash: prevent warning about null bytes in input
2017-08-23 14:13:08 -07:00
Junio C Hamano 76be4487f0 Merge branch 'ah/doc-empty-string-is-false'
Doc update.

* ah/doc-empty-string-is-false:
  doc: clarify "config --bool" behaviour with empty string
2017-08-23 14:13:08 -07:00
Junio C Hamano ad7d3c3b39 Merge branch 'kw/rebase-progress'
"git rebase", especially when it is run by mistake and ends up
trying to replay many changes, spent long time in silence.  The
command has been taught to show progress report when it spends
long time preparing these many changes to replay (which would give
the user a chance to abort with ^C).

* kw/rebase-progress:
  rebase: turn on progress option by default for format-patch
  format-patch: have progress option while generating patches
2017-08-23 14:13:07 -07:00
Junio C Hamano 75010153e9 Merge branch 'ks/prepare-commit-msg-sample-fix'
An "oops" fix to a topic that is already in 'master'.

* ks/prepare-commit-msg-sample-fix:
  hook: use correct logical variable
2017-08-23 14:13:07 -07:00
Junio C Hamano 0ca2f3241a Merge branch 'nm/stash-untracked'
"git stash -u" used the contents of the committed version of the
".gitignore" file to decide which paths are ignored, even when the
file has local changes.  The command has been taught to instead use
the locally modified contents.

* nm/stash-untracked:
  stash: clean untracked files before reset
2017-08-23 14:13:07 -07:00
Junio C Hamano fa2a4bba2c Merge branch 'jt/sha1-file-cleanup'
Preparatory code clean-up.

* jt/sha1-file-cleanup:
  sha1_file: remove read_packed_sha1()
  sha1_file: set whence in storage-specific info fn
2017-08-23 14:13:07 -07:00
Jonathan Nieder b8f43b120b vcs-svn: move remaining repo_tree functions to fast_export.h
These used to be for manipulating the in-memory repo_tree structure,
but nowadays they are convenience wrappers to handle a few git-vs-svn
mismatches:

 1. Git does not track empty directories but Subversion does.  When
    looking up a path in git that Subversion thinks exists and finding
    nothing, we can safely assume that the path represents a
    directory.  This is needed when a later Subversion revision
    modifies that directory.

 2. Subversion allows deleting a file by copying.  In Git fast-import
    we have to handle that more explicitly as a deletion.

These are details of the tool's interaction with git fast-import.
Move them to fast_export.c, where other such details are handled.

This way the function names do not start with a repo_ prefix that
would clash with the repository object introduced in
v2.14.0-rc0~38^2~16 (repository: introduce the repository object,
2017-06-22) or an svn_ prefix that would clash with libsvn (in case
someone wants to link this code with libsvn some day).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-23 10:41:26 -07:00
Jonathan Nieder 9b0db33506 vcs-svn: remove repo_delete wrapper function
Since v1.7.10-rc0~118^2~4^2~4^2~3 (vcs-svn: pass paths through to
fast-import, 2010-12-13) this is an alias for fast_export_delete.
Remove the unnecessary layer of indirection.

No functional change intended.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-23 10:41:25 -07:00
Jonathan Nieder 21c7c2d92d vcs-svn: remove custom mode constants
In the rest of Git, these modes are spelled as S_IFDIR,
S_IFREG | 0644, S_IFREG | 0755, and S_IFLNK.  Use the same constants
in svn-fe for simplicity and consistency.

No functional change intended.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-23 10:41:24 -07:00
Jonathan Nieder 40222792fa vcs-svn: remove more unused prototypes and declarations
I forgot to remove these in v1.7.10-rc0~118^2~4^2~5^2~4 (vcs-svn:
eliminate repo_tree structure, 2010-12-10).

This finishes what was started in commit 36f63b50 (vcs-svn: remove
unused prototypes, 2017-08-21).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-23 10:41:20 -07:00
Jonathan Tan 4a4becfb23 Doc: clarify that pack-objects makes packs, plural
The documentation for pack-objects describes that it creates "a packed
archive of objects", which is confusing because it may create multiple
packs if --max-pack-size is set. Update the documentation to clarify
this, and explaining in which cases such a feature would be useful.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-23 10:39:41 -07:00
Michael Haggerty 4ff0f01cb7 refs: retry acquiring reference locks for 100ms
The philosophy of reference locking has been, "if another process is
changing a reference, then whatever I'm trying to do to it will
probably fail anyway because my old-SHA-1 value is probably no longer
current". But this argument falls down if the other process has locked
the reference to do something that doesn't actually change the value
of the reference, such as `pack-refs` or `reflog expire`. There
actually *is* a decent chance that a planned reference update will
still be able to go through after the other process has released the
lock.

So when trying to lock an individual reference (e.g., when creating
"refs/heads/master.lock"), if it is already locked, then retry the
lock acquisition for approximately 100 ms before giving up. This
should eliminate some unnecessary lock conflicts without wasting a lot
of time.

Add a configuration setting, `core.filesRefLockTimeout`, to allow this
setting to be tweaked.

Note: the function `get_files_ref_lock_timeout_ms()` cannot be private
to the files backend because it is also used by `write_pseudoref()`
and `delete_pseudoref()`, which are defined in `refs.c` so that they
can be used by other reference backends.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-23 10:37:21 -07:00
Michael J Gruber 9d89b35526 merge: save merge state earlier
If the `git merge` process is killed while waiting for the editor to
finish, the merge state is lost but the prepared merge msg and tree is kept.
So, a subsequent `git commit` creates a squashed merge even when the
user asked for proper merge commit originally.

Demonstrate the problem with a test crafted after the in t7502. The test
requires EXECKEEPSPID (thus does not run under MINGW).

Save the merge state earlier (in the non-squash case) so that it does
not get lost. This makes the test pass.

Reported-by: hIpPy <hippy2981@gmail.com>
Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-23 10:35:02 -07:00
Michael J Gruber 8e6a6bb360 merge: split write_merge_state in two
write_merge_state() writes out the merge heads, mode, and msg. But we
may want to write out heads, mode without the msg. So, split out heads
(+mode) into a separate function write_merge_heads() that is called by
write_merge_state().

No funtional change so far, except when these non-atomic writes are
interrupted: we write heads-mode-msg now when we used to write
heads-msg-mode.

Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-23 10:34:57 -07:00
Michael J Gruber 62dc42b937 merge: clarify call chain
prepare_to_commit() cannot be reached in the non-squash case:
It is called by merge_trivial() and finish_automerge() only, but the
calls to the latter are somewhat hard to track:

If option_commit is not set, the code in cmd_merge() uses a fake
conflict return code (ret=1) to avoid writing the tree, which also
avoids setting automerge_was_ok (just as in the proper ret==1 case), so
that finish_automerge() is not called.

To ensure that no code change breaks that assumption, safe-guard
prepare_to_commit() by a BUG() statement.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-23 10:34:41 -07:00
Junio C Hamano 6e96cb5286 rerere: allow approxidate in gc.rerereResolved/gc.rerereUnresolved
These two configuration variables are described in the documentation
to take an expiry period expressed in the number of days:

    gc.rerereResolved::
	    Records of conflicted merge you resolved earlier are
	    kept for this many days when 'git rerere gc' is run.
	    The default is 60 days.

    gc.rerereUnresolved::
	    Records of conflicted merge you have not resolved are
	    kept for this many days when 'git rerere gc' is run.
	    The default is 15 days.

There is no strong reason not to allow a more general "approxidate"
expiry specification, e.g. "5.days.ago", or "never".

Rename the config_get_expiry() helper introduced in the previous
step to git_config_get_expiry_in_days() and move it to a more
generic place, config.c, and use date.c::parse_expiry_date() to do
so.  Give it an ability to allow the caller to tell among three
cases (i.e. there is no "gc.rerereResolved" config, there is and it
is correctly parsed into the *expiry variable, and there was an
error in parsing the given value).  The current caller can work
correctly without using the return value, though.

In the future, we may find other variables that only allow an
integer that specifies "this many days" or other unit of time, and
when it happens we may need to drop "_days" suffix from the name of
the function and instead pass the "scale" value as another parameter.

But this will do for now.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-22 14:51:02 -07:00
Junio C Hamano 5ea82279c0 rerere: represent time duration in timestamp_t internally
The two configuration variables, gc.rerereResolved and
gc.rerereUnresolved, are measured in days and are passed as such
into the prune_one() helper function, which worked in time_t to see
if an entry in the rerere database is past its expiry.

Instead, have the caller turn the number of days into the expiry
timestamp.  Further, use timestamp_t instead of time_t.  This will
make it possible to extend the way the configuration variable is
spelled by using date.c::parse_expiry_date() that gives the expiry
timestamp in timestamp_t.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-22 14:51:02 -07:00
Junio C Hamano e579aaa64d t4200: parameterize "rerere gc" custom expiry test
The test creates a rerere database entry that is two days old, and
tries to expire with three different custom expiry configuration
(keep ones less than 5 days old, keep ones used less than 5 days
ago, and expire everything right now).

We'll be introducing a different way to spell the same "5 days" and
"right now" parameter in a later step; parameterize the test to make
it easier to test the new spelling when it happens.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-22 14:51:02 -07:00
Junio C Hamano 1ad8b47354 t4200: gather "rerere gc" together
Move the "rerere gc with custom expiry" test up, so that it is close
to the existing basic "rerere gc" tests.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-22 14:51:02 -07:00