git
9 years agocache-tree: do not try to use an invalidated subtree info to build a tree
Junio C Hamano [Tue, 2 Sep 2014 21:16:20 +0000 (14:16 -0700)] 
cache-tree: do not try to use an invalidated subtree info to build a tree

We punt from repairing the cache-tree during a branch switching if
it involves having to create a new tree object that does not yet
exist in the object store.  "mkdir dir && >dir/file && git add dir"
followed by "git checkout" is one example, when a tree that records
the state of such "dir/" is not in the object store.

However, after discovering that we do not have a tree object that
records the state of "dir/", the caller failed to remember the fact
that it noticed the cache-tree entry it received for "dir/" is
invalidated, it already knows it should not be populating the level
that has "dir/" as its immediate subdirectory, and it is not an
error at all for the sublevel cache-tree entry gave it a bogus
object name it shouldn't even look at.

This led the caller to detect and report a non-existent error.  The
end result was the same and we avoided stuffing a non-existent tree
to the cache-tree, but we shouldn't have issued an alarming error
message to the user.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agocache-tree: Write updated cache-tree after commit
David Turner [Sun, 13 Jul 2014 20:28:19 +0000 (13:28 -0700)] 
cache-tree: Write updated cache-tree after commit

During the commit process, update the cache-tree. Write this updated
cache-tree so that it's ready for subsequent commands.

Add test code which demonstrates that git commit now writes the cache
tree.  Make all tests test the entire cache-tree, not just the root
level.

Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agocache-tree: subdirectory tests
David Turner [Fri, 11 Jul 2014 00:31:25 +0000 (17:31 -0700)] 
cache-tree: subdirectory tests

Add tests to confirm that invalidation of subdirectories neither over-
nor under-invalidates.

Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agotest-dump-cache-tree: invalid trees are not errors
David Turner [Tue, 8 Jul 2014 00:33:43 +0000 (17:33 -0700)] 
test-dump-cache-tree: invalid trees are not errors

Do not treat known-invalid trees as errors even when their subtree_nr is
incorrect.  Because git already knows that these trees are invalid,
an incorrect subtree_nr will not cause problems.

Add a couple of comments.

Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agocache-tree: create/update cache-tree on checkout
David Turner [Sun, 6 Jul 2014 04:06:56 +0000 (21:06 -0700)] 
cache-tree: create/update cache-tree on checkout

When git checkout checks out a branch, create or update the
cache-tree so that subsequent operations are faster.

update_main_cache_tree learned a new flag, WRITE_TREE_REPAIR.  When
WRITE_TREE_REPAIR is set, portions of the cache-tree which do not
correspond to existing tree objects are invalidated (and portions which
do are marked as valid).  No new tree objects are created.

Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'maint-1.8.5' into maint
Junio C Hamano [Wed, 2 Jul 2014 19:51:50 +0000 (12:51 -0700)] 
Merge branch 'maint-1.8.5' into maint

* maint-1.8.5:
  t7300: repair filesystem permissions with test_when_finished
  enums: remove trailing ',' after last item in enum

10 years agot7300: repair filesystem permissions with test_when_finished
Jeff King [Wed, 2 Jul 2014 18:44:30 +0000 (14:44 -0400)] 
t7300: repair filesystem permissions with test_when_finished

We create a directory that cannot be removed, confirm that
it cannot be removed, and then fix it like:

  chmod 0 foo &&
  test_must_fail git clean -d -f &&
  chmod 755 foo

If the middle step fails but leaves the directory (e.g., the
bug is that clean does not notice the failure), this
pollutes the test repo with an unremovable directory. Not
only does this cause further tests to fail, but it means
that "rm -rf" fails on the whole trash directory, and the
user has to intervene manually to even re-run the test script.

We can bump the "chmod 755" recovery to a test_when_finished
block to be sure that it always runs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoenums: remove trailing ',' after last item in enum
Ronnie Sahlberg [Wed, 2 Jul 2014 18:24:05 +0000 (11:24 -0700)] 
enums: remove trailing ',' after last item in enum

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoGit 2.0.1 v2.0.1
Junio C Hamano [Wed, 25 Jun 2014 19:21:11 +0000 (12:21 -0700)] 
Git 2.0.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'na/no-http-test-in-the-middle' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:50:13 +0000 (11:50 -0700)] 
Merge branch 'na/no-http-test-in-the-middle' into maint

The mode to run tests with HTTP server tests disabled was broken.

* na/no-http-test-in-the-middle:
  t5538: move http push tests out to t5542

10 years agoMerge branch 'jl/status-added-submodule-is-never-ignored' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:50:03 +0000 (11:50 -0700)] 
Merge branch 'jl/status-added-submodule-is-never-ignored' into maint

"git status" (and "git commit") behaved as if changes in a modified
submodule are not there if submodule.*.ignore configuration is set,
which was misleading.  The configuration is only to unclutter diff
output during the course of development, and should not to hide
changes in the "status" output to cause the users forget to commit
them.

* jl/status-added-submodule-is-never-ignored:
  commit -m: commit staged submodules regardless of ignore config
  status/commit: show staged submodules regardless of ignore config

10 years agoMerge branch 'ym/fix-opportunistic-index-update-race' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:49:48 +0000 (11:49 -0700)] 
Merge branch 'ym/fix-opportunistic-index-update-race' into maint

"git status", even though it is a read-only operation, tries to
update the index with refreshed lstat(2) info to optimize future
accesses to the working tree opportunistically, but this could
race with a "read-write" operation that modify the index while it
is running.  Detect such a race and avoid overwriting the index.

* ym/fix-opportunistic-index-update-race:
  read-cache.c: verify index file before we opportunistically update it
  wrapper.c: add xpread() similar to xread()

10 years agoMerge branch 'mk/show-s-no-extra-blank-line-for-merges' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:49:39 +0000 (11:49 -0700)] 
Merge branch 'mk/show-s-no-extra-blank-line-for-merges' into maint

"git show -s" (i.e. show log message only) used to incorrectly emit
an extra blank line after a merge commit.

* mk/show-s-no-extra-blank-line-for-merges:
  git-show: fix 'git show -s' to not add extra terminator after merge commit

10 years agoMerge branch 'rr/rebase-autostash-fix' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:49:31 +0000 (11:49 -0700)] 
Merge branch 'rr/rebase-autostash-fix' into maint

