* Re: [ANNOUNCE] Git v2.11.0-rc3
From: Marc Branchaud @ 2016-11-24 16:25 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <xmqqinrdlr3o.fsf@gitster.mtv.corp.google.com>
On 2016-11-23 06:21 PM, Junio C Hamano wrote:
>
> * The original command line syntax for "git merge", which was "git
> merge <msg> HEAD <parent>...", has been deprecated for quite some
> time, and "git gui" was the last in-tree user of the syntax. This
> is finally fixed, so that we can move forward with the deprecation.
Is this still true, given j6t's recent patch at
http://public-inbox.org/git/e61cc267-a59b-3be1-29db-c49d56f521f7@kdbg.org/T/
?
M.
^ permalink raw reply
* RE: [char-misc-next] mei: request async autosuspend at the end of enumeration
From: Winkler, Tomas @ 2016-11-24 16:10 UTC (permalink / raw)
To: git@vger.kernel.org, Greg KH (gregkh@linuxfoundation.org)
Cc: Usyskin, Alexander, linux-kernel@vger.kernel.org
In-Reply-To: <1479987242-32050-1-git-send-email-tomas.winkler@intel.com>
>
> From: Alexander Usyskin <alexander.usyskin@intel.com>
>
> pm_runtime_autosuspend can take synchronous or asynchronous paths,
> Because we are calling pm_runtime_mark_last_busy just before this most of
> the cases it takes the asynchronous way. However, when the FW or driver
> resets during already running runtime suspend, the call will result in calling to
> the driver's rpm callback and results in a deadlock on device_lock.
> The simplest fix is to replace pm_runtime_autosuspend with asynchronous
> pm_request_autosuspend.
>
> Cc: <stable@vger.kernel.org> # 4.4+
Looks like git send-email is not able to parse this address correctly though this is suggested format by Documentation/stable_kernel_rules.txt.
Create wrong address If git parsers is used : 'stable@vger.kernel.org#4.4+'
Something like s/#.*$// is needed before parsing Cc:
Thanks
Tomas
^ permalink raw reply
* Re: RFC: Enable delayed responses to Git clean/smudge filter requests
From: Lars Schneider @ 2016-11-24 15:45 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Eric Wong, git
In-Reply-To: <xmqqvavotych.fsf@gitster.mtv.corp.google.com>
> On 15 Nov 2016, at 19:03, Junio C Hamano <gitster@pobox.com> wrote:
>
> Lars Schneider <larsxschneider@gmail.com> writes:
>
>>> The filter itself would need to be aware of parallelism
>>> if it lives for multiple objects, right?
>>
>> Correct. This way Git doesn't need to deal with threading...
>
> I think you need to be careful about three things (at least; there
> may be more):
>
> ...
>
> * Done naively, it will lead to unmaintainable code, like this:
>
> ...
Hi Junio,
I started to work on the "delayed responses to Git clean/smudge filter
requests" implementation and I am looking for a recommendation regarding
code maintainability:
Deep down in convert.c:636 `apply_multi_file_filter()` [1] the filter learns
from the external process that the filter response is not yet available.
I need to transport this information quite a few levels up the call
stack.
# Option 1
I could do this by explicitly passing a pointer such as "int *is_delayed"
to the function. This would mean I need to update the function definitions
for all functions on my way through the stack:
int apply_multi_file_filter()
int apply_filter()
int convert_to_working_tree_internal()
int convert_to_working_tree()
...
# Option 2
All these functions pass-through an "int" return value that communicates
if the filter succeeded or failed. I could define a special return value
to communicate the third state: delayed.
What way do you think is better from a maintenance point of view?
I prefer option 2 but I fear that these "special" values could confuse
future readers of the code.
Thanks,
Lars
[1] https://github.com/git/git/blob/e2b2d6a172b76d44cb7b1ddb12ea5bfac9613a44/convert.c#L673-L777
^ permalink raw reply
* [PATCH v2] merge-recursive.c: use string_list_sort instead of qsort
From: Nguyễn Thái Ngọc Duy @ 2016-11-24 11:45 UTC (permalink / raw)
To: git
Cc: René Scharfe, Jeff King, Junio C Hamano,
Nguyễn Thái Ngọc Duy
In-Reply-To: <20161122123019.7169-1-pclouds@gmail.com>
This started out to as a hunt for remaining qsort() calls after rs/qsort
series because qsort() API is a bit easy to get wrong (*). However,
since we have string_list_sort(), it's conceptually a better way to sort
here.
(*) In this particular case, it's even more confusing when you sort one
variable but you use the number of items and item size from an unrelated
variable (from a first glance)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
merge-recursive.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 9041c2f..90e83bd 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -388,12 +388,10 @@ static struct string_list *get_unmerged(void)
return unmerged;
}
-static int string_list_df_name_compare(const void *a, const void *b)
+static int string_list_df_name_compare(const char *one, const char *two)
{
- const struct string_list_item *one = a;
- const struct string_list_item *two = b;
- int onelen = strlen(one->string);
- int twolen = strlen(two->string);
+ int onelen = strlen(one);
+ int twolen = strlen(two);
/*
* Here we only care that entries for D/F conflicts are
* adjacent, in particular with the file of the D/F conflict
@@ -406,8 +404,8 @@ static int string_list_df_name_compare(const void *a, const void *b)
* since in other cases any changes in their order due to
* sorting cause no problems for us.
*/
- int cmp = df_name_compare(one->string, onelen, S_IFDIR,
- two->string, twolen, S_IFDIR);
+ int cmp = df_name_compare(one, onelen, S_IFDIR,
+ two, twolen, S_IFDIR);
/*
* Now that 'foo' and 'foo/bar' compare equal, we have to make sure
* that 'foo' comes before 'foo/bar'.
@@ -451,8 +449,8 @@ static void record_df_conflict_files(struct merge_options *o,
string_list_append(&df_sorted_entries, next->string)->util =
next->util;
}
- qsort(df_sorted_entries.items, entries->nr, sizeof(*entries->items),
- string_list_df_name_compare);
+ df_sorted_entries.cmp = string_list_df_name_compare;
+ string_list_sort(&df_sorted_entries);
string_list_clear(&o->df_conflict_file_set, 1);
for (i = 0; i < df_sorted_entries.nr; i++) {
--
2.8.2.524.g6ff3d78
^ permalink raw reply related
* Re: [PATCH v2 1/1] difftool: add the builtin
From: Johannes Schindelin @ 2016-11-24 10:38 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, David Aguilar, Dennis Kaarsemaker
In-Reply-To: <xmqqshqhlthu.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On Wed, 23 Nov 2016, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
> > ... I do not think you can safely add these two bits here until the
> > migration completes.
>
> I accidentally removed a more useful bit I wrote after the above
> sentence while editing.
>
> The NEEDSWORK comment in 73c2779f42 ("builtin-am: implement skeletal
> builtin am", 2015-08-04) mentions why it calls setup-git-directory
> and setup-work-tree instead of letting run_builtin() do so; perhaps
> you can do something similar here to fix this.
This is the Catch-22 I mentioned a couple times: if you insist on a config
setting, the config has to be read. For that to work,
setup_git_directory() has to be called.
So no matter what you do, if you want to have conditional code that
depends on the config, and that wants setup_git_directory() *not* to be
called before, you are simply out of luck.
Sadly, I now bought into your comment that using a file in exec-path as a
feature flag is a bad thing, and that we have to use a config setting. So
now I have to spend more time on fixing something that was not a problem
in my original patches.
However, this exchange has something else in it, apart from creating
unneeded work for me.
What you really accidentally did was to identify a fundamental problem
with the builtin difftool: when called from a subdirectory, the RUN_SETUP
flag would make it chdir() to the top-level directory, and the
subsequently spawned Git processes would get the wrong idea about relative
paths.
Thank you for that,
Dscho
^ permalink raw reply
* Re: Git status takes too long- How to improve the performance of git
From: MaryTurner @ 2016-11-24 8:38 UTC (permalink / raw)
To: git
In-Reply-To: <1479202392275-7657456.post@n2.nabble.com>
Nice
--
View this message in context: http://git.661346.n2.nabble.com/Git-status-takes-too-long-How-to-improve-the-performance-of-git-tp7657456p7657457.html
Sent from the git mailing list archive at Nabble.com.
^ permalink raw reply
* [ANNOUNCE] Git v2.11.0-rc3
From: Junio C Hamano @ 2016-11-23 23:21 UTC (permalink / raw)
To: git; +Cc: Linux Kernel
A release candidate Git v2.11.0-rc3 is now available for testing
at the usual places. It is comprised of 666 non-merge commits
since v2.10.0, contributed by 73 people, 15 of which are new faces.
It turns out that one recent fix exposed codepaths that have not
been using the API correctly, resulting apparent minor regressions
in a few programs. This hopefully final release candidate contains
fixes to them.
The tarballs are found at:
https://www.kernel.org/pub/software/scm/git/testing/
The following public repositories all have a copy of the
'v2.11.0-rc3' tag and the 'master' branch that the tag points at:
url = https://kernel.googlesource.com/pub/scm/git/git
url = git://repo.or.cz/alt-git.git
url = git://git.sourceforge.jp/gitroot/git-core/git.git
url = git://git-core.git.sourceforge.net/gitroot/git-core/git-core
url = https://github.com/gitster/git
New contributors whose contributions weren't in v2.10.0 are as follows.
Welcome to the Git development community!
Aaron M Watson, Brandon Williams, Brian Henderson, Emily Xie,
Gavin Lambert, Ian Kelling, Jeff Hostetler, jfbu, Mantas
Mikulėnas, Petr Stodulka, Satoshi Yasushima, Stefan Christ,
Vegard Nossum, yaras, and Younes Khoudli.
Returning contributors who helped this release are as follows.
Thanks for your continued support.
Ævar Arnfjörð Bjarmason, Alexander Shopov, Alex Henrie,
Alex Riesen, Anders Kaseorg, Andreas Schwab, Beat Bolli, Ben
North, brian m. carlson, Changwoo Ryu, Chris Packham, Christian
Couder, David Aguilar, David Turner, Dennis Kaarsemaker,
Dimitriy Ryazantcev, Elia Pinto, Eric Wong, Jacob Keller,
Jakub Narębski, Jean-Noel Avila, Jean-Noël AVILA, Jeff King,
Jiang Xin, Johannes Schindelin, Johannes Sixt, Jonathan Nieder,
Jonathan Tan, Josh Triplett, Junio C Hamano, Karsten Blees, Kevin
Daudt, Kirill Smelkov, Lars Schneider, Linus Torvalds, Matthieu
Moy, Michael Haggerty, Michael J Gruber, Mike Ralphson, Nguyễn
Thái Ngọc Duy, Olaf Hering, Orgad Shaneh, Patrick Steinhardt,
Pat Thoyts, Peter Krefting, Philip Oakley, Pranit Bauva, Ralf
Thielow, Ray Chen, René Scharfe, Ronnie Sahlberg, Stefan Beller,
SZEDER Gábor, Thomas Gummerer, Tobias Klauser, Trần Ngọc
Quân, Vasco Almeida, and Дилян Палаузов.
----------------------------------------------------------------
Git 2.11 Release Notes (draft)
==============================
Backward compatibility notes.
* An empty string used as a pathspec element has always meant
'everything matches', but it is too easy to write a script that
finds a path to remove in $path and run 'git rm "$paht"' by
mistake (when the user meant to give "$path"), which ends up
removing everything. This release starts warning about the
use of an empty string that is used for 'everything matches' and
asks users to use a more explicit '.' for that instead.
The hope is that existing users will not mind this change, and
eventually the warning can be turned into a hard error, upgrading
the deprecation into removal of this (mis)feature.
* The historical argument order "git merge <msg> HEAD <commit>..."
has been deprecated for quite some time, and will be removed in the
next release (not this one).
* The default abbreviation length, which has historically been 7, now
scales as the repository grows, using the approximate number of
objects in the repository and a bit of math around the birthday
paradox. The logic suggests to use 12 hexdigits for the Linux
kernel, and 9 to 10 for Git itself.
Updates since v2.10
-------------------
UI, Workflows & Features
* Comes with new version of git-gui, now at its 0.21.0 tag.
* "git format-patch --cover-letter HEAD^" to format a single patch
with a separate cover letter now numbers the output as [PATCH 0/1]
and [PATCH 1/1] by default.
* An incoming "git push" that attempts to push too many bytes can now
be rejected by setting a new configuration variable at the receiving
end.
* "git nosuchcommand --help" said "No manual entry for gitnosuchcommand",
which was not intuitive, given that "git nosuchcommand" said "git:
'nosuchcommand' is not a git command".
* "git clone --recurse-submodules --reference $path $URL" is a way to
reduce network transfer cost by borrowing objects in an existing
$path repository when cloning the superproject from $URL; it
learned to also peek into $path for presence of corresponding
repositories of submodules and borrow objects from there when able.
* The "git diff --submodule={short,log}" mechanism has been enhanced
to allow "--submodule=diff" to show the patch between the submodule
commits bound to the superproject.
* Even though "git hash-objects", which is a tool to take an
on-filesystem data stream and put it into the Git object store,
allowed to perform the "outside-world-to-Git" conversions (e.g.
end-of-line conversions and application of the clean-filter), and
it had the feature on by default from very early days, its reverse
operation "git cat-file", which takes an object from the Git object
store and externalize for the consumption by the outside world,
lacked an equivalent mechanism to run the "Git-to-outside-world"
conversion. The command learned the "--filters" option to do so.
* Output from "git diff" can be made easier to read by selecting
which lines are common and which lines are added/deleted
intelligently when the lines before and after the changed section
are the same. A command line option is added to help with the
experiment to find a good heuristics.
* In some projects, it is common to use "[RFC PATCH]" as the subject
prefix for a patch meant for discussion rather than application. A
new option "--rfc" is a short-hand for "--subject-prefix=RFC PATCH"
to help the participants of such projects.
* "git add --chmod=+x <pathspec>" added recently only toggled the
executable bit for paths that are either new or modified. This has
been corrected to flip the executable bit for all paths that match
the given pathspec.
* When "git format-patch --stdout" output is placed as an in-body
header and it uses the RFC2822 header folding, "git am" failed to
put the header line back into a single logical line. The
underlying "git mailinfo" was taught to handle this properly.
* "gitweb" can spawn "highlight" to show blob contents with
(programming) language-specific syntax highlighting, but only
when the language is known. "highlight" can however be told
to make the guess itself by giving it "--force" option, which
has been enabled.
* "git gui" l10n to Portuguese.
* When given an abbreviated object name that is not (or more
realistically, "no longer") unique, we gave a fatal error
"ambiguous argument". This error is now accompanied by a hint that
lists the objects beginning with the given prefix. During the
course of development of this new feature, numerous minor bugs were
uncovered and corrected, the most notable one of which is that we
gave "short SHA1 xxxx is ambiguous." twice without good reason.
* "git log rev^..rev" is an often-used revision range specification
to show what was done on a side branch merged at rev. This has
gained a short-hand "rev^-1". In general "rev^-$n" is the same as
"^rev^$n rev", i.e. what has happened on other branches while the
history leading to nth parent was looking the other way.
* In recent versions of cURL, GSSAPI credential delegation is
disabled by default due to CVE-2011-2192; introduce a configuration
to selectively allow enabling this.
(merge 26a7b23429 ps/http-gssapi-cred-delegation later to maint).
* "git mergetool" learned to honor "-O<orderfile>" to control the
order of paths to present to the end user.
* "git diff/log --ws-error-highlight=<kind>" lacked the corresponding
configuration variable to set it by default.
* "git ls-files" learned "--recurse-submodules" option that can be
used to get a listing of tracked files across submodules (i.e. this
only works with "--cached" option, not for listing untracked or
ignored files). This would be a useful tool to sit on the upstream
side of a pipe that is read with xargs to work on all working tree
files from the top-level superproject.
* A new credential helper that talks via "libsecret" with
implementations of XDG Secret Service API has been added to
contrib/credential/.
* The GPG verification status shown in "%G?" pretty format specifier
was not rich enough to differentiate a signature made by an expired
key, a signature made by a revoked key, etc. New output letters
have been assigned to express them.
* In addition to purely abbreviated commit object names, "gitweb"
learned to turn "git describe" output (e.g. v2.9.3-599-g2376d31787)
into clickable links in its output.
* When new paths were added by "git add -N" to the index, it was
enough to circumvent the check by "git commit" to refrain from
making an empty commit without "--allow-empty". The same logic
prevented "git status" to show such a path as "new file" in the
"Changes not staged for commit" section.
* The smudge/clean filter API expect an external process is spawned
to filter the contents for each path that has a filter defined. A
new type of "process" filter API has been added to allow the first
request to run the filter for a path to spawn a single process, and
all filtering need is served by this single process for multiple
paths, reducing the process creation overhead.
* The user always has to say "stash@{$N}" when naming a single
element in the default location of the stash, i.e. reflogs in
refs/stash. The "git stash" command learned to accept "git stash
apply 4" as a short-hand for "git stash apply stash@{4}".
Performance, Internal Implementation, Development Support etc.
* The delta-base-cache mechanism has been a key to the performance in
a repository with a tightly packed packfile, but it did not scale
well even with a larger value of core.deltaBaseCacheLimit.
* Enhance "git status --porcelain" output by collecting more data on
the state of the index and the working tree files, which may
further be used to teach git-prompt (in contrib/) to make fewer
calls to git.
* Extract a small helper out of the function that reads the authors
script file "git am" internally uses.
(merge a77598e jc/am-read-author-file later to maint).
* Lifts calls to exit(2) and die() higher in the callchain in
sequencer.c files so that more helper functions in it can be used
by callers that want to handle error conditions themselves.
* "git am" has been taught to make an internal call to "git apply"'s
innards without spawning the latter as a separate process.
* The ref-store abstraction was introduced to the refs API so that we
can plug in different backends to store references.
* The "unsigned char sha1[20]" to "struct object_id" conversion
continues. Notable changes in this round includes that ce->sha1,
i.e. the object name recorded in the cache_entry, turns into an
object_id.
* JGit can show a fake ref "capabilities^{}" to "git fetch" when it
does not advertise any refs, but "git fetch" was not prepared to
see such an advertisement. When the other side disconnects without
giving any ref advertisement, we used to say "there may not be a
repository at that URL", but we may have seen other advertisement
like "shallow" and ".have" in which case we definitely know that a
repository is there. The code to detect this case has also been
updated.
* Some codepaths in "git pack-objects" were not ready to use an
existing pack bitmap; now they are and as the result they have
become faster.
* The codepath in "git fsck" to detect malformed tree objects has
been updated not to die but keep going after detecting them.
* We call "qsort(array, nelem, sizeof(array[0]), fn)", and most of
the time third parameter is redundant. A new QSORT() macro lets us
omit it.
* "git pack-objects" in a repository with many packfiles used to
spend a lot of time looking for/at objects in them; the accesses to
the packfiles are now optimized by checking the most-recently-used
packfile first.
(merge c9af708b1a jk/pack-objects-optim-mru later to maint).
* Codepaths involved in interacting alternate object store have
been cleaned up.
* In order for the receiving end of "git push" to inspect the
received history and decide to reject the push, the objects sent
from the sending end need to be made available to the hook and
the mechanism for the connectivity check, and this was done
traditionally by storing the objects in the receiving repository
and letting "git gc" to expire it. Instead, store the newly
received objects in a temporary area, and make them available by
reusing the alternate object store mechanism to them only while we
decide if we accept the check, and once we decide, either migrate
them to the repository or purge them immediately.
* The require_clean_work_tree() helper was recreated in C when "git
pull" was rewritten from shell; the helper is now made available to
other callers in preparation for upcoming "rebase -i" work.
* "git upload-pack" had its code cleaned-up and performance improved
by reducing use of timestamp-ordered commit-list, which was
replaced with a priority queue.
* "git diff --no-index" codepath has been updated not to try to peek
into .git/ directory that happens to be under the current
directory, when we know we are operating outside any repository.
* Update of the sequencer codebase to make it reusable to reimplement
"rebase -i" continues.
* Git generally does not explicitly close file descriptors that were
open in the parent process when spawning a child process, but most
of the time the child does not want to access them. As Windows does
not allow removing or renaming a file that has a file descriptor
open, a slow-to-exit child can even break the parent process by
holding onto them. Use O_CLOEXEC flag to open files in various
codepaths.
* Update "interpret-trailers" machinery and teaches it that people in
real world write all sorts of crufts in the "trailer" that was
originally designed to have the neat-o "Mail-Header: like thing"
and nothing else.
Also contains various documentation updates and code clean-ups.
Fixes since v2.10
-----------------
Unless otherwise noted, all the fixes since v2.9 in the maintenance
track are contained in this release (see the maintenance releases'
notes for details).
* Clarify various ways to specify the "revision ranges" in the
documentation.
* "diff-highlight" script (in contrib/) learned to work better with
"git log -p --graph" output.
* The test framework left the number of tests and success/failure
count in the t/test-results directory, keyed by the name of the
test script plus the process ID. The latter however turned out not
to serve any useful purpose. The process ID part of the filename
has been removed.
* Having a submodule whose ".git" repository is somehow corrupt
caused a few commands that recurse into submodules loop forever.
* "git symbolic-ref -d HEAD" happily removes the symbolic ref, but
the resulting repository becomes an invalid one. Teach the command
to forbid removal of HEAD.
* A test spawned a short-lived background process, which sometimes
prevented the test directory from getting removed at the end of the
script on some platforms.
* Update a few tests that used to use GIT_CURL_VERBOSE to use the
newer GIT_TRACE_CURL.
* "git pack-objects --include-tag" was taught that when we know that
we are sending an object C, we want a tag B that directly points at
C but also a tag A that points at the tag B. We used to miss the
intermediate tag B in some cases.
* Update Japanese translation for "git-gui".
* "git fetch http::/site/path" did not die correctly and segfaulted
instead.
* "git commit-tree" stopped reading commit.gpgsign configuration
variable that was meant for Porcelain "git commit" in Git 2.9; we
forgot to update "git gui" to look at the configuration to match
this change.
* "git add --chmod=+x" added recently lacked documentation, which has
been corrected.
* "git log --cherry-pick" used to include merge commits as candidates
to be matched up with other commits, resulting a lot of wasted time.
The patch-id generation logic has been updated to ignore merges to
avoid the wastage.
* The http transport (with curl-multi option, which is the default
these days) failed to remove curl-easy handle from a curlm session,
which led to unnecessary API failures.
* There were numerous corner cases in which the configuration files
are read and used or not read at all depending on the directory a
Git command was run, leading to inconsistent behaviour. The code
to set-up repository access at the beginning of a Git process has
been updated to fix them.
(merge 4d0efa1 jk/setup-sequence-update later to maint).
* "git diff -W" output needs to extend the context backward to
include the header line of the current function and also forward to
include the body of the entire current function up to the header
line of the next one. This process may have to merge two adjacent
hunks, but the code forgot to do so in some cases.
* Performance tests done via "t/perf" did not use the same set of
build configuration if the user relied on autoconf generated
configuration.
* "git format-patch --base=..." feature that was recently added
showed the base commit information after "-- " e-mail signature
line, which turned out to be inconvenient. The base information
has been moved above the signature line.
* More i18n.
* Even when "git pull --rebase=preserve" (and the underlying "git
rebase --preserve") can complete without creating any new commit
(i.e. fast-forwards), it still insisted on having a usable ident
information (read: user.email is set correctly), which was less
than nice. As the underlying commands used inside "git rebase"
would fail with a more meaningful error message and advice text
when the bogus ident matters, this extra check was removed.
* "git gc --aggressive" used to limit the delta-chain length to 250,
which is way too deep for gaining additional space savings and is
detrimental for runtime performance. The limit has been reduced to
50.
* Documentation for individual configuration variables to control use
of color (like `color.grep`) said that their default value is
'false', instead of saying their default is taken from `color.ui`.
When we updated the default value for color.ui from 'false' to
'auto' quite a while ago, all of them broke. This has been
corrected.
* The pretty-format specifier "%C(auto)" used by the "log" family of
commands to enable coloring of the output is taught to also issue a
color-reset sequence to the output.
* A shell script example in check-ref-format documentation has been
fixed.
* "git checkout <word>" does not follow the usual disambiguation
rules when the <word> can be both a rev and a path, to allow
checking out a branch 'foo' in a project that happens to have a
file 'foo' in the working tree without having to disambiguate.
This was poorly documented and the check was incorrect when the
command was run from a subdirectory.
* Some codepaths in "git diff" used regexec(3) on a buffer that was
mmap(2)ed, which may not have a terminating NUL, leading to a read
beyond the end of the mapped region. This was fixed by introducing
a regexec_buf() helper that takes a <ptr,len> pair with REG_STARTEND
extension.
* The procedure to build Git on Mac OS X for Travis CI hardcoded the
internal directory structure we assumed HomeBrew uses, which was a
no-no. The procedure has been updated to ask HomeBrew things we
need to know to fix this.
* When "git rebase -i" is given a broken instruction, it told the
user to fix it with "--edit-todo", but didn't say what the step
after that was (i.e. "--continue").
* Documentation around tools to import from CVS was fairly outdated.
* "git clone --recurse-submodules" lost the progress eye-candy in
recent update, which has been corrected.
* A low-level function verify_packfile() was meant to show errors
that were detected without dying itself, but under some conditions
it didn't and died instead, which has been fixed.
* When "git fetch" tries to find where the history of the repository
it runs in has diverged from what the other side has, it has a
mechanism to avoid digging too deep into irrelevant side branches.
This however did not work well over the "smart-http" transport due
to a design bug, which has been fixed.
* In the codepath that comes up with the hostname to be used in an
e-mail when the user didn't tell us, we looked at ai_canonname
field in struct addrinfo without making sure it is not NULL first.
* "git worktree", even though it used the default_abbrev setting that
ought to be affected by core.abbrev configuration variable, ignored
the variable setting. The command has been taught to read the
default set of configuration variables to correct this.
* "git init" tried to record core.worktree in the repository's
'config' file when GIT_WORK_TREE environment variable was set and
it was different from where GIT_DIR appears as ".git" at its top,
but the logic was faulty when .git is a "gitdir:" file that points
at the real place, causing trouble in working trees that are
managed by "git worktree". This has been corrected.
* Codepaths that read from an on-disk loose object were too loose in
validating what they are reading is a proper object file and
sometimes read past the data they read from the disk, which has
been corrected. H/t to Gustavo Grieco for reporting.
* The original command line syntax for "git merge", which was "git
merge <msg> HEAD <parent>...", has been deprecated for quite some
time, and "git gui" was the last in-tree user of the syntax. This
is finally fixed, so that we can move forward with the deprecation.
* An author name, that spelled a backslash-quoted double quote in the
human readable part "My \"double quoted\" name", was not unquoted
correctly while applying a patch from a piece of e-mail.
* Doc update to clarify what "log -3 --reverse" does.
* Almost everybody uses DEFAULT_ABBREV to refer to the default
setting for the abbreviation, but "git blame" peeked into
underlying variable bypassing the macro for no good reason.
* The "graph" API used in "git log --graph" miscounted the number of
output columns consumed so far when drawing a padding line, which
has been fixed; this did not affect any existing code as nobody
tried to write anything after the padding on such a line, though.
* The code that parses the format parameter of for-each-ref command
has seen a micro-optimization.
* When we started cURL to talk to imap server when a new enough
version of cURL library is available, we forgot to explicitly add
imap(s):// before the destination. To some folks, that didn't work
and the library tried to make HTTP(s) requests instead.
* The ./configure script generated from configure.ac was taught how
to detect support of SSL by libcurl better.
* The command-line completion script (in contrib/) learned to
complete "git cmd ^mas<HT>" to complete the negative end of
reference to "git cmd ^master".
(merge 49416ad22a cp/completion-negative-refs later to maint).
* The existing "git fetch --depth=<n>" option was hard to use
correctly when making the history of an existing shallow clone
deeper. A new option, "--deepen=<n>", has been added to make this
easier to use. "git clone" also learned "--shallow-since=<date>"
and "--shallow-exclude=<tag>" options to make it easier to specify
"I am interested only in the recent N months worth of history" and
"Give me only the history since that version".
(merge cccf74e2da nd/shallow-deepen later to maint).
* It is a common mistake to say "git blame --reverse OLD path",
expecting that the command line is dwimmed as if asking how lines
in path in an old revision OLD have survived up to the current
commit.
(merge e1d09701a4 jc/blame-reverse later to maint).
* http.emptyauth configuration is a way to allow an empty username to
pass when attempting to authenticate using mechanisms like
Kerberos. We took an unspecified (NULL) username and sent ":"
(i.e. no username, no password) to CURLOPT_USERPWD, but did not do
the same when the username is explicitly set to an empty string.
* "git clone" of a local repository can be done at the filesystem
level, but the codepath did not check errors while copying and
adjusting the file that lists alternate object stores.
* Documentation for "git commit" was updated to clarify that "commit
-p <paths>" adds to the current contents of the index to come up
with what to commit.
* A stray symbolic link in $GIT_DIR/refs/ directory could make name
resolution loop forever, which has been corrected.
* The "submodule.<name>.path" stored in .gitmodules is never copied
to .git/config and such a key in .git/config has no meaning, but
the documentation described it and submodule.<name>.url next to
each other as if both belong to .git/config. This has been fixed.
* In a worktree connected to a repository elsewhere, created via "git
worktree", "git checkout" attempts to protect users from confusion
by refusing to check out a branch that is already checked out in
another worktree. However, this also prevented checking out a
branch, which is designated as the primary branch of a bare
reopsitory, in a worktree that is connected to the bare
repository. The check has been corrected to allow it.
* "git rebase" immediately after "git clone" failed to find the fork
point from the upstream.
* When fetching from a remote that has many tags that are irrelevant
to branches we are following, we used to waste way too many cycles
when checking if the object pointed at by a tag (that we are not
going to fetch!) exists in our repository too carefully.
* Protect our code from over-eager compilers.
* Recent git allows submodule.<name>.branch to use a special token
"." instead of the branch name; the documentation has been updated
to describe it.
* A hot-fix for a test added by a recent topic that went to both
'master' and 'maint' already.
* "git send-email" attempts to pick up valid e-mails from the
trailers, but people in real world write non-addresses there, like
"Cc: Stable <add@re.ss> # 4.8+", which broke the output depending
on the availability and vintage of Mail::Address perl module.
(merge dcfafc5214 mm/send-email-cc-cruft-after-address later to maint).
* The Travis CI configuration we ship ran the tests with --verbose
option but this risks non-TAP output that happens to be "ok" to be
misinterpreted as TAP signalling a test that passed. This resulted
in unnecessary failure. This has been corrected by introducing a
new mode to run our tests in the test harness to send the verbose
output separately to the log file.
* Some AsciiDoc formatter mishandles a displayed illustration with
tabs in it. Adjust a few of them in merge-base documentation to
work around them.
* A minor regression fix for "git submodule" that was introduced
when more helper functions were reimplemented in C.
(merge 77b63ac31e sb/submodule-ignore-trailing-slash later to maint).
* The code that we have used for the past 10+ years to cycle
4-element ring buffers turns out to be not quite portable in
theoretical world.
(merge bb84735c80 rs/ring-buffer-wraparound later to maint).
* "git daemon" used fixed-length buffers to turn URL to the
repository the client asked for into the server side directory
path, using snprintf() to avoid overflowing these buffers, but
allowed possibly truncated paths to the directory. This has been
tightened to reject such a request that causes overlong path to be
required to serve.
(merge 6bdb0083be jk/daemon-path-ok-check-truncation later to maint).
* Recent update to git-sh-setup (a library of shell functions that
are used by our in-tree scripted Porcelain commands) included
another shell library git-sh-i18n without specifying where it is,
relying on the $PATH. This has been fixed to be more explicit by
prefixing $(git --exec-path) output in front.
(merge 1073094f30 ak/sh-setup-dot-source-i18n-fix later to maint).
* Fix for a racy false-positive test failure.
(merge fdf4f6c79b as/merge-attr-sleep later to maint).
* Portability update and workaround for builds on recent Mac OS X.
(merge a296bc0132 ls/macos-update later to maint).
* Using a %(HEAD) placeholder in "for-each-ref --format=" option
caused the command to segfault when on an unborn branch.
(merge 84679d470d jc/for-each-ref-head-segfault-fix later to maint).
* "git rebase -i" did not work well with core.commentchar
configuration variable for two reasons, both of which have been
fixed.
(merge 882cd23777 js/rebase-i-commentchar-fix later to maint).
* Other minor doc, test and build updates and code cleanups.
(merge 5c238e29a8 jk/common-main later to maint).
(merge 5a5749e45b ak/pre-receive-hook-template-modefix later to maint).
(merge 6d834ac8f1 jk/rebase-config-insn-fmt-docfix later to maint).
(merge de9f7fa3b0 rs/commit-pptr-simplify later to maint).
(merge 4259d693fc sc/fmt-merge-msg-doc-markup-fix later to maint).
(merge 28fab7b23d nd/test-helpers later to maint).
(merge c2bb0c1d1e rs/cocci later to maint).
(merge 3285b7badb ps/common-info-doc later to maint).
(merge 2b090822e8 nd/worktree-lock later to maint).
(merge 4bd488ea7c jk/create-branch-remove-unused-param later to maint).
(merge 974e0044d6 tk/diffcore-delta-remove-unused later to maint).
----------------------------------------------------------------
Changes since v2.10.0 are as follows:
Aaron M Watson (1):
stash: allow stashes to be referenced by index only
Alex Henrie (5):
am: put spaces around pipe in usage string
cat-file: put spaces around pipes in usage string
git-rebase--interactive: fix English grammar
git-merge-octopus: do not capitalize "octopus"
unpack-trees: do not capitalize "working"
Alex Riesen (2):
git-gui: support for $FILENAMES in tool definitions
git-gui: ensure the file in the diff pane is in the list of selected files
Alexander Shopov (2):
git-gui i18n: Updated Bulgarian translation (565,0f,0u)
git-gui: Mark 'All' in remote.tcl for translation
Anders Kaseorg (3):
imap-send: Tell cURL to use imap:// or imaps://
pre-receive.sample: mark it executable
git-sh-setup: be explicit where to dot-source git-sh-i18n from.
Andreas Schwab (2):
t6026-merge-attr: don't fail if sleep exits early
t6026-merge-attr: ensure that the merge driver was called
Beat Bolli (1):
SubmittingPatches: use gitk's "Copy commit summary" format
Ben North (1):
git-worktree.txt: fix typo "to"/"two", and add comma
Brandon Williams (6):
pathspec: remove unnecessary function prototypes
git: make super-prefix option
ls-files: optionally recurse into submodules
ls-files: pass through safe options for --recurse-submodules
ls-files: add pathspec matching for submodules
submodules doc: update documentation for "." used for submodule branches
Brian Henderson (3):
diff-highlight: add some tests
diff-highlight: add failing test for handling --graph output
diff-highlight: add support for --graph output
Changwoo Ryu (1):
l10n: ko.po: Update Korean translation
Chris Packham (1):
completion: support excluding refs
Christian Couder (43):
apply: make some names more specific
apply: move 'struct apply_state' to apply.h
builtin/apply: make apply_patch() return -1 or -128 instead of die()ing
builtin/apply: read_patch_file() return -1 instead of die()ing
builtin/apply: make find_header() return -128 instead of die()ing
builtin/apply: make parse_chunk() return a negative integer on error
builtin/apply: make parse_single_patch() return -1 on error
builtin/apply: make parse_whitespace_option() return -1 instead of die()ing
builtin/apply: make parse_ignorewhitespace_option() return -1 instead of die()ing
builtin/apply: move init_apply_state() to apply.c
apply: make init_apply_state() return -1 instead of exit()ing
builtin/apply: make check_apply_state() return -1 instead of die()ing
builtin/apply: move check_apply_state() to apply.c
builtin/apply: make apply_all_patches() return 128 or 1 on error
builtin/apply: make parse_traditional_patch() return -1 on error
builtin/apply: make gitdiff_*() return 1 at end of header
builtin/apply: make gitdiff_*() return -1 on error
builtin/apply: change die_on_unsafe_path() to check_unsafe_path()
builtin/apply: make build_fake_ancestor() return -1 on error
builtin/apply: make remove_file() return -1 on error
builtin/apply: make add_conflicted_stages_file() return -1 on error
builtin/apply: make add_index_file() return -1 on error
builtin/apply: make create_file() return -1 on error
builtin/apply: make write_out_one_result() return -1 on error
builtin/apply: make write_out_results() return -1 on error
unpack-objects: add --max-input-size=<size> option
builtin/apply: make try_create_file() return -1 on error
builtin/apply: make create_one_file() return -1 on error
builtin/apply: rename option parsing functions
apply: rename and move opt constants to apply.h
apply: move libified code from builtin/apply.c to apply.{c,h}
apply: make some parsing functions static again
apply: use error_errno() where possible
apply: make it possible to silently apply
apply: don't print on stdout in verbosity_silent mode
usage: add set_warn_routine()
usage: add get_error_routine() and get_warn_routine()
apply: change error_routine when silent
apply: refactor `git apply` option parsing
apply: pass apply state to build_fake_ancestor()
apply: learn to use a different index file
builtin/am: use apply API in run_apply()
split-index: s/eith/with/ typo fix
David Aguilar (4):
mergetool: add copyright
mergetool: move main program flow into a main() function
mergetool: honor diff.orderFile
mergetool: honor -O<orderfile>
David Turner (11):
rename_ref_available(): add docstring
refs: add methods for reflog
refs: add method for initial ref transaction commit
refs: make delete_refs() virtual
refs: add methods to init refs db
refs: add method to rename refs
refs: make lock generic
refs: implement iteration over only per-worktree refs
add David Turner's Two Sigma address
fsck: handle bad trees like other errors
http: http.emptyauth should allow empty (not just NULL) usernames
Dennis Kaarsemaker (1):
worktree: allow the main brach of a bare repository to be checked out
Dimitriy Ryazantcev (3):
l10n: ru.po: update Russian translation
git-gui: Update Russian translation
l10n: ru.po: update Russian translation
Elia Pinto (6):
t5541-http-push-smart.sh: use the GIT_TRACE_CURL environment var
test-lib.sh: preserve GIT_TRACE_CURL from the environment
t5550-http-fetch-dumb.sh: use the GIT_TRACE_CURL environment var
t5551-http-fetch-smart.sh: use the GIT_TRACE_CURL environment var
git-check-ref-format.txt: fixup documentation
git-gui/po/glossary/txt-to-pot.sh: use the $( ... ) construct for command substitution
Emily Xie (1):
pathspec: warn on empty strings as pathspec
Eric Wong (5):
http: warn on curl_multi_add_handle failures
http: consolidate #ifdefs for curl_multi_remove_handle
http: always remove curl easy from curlm session on release
git-svn: reduce scope of input record separator change
git-svn: "git worktree" awareness
Gavin Lambert (1):
git-svn: do not reuse caches memoized for a different architecture
Ian Kelling (2):
gitweb: remove unused guess_file_syntax() parameter
gitweb: use highlight's shebang detection
Jacob Keller (9):
format-patch: show 0/1 and 1/1 for singleton patch with cover letter
cache: add empty_tree_oid object and helper function
graph: add support for --line-prefix on all graph-aware output
diff: prepare for additional submodule formats
allow do_submodule_path to work even if submodule isn't checked out
submodule: convert show_submodule_summary to use struct object_id *
submodule: refactor show_submodule_summary with helper function
diff: teach diff to display submodule difference with an inline diff
rev-list: use hdr_termination instead of a always using a newline
Jakub Narębski (1):
configure.ac: improve description of NO_REGEX test
Jean-Noel Avila (1):
l10n: fr.po v2.11.0_rnd1
Jean-Noël AVILA (1):
i18n: i18n: diff: mark die messages for translation
Jeff Hostetler (9):
status: rename long-format print routines
status: cleanup API to wt_status_print
status: support --porcelain[=<version>]
status: collect per-file data for --porcelain=v2
status: print per-file porcelain v2 status data
status: print branch info with --porcelain=v2 --branch
git-status.txt: describe --porcelain=v2 format
test-lib-functions.sh: add lf_to_nul helper
status: unit tests for --porcelain=v2
Jeff King (116):
rebase-interactive: drop early check for valid ident
provide an initializer for "struct object_info"
sha1_file: make packed_object_info public
pack-objects: break delta cycles before delta-search phase
pack-objects: use mru list when iterating over packs
gc: default aggressive depth to 50
cache_or_unpack_entry: drop keep_cache parameter
clear_delta_base_cache_entry: use a more descriptive name
release_delta_base_cache: reuse existing detach function
delta_base_cache: use list.h for LRU
delta_base_cache: drop special treatment of blobs
delta_base_cache: use hashmap.h
t/perf: add basic perf tests for delta base cache
index-pack: add --max-input-size=<size> option
receive-pack: allow a maximum input size to be specified
test-lib: drop PID from test-results/*.count
diff-highlight: ignore test cruft
diff-highlight: add multi-byte tests
diff-highlight: avoid highlighting combined diffs
error_errno: use constant return similar to error()
color_parse_mem: initialize "struct color" temporary
t5305: move cleanup into test block
t5305: drop "dry-run" of unpack-objects
t5305: use "git -C"
t5305: simplify packname handling
pack-objects: walk tag chains for --include-tag
remote-curl: handle URLs without protocol
patch-ids: turn off rename detection
add_delta_base_cache: use list_for_each_safe
patch-ids: refuse to compute patch-id for merge commit
hash-object: always try to set up the git repository
patch-id: use RUN_SETUP_GENTLY
diff: skip implicit no-index check when given --no-index
diff: handle --no-index prefixes consistently
diff: always try to set up the repository
pager: remove obsolete comment
pager: stop loading git_default_config()
pager: make pager_program a file-local static
pager: use callbacks instead of configset
pager: handle early config
t1302: use "git -C"
test-config: setup git directory
config: only read .git/config from configured repos
init: expand comments explaining config trickery
init: reset cached config when entering new repo
t1007: factor out repeated setup
verify_packfile: check pack validity before accessing data
clone: pass --progress decision to recursive submodules
docs/cvsimport: prefer cvs-fast-export to parsecvs
docs/cvs-migration: update link to cvsps homepage
docs/cvs-migration: mention cvsimport caveats
ident: handle NULL ai_canonname
get_sha1: detect buggy calls with multiple disambiguators
get_sha1: avoid repeating ourselves via ONLY_TO_DIE
get_sha1: propagate flags to child functions
get_short_sha1: parse tags when looking for treeish
get_short_sha1: refactor init of disambiguation code
get_short_sha1: NUL-terminate hex prefix
get_short_sha1: mark ambiguity error for translation
sha1_array: let callbacks interrupt iteration
for_each_abbrev: drop duplicate objects
get_short_sha1: list ambiguous objects on error
xdiff: rename "struct group" to "struct xdlgroup"
get_short_sha1: make default disambiguation configurable
tree-walk: be more specific about corrupt tree errors
graph: fix extra spaces in graph_padding_line
t5613: drop reachable_via function
t5613: drop test_valid_repo function
t5613: use test_must_fail
t5613: whitespace/style cleanups
t5613: do not chdir in main process
find_unique_abbrev: move logic out of get_short_sha1()
clone: detect errors in normalize_path_copy
files_read_raw_ref: avoid infinite loop on broken symlinks
files_read_raw_ref: prevent infinite retry loops in general
t5613: clarify "too deep" recursion tests
link_alt_odb_entry: handle normalize_path errors
link_alt_odb_entry: refactor string handling
alternates: provide helper for adding to alternates list
alternates: provide helper for allocating alternate
alternates: encapsulate alt->base munging
alternates: use a separate scratch space
fill_sha1_file: write "boring" characters
alternates: store scratch buffer as strbuf
fill_sha1_file: write into a strbuf
count-objects: report alternates via verbose mode
sha1_file: always allow relative paths to alternates
alternates: use fspathcmp to detect duplicates
check_connected: accept an env argument
tmp-objdir: introduce API for temporary object directories
receive-pack: quarantine objects until pre-receive accepts
tmp-objdir: put quarantine information in the environment
tmp-objdir: do not migrate files starting with '.'
upload-pack: use priority queue in reachable() check
merge-base: handle --fork-point without reflog
fetch: use "quick" has_sha1_file for tag following
test-lib: handle TEST_OUTPUT_DIRECTORY with spaces
test-lib: add --verbose-log option
travis: use --verbose-log test option
test-lib: bail out when "-v" used under "prove"
daemon: detect and reject too-long paths
read info/{attributes,exclude} only when in repository
test-*-cache-tree: setup git dir
find_unique_abbrev: use 4-buffer ring
diff_unique_abbrev: rename to diff_aligned_abbrev
diff_aligned_abbrev: use "struct oid"
diff: handle sha1 abbreviations outside of repository
git-compat-util: move content inside ifdef/endif guards
doc: fix missing "::" in config list
t0021: use write_script to create rot13 shell script
t0021: put $TEST_ROOT in $PATH
t0021: use $PERL_PATH for rot13-filter.pl
t0021: fix filehandle usage on older perl
alternates: re-allow relative paths from environment
sequencer: silence -Wtautological-constant-out-of-range-compare
create_branch: drop unused "head" parameter
Jiang Xin (6):
l10n: zh_CN: fixed some typos for git 2.10.0
l10n: git.pot: v2.11.0 round 1 (209 new, 53 removed)
l10n: zh_CN: for git v2.11.0 l10n round 1
i18n: fix unmatched single quote in error message
l10n: git.pot: v2.11.0 round 2 (1 new, 1 removed)
l10n: Fixed typo of git fetch-pack command
Johannes Schindelin (63):
cat-file: fix a grammo in the man page
sequencer: lib'ify sequencer_pick_revisions()
sequencer: do not die() in do_pick_commit()
sequencer: lib'ify write_message()
sequencer: lib'ify do_recursive_merge()
sequencer: lib'ify do_pick_commit()
sequencer: lib'ify walk_revs_populate_todo()
sequencer: lib'ify prepare_revs()
sequencer: lib'ify read_and_refresh_cache()
sequencer: lib'ify read_populate_todo()
sequencer: lib'ify read_populate_opts()
sequencer: lib'ify create_seq_dir()
sequencer: lib'ify save_head()
sequencer: lib'ify save_todo()
sequencer: lib'ify save_opts()
sequencer: lib'ify fast_forward_to()
sequencer: lib'ify checkout_fast_forward()
sequencer: ensure to release the lock when we could not read the index
cat-file: introduce the --filters option
cat-file --textconv/--filters: allow specifying the path separately
cat-file: support --textconv/--filters in batch mode
git-gui: respect commit.gpgsign again
regex: -G<pattern> feeds a non NUL-terminated string to regexec() and fails
regex: add regexec_buf() that can work on a non NUL-terminated string
regex: use regexec_buf()
pull: drop confusing prefix parameter of die_on_unclean_work_tree()
pull: make code more similar to the shell script again
wt-status: make the require_clean_work_tree() function reusable
wt-status: export also the has_un{staged,committed}_changes() functions
wt-status: teach has_{unstaged,uncommitted}_changes() about submodules
wt-status: begin error messages with lower-case
reset: fix usage
sequencer: use static initializers for replay_opts
sequencer: use memoized sequencer directory path
sequencer: avoid unnecessary indirection
sequencer: future-proof remove_sequencer_state()
sequencer: plug memory leaks for the option values
sequencer: future-proof read_populate_todo()
sequencer: refactor the code to obtain a short commit name
sequencer: completely revamp the "todo" script parsing
sequencer: strip CR from the todo script
sequencer: avoid completely different messages for different actions
sequencer: get rid of the subcommand field
sequencer: remember the onelines when parsing the todo file
sequencer: prepare for rebase -i's commit functionality
sequencer: introduce a helper to read files written by scripts
sequencer: allow editing the commit message on a case-by-case basis
sequencer: support amending commits
sequencer: support cleaning up commit messages
sequencer: left-trim lines read from the script
sequencer: stop releasing the strbuf in write_message()
sequencer: roll back lock file if write_message() failed
sequencer: refactor write_message() to take a pointer/length
sequencer: teach write_message() to append an optional LF
sequencer: remove overzealous assumption in rebase -i mode
sequencer: mark action_name() for translation
sequencer: quote filenames in error messages
sequencer: start error messages consistently with lower case
sequencer: mark all error messages for translation
t6026: ensure that long-running script really is
rebase -i: highlight problems with core.commentchar
stripspace: respect repository config
rebase -i: handle core.commentChar=auto
Johannes Sixt (9):
t9903: fix broken && chain
t6026-merge-attr: clean up background process at end of test case
t3700-add: create subdirectory gently
t3700-add: do not check working tree file mode without POSIXPERM
t0060: sidestep surprising path mangling results on Windows
t0021: expect more variations in the output of uniq -c
t0021: compute file size with a single process instead of a pipeline
t0021, t5615: use $PWD instead of $(pwd) in PATH-like shell variables
t6026: clarify the point of "kill $(cat sleep.pid)"
Jonathan Nieder (1):
connect: tighten check for unexpected early hang up
Jonathan Tan (15):
tests: move test_lazy_prereq JGIT to test-lib.sh
connect: advertized capability is not a ref
mailinfo: separate in-body header processing
mailinfo: make is_scissors_line take plain char *
mailinfo: handle in-body header continuations
fetch-pack: do not reset in_vain on non-novel acks
trailer: improve const correctness
trailer: use list.h for doubly-linked list
trailer: streamline trailer item create and add
trailer: make args have their own struct
trailer: clarify failure modes in parse_trailer
trailer: allow non-trailers in trailer block
trailer: forbid leading whitespace in trailers
trailer: support values folded to multiple lines
doc: mention user-configured trailers
Josh Triplett (2):
format-patch: show base info before email signature
format-patch: add "--rfc" for the common case of [RFC PATCH]
Junio C Hamano (53):
blame: improve diagnosis for "--reverse NEW"
blame: dwim "blame --reverse OLD" as "blame --reverse OLD.."
am: refactor read_author_script()
diff.c: remove output_prefix_length field
submodule: avoid auto-discovery in prepare_submodule_repo_env()
symbolic-ref -d: do not allow removal of HEAD
Prepare for 2.9.4
Start the 2.11 cycle
First batch for 2.11
Second batch for 2.11
Third batch for 2.11
Start preparing for 2.10.1
Fourth batch for 2.11
streaming: make sure to notice corrupt object
unpack_sha1_header(): detect malformed object header
Fifth batch for 2.11
worktree: honor configuration variables
blame: use DEFAULT_ABBREV macro
Prepare for 2.10.1
Sixth batch for 2.11
diff_unique_abbrev(): document its assumption and limitation
abbrev: add FALLBACK_DEFAULT_ABBREV to prepare for auto sizing
abbrev: prepare for new world order
Git 2.10.1
Seventh batch for 2.11
t4015: split out the "setup" part of ws-error-highlight test
diff.c: refactor parse_ws_error_highlight()
diff.c: move ws-error-highlight parsing helpers up
diff: introduce diff.wsErrorHighlight option
Eighth batch for 2.11
Ninth batch for 2.11
Start preparing for 2.10.2
cocci: refactor common patterns to use xstrdup_or_null()
Tenth batch for 2.11
t3700: fix broken test under !SANITY
transport: pass summary_width down the callchain
fetch: pass summary_width down the callchain
transport: allow summary-width to be computed dynamically
transport: compute summary-width dynamically
Eleventh batch for 2.11
Getting ready for 2.11-rc0
Git 2.10.2
Git 2.11-rc0
A bit of updates post -rc0
Revert "t6026-merge-attr: ensure that the merge driver was called"
Revert "t6026-merge-attr: don't fail if sleep exits early"
t0021: remove debugging cruft
Git 2.11.0-rc1
Git 2.11-rc2
for-each-ref: do not segv with %(HEAD) on an unborn branch
mailinfo: read local configuration
archive: read local configuration
Git 2.11-rc3
Karsten Blees (2):
git-gui: unicode file name support on windows
git-gui: handle the encoding of Git's output correctly
Kevin Daudt (2):
t5100-mailinfo: replace common path prefix with variable
mailinfo: unescape quoted-pair in header fields
Kirill Smelkov (3):
pack-objects: respect --local/--honor-pack-keep/--incremental when bitmap is in use
pack-objects: use reachability bitmap index when generating non-stdout pack
t/perf/run: copy config.mak.autogen & friends to build area
Lars Schneider (20):
travis-ci: ask homebrew for its path instead of hardcoding it
convert: quote filter names in error messages
convert: modernize tests
run-command: move check_pipe() from write_or_die to run_command
run-command: add clean_on_exit_handler
pkt-line: rename packet_write() to packet_write_fmt()
pkt-line: extract set_packet_header()
pkt-line: add packet_write_fmt_gently()
pkt-line: add packet_flush_gently()
pkt-line: add packet_write_gently()
pkt-line: add functions to read/write flush terminated packet streams
convert: make apply_filter() adhere to standard Git error handling
convert: prepare filter.<driver>.process option
convert: add filter.<driver>.process option
contrib/long-running-filter: add long running filter example
sha1_file: rename git_open_noatime() to git_open()
sha1_file: open window into packfiles with O_CLOEXEC
read-cache: make sure file handles are not inherited by child processes
Makefile: set NO_OPENSSL on macOS by default
travis-ci: disable GIT_TEST_HTTPD for macOS
Linus Torvalds (1):
abbrev: auto size the default abbreviation
Mantas Mikulėnas (1):
contrib: add credential helper for libsecret
Matthieu Moy (4):
Documentation/config: default for color.* is color.ui
parse_mailboxes: accept extra text after <...> address
t9000-addresses: update expected results after fix
Git.pm: add comment pointing to t9000
Michael Haggerty (36):
xdl_change_compact(): fix compaction heuristic to adjust ixo
xdl_change_compact(): only use heuristic if group can't be matched
is_blank_line(): take a single xrecord_t as argument
recs_match(): take two xrecord_t pointers as arguments
xdl_change_compact(): introduce the concept of a change group
resolve_gitlink_ref(): eliminate temporary variable
refs: rename struct ref_cache to files_ref_store
refs: create a base class "ref_store" for files_ref_store
add_packed_ref(): add a files_ref_store argument
get_packed_ref(): add a files_ref_store argument
resolve_missing_loose_ref(): add a files_ref_store argument
{lock,commit,rollback}_packed_refs(): add files_ref_store arguments
refs: reorder definitions
resolve_packed_ref(): rename function from resolve_missing_loose_ref()
resolve_gitlink_packed_ref(): remove function
read_raw_ref(): take a (struct ref_store *) argument
resolve_ref_recursively(): new function
resolve_gitlink_ref(): implement using resolve_ref_recursively()
resolve_gitlink_ref(): avoid memory allocation in many cases
resolve_gitlink_ref(): rename path parameter to submodule
refs: make read_raw_ref() virtual
refs: make verify_refname_available() virtual
refs: make pack_refs() virtual
refs: make create_symref() virtual
refs: make peel_ref() virtual
repack_without_refs(): add a files_ref_store argument
lock_raw_ref(): add a files_ref_store argument
commit_ref_update(): add a files_ref_store argument
lock_ref_for_update(): add a files_ref_store argument
lock_ref_sha1_basic(): add a files_ref_store argument
split_symref_update(): add a files_ref_store argument
files_ref_iterator_begin(): take a ref_store argument
refs: add method iterator_begin
diff: improve positioning of add/delete blocks in diffs
parse-options: add parse_opt_unknown_cb()
blame: honor the diff heuristic options and config
Michael J Gruber (1):
gpg-interface: use more status letters
Mike Ralphson (1):
vcs-svn/fast_export: fix timestamp fmt specifiers
Nguyễn Thái Ngọc Duy (40):
remote-curl.c: convert fetch_git() to use argv_array
transport-helper.c: refactor set_helper_option()
upload-pack: move shallow deepen code out of receive_needs()
upload-pack: move "shallow" sending code out of deepen()
upload-pack: remove unused variable "backup"
upload-pack: move "unshallow" sending code out of deepen()
upload-pack: use skip_prefix() instead of starts_with()
upload-pack: tighten number parsing at "deepen" lines
upload-pack: make check_non_tip() clean things up on error
upload-pack: move rev-list code out of check_non_tip()
fetch-pack: use skip_prefix() instead of starts_with()
fetch-pack: use a common function for verbose printing
fetch-pack.c: mark strings for translating
fetch-pack: use a separate flag for fetch in deepening mode
shallow.c: implement a generic shallow boundary finder based on rev-list
upload-pack: add deepen-since to cut shallow repos based on time
fetch: define shallow boundary with --shallow-since
clone: define shallow clone boundary based on time with --shallow-since
t5500, t5539: tests for shallow depth since a specific date
refs: add expand_ref()
upload-pack: support define shallow boundary by excluding revisions
fetch: define shallow boundary with --shallow-exclude
clone: define shallow clone boundary with --shallow-exclude
t5500, t5539: tests for shallow depth excluding a ref
upload-pack: split check_unreachable() in two, prep for get_reachable_list()
upload-pack: add get_reachable_list()
fetch, upload-pack: --deepen=N extends shallow boundary by N commits
checkout: add some spaces between code and comment
checkout.txt: document a common case that ignores ambiguation rules
checkout: fix ambiguity check in subdir
init: correct re-initialization from a linked worktree
init: call set_git_dir_init() from within init_db()
init: kill set_git_dir_init()
init: do not set unnecessary core.worktree
init: kill git_link variable
git-commit.txt: clarify --patch mode with pathspec
diff-lib: allow ita entries treated as "not yet exist in index"
diff: add --ita-[in]visible-in-index
commit: fix empty commit creation when there's no changes but ita entries
commit: don't be fooled by ita entries when creating initial commit
Olaf Hering (1):
git-gui: sort entries in tclIndex
Orgad Shaneh (1):
git-gui: Do not reset author details on amend
Pat Thoyts (7):
Allow keyboard control to work in the staging widgets.
Amend tab ordering and text widget border and highlighting.
git-gui: fix detection of Cygwin
git-gui (Windows): use git-gui.exe in `Create Desktop Shortcut`
git-gui: maintain backwards compatibility for merge syntax
git-gui: avoid persisting modified author identity
git-gui: set version 0.21
Patrick Steinhardt (1):
doc: fix location of 'info/' with $GIT_COMMON_DIR
Peter Krefting (1):
l10n: sv.po: Update Swedish translation (2913t0f0u)
Petr Stodulka (1):
http: control GSSAPI credential delegation
Philip Oakley (14):
doc: use 'symmetric difference' consistently
doc: revisions - name the left and right sides
doc: show the actual left, right, and boundary marks
doc: revisions: give headings for the two and three dot notations
doc: revisions: extra clarification of <rev>^! notation effects
doc: revisions: single vs multi-parent notation comparison
doc: gitrevisions - use 'reachable' in page description
doc: gitrevisions - clarify 'latter case' is revision walk
doc: revisions - define `reachable`
doc: revisions - clarify reachability examples
doc: revisions: show revision expansion in examples
doc: revisions: sort examples and fix alignment of the unchanged
doc: fix merge-base ASCII art tab spacing
doc: fix the 'revert a faulty merge' ASCII art tab spacing
Pranit Bauva (2):
rev-list-options: clarify the usage of --reverse
t0040: convert all possible tests to use `test-parse-options --expect`
Ralf Thielow (6):
help: introduce option --exclude-guides
help: make option --help open man pages only for Git commands
rebase -i: improve advice on bad instruction lines
l10n: de.po: fix translation of autostash
l10n: de.po: translate 260 new messages
fetch-pack.c: correct command at the beginning of an error message
Ray Chen (1):
l10n: zh_CN: review for git v2.10.0 l10n
René Scharfe (36):
compat: move strdup(3) replacement to its own file
introduce hex2chr() for converting two hexadecimal digits to a character
strbuf: use valid pointer in strbuf_remove()
checkout: constify parameters of checkout_stage() and checkout_merged()
unpack-trees: pass checkout state explicitly to check_updates()
sha1_file: use llist_mergesort() for sorting packs
xdiff: fix merging of hunks with -W context and -u context
contrib/coccinelle: fix semantic patch for oid_to_hex_r()
add coccicheck make target
use strbuf_addstr() for adding constant strings to a strbuf, part 2
pretty: let %C(auto) reset all attributes
introduce CHECKOUT_INIT
add COPY_ARRAY
use COPY_ARRAY
git-gui: stop using deprecated merge syntax
gitignore: ignore output files of coccicheck make target
use strbuf_addstr() instead of strbuf_addf() with "%s", part 2
use strbuf_add_unique_abbrev() for adding short hashes, part 2
add QSORT
use QSORT
remove unnecessary check before QSORT
coccicheck: use --all-includes by default
use QSORT, part 2
pretty: avoid adding reset for %C(auto) if output is empty
coccicheck: make transformation for strbuf_addf(sb, "...") more precise
show-branch: use QSORT
remove unnecessary NULL check before free(3)
use strbuf_add_unique_abbrev() for adding short hashes, part 3
pretty: fix document link for color specification
avoid pointer arithmetic involving NULL in FLEX_ALLOC_MEM
inline xalloc_flex() into FLEXPTR_ALLOC_MEM
hex: make wraparound of the index into ring-buffer explicit
valgrind: support test helpers
commit: simplify building parents list
sha1_name: make wraparound of the index into ring-buffer explicit
cocci: avoid self-references in object_id transformations
Ronnie Sahlberg (2):
refs: add a backend method structure
refs: add a transaction_commit() method
SZEDER Gábor (1):
ref-filter: strip format option after a field name only once while parsing
Satoshi Yasushima (6):
git-gui: consistently use the same word for "remote" in Japanese
git-gui: consistently use the same word for "blame" in Japanese
git-gui: apply po template to Japanese translation
git-gui: add Japanese language code
git-gui: update Japanese translation
git-gui: update Japanese information
Stefan Beller (16):
t7408: modernize style
t7408: merge short tests, factor out testing method
submodule--helper module-clone: allow multiple references
submodule--helper update-clone: allow multiple references
clone: factor out checking for an alternate path
clone: clarify option_reference as required
clone: implement optional references
clone: recursive and reference option triggers submodule alternates
xdiff: remove unneeded declarations
transport: report missing submodule pushes consistently on stderr
diff.c: use diff_options directly
diff: omit found pointer from emit_callback
diff: remove dead code
submodule: ignore trailing slash on superproject URL
submodule: ignore trailing slash in relative url
documentation: improve submodule.<name>.{url, path} description
Stefan Christ (1):
Documentation/fmt-merge-msg: fix markup in example
Thomas Gummerer (4):
add: document the chmod option
update-index: add test for chmod flags
read-cache: introduce chmod_index_entry
add: modify already added files when --chmod is given
Tobias Klauser (1):
diffcore-delta: remove unused parameter to diffcore_count_changes()
Trần Ngọc Quân (1):
l10n: vi.po: Updated translation to v2.11.0 (2913t)
Vasco Almeida (33):
l10n: pt_PT: update Portuguese translation
l10n: pt_PT: update Portuguese repository info
i18n: blame: mark error messages for translation
i18n: branch: mark option description for translation
i18n: config: mark error message for translation
i18n: merge-recursive: mark error messages for translation
i18n: merge-recursive: mark verbose message for translation
i18n: notes: mark error messages for translation
notes: spell first word of error messages in lowercase
i18n: receive-pack: mark messages for translation
i18n: show-branch: mark error messages for translation
i18n: show-branch: mark plural strings for translation
i18n: update-index: mark warnings for translation
i18n: commit: mark message for translation
i18n: connect: mark die messages for translation
i18n: ident: mark hint for translation
i18n: notes-merge: mark die messages for translation
i18n: stash: mark messages for translation
git-gui i18n: mark strings for translation
git-gui: l10n: add Portuguese translation
git-gui i18n: internationalize use of colon punctuation
git-gui i18n: mark "usage:" strings for translation
git-gui: fix incorrect use of Tcl append command
git-gui i18n: mark string in lib/error.tcl for translation
t1512: become resilient to GETTEXT_POISON build
i18n: apply: mark plural string for translation
i18n: apply: mark info messages for translation
i18n: apply: mark error messages for translation
i18n: apply: mark error message for translation
i18n: convert mark error messages for translation
i18n: credential-cache--daemon: mark advice for translation
i18n: diff: mark warnings for translation
l10n: pt_PT: update Portuguese translation
Vegard Nossum (1):
revision: new rev^-n shorthand for rev^n..rev
Younes Khoudli (1):
doc: remove reference to the traditional layout in git-tag.txt
brian m. carlson (20):
cache: convert struct cache_entry to use struct object_id
builtin/apply: convert static functions to struct object_id
builtin/blame: convert struct origin to use struct object_id
builtin/log: convert some static functions to use struct object_id
builtin/cat-file: convert struct expand_data to use struct object_id
builtin/cat-file: convert some static functions to struct object_id
builtin: convert textconv_object to use struct object_id
streaming: make stream_blob_to_fd take struct object_id
builtin/checkout: convert some static functions to struct object_id
notes-merge: convert struct notes_merge_pair to struct object_id
Convert read_mmblob to take struct object_id.
builtin/blame: convert file to use struct object_id
builtin/rm: convert to use struct object_id
notes: convert init_notes to use struct object_id
builtin/update-index: convert file to struct object_id
sha1_name: convert get_sha1_mb to struct object_id
refs: add an update_ref_oid function.
builtin/am: convert to struct object_id
builtin/commit-tree: convert to struct object_id
builtin/reset: convert to use struct object_id
jfbu (1):
l10n: fr.po fix grammar mistakes
yaras (1):
git-gui: fix initial git gui message encoding
Ævar Arnfjörð Bjarmason (3):
gitweb: fix a typo in a comment
gitweb: link to 7-char+ SHA-1s, not only 8-char+
gitweb: link to "git describe"'d commits in log messages
Дилян Палаузов (1):
./configure.ac: detect SSL in libcurl using curl-config
^ permalink raw reply
* What's cooking in git.git (Nov 2016, #05; Wed, 23)
From: Junio C Hamano @ 2016-11-23 23:21 UTC (permalink / raw)
To: git
Here are the topics that have been cooking. Commits prefixed with
'-' are only in 'pu' (proposed updates) while commits prefixed with
'+' are in 'next'. The ones marked with '.' do not appear in any of
the integration branches, but I am still holding onto them.
A new and hopefully final release candidate 2.11-rc3 has been
tagged.
You can find the changes described here in the integration branches
of the repositories listed at
http://git-blame.blogspot.com/p/git-public-repositories.html
--------------------------------------------------
[Graduated to "master"]
* jc/for-each-ref-head-segfault-fix (2016-11-18) 1 commit
(merged to 'next' on 2016-11-21 at 3c1f352316)
+ for-each-ref: do not segv with %(HEAD) on an unborn branch
Using a %(HEAD) placeholder in "for-each-ref --format=" option
caused the command to segfault when on an unborn branch.
* jc/setup-cleanup-fix (2016-11-22) 2 commits
(merged to 'next' on 2016-11-23 at e46785ec9c)
+ archive: read local configuration
+ mailinfo: read local configuration
"git archive" and "git mailinfo" stopped reading from local
configuration file with a recent update.
* js/prepare-sequencer (2016-11-21) 1 commit
(merged to 'next' on 2016-11-21 at 7cdf4ca421)
+ i18n: fix unmatched single quote in error message
Fix for an error message string.
* js/rebase-i-commentchar-fix (2016-11-21) 3 commits
(merged to 'next' on 2016-11-22 at 88581dfe2e)
+ rebase -i: handle core.commentChar=auto
+ stripspace: respect repository config
+ rebase -i: highlight problems with core.commentchar
"git rebase -i" did not work well with core.commentchar
configuration variable for two reasons, both of which have been
fixed.
* jt/trailer-with-cruft (2016-11-21) 1 commit
(merged to 'next' on 2016-11-22 at c68014088a)
+ doc: mention user-configured trailers
Doc update.
--------------------------------------------------
[New Topics]
* jc/cache-tree-wip (2016-11-18) 4 commits
- cache-tree: freshen the tree object at the top level
- cache-tree: retire cache_tree_fully_valid() API function
- commit: remove redundant check for active_cache_changed
- freshen_object(): factor out a helper function
* bw/push-dry-run (2016-11-23) 2 commits
- push: fix --dry-run to not push submodules
- push: --dry-run updates submodules when --recurse-submodules=on-demand
(this branch uses hv/submodule-not-yet-pushed-fix.)
* jk/rev-parse-symbolic-parents-fix (2016-11-16) 1 commit
- rev-parse: fix parent shorthands with --symbolic
* nd/worktree-list-fixup (2016-11-23) 3 commits
- worktree list: keep the list sorted
- get_worktrees() must return main worktree as first item even on error
- worktree.c: zero new 'struct worktree' on allocation
(this branch is used by nd/worktree-move.)
--------------------------------------------------
[Stalled]
* sb/push-make-submodule-check-the-default (2016-10-10) 2 commits
- push: change submodule default to check when submodules exist
- submodule add: extend force flag to add existing repos
Turn the default of "push.recurseSubmodules" to "check" when
submodules seem to be in use.
Will hold to wait for hv/submodule-not-yet-pushed-fix
* jc/bundle (2016-03-03) 6 commits
- index-pack: --clone-bundle option
- Merge branch 'jc/index-pack' into jc/bundle
- bundle v3: the beginning
- bundle: keep a copy of bundle file name in the in-core bundle header
- bundle: plug resource leak
- bundle doc: 'verify' is not about verifying the bundle
The beginning of "split bundle", which could be one of the
ingredients to allow "git clone" traffic off of the core server
network to CDN.
While I think it would make it easier for people to experiment and
build on if the topic is merged to 'next', I am at the same time a
bit reluctant to merge an unproven new topic that introduces a new
file format, which we may end up having to support til the end of
time. It is likely that to support a "prime clone from CDN", it
would need a lot more than just "these are the heads and the pack
data is over there", so this may not be sufficient.
Will discard.
* mh/connect (2016-06-06) 10 commits
- connect: [host:port] is legacy for ssh
- connect: move ssh command line preparation to a separate function
- connect: actively reject git:// urls with a user part
- connect: change the --diag-url output to separate user and host
- connect: make parse_connect_url() return the user part of the url as a separate value
- connect: group CONNECT_DIAG_URL handling code
- connect: make parse_connect_url() return separated host and port
- connect: re-derive a host:port string from the separate host and port variables
- connect: call get_host_and_port() earlier
- connect: document why we sometimes call get_port after get_host_and_port
Rewrite Git-URL parsing routine (hopefully) without changing any
behaviour.
It has been two months without any support. We may want to discard
this.
* ec/annotate-deleted (2015-11-20) 1 commit
- annotate: skip checking working tree if a revision is provided
Usability fix for annotate-specific "<file> <rev>" syntax with deleted
files.
Has been waiting for a review for too long without seeing anything.
Will discard.
* dk/gc-more-wo-pack (2016-01-13) 4 commits
- gc: clean garbage .bitmap files from pack dir
- t5304: ensure non-garbage files are not deleted
- t5304: test .bitmap garbage files
- prepare_packed_git(): find more garbage
Follow-on to dk/gc-idx-wo-pack topic, to clean up stale
.bitmap and .keep files.
Has been waiting for a reroll for too long.
cf. <xmqq60ypbeng.fsf@gitster.mtv.corp.google.com>
Will discard.
* jc/diff-b-m (2015-02-23) 5 commits
. WIPWIP
. WIP: diff-b-m
- diffcore-rename: allow easier debugging
- diffcore-rename.c: add locate_rename_src()
- diffcore-break: allow debugging
"git diff -B -M" produced incorrect patch when the postimage of a
completely rewritten file is similar to the preimage of a removed
file; such a resulting file must not be expressed as a rename from
other place.
The fix in this patch is broken, unfortunately.
Will discard.
--------------------------------------------------
[Cooking]
* jk/trailers-placeholder-in-pretty (2016-11-21) 2 commits
- ref-filter: add support to display trailers as part of contents
- pretty: add %(trailers) format for displaying trailers of a commit message
* sb/submodule-intern-gitdir (2016-11-22) 5 commits
- SQUASH
- submodule: add embed-git-dir function
- test-lib-functions.sh: teach test_commit -C <dir>
- submodule helper: support super prefix
- submodule: use absolute path for computing relative path connecting
* dt/empty-submodule-in-merge (2016-11-17) 1 commit
- submodules: allow empty working-tree dirs in merge/cherry-pick
An empty directory in a working tree that can simply be nuked used
to interfere while merging or cherry-picking a change to create a
submodule directory there, which has been fixed..
Waiting for review.
* bw/grep-recurse-submodules (2016-11-22) 6 commits
- grep: search history of moved submodules
- grep: enable recurse-submodules to work on <tree> objects
- grep: optionally recurse into submodules
- grep: add submodules as a grep source type
- submodules: load gitmodules file from commit sha1
- submodules: add helper functions to determine presence of submodules
"git grep" learns to optionally recurse into submodules
* dt/smart-http-detect-server-going-away (2016-11-18) 2 commits
(merged to 'next' on 2016-11-21 at d502523347)
+ upload-pack: optionally allow fetching any sha1
+ remote-curl: don't hang when a server dies before any output
When the http server gives an incomplete response to a smart-http
rpc call, it could lead to client waiting for a full response that
will never come. Teach the client side to notice this condition
and abort the transfer.
An improvement counterproposal has failed.
cf. <20161114194049.mktpsvgdhex2f4zv@sigill.intra.peff.net>
Will cook in 'next'.
* mm/push-social-engineering-attack-doc (2016-11-14) 1 commit
(merged to 'next' on 2016-11-16 at b7c1b27563)
+ doc: mention transfer data leaks in more places
Doc update on fetching and pushing.
Will cook in 'next'.
* nd/worktree-move (2016-11-23) 11 commits
. worktree remove: new command
. worktree move: refuse to move worktrees with submodules
. worktree move: accept destination as directory
. worktree move: new command
. worktree.c: add update_worktree_location()
. worktree.c: add validate_worktree()
. copy.c: convert copy_file() to copy_dir_recursively()
. copy.c: style fix
. copy.c: convert bb_(p)error_msg to error(_errno)
. copy.c: delete unused code in copy_file()
. copy.c: import copy_file() from busybox
(this branch uses nd/worktree-list-fixup.)
"git worktree" learned move and remove subcommands.
Reported to break builds on Windows. Perhaps it should just spawn
"cp -R" or something.
* jc/compression-config (2016-11-15) 1 commit
(merged to 'next' on 2016-11-23 at b3c9254897)
+ compression: unify pack.compression configuration parsing
Compression setting for producing packfiles were spread across
three codepaths, one of which did not honor any configuration.
Unify these so that all of them honor core.compression and
pack.compression variables the same way.
Will cook in 'next'.
* mm/gc-safety-doc (2016-11-16) 1 commit
(merged to 'next' on 2016-11-17 at fc0d225b6b)
+ git-gc.txt: expand discussion of races with other processes
Doc update.
Will cook in 'next'.
* hv/submodule-not-yet-pushed-fix (2016-11-16) 4 commits
(merged to 'next' on 2016-11-21 at 1a599af962)
+ submodule_needs_pushing(): explain the behaviour when we cannot answer
+ batch check whether submodule needs pushing into one call
+ serialize collection of refs that contain submodule changes
+ serialize collection of changed submodules
(this branch is used by bw/push-dry-run.)
The code in "git push" to compute if any commit being pushed in the
superproject binds a commit in a submodule that hasn't been pushed
out was overly inefficient, making it unusable even for a small
project that does not have any submodule but have a reasonable
number of refs.
Will cook in 'next'.
* kn/ref-filter-branch-list (2016-11-15) 18 commits
- for-each-ref: do not segv with %(HEAD) on an unborn branch
- branch: implement '--format' option
- branch: use ref-filter printing APIs
- branch, tag: use porcelain output
- ref-filter: allow porcelain to translate messages in the output
- ref-filter: add `:dir` and `:base` options for ref printing atoms
- ref-filter: make remote_ref_atom_parser() use refname_atom_parser_internal()
- ref-filter: introduce symref_atom_parser() and refname_atom_parser()
- ref-filter: introduce refname_atom_parser_internal()
- ref-filter: make "%(symref)" atom work with the ':short' modifier
- ref-filter: add support for %(upstream:track,nobracket)
- ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreams
- ref-filter: introduce format_ref_array_item()
- ref-filter: move get_head_description() from branch.c
- ref-filter: modify "%(objectname:short)" to take length
- ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)
- ref-filter: include reference to 'used_atom' within 'atom_value'
- ref-filter: implement %(if), %(then), and %(else) atoms
The code to list branches in "git branch" has been consolidated
with the more generic ref-filter API.
Rerolled, reviewed, looking good.
Expecting a reroll.
cf. <20161108201211.25213-1-Karthik.188@gmail.com>
cf. <CAOLa=ZQqe3vEj_428d41vd_4kfjzsm87Wam6Zm2dhXWkPdJ8Rw@mail.gmail.com>
cf. <xmqq7f84tqa7.fsf_-_@gitster.mtv.corp.google.com>
* bw/transport-protocol-policy (2016-11-09) 2 commits
(merged to 'next' on 2016-11-16 at 1391d3eeed)
+ transport: add protocol policy config option
+ lib-proto-disable: variable name fix
Finer-grained control of what protocols are allowed for transports
during clone/fetch/push have been enabled via a new configuration
mechanism.
Will cook in 'next'.
* jt/fetch-no-redundant-tag-fetch-map (2016-11-11) 1 commit
(merged to 'next' on 2016-11-16 at 5846c27cc5)
+ fetch: do not redundantly calculate tag refmap
Code cleanup to avoid using redundant refspecs while fetching with
the --tags option.
Will cook in 'next'.
* jc/retire-compaction-heuristics (2016-11-02) 3 commits
- SQUASH???
- SQUASH???
- diff: retire the original experimental "compaction" heuristics
Waiting for a reroll.
* jc/abbrev-autoscale-config (2016-11-01) 1 commit
- config.abbrev: document the new default that auto-scales
Waiting for a reroll.
* jk/nofollow-attr-ignore (2016-11-02) 5 commits
- exclude: do not respect symlinks for in-tree .gitignore
- attr: do not respect symlinks for in-tree .gitattributes
- exclude: convert "check_index" into a flags field
- attr: convert "macro_ok" into a flags field
- add open_nofollow() helper
As we do not follow symbolic links when reading control files like
.gitignore and .gitattributes from the index, match the behaviour
and not follow symbolic links when reading them from the working
tree. This also tightens security a bit by not leaking contents of
an unrelated file in the error messages when it is pointed at by
one of these files that is a symbolic link.
Perhaps we want to cover .gitmodules too with the same mechanism?
* sb/submodule-config-cleanup (2016-11-22) 3 commits
(merged to 'next' on 2016-11-23 at c02e578b49)
+ submodule-config: clarify parsing of null_sha1 element
+ submodule-config: rename commit_sha1 to treeish_name
+ submodule config: inline config_from_{name, path}
Minor code clean-up.
Will cook in 'next'.
* jc/push-default-explicit (2016-10-31) 2 commits
(merged to 'next' on 2016-11-01 at 8dc3a6cf25)
+ push: test pushing ambiguously named branches
+ push: do not use potentially ambiguous default refspec
A lazy "git push" without refspec did not internally use a fully
specified refspec to perform 'current', 'simple', or 'upstream'
push, causing unnecessary "ambiguous ref" errors.
Will cook in 'next'.
* jt/use-trailer-api-in-commands (2016-11-02) 6 commits
- sequencer: use trailer's trailer layout
- trailer: have function to describe trailer layout
- trailer: avoid unnecessary splitting on lines
- commit: make ignore_non_trailer take buf/len
- SQUASH???
- trailer: be stricter in parsing separators
Commands that operate on a log message and add lines to the trailer
blocks, such as "format-patch -s", "cherry-pick (-x|-s)", and
"commit -s", have been taught to use the logic of and share the
code with "git interpret-trailer".
What's the doneness of this topic?
* nd/rebase-forget (2016-10-28) 1 commit
- rebase: add --forget to cleanup rebase, leave HEAD untouched
"git rebase" learned "--forget" option, which allows a user to
remove the metadata left by an earlier "git rebase" that was
manually aborted without using "git rebase --abort".
Waiting for a reroll.
* jc/git-open-cloexec (2016-11-02) 3 commits
- sha1_file: stop opening files with O_NOATIME
- git_open_cloexec(): use fcntl(2) w/ FD_CLOEXEC fallback
- git_open(): untangle possible NOATIME and CLOEXEC interactions
The codeflow of setting NOATIME and CLOEXEC on file descriptors Git
opens has been simplified.
We may want to drop the tip one.
* jk/no-looking-at-dotgit-outside-repo-final (2016-10-26) 1 commit
(merged to 'next' on 2016-10-26 at 220e160451)
+ setup_git_env: avoid blind fall-back to ".git"
This is the endgame of the topic to avoid blindly falling back to
".git" when the setup sequence said we are _not_ in Git repository.
A corner case that happens to work right now may be broken by a
call to die("BUG").
Will cook in 'next'.
* jc/reset-unmerge (2016-10-24) 1 commit
- reset: --unmerge
After "git add" is run prematurely during a conflict resolution,
"git diff" can no longer be used as a way to sanity check by
looking at the combined diff. "git reset" learned a new
"--unmerge" option to recover from this situation.
Will discard.
This may not be needed, given that update-index has a similar
option.
* jc/merge-base-fp-only (2016-10-19) 8 commits
. merge-base: fp experiment
- merge: allow to use only the fp-only merge bases
- merge-base: limit the output to bases that are on first-parent chain
- merge-base: mark bases that are on first-parent chain
- merge-base: expose get_merge_bases_many_0() a bit more
- merge-base: stop moving commits around in remove_redundant()
- sha1_name: remove ONELINE_SEEN bit
- commit: simplify fastpath of merge-base
An experiment of merge-base that ignores common ancestors that are
not on the first parent chain.
Will discard.
The whole premise feels wrong.
* tb/convert-stream-check (2016-10-27) 2 commits
- convert.c: stream and fast search for binary
- read-cache: factor out get_sha1_from_index() helper
End-of-line conversion sometimes needs to see if the current blob
in the index has NULs and CRs to base its decision. We used to
always get a full statistics over the blob, but in many cases we
can return early when we have seen "enough" (e.g. if we see a
single NUL, the blob will be handled as binary). The codepaths
have been optimized by using streaming interface.
Will discard.
Retracted.
cf. <20161102071646.GA5094@tb-raspi>
* pb/bisect (2016-10-18) 27 commits
- bisect--helper: remove the dequote in bisect_start()
- bisect--helper: retire `--bisect-auto-next` subcommand
- bisect--helper: retire `--bisect-autostart` subcommand
- bisect--helper: retire `--bisect-write` subcommand
- bisect--helper: `bisect_replay` shell function in C
- bisect--helper: `bisect_log` shell function in C
- bisect--helper: retire `--write-terms` subcommand
- bisect--helper: retire `--check-expected-revs` subcommand
- bisect--helper: `bisect_state` & `bisect_head` shell function in C
- bisect--helper: `bisect_autostart` shell function in C
- bisect--helper: retire `--next-all` subcommand
- bisect--helper: retire `--bisect-clean-state` subcommand
- bisect--helper: `bisect_next` and `bisect_auto_next` shell function in C
- t6030: no cleanup with bad merge base
- bisect--helper: `bisect_start` shell function partially in C
- bisect--helper: `get_terms` & `bisect_terms` shell function in C
- bisect--helper: `bisect_next_check` & bisect_voc shell function in C
- bisect--helper: `check_and_set_terms` shell function in C
- bisect--helper: `bisect_write` shell function in C
- bisect--helper: `is_expected_rev` & `check_expected_revs` shell function in C
- bisect--helper: `bisect_reset` shell function in C
- wrapper: move is_empty_file() and rename it as is_empty_or_missing_file()
- t6030: explicitly test for bisection cleanup
- bisect--helper: `bisect_clean_state` shell function in C
- bisect--helper: `write_terms` shell function in C
- bisect: rewrite `check_term_format` shell function in C
- bisect--helper: use OPT_CMDMODE instead of OPT_BOOL
Move more parts of "git bisect" to C.
Waiting for review.
* st/verify-tag (2016-10-10) 7 commits
- t/t7004-tag: Add --format specifier tests
- t/t7030-verify-tag: Add --format specifier tests
- builtin/tag: add --format argument for tag -v
- builtin/verify-tag: add --format to verify-tag
- tag: add format specifier to gpg_verify_tag
- ref-filter: add function to print single ref_array_item
- gpg-interface, tag: add GPG_VERIFY_QUIET flag
"git tag" and "git verify-tag" learned to put GPG verification
status in their "--format=<placeholders>" output format.
Waiting for a reroll.
cf. <20161007210721.20437-1-santiago@nyu.edu>
* sb/attr (2016-11-11) 35 commits
- completion: clone can initialize specific submodules
- clone: add --init-submodule=<pathspec> switch
- submodule update: add `--init-default-path` switch
- pathspec: allow escaped query values
- pathspec: allow querying for attributes
- pathspec: move prefix check out of the inner loop
- pathspec: move long magic parsing out of prefix_pathspec
- Documentation: fix a typo
- attr: keep attr stack for each check
- attr: convert to new threadsafe API
- attr: make git_check_attr_counted static
- attr.c: outline the future plans by heavily commenting
- attr.c: always pass check[] to collect_some_attrs()
- attr.c: introduce empty_attr_check_elems()
- attr.c: correct ugly hack for git_all_attrs()
- attr.c: rename a local variable check
- attr.c: pass struct git_attr_check down the callchain
- attr.c: add push_stack() helper
- attr: support quoting pathname patterns in C style
- attr: expose validity check for attribute names
- attr: add counted string version of git_check_attr()
- attr: retire git_check_attrs() API
- attr: convert git_check_attrs() callers to use the new API
- attr: convert git_all_attrs() to use "struct git_attr_check"
- attr: (re)introduce git_check_attr() and struct git_attr_check
- attr: rename function and struct related to checking attributes
- attr.c: plug small leak in parse_attr_line()
- attr.c: tighten constness around "git_attr" structure
- attr.c: simplify macroexpand_one()
- attr.c: mark where #if DEBUG ends more clearly
- attr.c: complete a sentence in a comment
- attr.c: explain the lack of attr-name syntax check in parse_attr()
- attr.c: update a stale comment on "struct match_attr"
- attr.c: use strchrnul() to scan for one line
- commit.c: use strchrnul() to scan for one line
The attributes API has been updated so that it can later be
optimized using the knowledge of which attributes are queried.
Building on top of the updated API, the pathspec machinery learned
to select only paths with given attributes set.
Waiting for review.
* va/i18n-perl-scripts (2016-11-11) 16 commits
- i18n: difftool: mark warnings for translation
- i18n: send-email: mark composing message for translation
- i18n: send-email: mark string with interpolation for translation
- i18n: send-email: mark warnings and errors for translation
- i18n: send-email: mark strings for translation
- i18n: add--interactive: mark status words for translation
- i18n: add--interactive: remove %patch_modes entries
- i18n: add--interactive: mark edit_hunk_manually message for translation
- i18n: add--interactive: i18n of help_patch_cmd
- i18n: add--interactive: mark patch prompt for translation
- i18n: add--interactive: mark plural strings
- i18n: clean.c: match string with git-add--interactive.perl
- i18n: add--interactive: mark strings with interpolation for translation
- i18n: add--interactive: mark simple here-documents for translation
- i18n: add--interactive: mark strings for translation
- Git.pm: add subroutines for commenting lines
Porcelain scripts written in Perl are getting internationalized.
Waiting for review.
* jc/latin-1 (2016-09-26) 2 commits
(merged to 'next' on 2016-09-28 at c8673e03c2)
+ utf8: accept "latin-1" as ISO-8859-1
+ utf8: refactor code to decide fallback encoding
Some platforms no longer understand "latin-1" that is still seen in
the wild in e-mail headers; replace them with "iso-8859-1" that is
more widely known when conversion fails from/to it.
Will cook in 'next'.
* sg/fix-versioncmp-with-common-suffix (2016-09-08) 5 commits
- versioncmp: cope with common leading parts in versionsort.prereleaseSuffix
- versioncmp: pass full tagnames to swap_prereleases()
- t7004-tag: add version sort tests to show prerelease reordering issues
- t7004-tag: use test_config helper
- t7004-tag: delete unnecessary tags with test_when_finished
The prereleaseSuffix feature of version comparison that is used in
"git tag -l" did not correctly when two or more prereleases for the
same release were present (e.g. when 2.0, 2.0-beta1, and 2.0-beta2
are there and the code needs to compare 2.0-beta1 and 2.0-beta2).
Waiting for a reroll.
cf. <20160908223727.Horde.jVOOJ278ssZ3qkyjkmyqZD-@webmail.informatik.kit.edu>
* jc/pull-rebase-ff (2016-07-28) 1 commit
- pull: fast-forward "pull --rebase=true"
"git pull --rebase", when there is no new commits on our side since
we forked from the upstream, should be able to fast-forward without
invoking "git rebase", but it didn't.
Needs a real log message and a few tests.
* jc/merge-drop-old-syntax (2015-04-29) 1 commit
(merged to 'next' on 2016-10-11 at 8928c8b9b3)
+ merge: drop 'git merge <message> HEAD <commit>' syntax
Stop supporting "git merge <message> HEAD <commit>" syntax that has
been deprecated since October 2007, and issues a deprecation
warning message since v2.5.0.
Will cook in 'next'.
^ permalink raw reply
* Re: [PATCH] git-gui: pass the branch name to git merge
From: Johannes Sixt @ 2016-11-23 22:36 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Pat Thoyts, René Scharfe, Git Mailing List
In-Reply-To: <xmqq4m2ym06p.fsf@gitster.mtv.corp.google.com>
Am 23.11.2016 um 21:05 schrieb Junio C Hamano:
> Johannes Sixt <j6t@kdbg.org> writes:
>> Am 22.11.2016 um 21:40 schrieb Johannes Sixt:
>>> Am 22.11.2016 um 20:16 schrieb Junio C Hamano:
>>>> Can't this be handled on the "git merge FETCH_HEAD" codepath
>>>> instead?
>>>
>>> Absolutely. Any takers? ;)
>>
>> I attempted to fix git merge FETCH_HEAD, but I do not see a trivial
>> solution.
>>
>> But on second thought, we have an excuse to pick my proposed git-gui
>> change anyway: Without that change and a fix in git-merge only, there
>> is still a regression for all users who use the latest git-gui but
>> some git version between 2.5.0 and the fixed git-merge...
>
> I'll leave it up to Pat, as I do not read tcl very well ;-)
Sure!
In the mean time, here is my attempt to fix git merge FETCH_HEAD.
I would feel better if this were just taken as a starter for a
real fix by someone who is familiar with the area.
---- 8< ----
[PATCH] merge FETCH_HEAD: keep track of the branch names
'git merge FETCH_HEAD' is treated differently from 'git merge topic'
because FETCH_HEAD is not just a regular ref name, but contains the
names of the branches being merged. However, 'git merge' does not
store the names as the "remote description" of the merge parent
structure that is associated with merged commits, like an ordinary
'git merge topic' call does for the command line arguments.
A consequence is that conflict markers are not marked up with the
branch name, but with a raw object name. Parse off the branch names
from the FETCH_HEAD file and store them with the merged commits.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
builtin/merge.c | 8 ++++++++
commit.c | 1 +
2 files changed, 9 insertions(+)
diff --git a/builtin/merge.c b/builtin/merge.c
index b65eeaa87d..328517b091 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1051,9 +1051,17 @@ static void handle_fetch_head(struct commit_list **remotes, struct strbuf *merge
continue; /* not-for-merge */
else {
char saved = merge_names->buf[pos + 40];
+ char eol = ptr ? *ptr : '\0';
merge_names->buf[pos + 40] = '\0';
+ if (ptr)
+ *ptr = '\0';
commit = get_merge_parent(merge_names->buf + pos);
+ set_merge_remote_desc(commit,
+ merge_names->buf + pos + 40 + 2,
+ merge_remote_util(commit)->obj);
merge_names->buf[pos + 40] = saved;
+ if (ptr)
+ *ptr = eol;
}
if (!commit) {
if (ptr)
diff --git a/commit.c b/commit.c
index 856fd4aeef..7ac2ce6518 100644
--- a/commit.c
+++ b/commit.c
@@ -1582,6 +1582,7 @@ void set_merge_remote_desc(struct commit *commit,
struct merge_remote_desc *desc;
FLEX_ALLOC_STR(desc, name, name);
desc->obj = obj;
+ free(commit->util);
commit->util = desc;
}
--
2.11.0.rc1.52.g65ffb51
^ permalink raw reply related
* Re: [PATCH v2 1/1] difftool: add the builtin
From: Junio C Hamano @ 2016-11-23 22:30 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, David Aguilar, Dennis Kaarsemaker
In-Reply-To: <xmqqwpftltq9.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
> ... I do not think you can safely add these two bits here until the
> migration completes.
I accidentally removed a more useful bit I wrote after the above
sentence while editing.
The NEEDSWORK comment in 73c2779f42 ("builtin-am: implement skeletal
builtin am", 2015-08-04) mentions why it calls setup-git-directory
and setup-work-tree instead of letting run_builtin() do so; perhaps
you can do something similar here to fix this.
> I doubt that setting core.usebuiltindifftool to false and running
> the tool from a subdirectory and a pathspec work correctly with this
> patch. If running difftool from a subdirectory with a pathspec is
> not tested in t7800, perhaps we should.
>
> It is nice that we can now lose PERL prerequisite from t7800 ;-)
>
> Thanks.
^ permalink raw reply
* Re: [PATCH v2 1/1] difftool: add the builtin
From: Junio C Hamano @ 2016-11-23 22:25 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, David Aguilar, Dennis Kaarsemaker
In-Reply-To: <3e9a2f31c779476c7524849a2e5307f2d3396fe8.1479938494.git.johannes.schindelin@gmx.de>
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> + if (!strcmp(var, "core.usebuiltindifftool")) {
> + use_builtin_difftool = git_config_bool(var, value);
> + return 0;
> + }
This no way belongs to the core set; difftool.usebuiltin would be
more appropriate.
> + if (!use_builtin_difftool) {
> + const char *path = mkpath("%s/git-legacy-difftool", git_exec_path());
> +
> + if (sane_execvp(path, (char **)argv) < 0)
> + die_errno("could not exec %s", path);
> +
> + return 0;
> + }
> + ...
> diff --git a/git-difftool.perl b/git-legacy-difftool.perl
> similarity index 100%
> rename from git-difftool.perl
> rename to git-legacy-difftool.perl
> diff --git a/git.c b/git.c
> index efa1059..0e6bbee 100644
> --- a/git.c
> +++ b/git.c
> @@ -424,6 +424,7 @@ static struct cmd_struct commands[] = {
> { "diff-files", cmd_diff_files, RUN_SETUP | NEED_WORK_TREE },
> { "diff-index", cmd_diff_index, RUN_SETUP },
> { "diff-tree", cmd_diff_tree, RUN_SETUP },
> + { "difftool", cmd_difftool, RUN_SETUP | NEED_WORK_TREE },
Running set-up would mean that the spawning of legacy-difftool would
be done after you chdir(2) up to the root level of the working tree,
no? I do not think you can safely add these two bits here until the
migration completes.
I doubt that setting core.usebuiltindifftool to false and running
the tool from a subdirectory and a pathspec work correctly with this
patch. If running difftool from a subdirectory with a pathspec is
not tested in t7800, perhaps we should.
It is nice that we can now lose PERL prerequisite from t7800 ;-)
Thanks.
^ permalink raw reply
* [PATCH v2 1/1] difftool: add the builtin
From: Johannes Schindelin @ 2016-11-23 22:03 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, David Aguilar, Dennis Kaarsemaker
In-Reply-To: <cover.1479938494.git.johannes.schindelin@gmx.de>
This adds a builtin difftool that represents a conversion of the current
Perl script version of the difftool.
The motivation is that Perl scripts are not at all native on Windows,
and that `git difftool` therefore is pretty slow on that platform, when
there is no good reason for it to be slow.
In addition, Perl does not really have access to Git's internals. That
means that any script will always have to jump through unnecessary
hoops.
The current version of the builtin difftool does not, however, make full
use of the internals but instead chooses to spawn a couple of Git
processes, still, to make for an easier conversion. There remains a lot
of room for improvement, left for a later date.
Note: the original difftool is now called `git legacy-difftool`, but to
play it safe, it is still called by difftool unless the config setting
core.useBuiltinDifftool=true.
The reason: this new, experimental, builtin difftool will be shipped as
part of Git for Windows v2.11.0, to allow for easier large-scale
testing, but of course as an opt-in feature.
Sadly, the speedup is more noticable on Linux than on Windows: a quick
test shows that t7800-difftool.sh runs in (2.183s/0.052s/0.108s)
(real/user/sys) in a Linux VM, down from (6.529s/3.112s/0.644s), while
on Windows, it is (36.064s/2.730s/7.194s), down from
(47.637s/2.407s/6.863s). The culprit is most likely the overhead
incurred from *still* having to shell out to mergetool-lib.sh and
difftool--helper.sh.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
.gitignore | 1 +
Makefile | 3 +-
builtin.h | 1 +
builtin/difftool.c | 692 ++++++++++++++++++++++++++
git-difftool.perl => git-legacy-difftool.perl | 0
git.c | 1 +
6 files changed, 697 insertions(+), 1 deletion(-)
create mode 100644 builtin/difftool.c
rename git-difftool.perl => git-legacy-difftool.perl (100%)
diff --git a/.gitignore b/.gitignore
index 05cb58a..f96e50e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,6 +76,7 @@
/git-init-db
/git-interpret-trailers
/git-instaweb
+/git-legacy-difftool
/git-log
/git-ls-files
/git-ls-remote
diff --git a/Makefile b/Makefile
index f53fcc9..7863bc2 100644
--- a/Makefile
+++ b/Makefile
@@ -527,7 +527,7 @@ SCRIPT_LIB += git-sh-setup
SCRIPT_LIB += git-sh-i18n
SCRIPT_PERL += git-add--interactive.perl
-SCRIPT_PERL += git-difftool.perl
+SCRIPT_PERL += git-legacy-difftool.perl
SCRIPT_PERL += git-archimport.perl
SCRIPT_PERL += git-cvsexportcommit.perl
SCRIPT_PERL += git-cvsimport.perl
@@ -888,6 +888,7 @@ BUILTIN_OBJS += builtin/diff-files.o
BUILTIN_OBJS += builtin/diff-index.o
BUILTIN_OBJS += builtin/diff-tree.o
BUILTIN_OBJS += builtin/diff.o
+BUILTIN_OBJS += builtin/difftool.o
BUILTIN_OBJS += builtin/fast-export.o
BUILTIN_OBJS += builtin/fetch-pack.o
BUILTIN_OBJS += builtin/fetch.o
diff --git a/builtin.h b/builtin.h
index b9122bc..67f8051 100644
--- a/builtin.h
+++ b/builtin.h
@@ -60,6 +60,7 @@ extern int cmd_diff_files(int argc, const char **argv, const char *prefix);
extern int cmd_diff_index(int argc, const char **argv, const char *prefix);
extern int cmd_diff(int argc, const char **argv, const char *prefix);
extern int cmd_diff_tree(int argc, const char **argv, const char *prefix);
+extern int cmd_difftool(int argc, const char **argv, const char *prefix);
extern int cmd_fast_export(int argc, const char **argv, const char *prefix);
extern int cmd_fetch(int argc, const char **argv, const char *prefix);
extern int cmd_fetch_pack(int argc, const char **argv, const char *prefix);
diff --git a/builtin/difftool.c b/builtin/difftool.c
new file mode 100644
index 0000000..f845879
--- /dev/null
+++ b/builtin/difftool.c
@@ -0,0 +1,692 @@
+/*
+ * "git difftool" builtin command
+ *
+ * This is a wrapper around the GIT_EXTERNAL_DIFF-compatible
+ * git-difftool--helper script.
+ *
+ * This script exports GIT_EXTERNAL_DIFF and GIT_PAGER for use by git.
+ * The GIT_DIFF* variables are exported for use by git-difftool--helper.
+ *
+ * Any arguments that are unknown to this script are forwarded to 'git diff'.
+ *
+ * Copyright (C) 2016 Johannes Schindelin
+ */
+#include "cache.h"
+#include "builtin.h"
+#include "parse-options.h"
+#include "run-command.h"
+#include "argv-array.h"
+#include "strbuf.h"
+#include "lockfile.h"
+#include "dir.h"
+#include "exec_cmd.h"
+
+static char *diff_gui_tool;
+static int trust_exit_code;
+static int use_builtin_difftool;
+
+static const char *const builtin_difftool_usage[] = {
+ N_("git difftool [<options>] [<commit> [<commit>]] [--] [<path>...]"),
+ NULL
+};
+
+static int difftool_config(const char *var, const char *value, void *cb)
+{
+ if (!strcmp(var, "diff.guitool")) {
+ diff_gui_tool = xstrdup(value);
+ return 0;
+ }
+
+ if (!strcmp(var, "difftool.trustexitcode")) {
+ trust_exit_code = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.usebuiltindifftool")) {
+ use_builtin_difftool = git_config_bool(var, value);
+ return 0;
+ }
+
+ return git_default_config(var, value, cb);
+}
+
+static int print_tool_help(void)
+{
+ const char *argv[] = { "mergetool", "--tool-help=diff", NULL };
+ return run_command_v_opt(argv, RUN_GIT_CMD);
+}
+
+static int parse_index_info(char *p, int *mode1, int *mode2,
+ struct object_id *oid1, struct object_id *oid2,
+ char *status)
+{
+ if (*p != ':')
+ return error("expected ':', got '%c'", *p);
+ *mode1 = (int)strtol(p + 1, &p, 8);
+ if (*p != ' ')
+ return error("expected ' ', got '%c'", *p);
+ *mode2 = (int)strtol(p + 1, &p, 8);
+ if (*p != ' ')
+ return error("expected ' ', got '%c'", *p);
+ if (get_oid_hex(++p, oid1))
+ return error("expected object ID, got '%s'", p + 1);
+ p += GIT_SHA1_HEXSZ;
+ if (*p != ' ')
+ return error("expected ' ', got '%c'", *p);
+ if (get_oid_hex(++p, oid2))
+ return error("expected object ID, got '%s'", p + 1);
+ p += GIT_SHA1_HEXSZ;
+ if (*p != ' ')
+ return error("expected ' ', got '%c'", *p);
+ *status = *++p;
+ if (!status || p[1])
+ return error("unexpected trailer: '%s'", p);
+ return 0;
+}
+
+/*
+ * Remove any trailing slash from $workdir
+ * before starting to avoid double slashes in symlink targets.
+ */
+static void add_path(struct strbuf *buf, size_t base_len, const char *path)
+{
+ strbuf_setlen(buf, base_len);
+ if (buf->len && buf->buf[buf->len - 1] != '/')
+ strbuf_addch(buf, '/');
+ strbuf_addstr(buf, path);
+}
+
+/*
+ * Determine whether we can simply reuse the file in the worktree.
+ */
+static int use_wt_file(const char *workdir, const char *name,
+ struct object_id *oid)
+{
+ struct strbuf buf = STRBUF_INIT;
+ struct stat st;
+ int use = 0;
+
+ strbuf_addstr(&buf, workdir);
+ add_path(&buf, buf.len, name);
+
+ if (!lstat(buf.buf, &st) && !S_ISLNK(st.st_mode)) {
+ struct object_id wt_oid;
+ int fd = open(buf.buf, O_RDONLY);
+
+ if (!index_fd(wt_oid.hash, fd, &st, OBJ_BLOB, name, 0)) {
+ if (is_null_oid(oid)) {
+ oidcpy(oid, &wt_oid);
+ use = 1;
+ } else if (!oidcmp(oid, &wt_oid))
+ use = 1;
+ }
+ }
+
+ strbuf_release(&buf);
+
+ return use;
+}
+
+struct working_tree_entry {
+ struct hashmap_entry entry;
+ char path[FLEX_ARRAY];
+};
+
+static int working_tree_entry_cmp(struct working_tree_entry *a,
+ struct working_tree_entry *b, void *keydata)
+{
+ return strcmp(a->path, b->path);
+}
+
+/*
+ * The `left` and `right` entries hold paths for the symlinks hashmap,
+ * and a SHA-1 surrounded by brief text for submodules.
+ */
+struct pair_entry {
+ struct hashmap_entry entry;
+ char left[PATH_MAX], right[PATH_MAX];
+ const char path[FLEX_ARRAY];
+};
+
+static int pair_cmp(struct pair_entry *a, struct pair_entry *b, void *keydata)
+{
+ return strcmp(a->path, b->path);
+}
+
+static void add_left_or_right(struct hashmap *map, const char *path,
+ const char *content, int is_right)
+{
+ struct pair_entry *e, *existing;
+
+ FLEX_ALLOC_STR(e, path, path);
+ hashmap_entry_init(e, strhash(path));
+ existing = hashmap_get(map, e, NULL);
+ if (existing) {
+ free(e);
+ e = existing;
+ } else {
+ e->left[0] = e->right[0] = '\0';
+ hashmap_add(map, e);
+ }
+ strcpy(is_right ? e->right : e->left, content);
+}
+
+struct path_entry {
+ struct hashmap_entry entry;
+ char path[FLEX_ARRAY];
+};
+
+int path_entry_cmp(struct path_entry *a, struct path_entry *b, void *key)
+{
+ return strcmp(a->path, key ? key : b->path);
+}
+
+static void changed_files(struct hashmap *result, const char *index_path,
+ const char *workdir)
+{
+ struct child_process update_index = CHILD_PROCESS_INIT;
+ struct child_process diff_files = CHILD_PROCESS_INIT;
+ struct strbuf index_env = STRBUF_INIT, buf = STRBUF_INIT;
+ const char *git_dir = absolute_path(get_git_dir()), *env[] = {
+ NULL, NULL
+ };
+ FILE *fp;
+
+ strbuf_addf(&index_env, "GIT_INDEX_FILE=%s", index_path);
+ env[0] = index_env.buf;
+
+ argv_array_pushl(&update_index.args,
+ "--git-dir", git_dir, "--work-tree", workdir,
+ "update-index", "--really-refresh", "-q",
+ "--unmerged", NULL);
+ update_index.no_stdin = 1;
+ update_index.no_stdout = 1;
+ update_index.no_stderr = 1;
+ update_index.git_cmd = 1;
+ update_index.use_shell = 0;
+ update_index.clean_on_exit = 1;
+ update_index.dir = workdir;
+ update_index.env = env;
+ /* Ignore any errors of update-index */
+ run_command(&update_index);
+
+ argv_array_pushl(&diff_files.args,
+ "--git-dir", git_dir, "--work-tree", workdir,
+ "diff-files", "--name-only", "-z", NULL);
+ diff_files.no_stdin = 1;
+ diff_files.git_cmd = 1;
+ diff_files.use_shell = 0;
+ diff_files.clean_on_exit = 1;
+ diff_files.out = -1;
+ diff_files.dir = workdir;
+ diff_files.env = env;
+ if (start_command(&diff_files))
+ die("could not obtain raw diff");
+ fp = xfdopen(diff_files.out, "r");
+ while (!strbuf_getline_nul(&buf, fp)) {
+ struct path_entry *entry;
+ FLEX_ALLOC_STR(entry, path, buf.buf);
+ hashmap_entry_init(entry, strhash(buf.buf));
+ hashmap_add(result, entry);
+ }
+ if (finish_command(&diff_files))
+ die("diff-files did not exit properly");
+ strbuf_release(&index_env);
+ strbuf_release(&buf);
+}
+
+static NORETURN void exit_cleanup(const char *tmpdir, int exit_code)
+{
+ struct strbuf buf = STRBUF_INIT;
+ strbuf_addstr(&buf, tmpdir);
+ remove_dir_recursively(&buf, 0);
+ if (exit_code)
+ warning(_("failed: %d"), exit_code);
+ exit(exit_code);
+}
+
+static int ensure_leading_directories(char *path)
+{
+ switch (safe_create_leading_directories(path)) {
+ case SCLD_OK:
+ case SCLD_EXISTS:
+ return 0;
+ default:
+ return error(_("could not create leading directories "
+ "of '%s'"), path);
+ }
+}
+
+static int run_dir_diff(const char *extcmd, int symlinks,
+ int argc, const char **argv)
+{
+ char tmpdir[PATH_MAX];
+ struct strbuf info = STRBUF_INIT, lpath = STRBUF_INIT;
+ struct strbuf rpath = STRBUF_INIT, buf = STRBUF_INIT;
+ struct strbuf ldir = STRBUF_INIT, rdir = STRBUF_INIT;
+ struct strbuf wtdir = STRBUF_INIT;
+ size_t ldir_len, rdir_len, wtdir_len;
+ struct cache_entry *ce = xcalloc(1, sizeof(ce) + PATH_MAX + 1);
+ const char *workdir, *tmp;
+ int ret = 0, i;
+ FILE *fp;
+ struct hashmap working_tree_dups, submodules, symlinks2;
+ struct hashmap_iter iter;
+ struct pair_entry *entry;
+ enum object_type type;
+ unsigned long size;
+ struct index_state wtindex;
+ struct checkout lstate, rstate;
+ int rc, flags = RUN_GIT_CMD, err = 0;
+ struct child_process child = CHILD_PROCESS_INIT;
+ const char *helper_argv[] = { "difftool--helper", NULL, NULL, NULL };
+ struct hashmap wt_modified, tmp_modified;
+ int indices_loaded = 0;
+
+ setup_work_tree();
+ workdir = get_git_work_tree();
+
+ /* Setup temp directories */
+ tmp = getenv("TMPDIR");
+ xsnprintf(tmpdir, sizeof(tmpdir), "%s/git-difftool.XXXXXX", tmp ? tmp : "/tmp");
+ if (!mkdtemp(tmpdir))
+ return error("could not create '%s'", tmpdir);
+ strbuf_addf(&ldir, "%s/left/", tmpdir);
+ strbuf_addf(&rdir, "%s/right/", tmpdir);
+ strbuf_addstr(&wtdir, workdir);
+ if (!wtdir.len || !is_dir_sep(wtdir.buf[wtdir.len - 1]))
+ strbuf_addch(&wtdir, '/');
+ mkdir(ldir.buf, 0700);
+ mkdir(rdir.buf, 0700);
+
+ memset(&wtindex, 0, sizeof(wtindex));
+
+ memset(&lstate, 0, sizeof(lstate));
+ lstate.base_dir = ldir.buf;
+ lstate.base_dir_len = ldir.len;
+ lstate.force = 1;
+ memset(&rstate, 0, sizeof(rstate));
+ rstate.base_dir = rdir.buf;
+ rstate.base_dir_len = rdir.len;
+ rstate.force = 1;
+
+ ldir_len = ldir.len;
+ rdir_len = rdir.len;
+ wtdir_len = wtdir.len;
+
+ hashmap_init(&working_tree_dups,
+ (hashmap_cmp_fn)working_tree_entry_cmp, 0);
+ hashmap_init(&submodules, (hashmap_cmp_fn)pair_cmp, 0);
+ hashmap_init(&symlinks2, (hashmap_cmp_fn)pair_cmp, 0);
+
+ child.no_stdin = 1;
+ child.git_cmd = 1;
+ child.use_shell = 0;
+ child.clean_on_exit = 1;
+ child.out = -1;
+ argv_array_pushl(&child.args, "diff", "--raw", "--no-abbrev", "-z",
+ NULL);
+ for (i = 0; i < argc; i++)
+ argv_array_push(&child.args, argv[i]);
+ if (start_command(&child))
+ die("could not obtain raw diff");
+ fp = xfdopen(child.out, "r");
+
+ /* Build index info for left and right sides of the diff */
+ while (!strbuf_getline_nul(&info, fp)) {
+ int lmode, rmode;
+ struct object_id loid, roid;
+ char status;
+ const char *src_path, *dst_path;
+ size_t src_path_len, dst_path_len;
+
+ if (starts_with(info.buf, "::"))
+ die(N_("combined diff formats('-c' and '--cc') are "
+ "not supported in\n"
+ "directory diff mode('-d' and '--dir-diff')."));
+
+ if (parse_index_info(info.buf, &lmode, &rmode, &loid, &roid,
+ &status))
+ break;
+ if (strbuf_getline_nul(&lpath, fp))
+ break;
+ src_path = lpath.buf;
+ src_path_len = lpath.len;
+
+ if (status != 'C' && status != 'R') {
+ dst_path = src_path;
+ dst_path_len = src_path_len;
+ } else {
+ if (strbuf_getline_nul(&rpath, fp))
+ break;
+ dst_path = rpath.buf;
+ dst_path_len = rpath.len;
+ }
+
+ if (S_ISGITLINK(lmode) || S_ISGITLINK(rmode)) {
+ strbuf_reset(&buf);
+ strbuf_addf(&buf, "Subproject commit %s",
+ oid_to_hex(&loid));
+ add_left_or_right(&submodules, src_path, buf.buf, 0);
+ strbuf_reset(&buf);
+ strbuf_addf(&buf, "Subproject commit %s",
+ oid_to_hex(&roid));
+ if (!oidcmp(&loid, &roid))
+ strbuf_addstr(&buf, "-dirty");
+ add_left_or_right(&submodules, dst_path, buf.buf, 1);
+ continue;
+ }
+
+ if (S_ISLNK(lmode)) {
+ char *content = read_sha1_file(loid.hash, &type, &size);
+ add_left_or_right(&symlinks2, src_path, content, 0);
+ free(content);
+ }
+
+ if (S_ISLNK(rmode)) {
+ char *content = read_sha1_file(roid.hash, &type, &size);
+ add_left_or_right(&symlinks2, dst_path, content, 1);
+ free(content);
+ }
+
+ if (lmode && status != 'C') {
+ ce->ce_mode = lmode;
+ oidcpy(&ce->oid, &loid);
+ strcpy(ce->name, src_path);
+ ce->ce_namelen = src_path_len;
+ if (checkout_entry(ce, &lstate, NULL))
+ return error("could not write '%s'", src_path);
+ }
+
+ if (rmode) {
+ struct working_tree_entry *entry;
+
+ /* Avoid duplicate working_tree entries */
+ FLEX_ALLOC_STR(entry, path, dst_path);
+ hashmap_entry_init(entry, strhash(dst_path));
+ if (hashmap_get(&working_tree_dups, entry, NULL)) {
+ free(entry);
+ continue;
+ }
+ hashmap_add(&working_tree_dups, entry);
+
+ if (!use_wt_file(workdir, dst_path, &roid)) {
+ ce->ce_mode = rmode;
+ oidcpy(&ce->oid, &roid);
+ strcpy(ce->name, dst_path);
+ ce->ce_namelen = dst_path_len;
+ if (checkout_entry(ce, &rstate, NULL))
+ return error("could not write '%s'",
+ dst_path);
+ } else if (!is_null_oid(&roid)) {
+ /*
+ * Changes in the working tree need special
+ * treatment since they are not part of the
+ * index.
+ */
+ struct cache_entry *ce2 =
+ make_cache_entry(rmode, roid.hash,
+ dst_path, 0, 0);
+ ce_mode_from_stat(ce2, rmode);
+
+ add_index_entry(&wtindex, ce2,
+ ADD_CACHE_JUST_APPEND);
+
+ add_path(&wtdir, wtdir_len, dst_path);
+ add_path(&rdir, rdir_len, dst_path);
+ if (ensure_leading_directories(rdir.buf))
+ return error("could not create "
+ "directory for '%s'",
+ dst_path);
+ if (symlinks) {
+ if (symlink(wtdir.buf, rdir.buf)) {
+ ret = error_errno("could not symlink '%s' to '%s'", wtdir.buf, rdir.buf);
+ goto finish;
+ }
+ } else {
+ struct stat st;
+ if (stat(wtdir.buf, &st))
+ st.st_mode = 0644;
+ if (copy_file(rdir.buf, wtdir.buf,
+ st.st_mode)) {
+ ret = error("could not copy '%s' to '%s'", wtdir.buf, rdir.buf);
+ goto finish;
+ }
+ }
+ }
+ }
+ }
+ if (finish_command(&child)) {
+ ret = error("error occurred running diff --raw");
+ goto finish;
+ }
+
+ /*
+ * Changes to submodules require special treatment.This loop writes a
+ * temporary file to both the left and right directories to show the
+ * change in the recorded SHA1 for the submodule.
+ */
+ hashmap_iter_init(&submodules, &iter);
+ while ((entry = hashmap_iter_next(&iter))) {
+ if (*entry->left) {
+ add_path(&ldir, ldir_len, entry->path);
+ ensure_leading_directories(ldir.buf);
+ write_file(ldir.buf, "%s", entry->left);
+ }
+ if (*entry->right) {
+ add_path(&rdir, rdir_len, entry->path);
+ ensure_leading_directories(rdir.buf);
+ write_file(rdir.buf, "%s", entry->right);
+ }
+ }
+
+ /*
+ * Symbolic links require special treatment.The standard "git diff"
+ * shows only the link itself, not the contents of the link target.
+ * This loop replicates that behavior.
+ */
+ hashmap_iter_init(&symlinks2, &iter);
+ while ((entry = hashmap_iter_next(&iter))) {
+ if (*entry->left) {
+ add_path(&ldir, ldir_len, entry->path);
+ ensure_leading_directories(ldir.buf);
+ write_file(ldir.buf, "%s", entry->left);
+ }
+ if (*entry->right) {
+ add_path(&rdir, rdir_len, entry->path);
+ ensure_leading_directories(rdir.buf);
+ write_file(rdir.buf, "%s", entry->right);
+ }
+ }
+
+ strbuf_release(&buf);
+
+ strbuf_setlen(&ldir, ldir_len);
+ helper_argv[1] = ldir.buf;
+ strbuf_setlen(&rdir, rdir_len);
+ helper_argv[2] = rdir.buf;
+
+ if (extcmd) {
+ helper_argv[0] = extcmd;
+ flags = 0;
+ } else
+ setenv("GIT_DIFFTOOL_DIRDIFF", "true", 1);
+ rc = run_command_v_opt(helper_argv, flags);
+
+ /*
+ * If the diff includes working copy files and those
+ * files were modified during the diff, then the changes
+ * should be copied back to the working tree.
+ * Do not copy back files when symlinks are used and the
+ * external tool did not replace the original link with a file.
+ *
+ * These hashes are loaded lazily since they aren't needed
+ * in the common case of --symlinks and the difftool updating
+ * files through the symlink.
+ */
+ hashmap_init(&wt_modified, (hashmap_cmp_fn)path_entry_cmp,
+ wtindex.cache_nr);
+ hashmap_init(&tmp_modified, (hashmap_cmp_fn)path_entry_cmp,
+ wtindex.cache_nr);
+
+ for (i = 0; i < wtindex.cache_nr; i++) {
+ struct hashmap_entry dummy;
+ const char *name = wtindex.cache[i]->name;
+ struct stat st;
+
+ add_path(&rdir, rdir_len, name);
+ if (lstat(rdir.buf, &st))
+ continue;
+
+ if ((symlinks && S_ISLNK(st.st_mode)) || !S_ISREG(st.st_mode))
+ continue;
+
+ if (!indices_loaded) {
+ static struct lock_file lock;
+ strbuf_reset(&buf);
+ strbuf_addf(&buf, "%s/wtindex", tmpdir);
+ if (hold_lock_file_for_update(&lock, buf.buf, 0) < 0 ||
+ write_locked_index(&wtindex, &lock, COMMIT_LOCK)) {
+ ret = error("could not write %s", buf.buf);
+ rollback_lock_file(&lock);
+ goto finish;
+ }
+ changed_files(&wt_modified, buf.buf, workdir);
+ strbuf_setlen(&rdir, rdir_len);
+ changed_files(&tmp_modified, buf.buf, rdir.buf);
+ add_path(&rdir, rdir_len, name);
+ indices_loaded = 1;
+ }
+
+ hashmap_entry_init(&dummy, strhash(name));
+ if (hashmap_get(&tmp_modified, &dummy, name)) {
+ add_path(&wtdir, wtdir_len, name);
+ if (hashmap_get(&wt_modified, &dummy, name)) {
+ warning(_("both files modified: '%s' and '%s'."),
+ wtdir.buf, rdir.buf);
+ warning(_("working tree file has been left."));
+ warning("");
+ err = 1;
+ } else if (unlink(wtdir.buf) ||
+ copy_file(wtdir.buf, rdir.buf, st.st_mode))
+ warning_errno(_("could not copy '%s' to '%s'"),
+ rdir.buf, wtdir.buf);
+ }
+ }
+
+ if (err) {
+ warning(_("temporary files exist in '%s'."), tmpdir);
+ warning(_("you may want to cleanup or recover these."));
+ exit(1);
+ } else
+ exit_cleanup(tmpdir, rc);
+
+finish:
+ free(ce);
+ strbuf_release(&ldir);
+ strbuf_release(&rdir);
+ strbuf_release(&wtdir);
+ strbuf_release(&buf);
+
+ return ret;
+}
+
+static int run_file_diff(int prompt, int argc, const char **argv)
+{
+ struct argv_array args = ARGV_ARRAY_INIT;
+ const char *env[] = {
+ "GIT_PAGER=", "GIT_EXTERNAL_DIFF=git-difftool--helper", NULL,
+ NULL
+ };
+ int ret = 0, i;
+
+ if (prompt > 0)
+ env[2] = "GIT_DIFFTOOL_PROMPT=true";
+ else if (!prompt)
+ env[2] = "GIT_DIFFTOOL_NO_PROMPT=true";
+
+ argv_array_push(&args, "diff");
+ for (i = 0; i < argc; i++)
+ argv_array_push(&args, argv[i]);
+ ret = run_command_v_opt_cd_env(args.argv, RUN_GIT_CMD, NULL, env);
+ exit(ret);
+}
+
+int cmd_difftool(int argc, const char ** argv, const char * prefix)
+{
+ int use_gui_tool = 0, dir_diff = 0, prompt = -1, symlinks = 0,
+ tool_help = 0;
+ static char *difftool_cmd = NULL, *extcmd = NULL;
+ struct option builtin_difftool_options[] = {
+ OPT_BOOL('g', "gui", &use_gui_tool,
+ N_("use `diff.guitool` instead of `diff.tool`")),
+ OPT_BOOL('d', "dir-diff", &dir_diff,
+ N_("perform a full-directory diff")),
+ { OPTION_SET_INT, 'y', "no-prompt", &prompt, NULL,
+ N_("do not prompt before launching a diff tool"),
+ PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, 0},
+ { OPTION_SET_INT, 0, "prompt", &prompt, NULL, NULL,
+ PARSE_OPT_NOARG | PARSE_OPT_NONEG | PARSE_OPT_HIDDEN,
+ NULL, 1 },
+ OPT_BOOL(0, "symlinks", &symlinks,
+ N_("use symlinks in dir-diff mode")),
+ OPT_STRING('t', "tool", &difftool_cmd, N_("<tool>"),
+ N_("use the specified diff tool")),
+ OPT_BOOL(0, "tool-help", &tool_help,
+ N_("print a list of diff tools that may be used with "
+ "`--tool`")),
+ OPT_BOOL(0, "trust-exit-code", &trust_exit_code,
+ N_("make 'git-difftool' exit when an invoked diff "
+ "tool returns a non - zero exit code")),
+ OPT_STRING('x', "extcmd", &extcmd, N_("<command>"),
+ N_("specify a custom command for viewing diffs")),
+ OPT_END()
+ };
+
+ git_config(difftool_config, NULL);
+ symlinks = has_symlinks;
+ if (!use_builtin_difftool) {
+ const char *path = mkpath("%s/git-legacy-difftool", git_exec_path());
+
+ if (sane_execvp(path, (char **)argv) < 0)
+ die_errno("could not exec %s", path);
+
+ return 0;
+ }
+
+ argc = parse_options(argc, argv, prefix, builtin_difftool_options,
+ builtin_difftool_usage, PARSE_OPT_KEEP_UNKNOWN |
+ PARSE_OPT_KEEP_DASHDASH);
+
+ if (tool_help)
+ return print_tool_help();
+
+ if (use_gui_tool && diff_gui_tool && *diff_gui_tool)
+ setenv("GIT_DIFF_TOOL", diff_gui_tool, 1);
+ else if (difftool_cmd) {
+ if (*difftool_cmd)
+ setenv("GIT_DIFF_TOOL", difftool_cmd, 1);
+ else
+ die(_("no <tool> given for --tool=<tool>"));
+ }
+
+ if (extcmd) {
+ if (*extcmd)
+ setenv("GIT_DIFFTOOL_EXTCMD", extcmd, 1);
+ else
+ die(_("no <cmd> given for --extcmd=<cmd>"));
+ }
+
+ setenv("GIT_DIFFTOOL_TRUST_EXIT_CODE",
+ trust_exit_code ? "true" : "false", 1);
+
+ /*
+ * In directory diff mode, 'git-difftool--helper' is called once
+ * to compare the a / b directories. In file diff mode, 'git diff'
+ * will invoke a separate instance of 'git-difftool--helper' for
+ * each file that changed.
+ */
+ if (dir_diff)
+ return run_dir_diff(extcmd, symlinks, argc, argv);
+ return run_file_diff(prompt, argc, argv);
+}
diff --git a/git-difftool.perl b/git-legacy-difftool.perl
similarity index 100%
rename from git-difftool.perl
rename to git-legacy-difftool.perl
diff --git a/git.c b/git.c
index efa1059..0e6bbee 100644
--- a/git.c
+++ b/git.c
@@ -424,6 +424,7 @@ static struct cmd_struct commands[] = {
{ "diff-files", cmd_diff_files, RUN_SETUP | NEED_WORK_TREE },
{ "diff-index", cmd_diff_index, RUN_SETUP },
{ "diff-tree", cmd_diff_tree, RUN_SETUP },
+ { "difftool", cmd_difftool, RUN_SETUP | NEED_WORK_TREE },
{ "fast-export", cmd_fast_export, RUN_SETUP },
{ "fetch", cmd_fetch, RUN_SETUP },
{ "fetch-pack", cmd_fetch_pack, RUN_SETUP },
--
2.10.1.583.g721a9e0
^ permalink raw reply related
* [PATCH v2 0/1] Show Git Mailing List: a builtin difftool
From: Johannes Schindelin @ 2016-11-23 22:03 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, David Aguilar, Dennis Kaarsemaker
In-Reply-To: <cover.1479834051.git.johannes.schindelin@gmx.de>
I have been working on the builtin difftool for almost two weeks,
for two reasons:
1. Perl is really not native on Windows. Not only is there a performance
penalty to be paid just for running Perl scripts, we also have to deal
with the fact that users may have different Perl installations, with
different options, and some other Perl installation may decide to set
PERL5LIB globally, wreaking havoc with Git for Windows' Perl (which we
have to use because almost all other Perl distributions lack the
Subversion bindings we need for `git svn`).
2. Perl makes for a rather large reason that Git for Windows' installer
weighs in with >30MB. While one Perl script less does not relieve us
of that burden, it is one step in the right direction.
This patch serves two purposes: to ask for reviews, and to show what I
plan to release as part of Git for Windows v2.11.0 (which is due this
coming Wednesday, if Git v2.11.0 is released on Tuesday, as planned).
Changes since v1:
- fixed the usage (pointed out by David Aguilar)
- moved the stray #include "dir.h" to cuddle with the other #include's
(also pointed out by David Aguilar)
- changed the `sprintf()` call to a much safer `xsnprintf()` call
(again, pointed out by David Aguilar)
- changed an error message to include the offending path (need I say,
pointed out by David Aguilar?)
- used more restrictive permissions for the temporary directories (once
again, David Aguilar's suggestion)
- fixed a comment that lacked a space after a period (another fix thanks
to David Aguilar).
- switched the opt-in feature flag triggering the use of the builtin
difftool to a config variable (this suggestion came from Junio
Hamano).
- made difftool respect core.symlinks by moving the usage of
has_symlinks after the config was parsed.
Johannes Schindelin (1):
difftool: add the builtin
.gitignore | 1 +
Makefile | 3 +-
builtin.h | 1 +
builtin/difftool.c | 692 ++++++++++++++++++++++++++
git-difftool.perl => git-legacy-difftool.perl | 0
git.c | 1 +
6 files changed, 697 insertions(+), 1 deletion(-)
create mode 100644 builtin/difftool.c
rename git-difftool.perl => git-legacy-difftool.perl (100%)
base-commit: 1e37181391e305a7ab0c382ca3c3b2de998d4138
Published-As: https://github.com/dscho/git/releases/tag/builtin-difftool-v2
Fetch-It-Via: git fetch https://github.com/dscho/git builtin-difftool-v2
Interdiff vs v1:
diff --git a/.gitignore b/.gitignore
index 91bfd09..f96e50e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-/use-builtin-difftool
/GIT-BUILD-OPTIONS
/GIT-CFLAGS
/GIT-LDFLAGS
@@ -52,7 +51,6 @@
/git-diff-tree
/git-difftool
/git-difftool--helper
-/git-builtin-difftool
/git-describe
/git-fast-export
/git-fast-import
@@ -78,6 +76,7 @@
/git-init-db
/git-interpret-trailers
/git-instaweb
+/git-legacy-difftool
/git-log
/git-ls-files
/git-ls-remote
diff --git a/Makefile b/Makefile
index f764174..7863bc2 100644
--- a/Makefile
+++ b/Makefile
@@ -527,7 +527,7 @@ SCRIPT_LIB += git-sh-setup
SCRIPT_LIB += git-sh-i18n
SCRIPT_PERL += git-add--interactive.perl
-SCRIPT_PERL += git-difftool.perl
+SCRIPT_PERL += git-legacy-difftool.perl
SCRIPT_PERL += git-archimport.perl
SCRIPT_PERL += git-cvsexportcommit.perl
SCRIPT_PERL += git-cvsimport.perl
@@ -888,7 +888,7 @@ BUILTIN_OBJS += builtin/diff-files.o
BUILTIN_OBJS += builtin/diff-index.o
BUILTIN_OBJS += builtin/diff-tree.o
BUILTIN_OBJS += builtin/diff.o
-BUILTIN_OBJS += builtin/builtin-difftool.o
+BUILTIN_OBJS += builtin/difftool.o
BUILTIN_OBJS += builtin/fast-export.o
BUILTIN_OBJS += builtin/fetch-pack.o
BUILTIN_OBJS += builtin/fetch.o
diff --git a/builtin.h b/builtin.h
index 409a61e..67f8051 100644
--- a/builtin.h
+++ b/builtin.h
@@ -60,7 +60,7 @@ extern int cmd_diff_files(int argc, const char **argv, const char *prefix);
extern int cmd_diff_index(int argc, const char **argv, const char *prefix);
extern int cmd_diff(int argc, const char **argv, const char *prefix);
extern int cmd_diff_tree(int argc, const char **argv, const char *prefix);
-extern int cmd_builtin_difftool(int argc, const char **argv, const char *prefix);
+extern int cmd_difftool(int argc, const char **argv, const char *prefix);
extern int cmd_fast_export(int argc, const char **argv, const char *prefix);
extern int cmd_fetch(int argc, const char **argv, const char *prefix);
extern int cmd_fetch_pack(int argc, const char **argv, const char *prefix);
diff --git a/builtin/builtin-difftool.c b/builtin/difftool.c
similarity index 95%
rename from builtin/builtin-difftool.c
rename to builtin/difftool.c
index 9feefcd..f845879 100644
--- a/builtin/builtin-difftool.c
+++ b/builtin/difftool.c
@@ -18,12 +18,15 @@
#include "argv-array.h"
#include "strbuf.h"
#include "lockfile.h"
+#include "dir.h"
+#include "exec_cmd.h"
static char *diff_gui_tool;
static int trust_exit_code;
+static int use_builtin_difftool;
-static const char * const builtin_difftool_usage[] = {
- N_("git add [<options>] [--] <pathspec>..."),
+static const char *const builtin_difftool_usage[] = {
+ N_("git difftool [<options>] [<commit> [<commit>]] [--] [<path>...]"),
NULL
};
@@ -39,6 +42,11 @@ static int difftool_config(const char *var, const char *value, void *cb)
return 0;
}
+ if (!strcmp(var, "core.usebuiltindifftool")) {
+ use_builtin_difftool = git_config_bool(var, value);
+ return 0;
+ }
+
return git_default_config(var, value, cb);
}
@@ -227,8 +235,6 @@ static void changed_files(struct hashmap *result, const char *index_path,
strbuf_release(&buf);
}
-#include "dir.h"
-
static NORETURN void exit_cleanup(const char *tmpdir, int exit_code)
{
struct strbuf buf = STRBUF_INIT;
@@ -282,16 +288,16 @@ static int run_dir_diff(const char *extcmd, int symlinks,
/* Setup temp directories */
tmp = getenv("TMPDIR");
- sprintf(tmpdir, "%s/git-difftool.XXXXXX", tmp ? tmp : "/tmp");
+ xsnprintf(tmpdir, sizeof(tmpdir), "%s/git-difftool.XXXXXX", tmp ? tmp : "/tmp");
if (!mkdtemp(tmpdir))
- return error("could not create temporary directory");
+ return error("could not create '%s'", tmpdir);
strbuf_addf(&ldir, "%s/left/", tmpdir);
strbuf_addf(&rdir, "%s/right/", tmpdir);
strbuf_addstr(&wtdir, workdir);
if (!wtdir.len || !is_dir_sep(wtdir.buf[wtdir.len - 1]))
strbuf_addch(&wtdir, '/');
- mkdir(ldir.buf, 0777);
- mkdir(rdir.buf, 0777);
+ mkdir(ldir.buf, 0700);
+ mkdir(rdir.buf, 0700);
memset(&wtindex, 0, sizeof(wtindex));
@@ -606,12 +612,11 @@ static int run_file_diff(int prompt, int argc, const char **argv)
exit(ret);
}
-int cmd_builtin_difftool(int argc, const char ** argv, const char * prefix)
+int cmd_difftool(int argc, const char ** argv, const char * prefix)
{
int use_gui_tool = 0, dir_diff = 0, prompt = -1, symlinks = 0,
tool_help = 0;
static char *difftool_cmd = NULL, *extcmd = NULL;
-
struct option builtin_difftool_options[] = {
OPT_BOOL('g', "gui", &use_gui_tool,
N_("use `diff.guitool` instead of `diff.tool`")),
@@ -638,9 +643,16 @@ int cmd_builtin_difftool(int argc, const char ** argv, const char * prefix)
OPT_END()
};
+ git_config(difftool_config, NULL);
symlinks = has_symlinks;
+ if (!use_builtin_difftool) {
+ const char *path = mkpath("%s/git-legacy-difftool", git_exec_path());
- git_config(difftool_config, NULL);
+ if (sane_execvp(path, (char **)argv) < 0)
+ die_errno("could not exec %s", path);
+
+ return 0;
+ }
argc = parse_options(argc, argv, prefix, builtin_difftool_options,
builtin_difftool_usage, PARSE_OPT_KEEP_UNKNOWN |
@@ -670,7 +682,7 @@ int cmd_builtin_difftool(int argc, const char ** argv, const char * prefix)
/*
* In directory diff mode, 'git-difftool--helper' is called once
- * to compare the a / b directories.In file diff mode, 'git diff'
+ * to compare the a / b directories. In file diff mode, 'git diff'
* will invoke a separate instance of 'git-difftool--helper' for
* each file that changed.
*/
diff --git a/git-difftool.perl b/git-legacy-difftool.perl
similarity index 98%
rename from git-difftool.perl
rename to git-legacy-difftool.perl
index 28e47d8..a5790d0 100755
--- a/git-difftool.perl
+++ b/git-legacy-difftool.perl
@@ -23,13 +23,6 @@ use File::Temp qw(tempdir);
use Getopt::Long qw(:config pass_through);
use Git;
-if (-e Git::exec_path() . '/use-builtin-difftool') {
- unshift(@ARGV, "builtin-difftool");
- unshift(@ARGV, "git");
- exec(@ARGV);
- die("Could not execute builtin difftool");
-}
-
sub usage
{
my $exitcode = shift;
diff --git a/git.c b/git.c
index 7a0df7a..0e6bbee 100644
--- a/git.c
+++ b/git.c
@@ -2,7 +2,6 @@
#include "exec_cmd.h"
#include "help.h"
#include "run-command.h"
-#include "dir.h"
const char git_usage_string[] =
"git [--version] [--help] [-C <path>] [-c name=value]\n"
@@ -425,7 +424,7 @@ static struct cmd_struct commands[] = {
{ "diff-files", cmd_diff_files, RUN_SETUP | NEED_WORK_TREE },
{ "diff-index", cmd_diff_index, RUN_SETUP },
{ "diff-tree", cmd_diff_tree, RUN_SETUP },
- { "builtin-difftool", cmd_builtin_difftool, RUN_SETUP | NEED_WORK_TREE },
+ { "difftool", cmd_difftool, RUN_SETUP | NEED_WORK_TREE },
{ "fast-export", cmd_fast_export, RUN_SETUP },
{ "fetch", cmd_fetch, RUN_SETUP },
{ "fetch-pack", cmd_fetch_pack, RUN_SETUP },
@@ -543,22 +542,6 @@ static void strip_extension(const char **argv)
#define strip_extension(cmd)
#endif
-static int use_builtin_difftool(void)
-{
- static int initialized, use;
-
- if (!initialized) {
- struct strbuf buf = STRBUF_INIT;
- strbuf_addf(&buf, "%s/%s", git_exec_path(),
- "use-builtin-difftool");
- use = file_exists(buf.buf);
- strbuf_release(&buf);
- initialized = 1;
- }
-
- return use;
-}
-
static void handle_builtin(int argc, const char **argv)
{
struct argv_array args = ARGV_ARRAY_INIT;
@@ -568,9 +551,6 @@ static void handle_builtin(int argc, const char **argv)
strip_extension(argv);
cmd = argv[0];
- if (!strcmp("difftool", cmd) && use_builtin_difftool())
- cmd = "builtin-difftool";
-
/* Turn "git cmd --help" into "git help --exclude-guides cmd" */
if (argc > 1 && !strcmp(argv[1], "--help")) {
int i;
--
2.10.1.583.g721a9e0
^ permalink raw reply
* Re: [PATCH 2/2] difftool: add a feature flag for the builtin vs scripted version
From: Johannes Schindelin @ 2016-11-23 22:01 UTC (permalink / raw)
To: Dennis Kaarsemaker; +Cc: git, Junio C Hamano
In-Reply-To: <alpine.DEB.2.20.1611231824530.3746@virtualbox>
Hi Dennis,
On Wed, 23 Nov 2016, Johannes Schindelin wrote:
> On Wed, 23 Nov 2016, Dennis Kaarsemaker wrote:
>
> > On Tue, 2016-11-22 at 18:01 +0100, Johannes Schindelin wrote:
> > > The original idea was to use an environment variable
> > > GIT_USE_BUILTIN_DIFFTOOL, but the test suite resets those variables, and
> > > we do want to use that feature flag to run the tests with, and without,
> > > the feature flag.
> > >
> > > Besides, the plan is to add an opt-in flag in Git for Windows'
> > > installer. If we implemented the feature flag as an environment
> > > variable, we would have to modify the user's environment, in order to
> > > make the builtin difftool the default when called from Git Bash, Git CMD
> > > or third-party tools.
> >
> > Why is this not a normal configuration variable (as in git config
> > difftool.builtin true or something)? It doesn't make much sense to me
> > to introduce a way of configuring git by introducing magic files, when
> > a normal configuration variable would do just fine, and the GfW
> > installer can also set such variables, like it does for the crlf config
> > I believe.
>
> I considered that. Adding a config setting would mean we simply test for
> it in git-difftool.perl and call the builtin if the setting is active,
> right?
>
> The downside is that we actually *do* go through Perl to do that. Only to
> go back to a builtin. Which is exactly the thing I intended to avoid.
Okay, I reconsidered. Junio's comment about how git-am did it made me
rethink the issue: I need not keep the name "difftool" for the script. So
what I do now is rename the Perl script to git-legacy-difftool and always
read the config in the builtin difftool, handing off to the legacy
difftool unless core.useBuiltinDifftool=true.
This is an easy way to do it, and a portable and clean blueprint for
similar feature-flags in the future.
Ciao,
Johannes
^ permalink raw reply
* Re: [PATCH] git-gui: pass the branch name to git merge
From: Junio C Hamano @ 2016-11-23 20:05 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Pat Thoyts, René Scharfe, Git Mailing List
In-Reply-To: <5baaf25b-6f15-8002-97ea-97c5c6a4b4e4@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
> Am 22.11.2016 um 21:40 schrieb Johannes Sixt:
>> Am 22.11.2016 um 20:16 schrieb Junio C Hamano:
>>> Can't this be handled on the "git merge FETCH_HEAD" codepath
>>> instead?
>>
>> Absolutely. Any takers? ;)
>
> I attempted to fix git merge FETCH_HEAD, but I do not see a trivial
> solution.
>
> But on second thought, we have an excuse to pick my proposed git-gui
> change anyway: Without that change and a fix in git-merge only, there
> is still a regression for all users who use the latest git-gui but
> some git version between 2.5.0 and the fixed git-merge...
I'll leave it up to Pat, as I do not read tcl very well ;-)
^ permalink raw reply
* Re: [PATCH 2/2] difftool: add a feature flag for the builtin vs scripted version
From: Junio C Hamano @ 2016-11-23 20:04 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Dennis Kaarsemaker, git
In-Reply-To: <alpine.DEB.2.20.1611232051420.3746@virtualbox>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Hi Junio,
>
> On Wed, 23 Nov 2016, Junio C Hamano wrote:
>
>> Junio C Hamano <gitster@pobox.com> writes:
>>
>> > Can't you route the control upon seeing "git difftool" to your
>> > experimental "C" difftool and check the configuration there? Then
>> > you can decide to run_command() a non-builtin one depending what the
>> > configuration says---that way, you would incur cost of spawning Perl
>> > only when you need it, no?
>>
>> FWIW, the approach taken by 73c2779f42 ("builtin-am: implement
>> skeletal builtin am", 2015-08-04) is what I had in mind when I wrote
>> the above.
>
> Maybe that worked back then. But I doubt it, because checking out that
> revision, I get this "warning":
>
> Makefile:1732: warning: overriding recipe for target 'git-am'
> Makefile:1696: warning: ignoring old recipe for target 'git-am'
>
> Seems like a matter of luck whether the `make` executable you happen to
> use guesses what we want: to munge git-am.sh into git-am, as opposed to
> hard-linking git to git-am.
You do not need to keep two copies of "git-cmd", though. commands[]
table can have an entry "difftool" that points at cmd_difftool(),
which switches between run_command("difftool-scripted") or makes a
function call to a static difftool_builtin() that you wrote in 1/2.
^ permalink raw reply
* Re: [PATCH 2/2] difftool: add a feature flag for the builtin vs scripted version
From: Johannes Schindelin @ 2016-11-23 19:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Dennis Kaarsemaker, git
In-Reply-To: <xmqqd1hmm54f.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On Wed, 23 Nov 2016, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
> > Can't you route the control upon seeing "git difftool" to your
> > experimental "C" difftool and check the configuration there? Then
> > you can decide to run_command() a non-builtin one depending what the
> > configuration says---that way, you would incur cost of spawning Perl
> > only when you need it, no?
>
> FWIW, the approach taken by 73c2779f42 ("builtin-am: implement
> skeletal builtin am", 2015-08-04) is what I had in mind when I wrote
> the above.
Maybe that worked back then. But I doubt it, because checking out that
revision, I get this "warning":
Makefile:1732: warning: overriding recipe for target 'git-am'
Makefile:1696: warning: ignoring old recipe for target 'git-am'
Seems like a matter of luck whether the `make` executable you happen to
use guesses what we want: to munge git-am.sh into git-am, as opposed to
hard-linking git to git-am.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] git-gui: pass the branch name to git merge
From: Johannes Sixt @ 2016-11-23 19:23 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Pat Thoyts, René Scharfe, Git Mailing List
In-Reply-To: <1dc28731-9000-c3bf-fbed-0cb17c230d8b@kdbg.org>
Am 22.11.2016 um 21:40 schrieb Johannes Sixt:
> Am 22.11.2016 um 20:16 schrieb Junio C Hamano:
>> Can't this be handled on the "git merge FETCH_HEAD" codepath
>> instead?
>
> Absolutely. Any takers? ;)
I attempted to fix git merge FETCH_HEAD, but I do not see a trivial
solution.
But on second thought, we have an excuse to pick my proposed git-gui
change anyway: Without that change and a fix in git-merge only, there is
still a regression for all users who use the latest git-gui but some git
version between 2.5.0 and the fixed git-merge...
-- Hannes
^ permalink raw reply
* Re: [PATCH 2/2] difftool: add a feature flag for the builtin vs scripted version
From: Junio C Hamano @ 2016-11-23 18:18 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Dennis Kaarsemaker, git
In-Reply-To: <xmqqh96ym6x6.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
> Can't you route the control upon seeing "git difftool" to your
> experimental "C" difftool and check the configuration there? Then
> you can decide to run_command() a non-builtin one depending what the
> configuration says---that way, you would incur cost of spawning Perl
> only when you need it, no?
FWIW, the approach taken by 73c2779f42 ("builtin-am: implement
skeletal builtin am", 2015-08-04) is what I had in mind when I wrote
the above.
^ permalink raw reply
* Re: [PATCH 2/2] difftool: add a feature flag for the builtin vs scripted version
From: Junio C Hamano @ 2016-11-23 17:40 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Dennis Kaarsemaker, git
In-Reply-To: <alpine.DEB.2.20.1611231824530.3746@virtualbox>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> The downside is that we actually *do* go through Perl to do that. Only to
> go back to a builtin. Which is exactly the thing I intended to avoid.
>
> If we do not go through Perl, we have to set up the git directory and
> parse the config in git.c *just* to figure out whether we want to
> magically forward difftool to builtin-difftool. That is not only ugly, but
> has potential side effects I was not willing to risk.
I won't accept the latter anyway, so do not worry ;-)
> In any case, this feature flag will be there only for one or two Git for
> Windows releases, to give early adopters a chance to send me bug reports
> about any regressions.
I think that is sensible. I suspect that for early detection of
breakages, you do not need to invent and force people to use a
completely new "mechanism" to switch between two implementations.
Can't you route the control upon seeing "git difftool" to your
experimental "C" difftool and check the configuration there? Then
you can decide to run_command() a non-builtin one depending what the
configuration says---that way, you would incur cost of spawning Perl
only when you need it, no?
^ permalink raw reply
* Re: [PATCH v1 15/19] config: add git_config_get_date_string() from gc.c
From: Junio C Hamano @ 2016-11-23 17:34 UTC (permalink / raw)
To: Christian Couder
Cc: git, Nguyen Thai Ngoc Duy, Ævar Arnfjörð Bjarmason,
Christian Couder
In-Reply-To: <CAP8UFD0iToVxU+maNL9BFXacp3sER+AfrqAnQXWf7EAwURKmdQ@mail.gmail.com>
Christian Couder <christian.couder@gmail.com> writes:
> Ok it will appear like this in cache.h:
>
> /* This dies if the configured or default date is in the future */
> extern int git_config_get_expire_date_string(const char *key, const
> char **output);
Those who imitate existing callsites never read comments, and you
need to spend effort to get the name right to protect the codebase
from them.
"get-expiry" may be shorter. Neither still does not say it will
die, though.
^ permalink raw reply
* Re: [PATCH 2/2] difftool: add a feature flag for the builtin vs scripted version
From: Johannes Schindelin @ 2016-11-23 17:29 UTC (permalink / raw)
To: Dennis Kaarsemaker; +Cc: git, Junio C Hamano
In-Reply-To: <1479912693.5181.27.camel@kaarsemaker.net>
Hi Dennis,
On Wed, 23 Nov 2016, Dennis Kaarsemaker wrote:
> On Tue, 2016-11-22 at 18:01 +0100, Johannes Schindelin wrote:
> > The original idea was to use an environment variable
> > GIT_USE_BUILTIN_DIFFTOOL, but the test suite resets those variables, and
> > we do want to use that feature flag to run the tests with, and without,
> > the feature flag.
> >
> > Besides, the plan is to add an opt-in flag in Git for Windows'
> > installer. If we implemented the feature flag as an environment
> > variable, we would have to modify the user's environment, in order to
> > make the builtin difftool the default when called from Git Bash, Git CMD
> > or third-party tools.
>
> Why is this not a normal configuration variable (as in git config
> difftool.builtin true or something)? It doesn't make much sense to me
> to introduce a way of configuring git by introducing magic files, when
> a normal configuration variable would do just fine, and the GfW
> installer can also set such variables, like it does for the crlf config
> I believe.
I considered that. Adding a config setting would mean we simply test for
it in git-difftool.perl and call the builtin if the setting is active,
right?
The downside is that we actually *do* go through Perl to do that. Only to
go back to a builtin. Which is exactly the thing I intended to avoid.
If we do not go through Perl, we have to set up the git directory and
parse the config in git.c *just* to figure out whether we want to
magically forward difftool to builtin-difftool. That is not only ugly, but
has potential side effects I was not willing to risk.
In any case, this feature flag will be there only for one or two Git for
Windows releases, to give early adopters a chance to send me bug reports
about any regressions.
To be crystal-clear: I never expected this patch to enter git.git.
In that light, I am okay with taking the heat for introducing a temporary,
Git for Windows-only feature flag that is implemented as a "does the file
<xyz> exist?" test.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] merge-recursive.c: use QSORT macro
From: Junio C Hamano @ 2016-11-23 17:21 UTC (permalink / raw)
To: Jeff King; +Cc: Nguyễn Thái Ngọc Duy, git, René Scharfe
In-Reply-To: <20161122174946.jy5at4g7rifu3und@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Another possibility is:
>
> df_sorted_entries.cmp = string_list_df_name_compare;
> string_list_sort(&df_sorted_entries);
>
> It's not any shorter, but maybe it's conceptually simpler.
My first reaction to Duy's patch was: it is moronic for the
string-list API not to offer "I've done _append() to add many items
while avoiding the overhead of doing insertion sort all the time;
now I finished adding and I want the result sorted".
And then I looked at string-list.h and there it was ;-)
^ permalink raw reply
* Re: [PATCH 3/3] worktree list: keep the list sorted
From: Junio C Hamano @ 2016-11-23 17:16 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git, rappazzo
In-Reply-To: <20161122100046.8341-4-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> + for (i = nr = 0; worktrees[i]; i++)
> + nr++;
> +
> + /*
> + * don't sort the first item (main worktree), which will
> + * always be the first
> + */
> + QSORT(worktrees + 1, nr - 1, compare_worktree);
> +
This is somewhat curious.
for (i = 0; worktrees[i]; i++)
; /* just counting */
QSORT(worktrees + 1, i - 1, compare_worktree);
would have been a lot more idiomatic (you do not use nr after sorting).
More importantly, perhaps get_worktrees() should learn to take an
optional pointer to int that returns how many items are in the list?
Alternatively, other existing callers of the function do not care
about the order, so it may not be such a good idea to always sort
the result, but it may be a good idea to teach it to take a boolean
that signals that the list should be sorted in a "natural order",
which is how "worktree list" would show them to the user?
This should be easily protectable with a new test. Please do.
^ permalink raw reply
* Re: [PATCH 2/3] get_worktrees() must return main worktree as first item even on error
From: Junio C Hamano @ 2016-11-23 17:06 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git, rappazzo
In-Reply-To: <20161122100046.8341-3-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> diff --git a/builtin/worktree.c b/builtin/worktree.c
> index 5c4854d..b835b91 100644
> --- a/builtin/worktree.c
> +++ b/builtin/worktree.c
> @@ -388,7 +388,7 @@ static void show_worktree_porcelain(struct worktree *wt)
> printf("HEAD %s\n", sha1_to_hex(wt->head_sha1));
> if (wt->is_detached)
> printf("detached\n");
> - else
> + else if (wt->head_ref)
> printf("branch %s\n", wt->head_ref);
This change looks somewhat unrelated to what the title and the log
message claims to do, but the fix is to indicate an error condition
by leaving wt->head_ref as NULL, so this is a necessary adjustment.
Good.
> @@ -406,10 +406,12 @@ static void show_worktree(struct worktree *wt, int path_maxlen, int abbrev_len)
> else {
> strbuf_addf(&sb, "%-*s ", abbrev_len,
> find_unique_abbrev(wt->head_sha1, DEFAULT_ABBREV));
> - if (!wt->is_detached)
> + if (wt->is_detached)
> + strbuf_addstr(&sb, "(detached HEAD)");
> + else if (wt->head_ref)
> strbuf_addf(&sb, "[%s]", shorten_unambiguous_ref(wt->head_ref, 0));
> else
> - strbuf_addstr(&sb, "(detached HEAD)");
> + strbuf_addstr(&sb, "(error)");
> }
Likewise.
> diff --git a/worktree.c b/worktree.c
> index f7c1b5e..a674efa 100644
> --- a/worktree.c
> +++ b/worktree.c
> @@ -89,7 +89,7 @@ static struct worktree *get_main_worktree(void)
> strbuf_addf(&path, "%s/HEAD", get_git_common_dir());
>
> if (parse_ref(path.buf, &head_ref, &is_detached) < 0)
> - goto done;
> + strbuf_reset(&head_ref);
>
> worktree = xcalloc(1, sizeof(*worktree));
> worktree->path = strbuf_detach(&worktree_path, NULL);
> @@ -97,7 +97,6 @@ static struct worktree *get_main_worktree(void)
> worktree->is_detached = is_detached;
> add_head_info(&head_ref, worktree);
OK. The earlier call to _reset() and add_head_info() function
itself may want to be clarified that a zero-length strbuf signals an
error condition with additional comment. It is all too unclear in
the code with this patch as it stands.
> -done:
> strbuf_release(&path);
> strbuf_release(&worktree_path);
> strbuf_release(&head_ref);
After this there is "return worktree" which used to return NULL
because of the "goto", but we never return NULL from the function
after this change, which is the whole point of this change. Good.
> @@ -173,8 +172,7 @@ struct worktree **get_worktrees(void)
>
> list = xmalloc(alloc * sizeof(struct worktree *));
>
> - if ((list[counter] = get_main_worktree()))
> - counter++;
> + list[counter++] = get_main_worktree();
Hence the conditional, while it does not hurt, becomes unnecessary
and we can unconditionally throw the primary one to the list.
Good.
Other than the "these need in-code commenting", and also that this
should have a new test, the patch makes sense to me.
Thanks.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox