Commit graph

41376 commits

Author SHA1 Message Date
Junio C Hamano c7bdbd6f92 Merge branch 'ls/p4-translation-failure' into maint
Work around "git p4" failing when the P4 depot records the contents
in UTF-16 without UTF-16 BOM.

* ls/p4-translation-failure:
  git-p4: handle "Translation of file content failed"
  git-p4: add test case for "Translation of file content failed" error
2015-11-03 15:32:32 -08:00
Junio C Hamano c04b3a2dbf Merge branch 'gr/rebase-i-drop-warn' into maint
Recent update to "rebase -i" that tries to sanity check the edited
insn sheet before it uses it has become too picky on Windows where
CRLF left by the editor is turned into a trailing CR on the line
read via the "read" built-in command.

* gr/rebase-i-drop-warn:
  rebase-i: work around Windows CRLF line endings
  t3404: "rebase -i" gets broken when insn sheet uses CR/LF line endings
2015-11-03 15:32:30 -08:00
Junio C Hamano f836a32ba7 Merge branch 'js/clone-dissociate' into maint
"git clone --dissociate" runs a big "git repack" process at the
end, and it helps to close file descriptors that are open on the
packs and their idx files before doing so on filesystems that
cannot remove a file that is still open.

* js/clone-dissociate:
  clone --dissociate: avoid locking pack files
  sha1_file.c: add a function to release all packs
  sha1_file: consolidate code to close a pack's file descriptor
  t5700: demonstrate a Windows file locking issue with `git clone --dissociate`
2015-11-03 15:32:29 -08:00
Junio C Hamano 04bba3a12b Merge branch 'ld/p4-import-labels' into maint
Correct "git p4 --detect-labels" so that it does not fail to create
a tag that points at a commit that is also being imported.

* ld/p4-import-labels:
  git-p4: fix P4 label import for unprocessed commits
  git-p4: do not terminate creating tag for unknown commit
  git-p4: failing test for ignoring invalid p4 labels
2015-11-03 15:32:28 -08:00
Junio C Hamano e23469f91a Merge branch 'tk/stripspace' into maint
The internal stripspace() function has been moved to where it
logically belongs to, i.e. strbuf API, and the command line parser
of "git stripspace" has been updated to use the parse_options API.

* tk/stripspace:
  stripspace: use parse-options for command-line parsing
  strbuf: make stripspace() part of strbuf
2015-11-03 15:32:26 -08:00
Junio C Hamano f89baca1b9 Merge branch 'jk/repository-extension' into maint
Prepare for Git on-disk repository representation to undergo
backward incompatible changes by introducing a new repository
format version "1", with an extension mechanism.

* jk/repository-extension:
  introduce "preciousObjects" repository extension
  introduce "extensions" form of core.repositoryformatversion
2015-11-03 15:32:25 -08:00
Junio C Hamano c29024e5d1 Tenth batch for 2.7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-03 15:18:22 -08:00
Junio C Hamano c3c592ef95 Merge branch 'rs/daemon-plug-child-leak'
"git daemon" uses "run_command()" without "finish_command()", so it
needs to release resources itself, which it forgot to do.

* rs/daemon-plug-child-leak:
  daemon: plug memory leak
  run-command: factor out child_process_clear()
2015-11-03 15:13:12 -08:00
Junio C Hamano 6784eb5ad9 Merge branch 'mk/blame-first-parent'
"git blame" learnt to take "--first-parent" and "--reverse" at the
same time when it makes sense.

* mk/blame-first-parent:
  blame: allow blame --reverse --first-parent when it makes sense
  blame: extract find_single_final
  blame: test to describe use of blame --reverse --first-parent
2015-11-03 15:13:10 -08:00
Junio C Hamano a59d1d8035 Merge branch 'rs/wt-status-detached-branch-fix'
"git status --branch --short" accessed beyond the constant string
"HEAD", which has been corrected.

* rs/wt-status-detached-branch-fix:
  wt-status: use skip_prefix() to get rid of magic string length constants
  wt-status: don't skip a magical number of characters blindly
  wt-status: avoid building bogus branch name with detached HEAD
  wt-status: exit early using goto in wt_shortstatus_print_tracking()
  t7060: add test for status --branch on a detached HEAD