The autostash mode of "git rebase -i" did not restore the dirty
working tree state if the user aborted the interactive rebase by
emptying the insn sheet.

* rr/rebase-autostash-fix:
  rebase -i: test "Nothing to do" case with autostash
  rebase -i: handle "Nothing to do" case with autostash

10 years agoMerge branch 'jc/shortlog-ref-exclude' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:49:10 +0000 (11:49 -0700)] 
Merge branch 'jc/shortlog-ref-exclude' into maint

"git log --exclude=<glob> --all | git shortlog" worked as expected,
but "git shortlog --exclude=<glob> --all", which is supposed to be
identical to the above pipeline, was not accepted at the command
line argument parser level.

* jc/shortlog-ref-exclude:
  shortlog: allow --exclude=<glob> to be passed

10 years agoMerge branch 'jl/remote-rm-prune' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:49:01 +0000 (11:49 -0700)] 
Merge branch 'jl/remote-rm-prune' into maint

"git remote rm" and "git remote prune" can involve removing many
refs at once, which is not a very efficient thing to do when very
many refs exist in the packed-refs file.

* jl/remote-rm-prune:
  remote prune: optimize "dangling symref" check/warning
  remote: repack packed-refs once when deleting multiple refs
  remote rm: delete remote configuration as the last

10 years agoMerge branch 'fc/rerere-conflict-style' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:48:54 +0000 (11:48 -0700)] 
Merge branch 'fc/rerere-conflict-style' into maint

"git rerere forget" did not work well when merge.conflictstyle
was set to a non-default value.

* fc/rerere-conflict-style:
  rerere: fix for merge.conflictstyle

10 years agoMerge branch 'rs/pack-objects-no-unnecessary-realloc' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:48:42 +0000 (11:48 -0700)] 
Merge branch 'rs/pack-objects-no-unnecessary-realloc' into maint

"git pack-objects" unnecessarily copied the previous contents when
extending the hashtable, even though it will populate the table
from scratch anyway.

* rs/pack-objects-no-unnecessary-realloc:
  pack-objects: use free()+xcalloc() instead of xrealloc()+memset()

10 years agoMerge branch 'dt/merge-recursive-case-insensitive' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:48:34 +0000 (11:48 -0700)] 
Merge branch 'dt/merge-recursive-case-insensitive' into maint

On a case insensitive filesystem, merge-recursive incorrectly
deleted the file that is to be renamed to a name that is the same
except for case differences.

* dt/merge-recursive-case-insensitive:
  mv: allow renaming to fix case on case insensitive filesystems
  merge-recursive.c: fix case-changing merge bug

10 years agoMerge branch 'rs/mailinfo-header-cmp' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:48:23 +0000 (11:48 -0700)] 
Merge branch 'rs/mailinfo-header-cmp' into maint

"git mailinfo" used to read beyond the end of header string while
parsing an incoming e-mail message to extract the patch.

* rs/mailinfo-header-cmp:
  mailinfo: use strcmp() for string comparison

10 years agoMerge branch 'jk/index-pack-report-missing' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:48:13 +0000 (11:48 -0700)] 
Merge branch 'jk/index-pack-report-missing' into maint

The error reporting from "git index-pack" has been improved to
distinguish missing objects from type errors.

* jk/index-pack-report-missing:
  index-pack: distinguish missing objects from type errors

10 years agoMerge branch 'nd/index-pack-one-fd-per-thread' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:47:58 +0000 (11:47 -0700)] 
Merge branch 'nd/index-pack-one-fd-per-thread' into maint

We used to disable threaded "git index-pack" on platforms without
thread-safe pread(); use a different workaround for such
platforms to allow threaded "git index-pack".

* nd/index-pack-one-fd-per-thread:
  index-pack: work around thread-unsafe pread()

10 years agoMerge branch 'sk/spawn-less-case-insensitively-from-grep-O-i' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:47:49 +0000 (11:47 -0700)] 
Merge branch 'sk/spawn-less-case-insensitively-from-grep-O-i' into maint

"git grep -O" to show the lines that hit in the pager did not work
well with case insensitive search.  We now spawn "less" with its
"-I" option when it is used as the pager (which is the default).

* sk/spawn-less-case-insensitively-from-grep-O-i:
  git grep -O -i: if the pager is 'less', pass the '-I' option

10 years agoMerge branch 'nd/daemonize-gc' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:47:36 +0000 (11:47 -0700)] 
Merge branch 'nd/daemonize-gc' into maint

"git gc --auto" was recently changed to run in the background to
give control back early to the end-user sitting in front of the
terminal, but it forgot that housekeeping involving reflogs should
be done without other processes competing for accesses to the refs.

* nd/daemonize-gc:
  gc --auto: do not lock refs in the background

10 years agoMerge branch 'jk/diff-follow-must-take-one-pathspec' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:47:23 +0000 (11:47 -0700)] 
Merge branch 'jk/diff-follow-must-take-one-pathspec' into maint

"git format-patch" did not enforce the rule that the "--follow"
option from the log/diff family of commands must be used with
exactly one pathspec.

* jk/diff-follow-must-take-one-pathspec:
  move "--follow needs one pathspec" rule to diff_setup_done

10 years agoMerge branch 'jk/diff-files-assume-unchanged' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:47:09 +0000 (11:47 -0700)] 
Merge branch 'jk/diff-files-assume-unchanged' into maint

"git diff --find-copies-harder" sometimes pretended as if the mode
bits have changed for paths that are marked with assume-unchanged
bit.

* jk/diff-files-assume-unchanged:
  run_diff_files: do not look at uninitialized stat data

10 years agoMerge branch 'jk/commit-C-pick-empty' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:46:54 +0000 (11:46 -0700)] 
Merge branch 'jk/commit-C-pick-empty' into maint

"git commit --allow-empty-message -C $commit" did not work when the
commit did not have any log message.

* jk/commit-C-pick-empty:
  commit: do not complain of empty messages from -C

10 years agoMerge branch 'bc/blame-crlf-test' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:46:44 +0000 (11:46 -0700)] 
Merge branch 'bc/blame-crlf-test' into maint

"git blame" assigned the blame to the copy in the working-tree if
the repository is set to core.autocrlf=input and the file used CRLF
line endings.

* bc/blame-crlf-test:
  blame: correctly handle files regardless of autocrlf

