[ANNOUNCE] Git for Windows 2.22.0

2019-06-08 Thread Johannes Schindelin
Dear Git users,

It is my pleasure to announce that Git for Windows 2.22.0 is available from:

https://gitforwindows.org/

Changes since Git for Windows v2.21.0 (February 26th 2019)

New Features

  * Comes with Git v2.22.0.
  * The awk included in Git for Windows now includes extensions such as
inplace.
  * The file/product version stored in the installer's .exe file now
matches the version of the included git.exe file's.
  * Comes with OpenSSH v8.0p1.
  * Comes with Git LFS v2.7.2.
  * Comes with MSYS2 runtime (Git for Windows flavor) based on Cygwin
v3.x (see release notes for Cygwin 3.0.0, 3.0.1, 3.0.2, 3.0.3,
3.0.4, 3.0.5, 3.0.6, and 3.0.7).
  * There are now experimental built-in versions of git add -i and git
add -p, i.e. those modes are now a lot faster (in particular at
startup). You can opt into using them on the last installer page.
  * PortableGit now comes with a meta credential helper, i.e. a GUI
that lets the user choose which of the available credential helpers
to use. This should help to avoid storing credentials on other
people's machines when running portable Git from a thumb drive.
  * Comes with gawk v5.0.0.
  * Comes with Git Credential Manager v1.19.0.
  * Comes with git-flow v1.12.3.
  * Comes with OpenSSL v1.1.1c.
  * Comes with GNU Privacy Guard v2.2.16, specifically patched to
handle Windows paths.
  * Comes with cURL v7.65.1.
  * Comes with Heimdal v7.5.0. -packages/pull/33).

Bug Fixes

  * Git for Windows' updater is now accessible, i.e. it can be read by
a screen reader.
  * git update-git-for-windows (i.e. the auto updater of Git for
Windows) now reports correctly when it failed to access the GitHub
API.
  * Git for Windows' updater no longer runs into GitHub API rate limits
(this used to be quite common in enterprise scenarios, where many
users would share one IP as far as GitHub is concerned).
  * gitk no longer fails with "filename too long" when there are 1,000+
branches/tags.
  * A bug which on occasion caused lengthy rebase runs to crash without