2015-11-03 15:13:08 -08:00
Junio C Hamano 654b986dec Merge branch 'rs/show-branch-argv-array'
Code simplification.

* rs/show-branch-argv-array:
  show-branch: use argv_array for default arguments
2015-11-03 15:13:07 -08:00
Junio C Hamano 4b571eb0c2 Merge branch 'js/git-gdb'
Allow easier debugging of a single "git" invocation in our test
scripts.

* js/git-gdb:
  test: facilitate debugging Git executables in tests with gdb
2015-11-03 15:13:05 -08:00
Junio C Hamano acfeaf8c96 Merge branch 'jk/initialization-fix-to-add-submodule-odb'
We peek objects from submodule's object store by linking it to the
list of alternate object databases, but the code to do so forgot to
correctly initialize the list.

* jk/initialization-fix-to-add-submodule-odb:
  add_submodule_odb: initialize alt_odb list earlier
2015-11-03 15:13:04 -08:00
Junio C Hamano c253b82e42 Merge branch 'da/difftool'
The code to prepare the working tree side of temporary directory
for the "dir-diff" feature forgot that symbolic links need not be
copied (or symlinked) to the temporary area, as the code already
special cases and overwrites them.  Besides, it was wrong to try
computing the object name of the target of symbolic link, which may
not even exist or may be a directory.

* da/difftool:
  difftool: ignore symbolic links in use_wt_file
2015-11-03 15:13:02 -08:00
Junio C Hamano c5d9418ecd Merge branch 'jc/mailinfo-lib'
Hotfix for a topic already in 'master'.

* jc/mailinfo-lib:
  mailinfo: fix passing wrong address to git_mailinfo_config
2015-11-03 15:12:59 -08:00
Junio C Hamano 415095f055 Merge branch 'kn/for-each-branch'
Using the timestamp based criteria in "git branch --sort" did not
tiebreak branches that point at commits with the same timestamp (or
the same commit), making the resulting output unstable.

* kn/for-each-branch:
  ref-filter: fallback on alphabetical comparison
2015-11-03 15:12:57 -08:00
René Scharfe b1b49ff8d4 daemon: plug memory leak
Call child_process_clear() when a child ends to release the memory
allocated for its environment.  This is necessary because unlike all
other users of start_command() we don't call finish_command(), which
would have taken care of that for us.

This leak was introduced by f063d38b (daemon: use cld->env_array
when re-spawning).

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-02 15:01:23 -08:00
René Scharfe 2d71608ec0 run-command: factor out child_process_clear()
Avoid duplication by moving the code to release allocated memory for
arguments and environment to its own function, child_process_clear().
Export it to provide a counterpart to child_process_init().

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-02 15:01:00 -08:00
Jeff King f8117f550b http: use off_t to store partial file size
When we try to resume transfer of a partially-downloaded
object or pack, we fopen() the existing file for append,
then use ftell() to get the current position. We use a
"long", which can hold only 2GB on a 32-bit system, even
though packfiles may be larger than that.

Let's switch to using off_t, which should hold any file size
our system is capable of storing. We need to use ftello() to
get the off_t. This is in POSIX and hopefully available
everywhere; if not, we should be able to wrap it by falling
back to ftell(), which would presumably return "-1" on such
a large file (and we would simply skip resuming in that case).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-02 14:19:54 -08:00
David Turner 835c4d3689 http.c: use CURLOPT_RANGE for range requests
A HTTP server is permitted to return a non-range response to a HTTP
range request (and Apache httpd in fact does this in some cases).
While libcurl knows how to correctly handle this (by skipping bytes
before and after the requested range), it only turns on this handling
if it is aware that a range request is being made.  By manually
setting the range header instead of using CURLOPT_RANGE, we were
hiding the fact that this was a range request from libcurl.  This
could cause corruption.