10 years agoMerge branch 'jx/blame-align-relative-time' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:46:34 +0000 (11:46 -0700)] 
Merge branch 'jx/blame-align-relative-time' into maint

"git blame" miscounted number of columns needed to show localized
timestamps, resulting in jaggy left-side-edge of the source code
lines in its output.

* jx/blame-align-relative-time:
  blame: dynamic blame_date_width for different locales
  blame: fix broken time_buf paddings in relative timestamp

10 years agoMerge branch 'jc/apply-ignore-whitespace' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:46:23 +0000 (11:46 -0700)] 
Merge branch 'jc/apply-ignore-whitespace' into maint

"--ignore-space-change" option of "git apply" ignored the spaces
at the beginning of line too aggressively, which is inconsistent
with the option of the same name "diff" and "git diff" have.

* jc/apply-ignore-whitespace:
  apply --ignore-space-change: lines with and without leading whitespaces do not match

10 years agoMerge branch 'jk/complete-merge-pull' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:46:12 +0000 (11:46 -0700)] 
Merge branch 'jk/complete-merge-pull' into maint

The completion scripts (in contrib/) did not know about quite a few
options that are common between "git merge" and "git pull", and a
couple of options unique to "git merge".

* jk/complete-merge-pull:
  completion: add missing options for git-merge
  completion: add a note that merge options are shared

10 years agoMerge branch 'ow/config-mailmap-pathname' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:45:55 +0000 (11:45 -0700)] 
Merge branch 'ow/config-mailmap-pathname' into maint

The "mailmap.file" configuration option did not support the tilde
expansion (i.e. ~user/path and ~/path).

* ow/config-mailmap-pathname:
  config: respect '~' and '~user' in mailmap.file

10 years agoMerge branch 'as/pretty-truncate' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:45:31 +0000 (11:45 -0700)] 
Merge branch 'as/pretty-truncate' into maint

The "%<(10,trunc)%s" pretty format specifier in the log family of
commands is used to truncate the string to a given length (e.g. 10
in the example) with padding to column-align the output, but did
not take into account that number of bytes and number of display
columns are different.

* as/pretty-truncate:
  pretty.c: format string with truncate respects logOutputEncoding
  t4205, t6006: add tests that fail with i18n.logOutputEncoding set
  t4205 (log-pretty-format): use `tformat` rather than `format`
  t4041, t4205, t6006, t7102: don't hardcode tested encoding value
  t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs

10 years agoMerge branch 'jc/revision-dash-count-parsing' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:44:53 +0000 (11:44 -0700)] 
Merge branch 'jc/revision-dash-count-parsing' into maint

"git log -2master" is a common typo that shows two commits starting
from whichever random branch that is not 'master' that happens to
be checked out currently.

* jc/revision-dash-count-parsing:
  revision: parse "git log -<count>" more carefully

10 years agoMerge branch 'jk/report-fail-to-read-objects-better' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:43:57 +0000 (11:43 -0700)] 
Merge branch 'jk/report-fail-to-read-objects-better' into maint

Reworded the error message given upon a failure to open an existing
loose object file due to e.g. permission issues; it was reported as
the object being corrupt, but that is not quite true.

* jk/report-fail-to-read-objects-better:
  open_sha1_file: report "most interesting" errno

10 years agoMerge branch 'mn/sideband-no-ansi' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:43:43 +0000 (11:43 -0700)] 
Merge branch 'mn/sideband-no-ansi' into maint

Tools that read diagnostic output in our standard error stream do
not want to see terminal control sequence (e.g. erase-to-eol).
Detect them by checking if the standard error stream is connected
to a tty.

* mn/sideband-no-ansi:
  sideband.c: do not use ANSI control sequence on non-terminal

10 years agoMerge branch 'je/pager-do-not-recurse' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:43:07 +0000 (11:43 -0700)] 
Merge branch 'je/pager-do-not-recurse' into maint

We used to unconditionally disable the pager in the pager process
we spawn to feed out output, but that prevented people who want to
run "less" within "less" from doing so.

* je/pager-do-not-recurse:
  pager: do allow spawning pager recursively

10 years agoMerge branch 'jc/rev-parse-argh-dashed-multi-words' into maint
Junio C Hamano [Thu, 12 Jun 2014 19:17:57 +0000 (12:17 -0700)] 
Merge branch 'jc/rev-parse-argh-dashed-multi-words' into maint

* jc/rev-parse-argh-dashed-multi-words:
  update-index: fix segfault with missing --cacheinfo argument

10 years agopull: do not abuse 'break' inside a shell 'case'
Jacek Konieczny [Wed, 11 Jun 2014 08:47:45 +0000 (10:47 +0200)] 
pull: do not abuse 'break' inside a shell 'case'

It is not C. The code would break under mksh when 'pull.ff' is set:

  $ git pull
  /usr/lib/git-core/git-pull[67]: break: can't break
  Already up-to-date.

Signed-off-by: Jacek Konieczny <jajcus@jajcus.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorevision: parse "git log -<count>" more carefully
Junio C Hamano [Fri, 6 Jun 2014 22:33:25 +0000 (15:33 -0700)] 
revision: parse "git log -<count>" more carefully

This mistyped command line simply ignores "master" and ends up
showing two commits from the current HEAD:

    $ git log -2master

because we feed "2master" to atoi() without making sure that the
whole string is parsed as an integer.

Use the strtol_i() helper function instead.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoshortlog: allow --exclude=<glob> to be passed
Junio C Hamano [Fri, 30 May 2014 19:57:25 +0000 (12:57 -0700)] 
shortlog: allow --exclude=<glob> to be passed

These two commands are supposed to be equivalent:

  $ git log --exclude=refs/notes/\* --all --no-merges --since=2.days |
    git shortlog
  $ git shortlog --exclude=refs/notes/\* --all --no-merges --since=2.days

However, the latter does not understand the ref-exclusion command
line option, even though other options understood by "log", such as
"--all" and "--no-merges", are understood.

This was because e7b432c5 (revision: introduce --exclude=<glob> to
tame wildcards, 2013-08-30) did not wire the new option fully to the
machinery.  A new option understood by handle_revision_pseudo_opt()
must be told to handle_revision_opt() as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoupdate-index: fix segfault with missing --cacheinfo argument
Jeff King [Wed, 4 Jun 2014 07:11:11 +0000 (03:11 -0400)] 
update-index: fix segfault with missing --cacheinfo argument

Running "git update-index --cacheinfo" without any further
arguments results in a segfault rather than an error
message. Commit ec160ae (update-index: teach --cacheinfo a
new syntax "mode,sha1,path", 2014-03-23) added code to
examine the format of the argument, but forgot to handle the
NULL case.

Returning an error from the parser is enough, since we then
treat it as an old-style "--cacheinfo <mode> <sha1> <path>",
and complain that we have less than 3 arguments to read.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agopack-objects: use free()+xcalloc() instead of xrealloc()+memset()
René Scharfe [Sun, 1 Jun 2014 11:07:21 +0000 (13:07 +0200)] 
pack-objects: use free()+xcalloc() instead of xrealloc()+memset()

Whenever the hash table becomes too small then its size is increased,
the original part (and the added space) is zerod out using memset(),
and the table is rebuilt from scratch.

Simplify this proceess by returning the old memory using free() and
allocating the new buffer using xcalloc(), which already clears the
buffer for us.  That way we avoid copying the old hash table contents
needlessly inside xrealloc().

While at it, use the first array member with sizeof instead of a
specific type.  The old code used uint32_t and int, while index is
actually an array of int32_t.  Their sizes are the same basically
everywhere, so it's not actually a problem, but the new code is
cleaner and doesn't have to be touched should the type be changed.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agomailinfo: use strcmp() for string comparison
René Scharfe [Sun, 1 Jun 2014 09:00:40 +0000 (11:00 +0200)] 
mailinfo: use strcmp() for string comparison

The array header is defined as:

static const char *header[MAX_HDR_PARSED] = {
     "From","Subject","Date",
};

When looking for the index of a specfic string in that array, simply
use strcmp() instead of memcmp().  This avoids running over the end of
the string (e.g. with memcmp("Subject", "From", 7)) and gets rid of
magic string length constants.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosideband.c: do not use ANSI control sequence on non-terminal
Michael Naumov [Wed, 28 May 2014 03:12:15 +0000 (03:12 +0000)] 
sideband.c: do not use ANSI control sequence on non-terminal

Diagnostic messages received on the sideband #2 from the server side
are sent to the standard error with ANSI terminal control sequence
"\033[K" that erases to the end of line appended at the end of each
line.

However, some programs (e.g. GitExtensions for Windows) read and
interpret and/or show the message without understanding the terminal
control sequences, resulting them to be shown to their end users.
To help these programs, squelch the control sequence when the
standard error stream is not being sent to a tty.

NOTE: I considered to cover the case that a pager has already been
started. But decided that is probably not worth worrying about here,
though, as we shouldn't be using a pager for commands that do network
communications (and if we do, omitting the magic line-clearing signal
is probably a sane thing to do).

Thanks-to: Erik Faye-Lund <kusmabite@gmail.com>
Thanks-to: Jeff King <peff@peff.net>
Signed-off-by: Michael Naumov <mnaoumov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot5538: move http push tests out to t5542
Nick Alcock [Fri, 30 May 2014 17:36:21 +0000 (13:36 -0400)] 
t5538: move http push tests out to t5542

As 0232852b, but for the push tests instead: this avoids a start_httpd
in the middle of the file, which fails under GIT_TEST_HTTPD=false.

Note that we have to munge the test in a few ways while
moving it:

  1. We drop the `test -z "$GIT_TEST_HTTPD"` check; this is
     too simplistic since 83d842d, and we should let
     lib-httpd.sh handle it.

  2. We have to port over some of the old setup from t5538.

  3. In the final test, we no longer expect the extra commit
     "1" built on top of "4". This was a side effect from an
     earlier test in t5538 which was not ported over.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoSync with 1.9.4
Junio C Hamano [Fri, 30 May 2014 17:57:52 +0000 (10:57 -0700)] 
Sync with 1.9.4

10 years agoGit 1.9.4 v1.9.4
Junio C Hamano [Wed, 28 May 2014 22:50:22 +0000 (15:50 -0700)] 
Git 1.9.4

This is expected to be the final maintenance release for 1.9 series,
merging the remaining fixes that are relevant and are already in 2.0.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot5537: re-drop http tests
Jeff King [Fri, 30 May 2014 01:34:19 +0000 (21:34 -0400)] 
t5537: re-drop http tests

These were originally removed by 0232852 (t5537: move
http tests out to t5539, 2014-02-13). However, they were
accidentally re-added in 1ddb4d7 (Merge branch
'nd/upload-pack-shallow', 2014-03-21).

This looks like an error in manual conflict resolution.
Here's what happened:

  1. v1.9.0 shipped with the http tests in t5537.

  2. We realized that this caused problems, and built
     0232852 on top to move the tests to their own file.
     This fix made it into v1.9.1.

  3. We later had another fix in nd/upload-pack-shallow that
     also touched t5537. It was built directly on v1.9.0.

When we merged nd/upload-pack-shallow to master, we got a
conflict; it was built on a version with the http tests, but
we had since removed them. The correct resolution was to
drop the http tests and keep the new ones, but instead we
kept everything.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'rh/prompt-pcmode-avoid-eval-on-refname' into maint
Junio C Hamano [Wed, 28 May 2014 22:46:36 +0000 (15:46 -0700)] 
Merge branch 'rh/prompt-pcmode-avoid-eval-on-refname' into maint

* rh/prompt-pcmode-avoid-eval-on-refname:
  git-prompt.sh: don't assume the shell expands the value of PS1

10 years agoMerge branch 'mw/symlinks' into maint
Junio C Hamano [Wed, 28 May 2014 22:45:57 +0000 (15:45 -0700)] 
Merge branch 'mw/symlinks' into maint

* mw/symlinks:
  setup: fix windows path buffer over-stepping
  setup: don't dereference in-tree symlinks for absolute paths
  setup: add abspath_part_inside_repo() function
  t0060: add tests for prefix_path when path begins with work tree
  t0060: add test for prefix_path when path == work tree
  t0060: add test for prefix_path on symlinks via absolute paths
  t3004: add test for ls-files on symlinks via absolute paths

10 years agoGit 2.0 v2.0.0
Junio C Hamano [Wed, 28 May 2014 18:04:19 +0000 (11:04 -0700)] 
Git 2.0