error message was fixed.
  * Two workarounds from the Git for Windows 1.x era (concerning
reading credentials via GUI and fetching via git://) were
considered obsolete.
  * git difftool --no-index can now be run outside of Git worktrees.
  * git rebase -i used to get confused when an exec command created new
commits and then appended pick lines for them. This has been fixed.
  * During a run of git rebase --rebase-merges, the output of git
status now shows label lines correctly, i.e. with the labels' names
instead of the commit hash they point to.
  * We now avoid problems updating the commit graph when
gc.writeCommitGraph=true.

Filename | SHA-256
 | ---
Git-2.22.0-64-bit.exe | 
0c314a62f0f242c64fe1bdae20ab113fef990fb7e3323d0989478b6ed396d00b
Git-2.22.0-32-bit.exe | 
9995409d05c6789f96611f9a6365318dd384cb97b94d6d537f13bed789413e18
PortableGit-2.22.0-64-bit.7z.exe | 
2d935dc309568a9694711ac080967388c98b69907fb015f6536a4a0920084e0c
PortableGit-2.22.0-32-bit.7z.exe | 
dee3d963c218b5f7fb0925c5984070f7373abc4c44cf36050fde10bfd3d9bc2e
MinGit-2.22.0-64-bit.zip | 
308ce95b7de5792bed9d56e1af5d2053052ea6347ea0021f74070056684ce3ee
MinGit-2.22.0-32-bit.zip | 
61bbb2d02baee1b1c24857b031bae1063e38a3b062a642c0c9304bc80bf7b8fd
MinGit-2.22.0-busybox-64-bit.zip | 
48213aaba43be9b27d45affadcad98a65d06490987500b59e8310ebaed729327
MinGit-2.22.0-busybox-32-bit.zip | 
a5a4634a34cafaff3f7d9340c38d18f2044191a83c2da44fb3ff4db825ff4acd
Git-2.22.0-64-bit.tar.bz2 | 
e4df1f804512e678bc37b4dc2e0354f9177c0e44fbc73b28ec87702cb34eb236
Git-2.22.0-32-bit.tar.bz2 | 
15c1e87cd0a5c100c4c16d6043569eb478c87c4856670c97aeee920c20ea0b84
pdbs-for-git-64-bit-2.22.0.1.d003d728ff-1.zip | 
e54bb0cd2ae6c0e779065aecd8eeca3ab852781665ca9cfa53207cf136b4f915
pdbs-for-git-32-bit-2.22.0.1.d003d728ff-1.zip | 
2e4a1c2024de1b6af6259bfe1dae0d98314c72ca87291fd6a542885954dc6304

Ciao,
Johannes


Expression of Intent

2019-06-08 Thread Mr .Asher Chanan
Dear Sir/Madam,
My name is Mr.Asher Chanan. This email is in soliciting your assistance for a 
mutual benefitting business proposal.
Kindly indicate your interest by replying this email and I would be glad to 
furnish you with the details.
I look forward to a mutually benefitting relationship.
Warm Regards
Asher Chanan
Email:asherchan...@outlook.com


[PATCH 1/1] diffcore-rename: speed up register_rename_src

2019-06-08 Thread Jeff Hostetler via GitGitGadget
From: Jeff Hostetler 

Teach register_rename_src() to see if new file pair
can simply be appended to the rename_src[] array before
performing the binary search to find the proper insertion
point.

This is a performance optimization.  This routine is called
during run_diff_files in status and the caller is iterating
over the sorted index, so we should expect to be able to
append in the normal case.  The existing insert logic is
preserved so we don't have to assume that, but simply take
advantage of it if possible.

Signed-off-by: Jeff Hostetler 
Signed-off-by: Johannes Schindelin 
---
 diffcore-rename.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/diffcore-rename.c b/diffcore-rename.c
index 07bd34b631..5bfc5f6c22 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -82,6 +82,18 @@ static struct diff_rename_src *register_rename_src(struct 
diff_filepair *p)
 
first = 0;
last = rename_src_nr;
+
+   if (last > 0) {
+   struct diff_rename_src *src = &(rename_src[last-1]);
+   int cmp = strcmp(one->path, src->p->one->path);
+   if (!cmp)
+   return src;
+   if (cmp > 0) {
+   first = last;
+   goto append_it;
+   }
+   }
+
while (last > first) {
int next = (last + first) >> 1;
struct diff_rename_src *src = &(rename_src[next]);
@@ -95,6 +107,7 @@ static struct diff_rename_src *register_rename_src(struct 
diff_filepair *p)
first = next+1;
}
 
+append_it:
/* insert to make it at "first" */
ALLOC_GROW(rename_src, rename_src_nr + 1, rename_src_alloc);
rename_src_nr++;
-- 
gitgitgadget


[PATCH 0/1] Optimize run_diff_files()' rename detection

2019-06-08 Thread Johannes Schindelin via GitGitGadget
Just another patch from Git for Windows' branch thicket...

Jeff Hostetler (1):
  diffcore-rename: speed up register_rename_src

 diffcore-rename.c | 13 +
 1 file changed, 13 insertions(+)


base-commit: 8104ec994ea3849a968b4667d072fedd1e688642
Published-As: 
https://github.com/gitgitgadget/git/releases/tag/pr-142%2Fdscho%2Fregister_rename_src-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git 
pr-142/dscho/register_rename_src-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/142
-- 
gitgitgadget


[PATCH 0/1] Fix a test on NTFS (and probably HFS+)

2019-06-08 Thread Johannes Schindelin via GitGitGadget
My colleague Jameson Miller once presented me with a nice puzzle why the
test suite failed on their system.

Turns out that it is possible in PowerShell to spell the directory with a
different case than on disk in cd , and subsequent calls to get
the current working directory will use that case, rather than what is
recorded on disk. And since case-insensitive filesystems are frowned upon in
the Linux world, Git's test suite was not prepared for such a scenario.

Johannes Schindelin (1):
  t0001: fix on case-insensitive filesystems

 t/t0001-init.sh | 12 
 1 file changed, 12 insertions(+)


base-commit: 8104ec994ea3849a968b4667d072fedd1e688642
Published-As: 
https://github.com/gitgitgadget/git/releases/tag/pr-151%2Fdscho%2Ffunny-cased-cwd-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git 
pr-151/dscho/funny-cased-cwd-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/151
-- 
gitgitgadget


[PATCH 1/1] t0001: fix on case-insensitive filesystems

2019-06-08 Thread Johannes Schindelin via GitGitGadget
From: Johannes Schindelin 

On a case-insensitive filesystem, such as HFS+ or NTFS, it is possible
that the idea Bash has of the current directory differs in case from
what Git thinks it is. That's totally okay, though, and we should not
expect otherwise.

Reported by Jameson Miller.

Signed-off-by: Johannes Schindelin 
---
 t/t0001-init.sh | 12 
 1 file changed, 12 insertions(+)

diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 42a263cada..f54a69e2d9 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -307,10 +307,20 @@ test_expect_success 'init prefers command line to 
GIT_DIR' '
test_path_is_missing otherdir/refs
 '
 
+downcase_on_case_insensitive_fs () {
+   test false = "$(git config --get core.filemode)" || return 0
+   for f
+   do
+   tr A-Z a-z <"$f" >"$f".downcased &&
+   mv -f "$f".downcased "$f" || return 1
+   done
+}
+
 test_expect_success 'init with separate gitdir' '
rm -rf newdir &&
git init --separate-git-dir realgitdir newdir &&
echo "gitdir: $(pwd)/realgitdir" >expected &&
+   downcase_on_case_insensitive_fs expected newdir/.git &&
test_cmp expected newdir/.git &&
test_path_is_dir realgitdir/refs
 '
@@ -365,6 +375,7 @@ test_expect_success 're-init to update git link' '
git init --separate-git-dir ../surrealgitdir
) &&
echo "gitdir: $(pwd)/surrealgitdir" >expected &&
+   downcase_on_case_insensitive_fs expected newdir/.git &&
test_cmp expected newdir/.git &&
test_path_is_dir surrealgitdir/refs &&
test_path_is_missing realgitdir/refs
@@ -378,6 +389,7 @@ test_expect_success 're-init to move gitdir' '
git init --separate-git-dir ../realgitdir
) &&
echo "gitdir: $(pwd)/realgitdir" >expected &&
+   downcase_on_case_insensitive_fs expected newdir/.git &&
test_cmp expected newdir/.git &&
test_path_is_dir realgitdir/refs
 '
