Commit Graph

42403 Commits

Author SHA1 Message Date
Johannes Schindelin
55e9f0e5c9 merge-recursive: handle NULL in add_cacheinfo() correctly
1335d76e45 ("merge: avoid "safer crlf" during recording of merge
results", 2016-07-08) tried to split make_cache_entry() call made
with CE_MATCH_REFRESH into a call to make_cache_entry() without one,
followed by a call to add_cache_entry(), refresh_cache() and another
add_cache_entry() as needed.  However the conversion was botched in
that it forgot that refresh_cache() can return NULL, which was
handled correctly in make_cache_entry() but in the updated code.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-28 11:00:04 -08:00
Johannes Schindelin
05f2dfb965 cherry-pick: demonstrate a segmentation fault
In https://github.com/git-for-windows/git/issues/952, a complicated
scenario was described that leads to a segmentation fault in
cherry-pick.

It boils down to a certain code path involving a renamed file that is
dirty, for which `refresh_cache_entry()` returns `NULL`, and that
`NULL` not being handled properly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-28 10:46:28 -08:00
Junio C Hamano
1335d76e45 merge: avoid "safer crlf" during recording of merge results
When merge_recursive() decides what the correct blob object merge
result for a path should be, it uses update_file_flags() helper
function to write it out to a working tree file and then calls
add_cacheinfo().  The add_cacheinfo() function in turn calls
make_cache_entry() to create a new cache entry to replace the
higher-stage entries for the path that represents the conflict.

The make_cache_entry() function calls refresh_cache_entry() to fill
in the cached stat information.  To mark a cache entry as
up-to-date, the data is re-read from the file in the working tree,
and goes through convert_to_git() conversion to be compared with the
blob object name the new cache entry records.

It is important to note that this happens while the higher-stage
entries, which are going to be replaced with the new entry, are
still in the index.  Unfortunately, the convert_to_git() conversion
has a misguided "safer crlf" mechanism baked in, and looks at the
existing cache entry for the path to decide how to convert the
contents in the working tree file.  If our side (i.e. stage#2)
records a text blob with CRLF in it, even when the system is
configured to record LF in blobs and convert them to CRLF upon
checkout (and back to LF upon checkin), the "safer crlf" mechanism
stops us doing so.

This especially poses a problem during a renormalizing merge, where
the merge result for the path is computed by first "normalizing" the
blobs involved in the merge by using convert_to_working_tree()
followed by convert_to_git() with "safer crlf" disabled.  The merge
result that is computed correctly and fed to add_cacheinfo() via
update_file_flags() does _not_ match what refresh_cache_entry() sees
by converting the working tree file via convert_to_git().

We can work this around by not refreshing the new cache entry in
make_cache_entry() called by add_cacheinfo().  After add_cacheinfo()
adds the new entry, we can call refresh_cache_entry() on that,
knowing that addition of this new cache entry would have removed the
stale cache entries that had CRLF in stage #2 that were carried over
before the renormalizing merge started and will not interfere with
the correct recording of the result.

The test update was taken from a series by Torsten Bögershausen
that attempted to fix this with a different approach.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Reviewed-by: Torsten Bögershausen <tboegi@web.de>
2016-07-12 13:06:43 -07:00
Torsten Bögershausen
6523728499 convert: unify the "auto" handling of CRLF
Before this change,
$ echo "* text=auto" >.gitattributes
$ echo "* eol=crlf" >>.gitattributes

would have the same effect as
$ echo "* text" >.gitattributes
$ git config core.eol crlf

Since the 'eol' attribute had higher priority than 'text=auto', this may
corrupt binary files and is not what most users expect to happen.

Make the 'eol' attribute to obey 'text=auto' and now
$ echo "* text=auto" >.gitattributes
$ echo "* eol=crlf" >>.gitattributes
behaves the same as
$ echo "* text=auto" >.gitattributes
$ git config core.eol crlf

In other words,
$ echo "* text=auto eol=crlf" >.gitattributes
has the same effect as
$ git config core.autocrlf true

and
$ echo "* text=auto eol=lf" >.gitattributes
has the same effect as
$ git config core.autocrlf input

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-06 11:53:51 -07:00
Torsten Bögershausen
caa47adc5a convert.c: ident + core.autocrlf didn't work
When the ident attributes is set, get_stream_filter() did not obey
core.autocrlf=true, and the file was checked out with LF.

Change the rule when a streaming filter can be used:
- if an external filter is specified, don't use a stream filter.
- if the worktree eol is CRLF and "auto" is active, don't use a stream filter.
- Otherwise the stream filter can be used.

Add test cases in t0027.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-25 12:12:03 -07:00
Torsten Bögershausen
67e9bff06a t0027: test cases for combined attributes
Add more test cases for the not normalized files ("NNO"). The
"text" attribute is most important, use it as the first parameter.
"ident", if set, is the second paramater followed by the eol
attribute.  The eol attribute overrides core.autocrlf, which
overrides core.eol.
indent is not yet used, this will be done in the next commit.

Use loops to test more combinations of attributes, like
"* text eol=crlf" or especially "*text=auto eol=crlf".

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-25 12:12:03 -07:00
Torsten Bögershausen
70ad8c8d8c convert: allow core.autocrlf=input and core.eol=crlf
Even though the configuration parser errors out when core.autocrlf
is set to 'input' when core.eol is set to 'crlf', there is no need
to do so, because the core.autocrlf setting trumps core.eol.

Allow all combinations of core.crlf and core.eol and document
that core.autocrlf overrides core.eol.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-25 12:11:45 -07:00
Torsten Bögershausen
ded2444ad8 t0027: make commit_chk_wrnNNO() reliable
When the content of a commited file is unchanged and the attributes
are changed, Git may not detect that the next commit must treat the
file as changed.  This happens when lstat() doesn't detect a change,
since neither inode, mtime nor size are changed.

Add a single "Z" character to change the file size and content.
When the files are compared later in checkout_files(), the "Z" is
removed before the comparison.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-25 12:10:48 -07:00
Junio C Hamano
90f7b16b3a Git 2.8
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-28 12:19:45 -07:00
Junio C Hamano
56331f8727 Merge branch 'ls/p4-doc-markup'
* ls/p4-doc-markup:
  Documentation: fix git-p4 AsciiDoc formatting
  Documentation: use ASCII quotation marks in git-p4
2016-03-24 12:28:06 -07:00
Junio C Hamano
269fe3aed4 Merge branch 'js/mingw-tests-2.8'
* js/mingw-tests-2.8:
  mingw: skip some tests in t9115 due to file name issues
  t1300: fix the new --show-origin tests on Windows
  t1300-repo-config: make it resilient to being run via 'sh -x'
  config --show-origin: report paths with forward slashes
2016-03-24 12:27:58 -07:00
Junio C Hamano
2a4c8c36a7 Merge branch 'sb/submodule-module-list-pathspec-fix'
A fix for a small regression in "module_list" helper that was
rewritten in C (also applies to 2.7.x).

* sb/submodule-module-list-pathspec-fix:
  submodule: fix regression for deinit without submodules
2016-03-24 12:27:13 -07:00
Junio C Hamano
7e4ba3686a Merge branch 'master' of git://github.com/git-l10n/git-po
* 'master' of git://github.com/git-l10n/git-po:
  l10n: pt_PT: Update and add new translations
  l10n: ca.po: update translation
  l10n: vi.po (2530t): Update translation
2016-03-23 12:22:42 -07:00
Lars Schneider
887523ebb8 Documentation: fix git-p4 AsciiDoc formatting
Noticed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-23 10:09:11 -07:00
Johannes Schindelin
8257d3b458 mingw: skip some tests in t9115 due to file name issues
These two tests wanted to write file names which are incompatible with
Windows' file naming rules (even if they pass using Cygwin due to
Cygwin's magic path mangling).

While at it, skip the same tests also on MacOSX/HFS, as pointed out by
Torsten Bögershausen.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-23 10:03:37 -07:00
Johannes Schindelin
45bf32971c t1300: fix the new --show-origin tests on Windows
On Windows, we have that funny situation where the test script can refer
to POSIX paths because it runs in a shell that uses a POSIX emulation
layer ("MSYS2 runtime"). Yet, git.exe does *not* understand POSIX paths
at all but only pure Windows paths.

So let's just convert the POSIX paths to Windows paths before passing
them on to Git, using `pwd` (which is already modified on Windows to
output Windows paths).

While fixing the new tests on Windows, we also have to exclude the tests
that want to write a file with a name that is illegal on Windows
(unfortunately, there is more than one test trying to make use of that
file).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-23 10:02:46 -07:00
Johannes Schindelin
2ec20212c5 t1300-repo-config: make it resilient to being run via 'sh -x'
One way to diagnose broken regression tests is to run the test
script using 'sh -x t... -i -v' to find out which call actually
demonstrates the symptom.

Hence it is pretty counterproductive if the test script behaves
differently when being run via 'sh -x', in particular when using
test_cmp or test_i18ncmp on redirected stderr.  A more recent way
"sh tXXXX -i -v -x" has the same issue.

So let's use test_i18ngrep (as suggested by Jonathan Nieder) instead of
test_cmp/test_i18ncmp to verify that stderr looks as expected.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-23 09:59:21 -07:00
Johannes Schindelin
5ca6b7bb47 config --show-origin: report paths with forward slashes
On Windows, the backslash is the native directory separator, but all
supported Windows versions also accept the forward slash in most
circumstances.

Our tests expect forward slashes.

Relative paths are generated by Git using forward slashes.

So let's try to be consistent and use forward slashes in the $HOME part
of the paths reported by `git config --show-origin`, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-23 09:58:48 -07:00
Jiang Xin
103ee5c21e Merge branch 'master' of https://github.com/vnwildman/git
* 'master' of https://github.com/vnwildman/git:
  l10n: vi.po (2530t): Update translation
2016-03-23 23:01:51 +08:00
Jiang Xin
70749562fb Merge branch 'master' of git://github.com/alexhenrie/git-po
* 'master' of git://github.com/alexhenrie/git-po:
  l10n: ca.po: update translation
2016-03-23 22:48:14 +08:00
Stefan Beller
84ba959bbd submodule: fix regression for deinit without submodules
Per Cederqvist wrote:
> It used to be possible to run
>
>    git submodule deinit -f .
>
> to remove any submodules, no matter how many submodules you had.  That
> is no longer possible in projects that don't have any submodules at
> all.  The command will fail with:
>
>     error: pathspec '.' did not match any file(s) known to git.

This regression was introduced in 74703a1e4d (submodule: rewrite
`module_list` shell function in C, 2015-09-02), as we changed the
order of checking in new module listing to first check whether it is
a gitlin before feeding it to match_pathspec().  It used to be that
a pathspec that does not match any path were diagnosed as an error,
but the new code complains for a pathspec that does not match any
submodule path.

Arguably the new behaviour may give us a better diagnosis, but that
is inconsistent with the suggestion "deinit" gives, and also this
was an unintended accident.  The new behaviour hopefully can be
redesigned and implemented better in future releases, but for now,
switch these two checks to restore the same behavior as before.  In
an empty repository, giving the pathspec '.' will still get the same
"did not match" error, but that is the same bug we had before 1.7.0.

Reported-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-22 19:26:43 -07:00
Vasco Almeida
b3076a0920 l10n: pt_PT: Update and add new translations
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
2016-03-22 16:23:56 -01:00
Alex Henrie
4ee278bb34 l10n: ca.po: update translation
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
2016-03-21 23:04:22 -06:00
Junio C Hamano
808ecd4cca Git 2.8-rc4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-21 13:41:37 -07:00
Junio C Hamano
fb238fb4ba Sync with maint
* maint:
  Documentation: fix broken linkgit to git-config
  git-compat-util: st_add4: work around gcc 4.2.x compiler crash
2016-03-21 13:32:42 -07:00
Junio C Hamano
a0feb1b187 Merge branch 'mm/doc-hooks-linkgit-fix' into maint
* mm/doc-hooks-linkgit-fix:
  Documentation: fix broken linkgit to git-config
2016-03-21 13:32:18 -07:00
Matthieu Moy
ad52148a7d Documentation: fix broken linkgit to git-config
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-21 13:31:57 -07:00
Lars Schneider
c6a896b65e Documentation: use ASCII quotation marks in git-p4
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-21 11:14:24 -07:00
Junio C Hamano
074677315c Merge branch 'tb/avoid-gcc-on-darwin-10-6'
* tb/avoid-gcc-on-darwin-10-6:
  Revert "config.mak.uname: use clang for Mac OS X 10.6"
2016-03-21 09:20:13 -07:00
Eric Sunshine
c0ed7590ce Revert "config.mak.uname: use clang for Mac OS X 10.6"
This reverts commit 7b6daf8d2f.

Now that st_add4() has been patched to work around the gcc 4.2.x
compiler crash, revert the sledge-hammer approach of forcing Mac OS X
10.6 to unconditionally use 'clang' rather than the default compiler
(gcc).

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-21 09:20:02 -07:00
Junio C Hamano
2ab5c88642 Merge branch 'es/st-add4-gcc-4.2-workaround' into maint
* es/st-add4-gcc-4.2-workaround:
  git-compat-util: st_add4: work around gcc 4.2.x compiler crash
2016-03-21 09:19:27 -07:00
Eric Sunshine
d616fbf256 git-compat-util: st_add4: work around gcc 4.2.x compiler crash
Although changes by 5b442c4 (tree-diff: catch integer overflow in
combine_diff_path allocation, 2016-02-19) are perfectly valid, they
unfortunately trigger an internal compiler error in gcc 4.2.x:

    combine-diff.c: In function 'diff_tree_combined':
    combine-diff.c:1391: internal compiler error: Segmentation fault: 11

Experimentation reveals that changing st_add4()'s argument evaluation
order is sufficient to sidestep this problem.

Although st_add3() does not trigger the compiler bug, for style
consistency, change its argument evaluation order to match.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-21 09:18:07 -07:00
Junio C Hamano
b552ff8c67 l10n-2.8.0-rnd3
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJW7oL/AAoJEMek6Rt1RHooLCYP/2VFyDz9HHqMD6/qARnlbN8M
 4b5BbBjrvfEyeuVh3u6ACdfjpBOgTwsR0HiKjflSdkt8oz9sMHMNYGp6HjjIoRDd
 SVkYvfJalT7nGdHV3BbUMccLxzy8Vc9Df2usBYQC3Xl2xqcTVsiJJs0JYp1VKZxd
 tEvDa/q2sIh/j4sD5lZSq7Kf456xFGl3UljUlEEwf5dAs+2DHN1GzOt/8Rw4yV3M
 XZLxfnAnQWKNOi6+XSxPAysSClOnjbO9igPhWSWmKm7/vtoklNAVPGIN+dlvSvZD
 ixNJWyfgfD/4/RbfC0+VTIojloA0a4iigb3J9B/+zdv3NDPjwxISgTTaTVKYSgbn
 YPTKedKmCNpQe2dsJRawLxzi62tW57eB2oHZhrhACBHobYTF0BU/XusP6bkpVBqH
 xcBQc+lvrNgWsualCnNYdl3dIMHkEJg/UxVDyLHXVi9yDrrdp3m9x12LNn3serNd
 CRlds4B8UIlp8A1DxR3PonXm06JmumZP05GhjXhRCgWPt8MFg28VifRmgKISAk6Q
 OWaC721i1lq23BZy+iyvpcadSZpEl/p3zHw4lvIMH/Mhpat0Q/EYM4h0N7dkyp+U
 JKrGbd4IJrVoVBd79SijIb8muO7UwVLzDwqd/NLvapLp7UrRIDrOKz5xTtO9QZhU
 llz0WX9hJyjv5bTHrB4y
 =o2YU
 -----END PGP SIGNATURE-----

Merge tag 'l10n-2.8.0-rnd3' of git://github.com/git-l10n/git-po

l10n-2.8.0-rnd3

* tag 'l10n-2.8.0-rnd3' of git://github.com/git-l10n/git-po:
  l10n: zh_CN: review for git v2.8.0 l10n round 2
  l10n: de.po: add missing newlines
  l10n: de.po: translate 22 new messages
  l10n: ko.po: Update Korean translation
  l10n: fr.po v2.8.0 round 3
  l10n: sv.po: Update Swedish translation (2530t0f0u)
  l10n: ru.po: update Russian translation
2016-03-20 18:06:05 -07:00
Junio C Hamano
257000c617 Merge branch 'master' of git://ozlabs.org/~paulus/gitk
* 'master' of git://ozlabs.org/~paulus/gitk:
  gitk: Follow themed bgcolor in help dialogs
  gitk: fr.po: Sync translations with git
  gitk: Update French translation (311t)
  gitk: Update German translation
  gitk: Update Bulgarian translation (311t)
2016-03-20 18:05:10 -07:00
Tran Ngoc Quan
c2d674031f l10n: vi.po (2530t): Update translation
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2016-03-21 07:21:04 +07:00
Ray Chen
26e4cbec45 l10n: zh_CN: review for git v2.8.0 l10n round 2
Signed-off-by: Ray Chen <oldsharp@gmail.com>
2016-03-20 18:46:02 +08:00
Guillermo S. Romero
22a713c72d gitk: Follow themed bgcolor in help dialogs
Make Help > About & Key bindings dialogs readable if theme
has changed font color to something incompatible with white.

Signed-off-by: Guillermo S. Romero <gsromero@infernal-iceberg.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2016-03-19 14:12:21 +11:00
Jean-Noel Avila
ffbd0d77eb gitk: fr.po: Sync translations with git
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2016-03-19 14:08:52 +11:00
Jean-Noel Avila
3782d70676 gitk: Update French translation (311t)
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2016-03-19 14:08:52 +11:00
Ralf Thielow
fec7b51ec4 gitk: Update German translation
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2016-03-19 14:07:34 +11:00
Alexander Shopov
37afa4010f gitk: Update Bulgarian translation (311t)
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2016-03-19 14:06:37 +11:00
Junio C Hamano
047057bb41 RelNotes: remove the mention of !reinclusion
We will be postponing this to a later cycle.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-18 11:10:53 -07:00
Junio C Hamano
5cee349370 Revert "Merge branch 'nd/exclusion-regression-fix'"
This reverts commit 5e57f9c3df, reversing
changes made to e79112d210.

We will be postponing nd/exclusion-regression-fix topic to later
cycle.
2016-03-18 11:06:15 -07:00
Junio C Hamano
8ad3cb0869 Revert "Merge branch 'jc/exclusion-doc'"
This reverts commit e80aae51f2, reversing
changes made to 68846a92ea.

We will be postponing nd/exclusion-regression-fix topic to later
cycle.
2016-03-18 11:05:23 -07:00
Junio C Hamano
44915db935 Sync with Git 2.7.4
* maint:
  Git 2.7.4
  Git 2.6.6
  Git 2.5.5
  Git 2.4.11
2016-03-17 12:54:17 -07:00
Junio C Hamano
937978e0f3 Git 2.7.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-17 11:32:13 -07:00
Ralf Thielow
29a382db05 l10n: de.po: add missing newlines
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2016-03-17 19:31:33 +01:00
Junio C Hamano
8e9cc5f3e2 Sync with Git 2.6.6
* maint-2.6:
  Git 2.6.6
  Git 2.5.5
  Git 2.4.11
2016-03-17 11:28:52 -07:00
Junio C Hamano
e46579643d Git 2.6.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-17 11:26:41 -07:00
Junio C Hamano
ce4d4e763c Merge branch 'maint-2.5' into maint-2.6
* maint-2.5:
  Git 2.5.5
  Git 2.4.11
  list-objects: pass full pathname to callbacks
  list-objects: drop name_path entirely
  list-objects: convert name_path to a strbuf
  show_object_with_name: simplify by using path_name()
  http-push: stop using name_path
  tree-diff: catch integer overflow in combine_diff_path allocation
  add helpers for detecting size_t overflow
2016-03-17 11:26:18 -07:00