10 years agoconfig: respect '~' and '~user' in mailmap.file
Øystein Walle [Tue, 27 May 2014 08:45:58 +0000 (10:45 +0200)] 
config: respect '~' and '~user' in mailmap.file

git_config_string() does not handle '~' and '~user' as part of the
value. Using git_config_pathname() fixes this.

Signed-off-by: Øystein Walle <oystwa@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogc --auto: do not lock refs in the background
Nguyễn Thái Ngọc Duy [Sun, 25 May 2014 00:38:29 +0000 (07:38 +0700)] 
gc --auto: do not lock refs in the background

9f673f9 (gc: config option for running --auto in background -
2014-02-08) puts "gc --auto" in background to reduce user's wait
time. Part of the garbage collecting is pack-refs and pruning
reflogs. These require locking some refs and may abort other processes
trying to lock the same ref. If gc --auto is fired in the middle of a
script, gc's holding locks in the background could fail the script,
which could never happen before 9f673f9.

Keep running pack-refs and "reflog --prune" in foreground to stop
parallel ref updates. The remaining background operations (repack,
prune and rerere) should not impact running git processes.

Reported-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoremote prune: optimize "dangling symref" check/warning
Jens Lindström [Fri, 23 May 2014 10:30:25 +0000 (12:30 +0200)] 
remote prune: optimize "dangling symref" check/warning

When 'git remote prune' was used to delete many refs in a repository
with many refs, a lot of time was spent checking for (now) dangling
symbolic refs pointing to the deleted ref, since warn_dangling_symref()
was once per deleted ref to check all other refs in the repository.

Avoid this using the new warn_dangling_symrefs() function which
makes one pass over all refs and checks for all the deleted refs in
one go, after they have all been deleted.

Signed-off-by: Jens Lindström <jl@opera.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoremote: repack packed-refs once when deleting multiple refs
Jens Lindström [Fri, 23 May 2014 10:29:45 +0000 (12:29 +0200)] 
remote: repack packed-refs once when deleting multiple refs

When 'git remote rm' or 'git remote prune' were used in a repository
with many refs, and needed to delete many remote-tracking refs, a lot
of time was spent deleting those refs since for each deleted ref,
repack_without_refs() was called to rewrite packed-refs without just
that deleted ref.

To avoid this, call repack_without_refs() first to repack without all
the refs that will be deleted, before calling delete_ref() to delete
each one completely.  The call to repack_without_ref() in delete_ref()
then becomes a no-op, since packed-refs already won't contain any of
the deleted refs.

Signed-off-by: Jens Lindström <jl@opera.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocompletion: add missing options for git-merge
John Keeping [Thu, 22 May 2014 13:58:38 +0000 (14:58 +0100)] 
completion: add missing options for git-merge

The options added to __git_merge_options are those that git-pull passes
to git-merge, since that variable is used by both commands.

Those added directly in _git_merge() are specific to git-merge and
are not passed thru from git-pull.

Reported-by: Haralan Dobrev <hkdobrev@gmail.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocompletion: add a note that merge options are shared
John Keeping [Thu, 22 May 2014 13:58:37 +0000 (14:58 +0100)] 
completion: add a note that merge options are shared

This should avoid future confusion after a subsequent patch has added
some options to __git_merge_options and some directly in _git_merge().

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoremote rm: delete remote configuration as the last
Jens Lindström [Fri, 23 May 2014 10:28:43 +0000 (12:28 +0200)] 
remote rm: delete remote configuration as the last

When removing a remote, delete the remote-tracking branches before
deleting the remote configuration.  This way, if the operation fails or
is aborted while deleting the remote-tracking branches, the command can
be rerun to complete the operation.

Signed-off-by: Jens Lindström <jl@opera.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoUpdate draft release notes to 2.0
Junio C Hamano [Wed, 21 May 2014 18:50:35 +0000 (11:50 -0700)] 
Update draft release notes to 2.0

Hopefully for the last time ;-)

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agopretty.c: format string with truncate respects logOutputEncoding
Alexey Shumkin [Wed, 21 May 2014 13:20:07 +0000 (17:20 +0400)] 
pretty.c: format string with truncate respects logOutputEncoding

Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given
length with an appropriate padding. This works for non-ASCII texts when
i18n.logOutputEncoding is UTF-8 only (independently of a printed commit
message encoding) but does not work when i18n.logOutputEncoding is NOT
UTF-8.

In 7e77df3 (pretty: two phase conversion for non utf-8 commits, 2013-04-19)
'format_commit_item' function assumes commit message to be in UTF-8.
And that was so until ecaee80 (pretty: --format output should honor
logOutputEncoding, 2013-06-26) where conversion to logOutputEncoding was
added before calling 'format_commit_message'.

Correct this by converting a commit message to UTF-8 first (as it
assumed in 7e77df3 (pretty: two phase conversion for non utf-8 commits,
2013-04-19)). Only after that convert a commit message to an actual
logOutputEncoding.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4205, t6006: add tests that fail with i18n.logOutputEncoding set
Alexey Shumkin [Wed, 21 May 2014 13:20:06 +0000 (17:20 +0400)] 
t4205, t6006: add tests that fail with i18n.logOutputEncoding set

Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given
length with an appropriate padding. This works for non-ASCII texts when
i18n.logOutputEncoding is UTF-8 only (independently of a printed commit
message encoding) but does not work when i18n.logOutputEncoding is NOT
UTF-8.

There were no breakages as far as were no tests for the case
when both a commit message and logOutputEncoding are not UTF-8.

Add failing tests for that which will be fixed in the next patch.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Helped-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Helped-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4205 (log-pretty-format): use `tformat` rather than `format`
Alexey Shumkin [Wed, 21 May 2014 13:20:05 +0000 (17:20 +0400)] 
t4205 (log-pretty-format): use `tformat` rather than `format`

Use `tformat` to avoid using of `echo` to complete end of line.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4041, t4205, t6006, t7102: don't hardcode tested encoding value
Alexey Shumkin [Wed, 21 May 2014 13:20:04 +0000 (17:20 +0400)] 
t4041, t4205, t6006, t7102: don't hardcode tested encoding value