Signed-off-by: David Turner <dturner@twopensource.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-02 14:18:06 -08:00
Edmundo Carmona Antoranz 870ebdb9c4 checkout: add --progress option
Under normal circumstances, and like other git commands,
git checkout will write progress info to stderr if
attached to a terminal. This option allows progress
to be forced even if not using a terminal. Also,
progress can be skipped if using option --no-progress.

Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-01 14:08:17 -08:00
Nguyễn Thái Ngọc Duy 85d9d9ddf3 mailinfo: fix passing wrong address to git_mailinfo_config
git_mailinfo_config() expects "struct mailinfo *". But in
setup_mailinfo(), "mi" is already "struct mailinfo *". &mi would make
it "struct mailinfo **" and git_mailinfo_config() would damage some
other memory when it assigns some value to mi->use_scissors.

This is caught by t4150.20. git_mailinfo_config() breaks
mi->name.alloc and makes strbuf_release() in clear_mailinfo() attempt
to free strbuf_slopbuf.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-01 10:29:40 -08:00
René Scharfe c949b00fb8 show-branch: use argv_array for default arguments
Use argv_array instead of open-coding it.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-01 10:24:29 -08:00
René Scharfe c72b49dfab wt-status: use skip_prefix() to get 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>
2015-11-01 09:58:20 -08:00
René Scharfe 8d8325f8ee wt-status: don't skip a magical number of characters blindly
Use the variable branch_name, which already has "refs/heads/" removed,
instead of blindly advancing in the ->branch string by 11 bytes.  This
is safer and less magical.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-01 09:58:20 -08:00
René Scharfe baf0a3e47d wt-status: avoid building bogus branch name with detached HEAD
If we're on a detached HEAD then wt_shortstatus_print_tracking() takes
the string "HEAD (no branch)", translates it, skips the first eleven
characters and passes the result to branch_get(), which returns a bogus
result and accesses memory out of bounds in order to produce it.
Somehow stat_tracking_info(), which is passed that result, does the
right thing anyway, i.e. it finds that there is no base.

Avoid the bogus results and memory accesses by checking for HEAD first
and exiting early in that case.  This fixes t7060 with --valgrind.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-01 09:58:20 -08:00
René Scharfe bcf8cc25ac wt-status: exit early using goto in wt_shortstatus_print_tracking()
Deduplicate printing the line terminator by jumping to the end of the
function.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-01 09:58:20 -08:00
René Scharfe 7ca8c18950 t7060: add test for status --branch on a detached HEAD
This test fails when run under Valgrind because branch_get() gets passed
a bogus branch name pointer:

==62831== Invalid read of size 1
==62831==    at 0x4F76AE: branch_get (remote.c:1650)
==62831==    by 0x53499E: wt_shortstatus_print_tracking (wt-status.c:1654)
==62831==    by 0x53499E: wt_shortstatus_print (wt-status.c:1706)
==62831==    by 0x428D29: cmd_status (commit.c:1384)
==62831==    by 0x405D6D: run_builtin (git.c:350)
==62831==    by 0x405D6D: handle_builtin (git.c:536)
==62831==    by 0x404F10: run_argv (git.c:582)
==62831==    by 0x404F10: main (git.c:690)
==62831==  Address 0x5e89b0b is 6 bytes after a block of size 5 alloc'd
==62831==    at 0x4C28C4F: malloc (vg_replace_malloc.c:299)
==62831==    by 0x59579E9: strdup (strdup.c:42)
==62831==    by 0x52E108: xstrdup (wrapper.c:43)
==62831==    by 0x5322A6: wt_status_prepare (wt-status.c:130)
==62831==    by 0x4276E0: status_init_config (commit.c:184)
==62831==    by 0x428BB8: cmd_status (commit.c:1350)
==62831==    by 0x405D6D: run_builtin (git.c:350)
==62831==    by 0x405D6D: handle_builtin (git.c:536)
==62831==    by 0x404F10: run_argv (git.c:582)
==62831==    by 0x404F10: main (git.c:690)

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-01 09:58:20 -08:00
Max Kirillov 700fd28e4f blame: allow blame --reverse --first-parent when it makes sense
Allow combining --reverse and --first-parent if initial commit of
specified range is at the first-parent chain starting from the final
commit. Disable the prepare_revision_walk()'s builtin children
collection, instead picking only the ones which are along the first
parent chain.