-- 
gitgitgadget


Business Intent

2019-06-08 Thread Mr .Asher Chanan
Dear Sir/Madam,
My name is Mr.Asher Chanan. This email is in soliciting your assistance for a 
mutual benefitting business proposal.
Kindly indicate your interest by replying this email and I would be glad to 
furnish you with the details.
I look forward to a mutually benefitting relationship.
Warm Regards
Asher Chanan
Email:asherchan...@outlook.com


Re: New command/tool: git filter-repo

2019-06-08 Thread Elijah Newren
Hi,

Now that there's a released version of git that has all necessary
flags and features[1] to run git filter-repo
(https://github.com/newren/git-filter-repo), I thought I'd send an
update...

On Fri, Feb 8, 2019 at 10:53 AM Ævar Arnfjörð Bjarmason
 wrote:
> On Thu, Jan 31 2019, Elijah Newren wrote:
>
> > What's the future?  (Core command of git.git?  place it in contrib?  keep it
> > in a separate repo?)  I'm hoping to discuss that at the contributor summit
> > today, but feedback on the list is also welcome.
>
> Some of this I may have mentioned at the summit, but here for the list:
>
> * I think it should be a candidate for a core (not "just contrib")
>   git.git command, given that we have someone willing to maintain it &
>   deal with bugs etc. I'm not worried about that given the author.
>
> * It's unfortunate in terms of API we need to support going forward that
>   this obligates us to support a fairly intricate python API going
>   forward, so it's similar (but more detailed) to Git.pm (which I also
>   tried to get rid of as an external API a while ago).
>
>   However, as you correctly note that's the only way a command like this
>   can be really fast, we already have the "no special API" command with
>   git-filter-branch, and that's horribly slow.
>
>   But perhaps there's ways we can in advance deal with a potential
>   future breaking API change. E.g. some Pythonic way of versioning the
>   API, or just prominently documenting whatever (low?) stability
>   guarantees we're making.
>
>   I imagine if we need to make breaking changes in the future that'll
>   less big of a deal than in other cases, since we'd expect the API use
>   to be one-off migration scripts, although maybe it'll get used for
>   all-the-time exports (e.g. mirroring internal->external repos with
>   filtering).
>
> * The rest of our commands are hooked up to the i18n framework. I don't
>   think this should be a blocker, but it's worth thinking about what the
>   plan for this is.
>
>   Are we going to need the equivalent of Git::I18N for Python (which
>   presumably will be a run-time dependency on something needing the
>   Python API that links to gettext).
>
>   Or perhaps we could do the translated strings in C, by making the
>   program you're invoking be a C command, invoking the Python part as a
>   helper (which would need to re-invoke a helper if it prints its own
>   messages).
>
> Thanks for working on this!

I've implemented these, and several other things too.  Changes since last time:

* Now i18n-ized
* Several disclaimers about API backcompat (this is more of a one-shot
conversion tool) [2]
* Converted to Python3 (Python2 is EOL at EOY)
* Pruning of become-empty and become-degenerate+empty commits has been
fixed up (I mentioned this as a concern last time)
* Testsuite has been fleshed out, including not only multiple small
fixes to filter repo, but more fixes to git itself[3]
* Usage, Examples, Internals, and Limitations documentation now exists
(in README.md format and built-in -h help; no manpage yet)
* Several new filters and abilities have been added

Now that filter-repo is complete and more easily tested, what are
folks thoughts on incorporating it in git.git?  (And if we do go that
route, can we avoid losing its history so I can bisect issues if
necessary?)

Thanks,
Elijah


[1] Well, except people will get an error if they use
--preserve-commit-encoding saying they don't have a new enough git
since en/fast-export-encoding is still sitting in next and didn't make
it in to git-2.22.  But I only know of one repo that even uses special
commit encodings, so I suspect few if any will even care about that
flag.

[2] The warnings appear in several places to try to make sure people
notice them; a not quite complete list:
https://github.com/newren/git-filter-repo/blame/master/README.md#L620-L625
https://github.com/newren/git-filter-repo/blame/master/README.md#L727-L730
https://github.com/newren/git-filter-repo/blame/master/README.md#L989-L993
https://github.com/newren/git-filter-repo/blob/master/git-filter-repo#L13-L30
https://github.com/newren/git-filter-repo/blob/master/git-filter-repo#L1523,L1524
https://github.com/newren/git-filter-repo/blob/master/t/t9391/commit_info.py#L4-L6
https://github.com/newren/git-filter-repo/blob/master/t/t9391/create_fast_export_output.py#L4-L6
https://github.com/newren/git-filter-repo/blob/master/t/t9391/file_filter.py#L4-L6
https://github.com/newren/git-filter-repo/blob/master/t/t9391/splice_repos.py#L4-L6
https://github.com/newren/git-filter-repo/blob/master/t/t9391/strip-cvs-keywords.py#L4-L6

[3] https://github.com/newren/git-filter-repo/tree/develop#upstream-improvements


[GSoC][PATCH 1/3] sequencer: add advice for revert

2019-06-08 Thread Rohit Ashiwal
In the case of merge conflicts, while performing a revert, we are
currently advised to use `git cherry-pick --`
of which --continue is incompatible for continuing the revert.
Introduce a separate advice message for `git revert`.