The tested encoding is always available in a variable. Use it instead of
hardcoding. Also, to be in line with other tests use ISO8859-1
(uppercase) rather then iso8859-1.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoGit 2.0-rc4 v2.0.0-rc4
Junio C Hamano [Tue, 20 May 2014 19:07:35 +0000 (12:07 -0700)] 
Git 2.0-rc4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoRelNotes/2.0.0.txt: Fix several grammar issues, notably a lack of hyphens, double...
Jason St. John [Sat, 17 May 2014 03:30:34 +0000 (23:30 -0400)] 
RelNotes/2.0.0.txt: Fix several grammar issues, notably a lack of hyphens, double quotes, or articles

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoRevert "Merge branch 'jc/graduate-remote-hg-bzr' (early part)"
Junio C Hamano [Tue, 20 May 2014 21:18:11 +0000 (14:18 -0700)] 
Revert "Merge branch 'jc/graduate-remote-hg-bzr' (early part)"

Instead of showing a warning and working as before, fail and show
the message and force immediate upgrade from their upstream
repositories when these tools are run, per request from their
primary author.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorebase -i: test "Nothing to do" case with autostash
Matthieu Moy [Tue, 20 May 2014 07:49:31 +0000 (09:49 +0200)] 
rebase -i: test "Nothing to do" case with autostash

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agomove "--follow needs one pathspec" rule to diff_setup_done
Jeff King [Tue, 20 May 2014 06:49:20 +0000 (02:49 -0400)] 
move "--follow needs one pathspec" rule to diff_setup_done

Because of the way "--follow" is implemented, we must have
exactly one pathspec. "git log" enforces this restriction,
but other users of the revision traversal code do not. For
example, "git format-patch --follow" will segfault during
try_to_follow_renames, as we have no pathspecs at all.

We can push this check down into diff_setup_done, which is
probably a better place anyway. It is the diff code that
introduces this restriction, so other parts of the code
should not need to care themselves.

Reported-by: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'jc/graduate-remote-hg-bzr' (early part)
Junio C Hamano [Tue, 20 May 2014 00:12:36 +0000 (17:12 -0700)] 
Merge branch 'jc/graduate-remote-hg-bzr' (early part)

* 'jc/graduate-remote-hg-bzr' (early part):
  remote-helpers: point at their upstream repositories
  contrib: remote-helpers: add move warnings (v2.0)
  Revert "Merge branch 'fc/transport-helper-sync-error-fix'"

10 years agoremote-helpers: point at their upstream repositories
Junio C Hamano [Thu, 15 May 2014 21:58:16 +0000 (14:58 -0700)] 
remote-helpers: point at their upstream repositories

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib: remote-helpers: add move warnings (v2.0)
Felipe Contreras [Tue, 13 May 2014 21:29:56 +0000 (16:29 -0500)] 
contrib: remote-helpers: add move warnings (v2.0)

The tools are now maintained out-of-tree, and they have a regression
in v2.0. It's better to start warning the users as soon as possible.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoRevert "Merge branch 'fc/transport-helper-sync-error-fix'"
Junio C Hamano [Wed, 14 May 2014 19:06:35 +0000 (12:06 -0700)] 
Revert "Merge branch 'fc/transport-helper-sync-error-fix'"

This reverts commit d508e4a8e2391ae2596403b6478d01cf3d5f928f,
reversing changes made to e42552135a2a396f37053a89f44952ea907870b2.

The author of the original topic says he broke the upcoming 2.0
release with something that relates to "synchronization crash
regression" while refusing to give further specifics, so this would
unfortunately be the safest option for the upcoming release.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'rh/prompt-pcmode-avoid-eval-on-refname'
Junio C Hamano [Mon, 19 May 2014 23:10:10 +0000 (16:10 -0700)] 
Merge branch 'rh/prompt-pcmode-avoid-eval-on-refname'

* rh/prompt-pcmode-avoid-eval-on-refname:
  git-prompt.sh: don't assume the shell expands the value of PS1

10 years agogit-prompt.sh: don't assume the shell expands the value of PS1
Richard Hansen [Mon, 19 May 2014 22:55:37 +0000 (18:55 -0400)] 
git-prompt.sh: don't assume the shell expands the value of PS1

Not all shells subject the prompt string to parameter expansion.  Test
whether the shell will expand the value of PS1, and use the result to
control whether raw ref names are included directly in PS1.

This fixes a regression introduced in commit 8976500 ("git-prompt.sh:
don't put unsanitized branch names in $PS1"):  zsh does not expand PS1
by default, but that commit assumed it did.  The bug resulted in
prompts containing the literal string '${__git_ps1_branch_name}'
instead of the actual branch name.

Reported-by: Caleb Thompson <caleb@calebthompson.io>
Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorebase -i: handle "Nothing to do" case with autostash
Ramkumar Ramachandra [Mon, 19 May 2014 22:05:20 +0000 (18:05 -0400)] 
rebase -i: handle "Nothing to do" case with autostash

When a user invokes

  $ git rebase -i @~3

with dirty files and rebase.autostash turned on, and exits the $EDITOR
with an empty buffer, the autostash fails to apply. Although the primary
focus of rr/rebase-autostash was to get the git-rebase--backend.sh
scripts to return control to git-rebase.sh, it missed this case in
git-rebase--interactive.sh. Since this case is unlike the other cases
which return control for housekeeping, assign it a special return status
and handle that return value explicitly in git-rebase.sh.

Reported-by: Karen Etheridge <ether@cpan.org>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs
Alexey Shumkin [Mon, 19 May 2014 15:28:16 +0000 (19:28 +0400)] 
t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs

The expected SHA-1 digests are always available in variables. Use
them instead of hardcoding.

That was introduced in a742f2a (t4205 (log-pretty-formats): don't
hardcode SHA-1 in expected outputs, 2013-06-26) but unfortunately was
not followed in 5e1361c (log: properly handle decorations with chained
tags, 2013-12-17)

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'lt/request-pull'
Junio C Hamano [Mon, 19 May 2014 17:35:36 +0000 (10:35 -0700)] 
Merge branch 'lt/request-pull'

* lt/request-pull:
  request-pull: resurrect for-linus -> tags/for-linus DWIM

10 years agoMerge branch 'jl/use-vsatisfy-correctly-for-2.0'
Junio C Hamano [Mon, 19 May 2014 17:35:24 +0000 (10:35 -0700)] 
Merge branch 'jl/use-vsatisfy-correctly-for-2.0'

* jl/use-vsatisfy-correctly-for-2.0:
  git-gui: tolerate major version changes when comparing the git version

10 years agoMerge git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 19 May 2014 17:32:56 +0000 (10:32 -0700)] 
Merge git://github.com/git-l10n/git-po