Signed-off-by: Max Kirillov <max@max630.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-10-30 15:33:13 -07:00
Max Kirillov 1b0d40000a blame: extract find_single_final
Signed-off-by: Max Kirillov <max@max630.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-10-30 15:30:41 -07:00
Max Kirillov ec352401fb blame: test to describe use of blame --reverse --first-parent
Reverse blame can be used to locate removal of lines which does not
change adjacent lines. Such edits do not appear in non-reverse blame,
because the adjacent lines last changed commit is older history, before
the edit.

For a big and active project which uses topic branches, or analogous
feature, for example pull-requests, the history can contain many
concurrent branches, and even after an edit merged into the target
branch, there are still many (sometimes several tens or even hundreds)
topic branch which do not contain it:

 a0--a1-----*a2-*a3-a4...-*a100
 |\         /   /         /
 | b0-B1..bN   /         /
 |\           /         /
 | c0..   ..cN         /
 \                    /
  z0..            ..zN

Here, the '*'s mark the first parent in merge, and uppercase B1 - the
commit where the line being blamed for was removed. Since commits cN-zN
do not contain B1, they still have the line removed in B1, and
reverse blame can report that the last commit for the line was zN
(meaning that it was removed in a100). In fact it really does return
some very late commit, and this makes it unusable for finding the B1
commit.

The search could be done by blame --reverse --first-parent. For range
a0..a100 it would return a1, and then only one additional blame along
the a0..bN will return the desired commit b0. But combining --reverse
and --first-parent was forbidden in 95a4fb0eac, because incorrectly
specified range could produce unexpected and meaningless result.

Add test which describes the expected behavior of
`blame --reverse --first-parent` in the case described above.

Signed-off-by: Max Kirillov <max@max630.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-10-30 15:28:45 -07:00
Johannes Schindelin 6a94088cc3 test: facilitate debugging Git executables in tests with gdb
When prefixing a Git call in the test suite with 'debug ', it will
now be run with GDB, allowing the developer to debug test failures
more conveniently.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-10-30 14:02:38 -07:00
Karthik Nayak 9e468334b4 ref-filter: fallback on alphabetical comparison
In ref-filter.c the comparison of refs while sorting is handled by
cmp_ref_sorting() function. When sorting as per numerical values
(e.g. --sort=objectsize) there is no fallback comparison when both
refs hold the same value. This can cause unexpected results (i.e. the
order of listing refs with equal values cannot be pre-determined) as
pointed out by Johannes Sixt ($gmane/280117).

Hence, fallback to alphabetical comparison based on the refname
whenever the other criterion is equal.

A test in t3203 was expecting that branch-two sorts before HEAD, which
happened to be how qsort(3) on Linux sorted the array, but (1) that
outcome was not even guaranteed, and (2) once we start breaking ties
with the refname, "HEAD" should sort before "branch-two" so the
original expectation was inconsistent with the criterion we now use.

Update it to match the new world order, which we can now depend on
being stable.

Helped-by: Junio C Hamano <gitster@pobox.com>
Reported-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-10-30 13:50:52 -07:00
Junio C Hamano 2635c2b8bf Ninth batch for 2.7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-10-30 13:17:31 -07:00
Junio C Hamano 54bc41416c Merge branch 'jk/merge-file-exit-code'
"git merge-file" tried to signal how many conflicts it found, which
obviously would not work well when there are too many of them.

* jk/merge-file-exit-code:
  merge-file: clamp exit code to maximum 127
2015-10-30 13:07:08 -07:00
Junio C Hamano f60b5dc68c Merge branch 'gr/rebase-i-drop-warn'
Recent update to "rebase -i" that tries to sanity check the edited
insn sheet before it uses it has become too picky on Windows where
CRLF left by the editor is turned into a trailing CR on the line
read via the "read" built-in command.

* gr/rebase-i-drop-warn:
  rebase-i: work around Windows CRLF line endings
  t3404: "rebase -i" gets broken when insn sheet uses CR/LF line endings
2015-10-30 13:07:06 -07:00
Junio C Hamano 7fd4181c66 Merge branch 'xf/user-manual-ff'
* xf/user-manual-ff:
  user-manual: fix the description of fast-forward
2015-10-30 13:07:05 -07:00
Junio C Hamano 0692a6c22c Merge branch 'rs/pop-commit'
Code simplification.

* rs/pop-commit:
  use pop_commit() for consuming the first entry of a struct commit_list
2015-10-30 13:07:03 -07:00
Junio C Hamano 23d58a00e5 Merge branch 'mk/blame-error-message'
The error message from "git blame --contents --reverse" incorrectly
talked about "--contents --children".

* mk/blame-error-message:
  blame: fix option name in error message
2015-10-30 13:07:02 -07:00
Junio C Hamano 808d119263 Merge branch 'js/misc-fixes'
Various compilation fixes and squelching of warnings.

* js/misc-fixes:
  Correct fscanf formatting string for I64u values
  Silence GCC's "cast of pointer to integer of a different size" warning
  Squelch warning about an integer overflow
2015-10-30 13:07:00 -07:00
Junio C Hamano e88e424f4c Merge branch 'js/imap-send-curl-compilation-fix'
"git imap-send" did not compile well with older version of cURL library.

* js/imap-send-curl-compilation-fix:
  imap-send: only use CURLOPT_LOGIN_OPTIONS if it is actually available
2015-10-30 13:06:58 -07:00
Junio C Hamano 203501b39f Merge branch 'jk/delete-modechange-conflict'
Merging a branch that removes a path and another that changes the
mode bits on the same path should have conflicted at the path, but
it didn't and silently favoured the removal.

* jk/delete-modechange-conflict:
  merge: detect delete/modechange conflict
  t6031: generalize for recursive and resolve strategies
  t6031: move triple-rename test to t3030
2015-10-30 13:06:57 -07:00
Junio C Hamano f7722a447a Merge branch 'jc/add-u-A-default-to-top'
"git --literal-pathspecs add -u/-A" without any command line
argument misbehaved ever since Git 2.0.

* jc/add-u-A-default-to-top:
  add: simplify -u/-A without pathspec
2015-10-30 13:06:55 -07:00
Junio C Hamano 908700c008 Merge branch 'ar/clone-dissociate'
"git clone --dissociate" used to require that "--reference" was
used at the same time, but you can create a new repository that
borrows objects from another without using "--reference", namely
with "clone --local" from a repository that borrows objects from
other repositories.

* ar/clone-dissociate:
  clone: allow "--dissociate" without reference
2015-10-30 13:06:53 -07:00
Junio C Hamano 482456a414 Merge git://ozlabs.org/~paulus/gitk
* git://ozlabs.org/~paulus/gitk:
  gitk: Update Russian translation
  gitk: Add accelerator to German locale
  gitk: Add accelerators to Japanese locale
  gitk: Update msgid's for menu items with accelerator
  gitk: l10n: Update Catalan translation
  gitk: Add missing accelerators
  Updated Vietnamese translation
2015-10-30 09:02:27 -07:00
Paul Mackerras d70c034a75 Merge https://github.com/vnwildman/gitk
This brings in an update to the Vietnamese translation.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2015-10-30 21:01:55 +11:00
Dimitriy Ryazantcev 222e878802 gitk: Update Russian translation
Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2015-10-30 20:56:11 +11:00
Takashi Iwai 61aae60af1 gitk: Add accelerator to German locale
Assigned either to the first letter or some unique letter.  At least
there are no conflicts, as far as I see...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2015-10-30 20:45:56 +11:00
Takashi Iwai c3f695d5f7 gitk: Add accelerators to Japanese locale
Just follow the English accelerator keys.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2015-10-30 20:45:55 +11:00
Takashi Iwai 4ed950841e gitk: Update msgid's for menu items with accelerator
The commit d99b4b0de2 ("gitk: Accelerators for the main menu")
modified the menu item strings with the accelerator, but the
translations didn't follow, thus the menus are shown without
translations.

This patch systematically update the msgid keys just to follow this
change.  The contents aren't changed, so the accelerator won't work in
these locales for now.  Each locale translator needs to add proper
acceleration keys appropriately.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2015-10-30 20:45:55 +11:00