Signed-off-by: Rohit Ashiwal 
---
 sequencer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sequencer.c b/sequencer.c
index f88a97fb10..9c561a041b 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2655,6 +2655,7 @@ static int create_seq_dir(void)
if (file_exists(git_path_seq_dir())) {
error(_("a cherry-pick or revert is already in progress"));
advise(_("try \"git cherry-pick (--continue | --quit | 
--abort)\""));
+   advise(_("or  \"git revert (--continue | --quit | --abort)\""));
return -1;
} else if (mkdir(git_path_seq_dir(), 0777) < 0)
return error_errno(_("could not create sequencer directory 
'%s'"),
-- 
2.21.0



[GSoC][PATCH 2/3] cherry-pick/revert: add --skip option

2019-06-08 Thread Rohit Ashiwal
git am or rebase advise the user to use `git (am | rebase) --skip` to
skip the commit. cherry-pick and revert also have this concept of
skipping commits but they advise the user to use `git reset` (or in
case of a patch which had conflicts, `git reset --merge`) which on the
user's part is annoying and sometimes confusing. Add a `--skip` option
to make these commands more consistent.

In the next commit, we will change the advice messages hence finishing
the process of teaching revert and cherry-pick "how to skip commits".

Signed-off-by: Rohit Ashiwal 
---
 Documentation/git-cherry-pick.txt |  4 +-
 Documentation/git-revert.txt  |  4 +-
 Documentation/sequencer.txt   |  4 ++
 builtin/revert.c  |  5 +++
 sequencer.c   | 23 +++
 sequencer.h   |  1 +
 t/t3510-cherry-pick-sequence.sh   | 63 +++
 7 files changed, 98 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-cherry-pick.txt 
b/Documentation/git-cherry-pick.txt
index 754b16ce0c..955880ab88 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -10,9 +10,7 @@ SYNOPSIS
 [verse]
 'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff]
  [-S[]] ...
-'git cherry-pick' --continue
-'git cherry-pick' --quit
-'git cherry-pick' --abort
+'git cherry-pick' --continue | --skip | --abort | --quit
 
 DESCRIPTION
 ---
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index 0c82ca5bc0..ffce98099c 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -9,9 +9,7 @@ SYNOPSIS
 
 [verse]
 'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[]] 
...
-'git revert' --continue
-'git revert' --quit
-'git revert' --abort
+'git revert' --continue | --skip | --abort | --quit
 
 DESCRIPTION
 ---
diff --git a/Documentation/sequencer.txt b/Documentation/sequencer.txt
index 5a57c4a407..3bceb56474 100644
--- a/Documentation/sequencer.txt
+++ b/Documentation/sequencer.txt
@@ -3,6 +3,10 @@
`.git/sequencer`.  Can be used to continue after resolving
conflicts in a failed cherry-pick or revert.
 
+--skip::
+   Skip the current commit and continue with the rest of the
+   sequence.
+
 --quit::
Forget about the current operation in progress.  Can be used
to clear the sequencer state after a failed cherry-pick or
diff --git a/builtin/revert.c b/builtin/revert.c
index d4dcedbdc6..5dc5891ea2 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -102,6 +102,7 @@ static int run_sequencer(int argc, const char **argv, 
struct replay_opts *opts)
OPT_CMDMODE(0, "quit", &cmd, N_("end revert or cherry-pick 
sequence"), 'q'),
OPT_CMDMODE(0, "continue", &cmd, N_("resume revert or 
cherry-pick sequence"), 'c'),
OPT_CMDMODE(0, "abort", &cmd, N_("cancel revert or cherry-pick 
sequence"), 'a'),
+   OPT_CMDMODE(0, "skip", &cmd, N_("skip current commit and 
continue"), 's'),
OPT_CLEANUP(&cleanup_arg),
OPT_BOOL('n', "no-commit", &opts->no_commit, N_("don't 
automatically commit")),
OPT_BOOL('e', "edit", &opts->edit, N_("edit the commit 
message")),
@@ -151,6 +152,8 @@ static int run_sequencer(int argc, const char **argv, 
struct replay_opts *opts)
this_operation = "--quit";
else if (cmd == 'c')
this_operation = "--continue";
+   else if (cmd == 's')
+   this_operation = "--skip";
else {
assert(cmd == 'a');
this_operation = "--abort";
@@ -210,6 +213,8 @@ static int run_sequencer(int argc, const char **argv, 
struct replay_opts *opts)
return sequencer_continue(the_repository, opts);
if (cmd == 'a')
return sequencer_rollback(the_repository, opts);
+   if (cmd == 's')
+   return sequencer_skip(the_repository, opts);
return sequencer_pick_revisions(the_repository, opts);
 }
 
diff --git a/sequencer.c b/sequencer.c
index 9c561a041b..f586e677d3 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2784,6 +2784,29 @@ int sequencer_rollback(struct repository *r, struct 
replay_opts *opts)
return -1;
 }
 
+int sequencer_skip(struct repository *r, struct replay_opts *opts)
+{
+   switch (opts->action) {
+   case REPLAY_REVERT:
+   if (!file_exists(git_path_revert_head(r)))
+   return error(_("no revert in progress"));
+   break;
+   case REPLAY_PICK:
+   if (!file_exists(git_path_cherry_pick_head(r)))
+   return error(_("no cherry-pick in progress"));
+   break;
+   default:
+   BUG("the control must not reach here.");
+   }
+
+   if (rollback_single_pick(r))
+   return error(

[GSoC][PATCH 0/3] Teach cherry-pick/revert to skip commits

2019-06-08 Thread Rohit Ashiwal
git am or rebase advice user to use git am --skip or git rebase --skip
to skip the commit that has become empty or has risen conflicts. OTOH,
cherry-pick advice user to use git reset HEAD which on the user’s part
is annoying and sometimes confusing. This patch series will bring
consistency between advices of these commands with introduction of
`--skip` flag to cherry-pick and revert.

Rohit Ashiwal (3):
  sequencer: add advice for revert
  cherry-pick/revert: add --skip option
  cherry-pick/revert: update hints

 Documentation/git-cherry-pick.txt |  4 +-
 Documentation/git-revert.txt  |  4 +-
 Documentation/sequencer.txt   |  4 ++
 builtin/commit.c  | 13 ---
 builtin/revert.c  |  5 +++
 sequencer.c   | 26 -
 sequencer.h   |  1 +
 t/t3510-cherry-pick-sequence.sh   | 63 +++
 8 files changed, 108 insertions(+), 12 deletions(-)

PR: https://github.com/r1walz/git/pull/1
Reviewed-by: Elijah Newren 
Reviewed-by: Thomas Gummerer 
-- 
2.21.0



[GSoC][PATCH 3/3] cherry-pick/revert: update hints

2019-06-08 Thread Rohit Ashiwal
Signed-off-by: Rohit Ashiwal 
---
 builtin/commit.c | 13 -
 sequencer.c  |  4 ++--
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 1c9e8e2228..1f47c51bdc 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -60,15 +60,18 @@ N_("The previous cherry-pick is now empty, possibly due to 
conflict resolution.\
 "\n");
 
 static const char empty_cherry_pick_advice_single[] =
-N_("Otherwise, please use 'git reset'\n");
+N_("Otherwise, please use 'git cherry-pick --skip'\n");
 
 static const char empty_cherry_pick_advice_multi[] =
-N_("If you wish to skip this commit, use:\n"
+N_("and then use:\n"
 "\n"
-"git reset\n"
+"git cherry-pick --continue\n"
 "\n"
-"Then \"git cherry-pick --continue\" will resume cherry-picking\n"
-"the remaining commits.\n");
+"to resume cherry-picking the remaining commits.\n"
+"If you wish to skip this commit, use:\n"
+"\n"
+"git cherry-pick --skip\n"
+"\n");
 
 static const char *color_status_slots[] = {
[WT_STATUS_HEADER]= "header",
diff --git a/sequencer.c b/sequencer.c
index f586e677d3..e889427eef 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2654,8 +2654,8 @@ static int create_seq_dir(void)
 {
if (file_exists(git_path_seq_dir())) {
error(_("a cherry-pick or revert is already in progress"));
-   advise(_("try \"git cherry-pick (--continue | --quit | 
--abort)\""));
-   advise(_("or  \"git revert (--continue | --quit | --abort)\""));
+   advise(_("try \"git cherry-pick (--continue | --skip | --quit | 
--abort)\""));
+   advise(_("or  \"git revert (--continue | --skip | --quit | 
--abort)\""));
return -1;
} else if (mkdir(git_path_seq_dir(), 0777) < 0)
return error_errno(_("could not create sequencer directory 
'%s'"),
-- 
2.21.0



Re: Git Test Coverage Report (Thursday, June 6 2019)

2019-06-08 Thread Philip Oakley

Hi Stollee

On 07/06/2019 02:19, Derrick Stolee wrote:

Here is today's test coverage report.

Thanks,
-Stolee

[1] https://derrickstolee.github.io/git-test-coverage/reports/2019-06-06.htm
[2] https://derrickstolee.github.io/git-test-coverage/reports/2019-06-06.txt

---

pu  4f91bbec8a3cc2fff435fb3dbb0dfa5f9d223141
jch e1895a3c3b1fef6d1bc80251d09598e219d3908d
nextee3066bb6536c68f973b3c0ffaaa13f4bfda5ea3
master  74583d89127e21255c12dd3c8a3bf60b497d7d03
master@{1}  aa25c82427ae70aebf3b8f970f2afd54e9a2a8c6


Uncovered code in 'pu' not in 'jch'


[snip]


Uncovered code in 'jch' not in 'next'


builtin/branch.c
1fde99cf 841) die(_("The -a, and -r, options to 'git branch' do not take a branch 
name.\n"

[nip]

Commits introducting uncovered code:
...
Philip Oakley   1fde99cf doc branch: provide examples for listing remote 
tracking branches
[snip rest]


The change was just a change to the die() message, but was not tested 
previously.


I've guessed that t3203 would be the right place for an extra test which 
I've hacked (but not yet tested) as


---
phili@Philip-Win10 MINGW64 /usr/src/git (branch-patterns-v2)
$ git show -1
commit d5a799d8833b0ae195915eefd5365f3fc4c7c0a4 (HEAD -> 
branch-patterns-v2, my/branch-patterns-v2)

Author: Philip Oakley 
Date:   Sat Jun 8 22:50:06 2019 +0100

    t3203-branch-output: test -a & -r pattern options

    Users may wrongly use the -r and -a options with a branch pattern when
    looking for a remote tracking branch. Test that we fail for that 
misuse.


    Signed-off-by: Philip Oakley 

diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index ee6787614c..e78bd1c56d 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -264,4 +264,9 @@ test_expect_success '--color overrides auto-color' '
    test_cmp expect.color actual
 '

+test_expect_success '-a & -r options do not take a branch name, without 
--list' '

+   test_must_fail git branch -a HEAD
+   test_must_fail git branch -r HEAD
+'
+
 test_done
---
https://github.com/PhilipOakley/git/commit/d5a799d8833b0ae195915eefd5365f3fc4c7c0a4

Not sure if that's the right way to do it (Its my first proper try at 
tests themselves..)


I'm going to be away for about a week with only intermittent internet 
hence the unfinished reply.

--
Philip


Re: [PATCH 1/1] diffcore-rename: speed up register_rename_src

2019-06-08 Thread René Scharfe
Am 08.06.19 um 16:42 schrieb Jeff Hostetler via GitGitGadget:
> From: Jeff Hostetler 
>
> Teach register_rename_src() to see if new file pair
> can simply be appended to the rename_src[] array before
> performing the binary search to find the proper insertion
> point.
>
> This is a performance optimization.  This routine is called
> during run_diff_files in status and the caller is iterating
> over the sorted index, so we should expect to be able to
> append in the normal case.  The existing insert logic is
> preserved so we don't have to assume that, but simply take
> advantage of it if possible.
>
> Signed-off-by: Jeff Hostetler 
> Signed-off-by: Johannes Schindelin 
> ---
>  diffcore-rename.c | 13 +
>  1 file changed, 13 insertions(+)
>
> diff --git a/diffcore-rename.c b/diffcore-rename.c
> index 07bd34b631..5bfc5f6c22 100644
> --- a/diffcore-rename.c
> +++ b/diffcore-rename.c
> @@ -82,6 +82,18 @@ static struct diff_rename_src *register_rename_src(struct 
> diff_filepair *p)
>
>   first = 0;
>   last = rename_src_nr;
> +
> + if (last > 0) {
> + struct diff_rename_src *src = &(rename_src[last-1]);
> + int cmp = strcmp(one->path, src->p->one->path);
> + if (!cmp)
> + return src;
> + if (cmp > 0) {
> + first = last;
> + goto append_it;

The goto is not necessary from a logical point of view; the binary
search is skipped even without it because the loop condition below is
not met anymore.

> + }

You could decrement "last" at this point as a micro-optimization, to use
all three possible outcomes of the comparison to make some progress.

Not sure if any of that would have a _measurable_ impact, though, so I
don't mind the patch going in as is.

> + }
> +
>   while (last > first) {
>   int next = (last + first) >> 1;

Hmm, "last" and "first" are ints as well, so this will give weird results
when "last" > INT_MAX / 2.  I thought 19716b21a4 ("cleanup: fix possible
overflow errors in binary search", 2017-10-08) got us rid of those, but
git grep -n '(.*+.*) >> 1' actually finds some more cases:

   builtin/ls-files.c:376: int next = (last + first) >> 1;
   diffcore-rename.c:26:   int next = (last + first) >> 1;
   diffcore-rename.c:86:   int next = (last + first) >> 1;
   dir.c:704:  int cmp, next = (last + first) >> 1;
   name-hash.c:349:int mid = (begin + end) >> 1;
   read-cache.c:552:   int next = (last + first) >> 1;
   sh-i18n--envsubst.c:252:  size_t j = (j1 + j2) >> 1;

(Not caused by this patch, of course, just noticed it in the context.)

>   struct diff_rename_src *src = &(rename_src[next]);
> @@ -95,6 +107,7 @@ static struct diff_rename_src *register_rename_src(struct 
> diff_filepair *p)
>   first = next+1;
>   }
>
> +append_it:
>   /* insert to make it at "first" */
>   ALLOC_GROW(rename_src, rename_src_nr + 1, rename_src_alloc);
>   rename_src_nr++;
>

Anyway, this here should work as well (and fix the possible overflow),
but may be too terse and quirky:

diff --git a/diffcore-rename.c b/diffcore-rename.c
index 07bd34b631..f2a9007e08 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -76,14 +76,13 @@ static int rename_src_nr, rename_src_alloc;

 static struct diff_rename_src *register_rename_src(struct diff_filepair *p)
 {
-   int first, last;
+   int first, last, next;
struct diff_filespec *one = p->one;
unsigned short score = p->score;

first = 0;
last = rename_src_nr;
-   while (last > first) {
-   int next = (last + first) >> 1;
+   for (next = last - 1; last > first; next = first + (last - first) / 2) {
struct diff_rename_src *src = &(rename_src[next]);
int cmp = strcmp(one->path, src->p->one->path);
if (!cmp)


Wright's Media | Licensing, Reprints, E-prints Request

2019-06-08 Thread April Joy Diaz


https://info.wrightsmedia.com/licensing-reprints-request


gabriel...@gmail.com


[PATCH 1/3] t/helper: add test-oidmap.c

2019-06-08 Thread Christian Couder
This new helper is very similar to "test-hashmap.c" and will help
test how `struct oidmap` from oidmap.{c,h} can be used.

Signed-off-by: Christian Couder 
---
 Makefile   |   1 +
 t/helper/test-oidmap.c | 134 +
 t/helper/test-tool.c   |   1 +
 t/helper/test-tool.h   |   1 +
 4 files changed, 137 insertions(+)
 create mode 100644 t/helper/test-oidmap.c

diff --git a/Makefile b/Makefile
index 8a7e235352..5efc7700ed 100644
--- a/Makefile
+++ b/Makefile
@@ -727,6 +727,7 @@ TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-match-trees.o
 TEST_BUILTINS_OBJS += test-mergesort.o
 TEST_BUILTINS_OBJS += test-mktemp.o
+TEST_BUILTINS_OBJS += test-oidmap.o
 TEST_BUILTINS_OBJS += test-online-cpus.o
 TEST_BUILTINS_OBJS += test-parse-options.o
 TEST_BUILTINS_OBJS += test-path-utils.o
diff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c
new file mode 100644
index 00..0ba122a264
--- /dev/null
+++ b/t/helper/test-oidmap.c
@@ -0,0 +1,134 @@
+#include "test-tool.h"
+#include "cache.h"
+#include "oidmap.h"
+#include "strbuf.h"
+
+/* key is an oid and value is a name (could be a refname for example) */
+struct test_entry {
+   struct oidmap_entry entry;
+   char name[FLEX_ARRAY];
+};
+
+#define DELIM " \t\r\n"
+
+/*
+ * Read stdin line by line and print result of commands to stdout:
+ *
+ * hash oidkey -> sha1hash(oidkey)
+ * put oidkey namevalue -> NULL / old namevalue
+ * get oidkey -> NULL / namevalue
+ * remove oidkey -> NULL / old namevalue
+ * iterate -> oidkey1 namevalue1\noidkey2 namevalue2\n...
+ *
+ */
+int cmd__oidmap(int argc, const char **argv)
+{
+   struct strbuf line = STRBUF_INIT;
+   struct oidmap map = OIDMAP_INIT;
+
+   setup_git_directory();
+
+   /* init oidmap */
+   oidmap_init(&map, 0);
+
+   /* process commands from stdin */
+   while (strbuf_getline(&line, stdin) != EOF) {
+   char *cmd, *p1 = NULL, *p2 = NULL;
+   struct test_entry *entry;
+   struct object_id oid;
+
+   /* break line into command and up to two parameters */
+   cmd = strtok(line.buf, DELIM);
+   /* ignore empty lines */
+   if (!cmd || *cmd == '#')
+   continue;
+
+   p1 = strtok(NULL, DELIM);
+   if (p1)
+   p2 = strtok(NULL, DELIM);
+
+   if (!strcmp("hash", cmd) && p1) {
+
+   /* print hash of oid */
+   if (!get_oid(p1, &oid))
+   printf("%u\n", sha1hash(oid.hash));
+   else
+   printf("Unknown oid: %s\n", p1);
+
+   } else if (!strcmp("add", cmd) && p1 && p2) {
+
+   if (get_oid(p1, &oid)) {
+   printf("Unknown oid: %s\n", p1);
+   continue;
+   }
+
+   /* create entry with oidkey from p1, value = p2 */
+   FLEX_ALLOC_STR(entry, name, p2);
+   oidcpy(&entry->entry.oid, &oid);
+
+   /* add to oidmap */
+   oidmap_put(&map, entry);
+
+   } else if (!strcmp("put", cmd) && p1 && p2) {
+
+   if (get_oid(p1, &oid)) {
+   printf("Unknown oid: %s\n", p1);
+   continue;
+   }
+
+   /* create entry with oid_key = p1, name_value = p2 */
+   FLEX_ALLOC_STR(entry, name, p2);
+   oidcpy(&entry->entry.oid, &oid);
+
+   /* add / replace entry */
+   entry = oidmap_put(&map, entry);
+
+   /* print and free replaced entry, if any */
+   puts(entry ? entry->name : "NULL");
+   free(entry);
+
+   } else if (!strcmp("get", cmd) && p1) {
+
+   if (get_oid(p1, &oid)) {
+   printf("Unknown oid: %s\n", p1);
+   continue;
+   }
+
+   /* lookup entry in oidmap */
+   entry = oidmap_get(&map, &oid);
+
+   /* print result */
+   puts(entry ? entry->name : "NULL");
+
+   } else if (!strcmp("remove", cmd) && p1) {
+
+   if (get_oid(p1, &oid)) {
+   printf("Unknown oid: %s\n", p1);
+   continue;
+   }
+
+   /* remove entry from oidmap */
+   entry = oidmap_remove(&map, &oid);
+
+   /* print result and free entry*/
+   puts(entry ? entry->name : "NULL");
+   free(entry);
+
+   } else if (!strcm

[PATCH 2/3] t: add t0016-oidmap.sh

2019-06-08 Thread Christian Couder
From: Christian Couder 

Add actual tests for operations using `struct oidmap` from oidmap.{c,h}.

Signed-off-by: Christian Couder 
---
 t/t0016-oidmap.sh | 100 ++
 1 file changed, 100 insertions(+)
 create mode 100755 t/t0016-oidmap.sh

diff --git a/t/t0016-oidmap.sh b/t/t0016-oidmap.sh
new file mode 100755
index 00..3a8e8bdb3d
--- /dev/null
+++ b/t/t0016-oidmap.sh
@@ -0,0 +1,100 @@
+#!/bin/sh
+
+test_description='test oidmap'
+. ./test-lib.sh
+
+# This purposefully is very similar to t0011-hashmap.sh
+
+test_oidmap() {
+   echo "$1" | test-tool oidmap $3 > actual &&
+   echo "$2" > expect &&
+   test_cmp expect actual
+}
+
+
+test_expect_success 'setup' '
+
+   test_commit one &&
+   test_commit two &&
+   test_commit three &&
+   test_commit four
+
+'
+
+test_oidhash() {
+   git rev-parse "$1" | perl -ne 'print hex("$4$3$2$1") . "\n" if 
m/^(..)(..)(..)(..).*/;'
+}
+
+test_expect_success PERL 'hash' '
+
+test_oidmap "hash one
+hash two
+hash invalidOid
+hash three" "$(test_oidhash one)
+$(test_oidhash two)
+Unknown oid: invalidOid
+$(test_oidhash three)"
+
+'
+
+test_expect_success 'put' '
+
+test_oidmap "put one 1
+put two 2
+put invalidOid 4
+put three 3" "NULL
+NULL
+Unknown oid: invalidOid
+NULL"
+
+'
+
+test_expect_success 'replace' '
+
+test_oidmap "put one 1
+put two 2
+put three 3
+put invalidOid 4
+put two deux
+put one un" "NULL
+NULL
+NULL
+Unknown oid: invalidOid
+2
+1"
+
+'
+
+test_expect_success 'get' '
+
+test_oidmap "put one 1
+put two 2
+put three 3
+get two
+get four
+get invalidOid
+get one" "NULL
+NULL
+NULL
+2
+NULL
+Unknown oid: invalidOid
+1"
+
+'
+
+test_expect_success 'iterate' '
+
+test_oidmap "put one 1
+put two 2
+put three 3
+iterate" "NULL
+NULL
+NULL
+$(git rev-parse two) 2
+$(git rev-parse one) 1
+$(git rev-parse three) 3"
+
+'
+
+test_done
-- 
2.22.0.14.g9023ccb50a



[PATCH 3/3] oidmap: use sha1hash() instead of static hash() function

2019-06-08 Thread Christian Couder
From: Christian Couder 

Get rid of the static hash() function in oidmap.c which is redundant
with sha1hash(). Use sha1hash() directly instead.

Let's be more consistent and not use several hash functions doing
nearly exactly the same thing.

Signed-off-by: Christian Couder 
---
 oidmap.c | 13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/oidmap.c b/oidmap.c
index b0841a0f58..01c206aaef 100644
--- a/oidmap.c
+++ b/oidmap.c
@@ -12,13 +12,6 @@ static int oidmap_neq(const void *hashmap_cmp_fn_data,
  &((const struct oidmap_entry *) entry_or_key)->oid);
 }
 
-static int hash(const struct object_id *oid)
-{
-   int hash;
-   memcpy(&hash, oid->hash, sizeof(hash));
-   return hash;
-}
-
 void oidmap_init(struct oidmap *map, size_t initial_size)
 {
hashmap_init(&map->map, oidmap_neq, NULL, initial_size);
@@ -36,7 +29,7 @@ void *oidmap_get(const struct oidmap *map, const struct 
object_id *key)
if (!map->map.cmpfn)
return NULL;
 
-   return hashmap_get_from_hash(&map->map, hash(key), key);
+   return hashmap_get_from_hash(&map->map, sha1hash(key->hash), key);
 }
 
 void *oidmap_remove(struct oidmap *map, const struct object_id *key)
@@ -46,7 +39,7 @@ void *oidmap_remove(struct oidmap *map, const struct 
object_id *key)
if (!map->map.cmpfn)
oidmap_init(map, 0);
 
-   hashmap_entry_init(&entry, hash(key));
+   hashmap_entry_init(&entry, sha1hash(key->hash));
return hashmap_remove(&map->map, &entry, key);
 }
 
@@ -57,6 +50,6 @@ void *oidmap_put(struct oidmap *map, void *entry)
if (!map->map.cmpfn)
oidmap_init(map, 0);
 
-   hashmap_entry_init(&to_put->internal_entry, hash(&to_put->oid));
+   hashmap_entry_init(&to_put->internal_entry, sha1hash(to_put->oid.hash));
return hashmap_put(&map->map, to_put);
 }
-- 
2.22.0.14.g9023ccb50a



[PATCH 0/3] Test oidmap

2019-06-08 Thread Christian Couder
From: Christian Couder 

Unlike hashmap that has t/helper/test-hashmap.c and t/t0011-hashmap.sh
oidmap has no specific test. The goal of this small patch series is to
change that and also improve oidmap a bit while at it.

Christian Couder (3):
  t/helper: add test-oidmap.c
  t: add t0016-oidmap.sh
  oidmap: use sha1hash() instead of static hash() function

 Makefile   |   1 +
 oidmap.c   |  13 +---
 t/helper/test-oidmap.c | 134 +
 t/helper/test-tool.c   |   1 +
 t/helper/test-tool.h   |   1 +
 t/t0016-oidmap.sh  | 100 ++
 6 files changed, 240 insertions(+), 10 deletions(-)
 create mode 100644 t/helper/test-oidmap.c
 create mode 100755 t/t0016-oidmap.sh

-- 
2.22.0.14.g9023ccb50a