* git://github.com/git-l10n/git-po:
  fr: a lot of good fixups

10 years agoMerge branch 'kb/fast-hashmap'
Junio C Hamano [Mon, 19 May 2014 17:32:25 +0000 (10:32 -0700)] 
Merge branch 'kb/fast-hashmap'

* kb/fast-hashmap:
  Documentation/technical/api-hashmap: remove source highlighting

10 years agoDocumentation/technical/api-hashmap: remove source highlighting
Anders Kaseorg [Sat, 17 May 2014 11:08:55 +0000 (07:08 -0400)] 
Documentation/technical/api-hashmap: remove source highlighting

The highlighting was pretty, but unfortunately, the failure mode
when source-highlight is not installed was that the entire code
block disappears.

See https://bugs.debian.org/745591,
    https://bugs.launchpad.net/bugs/1316810.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit-gui: tolerate major version changes when comparing the git version
Jens Lehmann [Sat, 17 May 2014 19:49:05 +0000 (21:49 +0200)] 
git-gui: tolerate major version changes when comparing the git version

Since git 2.0.0 starting git gui in a submodule using a gitfile fails with
the following error:

   No working directory ../../../<path>

   couldn't change working directory
   to "../../../<path>": no such file or
   directory

This is because "git rev-parse --show-toplevel" is only run when git gui
sees a git version of at least 1.7.0 (which is the version in which the
--show-toplevel option was introduced). But "package vsatisfies" returns
false when the major version changes, which is not what we want here.

Fix that for both places where the git version is checked using vsatisfies
by appending a '-' to the version number. This tells vsatisfies that a
change of the major version is not considered to be a problem, as long as
the new major version is larger. This is done for both the place that
caused the reported bug and another spot where the git version is tested
for another feature.

Reported-by: Chris Packham <judge.packham@gmail.com>
Reported-by: Yann Dirson <ydirson@free.fr>
Helped-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Tested-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agofr: a lot of good fixups
Grégoire Paris [Tue, 6 May 2014 21:29:57 +0000 (23:29 +0200)] 
fr: a lot of good fixups

Signed-off-by: Grégoire Paris <postmaster@greg0ire.fr>
Acked-by: Jean-Noel Avila <jn.avila@free.fr>
10 years agorequest-pull: resurrect for-linus -> tags/for-linus DWIM
Junio C Hamano [Fri, 16 May 2014 17:18:25 +0000 (10:18 -0700)] 
request-pull: resurrect for-linus -> tags/for-linus DWIM

Older versions of Git before v1.7.10 did not DWIM

    $ git pull $URL for-linus

to the tag "tags/for-linus" and the users were required to say

    $ git pull $URL tags/for-linus

instead.  Because newer versions of Git works either way,
request-pull used to show tags/for-linus when asked

    $ git request-pull origin/master $URL for-linus

The recent updates broke this and in the output we see "for-linus"
without the "tags/" prefix.

As v1.7.10 is more than 2 years old, this should matter very little
in practice, but resurrecting it is very simple.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit grep -O -i: if the pager is 'less', pass the '-I' option
Johannes Schindelin [Tue, 8 Feb 2011 06:17:24 +0000 (00:17 -0600)] 
git grep -O -i: if the pager is 'less', pass the '-I' option

When <command> happens to be the magic string "less", today

git grep -O<command> -e<pattern>

helpfully passes +/<pattern> to less so you can navigate through
the results within a file using the n and shift+n keystrokes.

Alas, that doesn't do the right thing for a case-insensitive match,
i.e.

git grep -i -O<command> -e<pattern>

For that case we should pass --IGNORE-CASE to "less" so that n and
shift+n can move between results ignoring case in the pattern.

The original patch came from msysgit and used "-i", but that was not
due to lack of support for "-I" but it merely overlooked that it
ought to work even when the pattern contains capital letters.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoopen_sha1_file: report "most interesting" errno
Jeff King [Thu, 15 May 2014 08:54:06 +0000 (04:54 -0400)] 
open_sha1_file: report "most interesting" errno

When we try to open a loose object file, we first attempt to
open in the local object database, and then try any
alternates. This means that the errno value when we return
will be from the last place we looked (and due to the way
the code is structured, simply ENOENT if we do not have have
any alternates).

This can cause confusing error messages, as read_sha1_file
checks for ENOENT when reporting a missing object. If errno
is something else, we report that. If it is ENOENT, but
has_loose_object reports that we have it, then we claim the
object is corrupted. For example:

    $ chmod 0 .git/objects/??/*
    $ git rev-list --all
    fatal: loose object b2d6fab18b92d49eac46dc3c5a0bcafabda20131 (stored in .git/objects/b2/d6fab18b92d49eac46dc3c5a0bcafabda20131) is corrupt

This patch instead keeps track of the "most interesting"
errno we receive during our search. We consider ENOENT to be
the least interesting of all, and otherwise report the first
error found (so problems in the object database take
precedence over ones in alternates). Here it is with this
patch:

    $ git rev-list --all
    fatal: failed to read object b2d6fab18b92d49eac46dc3c5a0bcafabda20131: Permission denied

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorun_diff_files: do not look at uninitialized stat data
Jeff King [Wed, 14 May 2014 22:13:06 +0000 (18:13 -0400)] 
run_diff_files: do not look at uninitialized stat data

If we try to diff an index entry marked CE_VALID (because it
was marked with --assume-unchanged), we do not bother even
running stat() on the file to see if it was removed. This
started long ago with 540e694 (Prevent diff machinery from
examining assume-unchanged entries on worktree, 2009-08-11).

However, the subsequent code may look at our "struct stat"
and expect to find actual data; currently it will find
whatever cruft was left on the stack. This can cause
problems in two situations:

  1. We call match_stat_with_submodule with the stat data,
     so a submodule may be erroneously marked as changed.

  2. If --find-copies-harder is in effect, we pass all
     entries, even unchanged ones, to diff_change, so it can
     list them as rename/copy sources. Since we found no
     change, we assume that function will realize it and not
     actually display any diff output. However, we end up
     feeding it a bogus mode, leading it to sometimes claim
     there was a mode change.

We can fix both by splitting the CE_VALID and regular code
paths, and making sure only to look at the stat information
in the latter. Furthermore, we push the declaration of our
"struct stat" down into the code paths that actually set it,
so we cannot accidentally access it uninitialized in future
code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit-show: fix 'git show -s' to not add extra terminator after merge commit
Max Kirillov [Wed, 14 May 2014 22:12:45 +0000 (01:12 +0300)] 
git-show: fix 'git show -s' to not add extra terminator after merge commit

When git show -s is called for merge commit it prints extra newline
after any merge commit. This differs from output for commits with one
parent. Fix it by more thorough checking that diff output is disabled.

The code in question exists since commit 3969cf7db1. The additional
newline is really needed for cases when patch is requested, test
t4013-diff-various.sh contains cases which can demonstrate behavior when
the condition is restricted further.

Tests:

Added merge commit to 'set up a bit of history' case in t7007-show.sh to
cover the fix.

Existing tests are updated to demonstrate the new behaviour.  Earlier,
the tests that used "git show -s --pretty=format:%s", even though
"--pretty=format:%s" calls for item separator semantics and does not ask
for the terminating newline after the last item, expected the output to
end with such a newline.  They were relying on the buggy behaviour.  Use
of "--format=%s", which is equivalent to "--pretty=tformat:%s" that asks
for a terminating newline after each item, is a more realistic way to
use the command.

In the test 'merge log messages' the expected data is changed, because
it was explicitly listing the extra newline. Also the msg.nologff and
msg.nolognoff expected files are replaced by one msg.nolog, because they
were diffing because of the bug, and now there should be no difference.

Signed-off-by: Max Kirillov <max@max630.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'fc/prompt-zsh-read-from-file'
Junio C Hamano [Tue, 13 May 2014 18:53:14 +0000 (11:53 -0700)] 
Merge branch 'fc/prompt-zsh-read-from-file'

* fc/prompt-zsh-read-from-file:
  contrib: completion: fix 'eread()' namespace

10 years agocontrib: completion: fix 'eread()' namespace
Felipe Contreras [Tue, 13 May 2014 13:21:19 +0000 (08:21 -0500)] 
contrib: completion: fix 'eread()' namespace

Otherwise it might collide with a function of the same name in the
user's environment.

Suggested-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoindex-pack: distinguish missing objects from type errors
Jeff King [Mon, 12 May 2014 04:38:39 +0000 (00:38 -0400)] 
index-pack: distinguish missing objects from type errors

When we fetch a pack that does not contain an object we
expected to receive, we get an error like:

  $ git init --bare tmp.git && cd tmp.git
  $ git fetch ../parent.git
  [...]
  error: Could not read 964953ec7bcc0245cb1d0db4095455edd21a2f2e
  fatal: Failed to traverse parents of commit b8247b40caf6704fe52736cdece6d6aae87471aa
  error: ../parent.git did not send all necessary objects

This comes from the check_everything_connected rev-list. If
we try cloning the same repo (rather than a fetch), we end
up using index-pack's --check-self-contained-and-connected
option instead, which produces output like:

  $ git clone --no-local --bare parent.git tmp.git
  [...]
  fatal: object of unexpected type
  fatal: index-pack failed

Not only is the sha1 missing, but it's a misleading message.
There's no type problem, but rather a missing object
problem; we don't notice the difference because we simply
compare OBJ_BAD != OBJ_BLOB.  Let's provide a different
message for this case:

  $ git clone --no-local --bare parent.git tmp.git
  fatal: did not receive expected object 6b00a8c61ed379d5f925a72c1987c9c52129d364
  fatal: index-pack failed

While we're at it, let's also improve a true type mismatch
error to look like

  fatal: object 6b00a8c61ed379d5f925a72c1987c9c52129d364: expected type blob, got tree

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 12 May 2014 17:12:05 +0000 (10:12 -0700)] 
Merge git://github.com/git-l10n/git-po

* git://github.com/git-l10n/git-po:
  l10n: Updated Bulgarian translation of git (1307t0f921u)

10 years agol10n: Updated Bulgarian translation of git (1307t0f921u)
Alexander Shopov [Wed, 29 Jan 2014 13:08:40 +0000 (15:08 +0200)] 
l10n: Updated Bulgarian translation of git (1307t0f921u)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
10 years agoGit 2.0-rc3 v2.0.0-rc3
Junio C Hamano [Fri, 9 May 2014 18:23:25 +0000 (11:23 -0700)] 
Git 2.0-rc3

10 years agoSync with 1.9.3
Junio C Hamano [Fri, 9 May 2014 18:00:48 +0000 (11:00 -0700)] 
Sync with 1.9.3

10 years agoGit 1.9.3 v1.9.3
Junio C Hamano [Fri, 9 May 2014 17:59:07 +0000 (10:59 -0700)] 
Git 1.9.3

The third maintenance release for Git 1.9; contains all the fixes
that are scheduled to appear in Git 2.0 since 1.9.2.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoblame: correctly handle files regardless of autocrlf
brian m. carlson [Sat, 26 Apr 2014 23:10:40 +0000 (23:10 +0000)] 
blame: correctly handle files regardless of autocrlf

If a file contained CRLF line endings in a repository with
core.autocrlf=input, then blame always marked lines as "Not
Committed Yet", even if they were unmodified.  Don't attempt to
convert the line endings when creating the fake commit so that blame
works correctly regardless of the autocrlf setting.

Reported-by: Ephrim Khong <dr.khong@gmail.com>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agomv: allow renaming to fix case on case insensitive filesystems
David Turner [Thu, 8 May 2014 17:23:34 +0000 (10:23 -0700)] 
mv: allow renaming to fix case on case insensitive filesystems

"git mv hello.txt Hello.txt" on a case insensitive filesystem
always triggers "destination already exists" error, because these
two names refer to the same path from the filesystem's point of
view, and requires the user to give "--force" when correcting the
case of the path recorded in the index and in the next commit.

Detect this case and allow it without requiring "--force".

Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoSync with maint
Junio C Hamano [Thu, 8 May 2014 18:59:51 +0000 (11:59 -0700)] 
Sync with maint

* maint:
  shell doc: remove stray "+" in example
  Start preparing for 1.9.3