* Re: [PATCH 01/19] spell checking
From: Jonathan Nieder @ 2013-03-09 20:25 UTC (permalink / raw)
To: Paul Campbell; +Cc: Junio C Hamano, git, David Greene
In-Reply-To: <CALeLG_kdYjFhZXWedTgr2zdzJfrGV6XmqT1qkMX9XpJgztnPcg@mail.gmail.com>
Paul Campbell wrote:
> Four of the eight original authors now have dead email addresses. As I
> found out when I started getting the mail bounces when I started
> sending these patches out. Would it be acceptable for those patches to
> leave the From line, add a Based-on-patch-by and then sign of myself?
It's always nice to get the original author's sign-off, but if you can
certify what's stated in the DCO1.1 (from
Documentation/SubmittingPatches) then just adding your sign-off is
fine. Please still keep the original authorship in that case, and no
need to add a Based-on-patch-by line.
Thanks,
Jonathan
^ permalink raw reply
* [PATCH v2 0/3] Improve P4Merge mergetool invocation
From: Kevin Bracey @ 2013-03-09 19:20 UTC (permalink / raw)
To: git; +Cc: Kevin Bracey, David Aguilar, Ciaran Jessup, Scott Chacon,
Alex Riesen
In-Reply-To: <1362601978-16911-1-git-send-email-kevin@bracey.fi>
Incorporated comments on the previous patches, and one new patch
addressing a problem I spotted while testing git-merge-one-file.
I couldn't figure out how to use git diff to achieve the effect of the
external diff here - we'd need some alternative to achieve what it does
with the -L option, and I failed to come up with anything remotely elegant.
Kevin Bracey (3):
mergetools/p4merge: swap LOCAL and REMOTE
mergetools/p4merge: create a base if none available
git-merge-one-file: revise merge error reporting
git-merge-one-file.sh | 38 ++++++++++++--------------------------
git-sh-setup.sh | 13 +++++++++++++
mergetools/p4merge | 8 ++++++--
3 files changed, 31 insertions(+), 28 deletions(-)
--
1.8.2.rc3.7.g77aeedb
^ permalink raw reply
* Re: Segfault in git 1.8.1.5
From: Dennis Kaarsemaker @ 2013-03-09 21:13 UTC (permalink / raw)
To: Strasser Pablo; +Cc: git
In-Reply-To: <2078462.OF4zRmv4ar@pablohp>
On za, 2013-03-09 at 21:16 +0100, Strasser Pablo wrote:
> Hello,
>
> I segfault with the following command:
>
> git checkout HEAD~1
> git branch -u origin/master
>
> I think it's because i'm in detached head.
> A error message like cannot use this command in would be a better responce
> than a segfault.
Confirmed.
dennis@lightning:/tmp/hacks$ gdb --args ~/code/git/git branch -u origin/master
(gdb) run
Starting program: /home/dennis/code/git/git branch -u origin/master
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
cmd_branch (argc=0, argv=0xbfffec08, prefix=0x0) at builtin/branch.c:886
886 if (!ref_exists(branch->refname))
(gdb) bt
#0 cmd_branch (argc=0, argv=0xbfffec08, prefix=0x0) at builtin/branch.c:886
#1 0x0804c26c in run_builtin (argv=0xbfffec08, argc=3, p=0x819f3f4 <commands.21695+84>) at git.c:273
#2 handle_internal_command (argc=3, argv=0xbfffec08) at git.c:435
#3 0x0804b656 in run_argv (argv=0xbfffeb74, argcp=0xbfffeb70) at git.c:481
#4 main (argc=3, argv=0xbfffec08) at git.c:556
But it's already been fixed by 8efb889: branch: segfault fixes and
validation.
--
Dennis Kaarsemaker
www.kaarsemaker.net
^ permalink raw reply
* Re: Segfault in git 1.8.1.5
From: Junio C Hamano @ 2013-03-09 21:16 UTC (permalink / raw)
To: Strasser Pablo; +Cc: git
In-Reply-To: <2078462.OF4zRmv4ar@pablohp>
Strasser Pablo <strasserpablo@bluewin.ch> writes:
> I segfault with the following command:
>
> git checkout HEAD~1
> git branch -u origin/master
A patch to address this in cooking in 'next', and is expected to be
in 1.8.2.1 or later.
^ permalink raw reply
* Re: Segfault in git 1.8.1.5
From: Strasser Pablo @ 2013-03-09 21:31 UTC (permalink / raw)
To: gitster, dennis; +Cc: git
In-Reply-To: <7vboase0jw.fsf@alter.siamese.dyndns.org>
On Saturday 09 March 2013 13.16:35 Junio C Hamano wrote:
> Strasser Pablo <strasserpablo@bluewin.ch> writes:
> > I segfault with the following command:
> >
> > git checkout HEAD~1
> > git branch -u origin/master
>
> A patch to address this in cooking in 'next', and is expected to be
> in 1.8.2.1 or later.
Ok thanks.
^ permalink raw reply
* [PATCH v3 0/2] shell: allow 'no-interactive-login' command to disable interactive shell
From: Jonathan Nieder @ 2013-03-09 21:52 UTC (permalink / raw)
To: Ethan Reesor
Cc: git, Jeff King, Sitaram Chamarty, Junio C Hamano,
Ramkumar Ramachandra, Greg Brockman
In-Reply-To: <CAE_TNikk-9sYVRQRwRecNpp3otQ+oc=uV9SPu+7pAkCUNbcUoQ@mail.gmail.com>
Hi again,
Here's a reroll along the lines described at
http://thread.gmane.org/gmane.comp.version-control.git/216229
As before, this series is meant to give users of basic 'git shell'
setups a chance to imitate some nice behaviors that GitHub and
gitolite offer in more complicated ways. Thanks for your help on it
so far.
Jonathan Nieder (2):
shell doc: emphasize purpose and security model
shell: allow customization of "interactive login disabled" message
Documentation/git-shell.txt | 86 +++++++++++++++++++++++++++++++++++++--------
shell.c | 13 +++++++
2 files changed, 84 insertions(+), 15 deletions(-)
^ permalink raw reply
* [PATCH 1/2] shell doc: emphasize purpose and security model
From: Jonathan Nieder @ 2013-03-09 21:55 UTC (permalink / raw)
To: Ethan Reesor
Cc: git, Jeff King, Sitaram Chamarty, Junio C Hamano,
Ramkumar Ramachandra, Greg Brockman
In-Reply-To: <20130309215237.GA24777@elie.Belkin>
The original git-shell(1) manpage emphasized that the shell supports
only git transport commands. As the shell gained features, that
emphasis and focus in the manual has been lost. Bring it back by
splitting the manpage into a few short sections and fleshing out each:
- SYNOPSIS, describing how the shell gets used in practice
- DESCRIPTION, which gives an overview of the purpose and guarantees
provided by this restricted shell
- COMMANDS, listing supported commands and restrictions on the
arguments they accept
- INTERACTIVE USE, describing the interactive mode
Also add a "see also" section with related reading.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Changes since v2:
- use "command -v" instead of "which" in synopsis to subtly reinforce
good habits
- use <user> instead of hardcoding "git" username in synopsis
- give up on typesetting "git> " in monospace, since the toolchain
doesn't seem to like lonely backticks :/
- clarify change description
The actual text is pretty much the same.
Documentation/git-shell.txt | 66 ++++++++++++++++++++++++++++++++++-----------
1 file changed, 51 insertions(+), 15 deletions(-)
diff --git a/Documentation/git-shell.txt b/Documentation/git-shell.txt
index 9b925060..544b21aa 100644
--- a/Documentation/git-shell.txt
+++ b/Documentation/git-shell.txt
@@ -9,25 +9,61 @@ git-shell - Restricted login shell for Git-only SSH access
SYNOPSIS
--------
[verse]
-'git shell' [-c <command> <argument>]
+'chsh' -s $(command -v git-shell) <user>
+'git clone' <user>`@localhost:/path/to/repo.git`
+'ssh' <user>`@localhost`
DESCRIPTION
-----------
-A login shell for SSH accounts to provide restricted Git access. When
-'-c' is given, the program executes <command> non-interactively;
-<command> can be one of 'git receive-pack', 'git upload-pack', 'git
-upload-archive', 'cvs server', or a command in COMMAND_DIR. The shell
-is started in interactive mode when no arguments are given; in this
-case, COMMAND_DIR must exist, and any of the executables in it can be
-invoked.
-
-'cvs server' is a special command which executes git-cvsserver.
-
-COMMAND_DIR is the path "$HOME/git-shell-commands". The user must have
-read and execute permissions to the directory in order to execute the
-programs in it. The programs are executed with a cwd of $HOME, and
-<argument> is parsed as a command-line string.
+This is a login shell for SSH accounts to provide restricted Git access.
+It permits execution only of server-side Git commands implementing the
+pull/push functionality, plus custom commands present in a subdirectory
+named `git-shell-commands` in the user's home directory.
+
+COMMANDS
+--------
+
+'git shell' accepts the following commands after the '-c' option:
+
+'git receive-pack <argument>'::
+'git upload-pack <argument>'::
+'git upload-archive <argument>'::
+ Call the corresponding server-side command to support
+ the client's 'git push', 'git fetch', or 'git archive --remote'
+ request.
+'cvs server'::
+ Imitate a CVS server. See linkgit:git-cvsserver[1].
+
+If a `~/git-shell-commands` directory is present, 'git shell' will
+also handle other, custom commands by running
+"`git-shell-commands/<command> <arguments>`" from the user's home
+directory.
+
+INTERACTIVE USE
+---------------
+
+By default, the commands above can be executed only with the '-c'
+option; the shell is not interactive.
+
+If a `~/git-shell-commands` directory is present, 'git shell'
+can also be run interactively (with no arguments). If a `help`
+command is present in the `git-shell-commands` directory, it is
+run to provide the user with an overview of allowed actions. Then a
+"git> " prompt is presented at which one can enter any of the
+commands from the `git-shell-commands` directory, or `exit` to close
+the connection.
+
+Generally this mode is used as an administrative interface to allow
+users to list repositories they have access to, create, delete, or
+rename repositories, or change repository descriptions and
+permissions.
+
+SEE ALSO
+--------
+ssh(1),
+linkgit:git-daemon[1],
+contrib/git-shell-commands/README
GIT
---
--
1.8.2.rc3
^ permalink raw reply related
* [PATCH 2/2] shell: new no-interactive-login command to print a custom message
From: Jonathan Nieder @ 2013-03-09 22:00 UTC (permalink / raw)
To: Ethan Reesor
Cc: git, Jeff King, Sitaram Chamarty, Junio C Hamano,
Ramkumar Ramachandra, Greg Brockman
In-Reply-To: <20130309215237.GA24777@elie.Belkin>
If I disable git-shell's interactive mode by removing the
~/git-shell-commands directory, attempts to use 'ssh' in produce a
message intended for the administrator:
$ ssh git@myserver
fatal: Interactive git shell is not enabled.
hint: ~/git-shell-commands should exist and have read and execute access.
$
That is helpful for the new admin who is wondering "What? Why isn't
the git-shell I just set up working?", but once the site setup is
complete, it would be better to give the user a friendly hint that she
is on the right track, like GitHub does.
Hi <username>! You've successfully authenticated, but
GitHub does not provide shell access.
An appropriate greeting might even include more complex dynamic
information, like gitolite's list of repositories the user has access
to. Add support for a ~/git-shell-commands/no-interactive-login
command that generates an arbitrary greeting. When the user tries to
log in:
* If the file ~/git-shell-commands/no-interactive-login exists,
run no-interactive-login to let the server say what it likes,
then hang up.
* Otherwise, if ~/git-shell-commands/ is present, start an
interactive read-eval-print loop.
* Otherwise, print the usual configuration hint and hang up.
Reported-by: Ethan Reesor <firelizzard@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Improved-by: Jeff King <peff@peff.net>
---
v2 jammed this functionality into the "help" command, which was kind
of silly. Hopefully this version's better.
This is not urgent at all. If it looks like a good change, I'd be
happy to see it be a part of the 1.8.3 cycle.
Thoughts?
Jonathan
Documentation/git-shell.txt | 20 ++++++++++++++++++++
shell.c | 13 +++++++++++++
2 files changed, 33 insertions(+)
diff --git a/Documentation/git-shell.txt b/Documentation/git-shell.txt
index 544b21aa..c35051ba 100644
--- a/Documentation/git-shell.txt
+++ b/Documentation/git-shell.txt
@@ -59,6 +59,26 @@ users to list repositories they have access to, create, delete, or
rename repositories, or change repository descriptions and
permissions.
+If a `no-interactive-login` command exists, then it is run and the
+interactive shell is aborted.
+
+EXAMPLE
+-------
+
+To disable interactive logins, displaying a greeting instead:
++
+----------------
+$ chsh -s /usr/bin/git-shell
+$ mkdir $HOME/git-shell-commands
+$ cat >$HOME/git-shell-commands/no-interactive-login <<\EOF
+#!/bin/sh
+printf '%s\n' "Hi $USER! You've successfully authenticated, but I do not"
+printf '%s\n' "provide interactive shell access."
+exit 128
+EOF
+$ chmod +x $HOME/git-shell-commands/no-interactive-login
+----------------
+
SEE ALSO
--------
ssh(1),
diff --git a/shell.c b/shell.c
index 84b237fe..1429870a 100644
--- a/shell.c
+++ b/shell.c
@@ -6,6 +6,7 @@
#define COMMAND_DIR "git-shell-commands"
#define HELP_COMMAND COMMAND_DIR "/help"
+#define NOLOGIN_COMMAND COMMAND_DIR "/no-interactive-login"
static int do_generic_cmd(const char *me, char *arg)
{
@@ -65,6 +66,18 @@ static void run_shell(void)
{
int done = 0;
static const char *help_argv[] = { HELP_COMMAND, NULL };
+
+ if (!access(NOLOGIN_COMMAND, F_OK)) {
+ /* Interactive login disabled. */
+ const char *argv[] = { NOLOGIN_COMMAND, NULL };
+ int status;
+
+ status = run_command_v_opt(argv, 0);
+ if (status < 0)
+ exit(127);
+ exit(status);
+ }
+
/* Print help if enabled */
run_command_v_opt(help_argv, RUN_SILENT_EXEC_FAILURE);
--
1.8.2.rc3
^ permalink raw reply related
* [PATCH] git.c: Remove unnecessary new line
From: Michael Fallows @ 2013-03-09 22:13 UTC (permalink / raw)
To: git; +Cc: gitster
New line on checkout-index is inconsistent with the rest of the commands
Signed-off-by: Michael Fallows <michael@fallo.ws>
---
git.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/git.c b/git.c
index b10c18b..b4d7bbb 100644
--- a/git.c
+++ b/git.c
@@ -316,8 +316,7 @@ static void handle_internal_command(int argc, const
char **argv)
{ "check-ignore", cmd_check_ignore, RUN_SETUP | NEED_WORK_TREE },
{ "check-ref-format", cmd_check_ref_format },
{ "checkout", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },
- { "checkout-index", cmd_checkout_index,
- RUN_SETUP | NEED_WORK_TREE},
+ { "checkout-index", cmd_checkout_index, RUN_SETUP | NEED_WORK_TREE },
{ "cherry", cmd_cherry, RUN_SETUP },
{ "cherry-pick", cmd_cherry_pick, RUN_SETUP | NEED_WORK_TREE },
{ "clean", cmd_clean, RUN_SETUP | NEED_WORK_TREE },
--
1.7.9.5
^ permalink raw reply related
* [PATCH v2] git.c: Remove unnecessary new line
From: Michael Fallows @ 2013-03-09 22:16 UTC (permalink / raw)
To: git; +Cc: gitster
New line on checkout-index is inconsistent with the rest of the commands
Signed-off-by: Michael Fallows <michael@fallo.ws>
---
git.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/git.c b/git.c
index b10c18b..b4d7bbb 100644
--- a/git.c
+++ b/git.c
@@ -316,8 +316,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "check-ignore", cmd_check_ignore, RUN_SETUP | NEED_WORK_TREE },
{ "check-ref-format", cmd_check_ref_format },
{ "checkout", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },
- { "checkout-index", cmd_checkout_index,
- RUN_SETUP | NEED_WORK_TREE},
+ { "checkout-index", cmd_checkout_index, RUN_SETUP | NEED_WORK_TREE },
{ "cherry", cmd_cherry, RUN_SETUP },
{ "cherry-pick", cmd_cherry_pick, RUN_SETUP | NEED_WORK_TREE },
{ "clean", cmd_clean, RUN_SETUP | NEED_WORK_TREE },
--
1.7.9.5
^ permalink raw reply related
* [PATCH] git.c: Remove unnecessary new line
From: Michael Fallows @ 2013-03-09 21:48 UTC (permalink / raw)
To: git; +Cc: gitster
>From 8750dc231a2b973efa18aff4dbc5b2ace7c79c47 Mon Sep 17 00:00:00 2001
From: Michael Fallows <michael@fallo.ws>
Date: Sat, 9 Mar 2013 21:47:11 +0000
Subject: [PATCH] git.c: Remove unnecessary new line
New line on checkout-index is inconsistent with the rest of the commands
Signed-off-by: Michael Fallows <michael@fallo.ws>
---
git.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/git.c b/git.c
index b10c18b..b4d7bbb 100644
--- a/git.c
+++ b/git.c
@@ -316,8 +316,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "check-ignore", cmd_check_ignore, RUN_SETUP | NEED_WORK_TREE },
{ "check-ref-format", cmd_check_ref_format },
{ "checkout", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },
- { "checkout-index", cmd_checkout_index,
- RUN_SETUP | NEED_WORK_TREE},
+ { "checkout-index", cmd_checkout_index, RUN_SETUP | NEED_WORK_TREE },
{ "cherry", cmd_cherry, RUN_SETUP },
{ "cherry-pick", cmd_cherry_pick, RUN_SETUP | NEED_WORK_TREE },
{ "clean", cmd_clean, RUN_SETUP | NEED_WORK_TREE },
--
1.7.9.5
^ permalink raw reply related
* [PATCH 1/2] setup.c: Fix prefix_pathspec from looping pass end of string
From: Andrew Wong @ 2013-03-09 23:45 UTC (permalink / raw)
To: git; +Cc: Andrew Wong
In-Reply-To: <7vk3pik6aq.fsf@alter.siamese.dyndns.org>
The previous code was assuming length ends at either ")" or ",", and was
not handling the case where strcspn returns length due to end of string.
So specifying ":(top" as pathspec will cause the loop to go pass the end
of string.
Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
---
setup.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/setup.c b/setup.c
index 1dee47e..f4c4e73 100644
--- a/setup.c
+++ b/setup.c
@@ -207,9 +207,11 @@ static const char *prefix_pathspec(const char *prefix, int prefixlen, const char
*copyfrom && *copyfrom != ')';
copyfrom = nextat) {
size_t len = strcspn(copyfrom, ",)");
- if (copyfrom[len] == ')')
+ if (copyfrom[len] == '\0')
nextat = copyfrom + len;
- else
+ else if (copyfrom[len] == ')')
+ nextat = copyfrom + len;
+ else if (copyfrom[len] == ',')
nextat = copyfrom + len + 1;
if (!len)
continue;
--
1.7.12.4
^ permalink raw reply related
* [PATCH 2/2] setup.c: Check that the pathspec magic ends with ")"
From: Andrew Wong @ 2013-03-09 23:46 UTC (permalink / raw)
To: git; +Cc: Andrew Wong
In-Reply-To: <1362872760-25803-1-git-send-email-andrew.kw.w@gmail.com>
The previous code allowed the ")" to be optional.
Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
---
setup.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/setup.c b/setup.c
index f4c4e73..5ed2b93 100644
--- a/setup.c
+++ b/setup.c
@@ -225,8 +225,9 @@ static const char *prefix_pathspec(const char *prefix, int prefixlen, const char
die("Invalid pathspec magic '%.*s' in '%s'",
(int) len, copyfrom, elt);
}
- if (*copyfrom == ')')
- copyfrom++;
+ if (*copyfrom != ')')
+ die("Missing ')' at the end of pathspec magic in '%s'", elt);
+ copyfrom++;
} else {
/* shorthand */
for (copyfrom = elt + 1;
--
1.7.12.4
^ permalink raw reply related
* Re: [PATCH v2] git.c: Remove unnecessary new line
From: Jonathan Nieder @ 2013-03-10 0:00 UTC (permalink / raw)
To: Michael Fallows; +Cc: git, gitster
In-Reply-To: <513BB4A2.8000407@fallo.ws>
Hi,
Michael Fallows wrote:
> --- a/git.c
> +++ b/git.c
> @@ -316,8 +316,7 @@ static void handle_internal_command(int argc, const char **argv)
> { "check-ignore", cmd_check_ignore, RUN_SETUP | NEED_WORK_TREE },
> { "check-ref-format", cmd_check_ref_format },
> { "checkout", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },
> - { "checkout-index", cmd_checkout_index,
> - RUN_SETUP | NEED_WORK_TREE},
> + { "checkout-index", cmd_checkout_index, RUN_SETUP | NEED_WORK_TREE },
This wrapped line was introduced a while ago (4465f410, checkout-index
needs a working tree, 2007-08-04). It was the first line to wrap, but
it was also the longest line at the time.
Now the longest line is
{ "merge-recursive-theirs", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },
(94 columns), so you are right that consistency would suggest dropping
the line wrapping for checkout-index.
But I find it hard to convince myself that alone is worth the churn.
In what context did you notice this? Is the intent to help scripts to
parse the commands[] list, or to manipulate it while preserving
formatting to avoid distractions? Did you notice the broken line
while reading through and get distracted, or did some syntax
highlighting tool notice the oddity, or something else?
Hope that helps,
Jonathan
^ permalink raw reply
* [PATCH v2 2/3] mergetools/p4merge: create a base if none available
From: Kevin Bracey @ 2013-03-09 19:20 UTC (permalink / raw)
To: git; +Cc: Kevin Bracey, David Aguilar, Ciaran Jessup, Scott Chacon,
Alex Riesen
In-Reply-To: <1362856860-15205-1-git-send-email-kevin@bracey.fi>
Originally, with no base, Git gave P4Merge $LOCAL as a dummy base:
p4merge "$LOCAL" "$LOCAL" "$REMOTE" "$MERGED"
Commit 0a0ec7bd changed this to:
p4merge "empty file" "$LOCAL" "$REMOTE" "$MERGED"
to avoid the problem of being unable to save in some circumstances with
similar inputs.
Unfortunately this approach produces much worse results on differing
inputs. P4Merge really regards the blank file as the base, and once you
have just a couple of differences between the two branches you end up
with one a massive full-file conflict. The 3-way diff is not readable,
and you have to invoke "difftool MERGE_HEAD HEAD" manually to get a
useful view.
The original approach appears to have invoked special 2-way merge
behaviour in P4Merge that occurs only if the base filename is "" or
equal to the left input. You get a good visual comparison, and it does
not auto-resolve differences. (Normally if one branch matched the base,
it would autoresolve to the other branch).
But there appears to be no way of getting this 2-way behaviour and being
able to reliably save. Having base==left appears to be triggering other
assumptions. There are tricks the user can use to force the save icon
on, but it's not intuitive.
So we now follow a suggestion given in the original patch's discussion:
generate a virtual base, consisting of the lines common to the two
branches. This is the same as the technique used in resolve and octopus
merges, so we relocate that code to a shared function.
Note that if there are no differences at the same location, this
technique can lead to automatic resolution without conflict, combining
everything from the 2 files. As with the other merges using this
technique, we assume the user will inspect the result before saving.
Signed-off-by: Kevin Bracey <kevin@bracey.fi>
---
git-merge-one-file.sh | 18 +++++-------------
git-sh-setup.sh | 13 +++++++++++++
mergetools/p4merge | 6 +++++-
3 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh
index f612cb8..1236fbf 100755
--- a/git-merge-one-file.sh
+++ b/git-merge-one-file.sh
@@ -104,30 +104,22 @@ case "${1:-.}${2:-.}${3:-.}" in
;;
esac
- src2=`git-unpack-file $3`
+ src1=$(git-unpack-file $2)
+ src2=$(git-unpack-file $3)
case "$1" in
'')
echo "Added $4 in both, but differently."
- # This extracts OUR file in $orig, and uses git apply to
- # remove lines that are unique to ours.
- orig=`git-unpack-file $2`
- sz0=`wc -c <"$orig"`
- @@DIFF@@ -u -La/$orig -Lb/$orig $orig $src2 | git apply --no-add
- sz1=`wc -c <"$orig"`
-
- # If we do not have enough common material, it is not
- # worth trying two-file merge using common subsections.
- expr $sz0 \< $sz1 \* 2 >/dev/null || : >$orig
+ orig=$(git-unpack-file $2)
+ create_virtual_base "$orig" "$src1" "$src2"
;;
*)
echo "Auto-merging $4"
- orig=`git-unpack-file $1`
+ orig=$(git-unpack-file $1)
;;
esac
# Be careful for funny filename such as "-L" in "$4", which
# would confuse "merge" greatly.
- src1=`git-unpack-file $2`
git merge-file "$src1" "$orig" "$src2"
ret=$?
msg=
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 795edd2..aa9a732 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -249,6 +249,19 @@ clear_local_git_env() {
unset $(git rev-parse --local-env-vars)
}
+# Generate a virtual base file for a two-file merge. On entry the
+# base file $1 should be a copy of $2. Uses git apply to remove
+# lines from $1 that are not in $3, leaving only common lines.
+create_virtual_base() {
+ sz0=$(wc -c <"$1")
+ @@DIFF@@ -u -La/"$1" -Lb/"$1" "$2" "$3" | git apply --no-add
+ sz1=$(wc -c <"$1")
+
+ # If we do not have enough common material, it is not
+ # worth trying two-file merge using common subsections.
+ expr $sz0 \< $sz1 \* 2 >/dev/null || : >"$1"
+}
+
# Platform specific tweaks to work around some commands
case $(uname -s) in
diff --git a/mergetools/p4merge b/mergetools/p4merge
index 46b3a5a..16ae0cc 100644
--- a/mergetools/p4merge
+++ b/mergetools/p4merge
@@ -21,7 +21,11 @@ diff_cmd () {
merge_cmd () {
touch "$BACKUP"
- $base_present || >"$BASE"
+ if ! $base_present
+ then
+ cp -- "$LOCAL" "$BASE"
+ create_virtual_base "$BASE" "$LOCAL" "$REMOTE"
+ fi
"$merge_tool_path" "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
check_unchanged
}
--
1.8.2.rc3.7.g77aeedb
^ permalink raw reply related
* Re: [PATCH v2] git.c: Remove unnecessary new line
From: Michael Fallows @ 2013-03-10 0:10 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: git, gitster
In-Reply-To: <20130310000023.GI3908@elie.Belkin>
On 10/03/13 00:00, Jonathan Nieder wrote:
> Hi,
>
> Michael Fallows wrote:
>
>> --- a/git.c
>> +++ b/git.c
>> @@ -316,8 +316,7 @@ static void handle_internal_command(int argc, const char **argv)
>> { "check-ignore", cmd_check_ignore, RUN_SETUP | NEED_WORK_TREE },
>> { "check-ref-format", cmd_check_ref_format },
>> { "checkout", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },
>> - { "checkout-index", cmd_checkout_index,
>> - RUN_SETUP | NEED_WORK_TREE},
>> + { "checkout-index", cmd_checkout_index, RUN_SETUP | NEED_WORK_TREE },
>
> This wrapped line was introduced a while ago (4465f410, checkout-index
> needs a working tree, 2007-08-04). It was the first line to wrap, but
> it was also the longest line at the time.
>
> Now the longest line is
>
> { "merge-recursive-theirs", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },
>
> (94 columns), so you are right that consistency would suggest dropping
> the line wrapping for checkout-index.
>
> But I find it hard to convince myself that alone is worth the churn.
> In what context did you notice this? Is the intent to help scripts to
> parse the commands[] list, or to manipulate it while preserving
> formatting to avoid distractions? Did you notice the broken line
> while reading through and get distracted, or did some syntax
> highlighting tool notice the oddity, or something else?
>
> Hope that helps,
> Jonathan
>
I do agree with you it does seem like a silly small change in the
context of the project! I noticed it when reading through the source
code (I felt working with git is nice but why not see what makes it
tick). I will admit also, have never contributed to git and my C is
nowhere near the standard worthy of any real contribution so this was
also a step for me to see exactly how the world of patch contribution
works too :D.
Thanks,
Michael
^ permalink raw reply
* Re: [PATCH v2 2/3] mergetools/p4merge: create a base if none available
From: Junio C Hamano @ 2013-03-10 4:55 UTC (permalink / raw)
To: Kevin Bracey; +Cc: git, David Aguilar, Ciaran Jessup, Scott Chacon, Alex Riesen
In-Reply-To: <1362856860-15205-3-git-send-email-kevin@bracey.fi>
Kevin Bracey <kevin@bracey.fi> writes:
> diff --git a/git-sh-setup.sh b/git-sh-setup.sh
> index 795edd2..aa9a732 100644
> --- a/git-sh-setup.sh
> +++ b/git-sh-setup.sh
> @@ -249,6 +249,19 @@ clear_local_git_env() {
> unset $(git rev-parse --local-env-vars)
> }
>
> +# Generate a virtual base file for a two-file merge. On entry the
> +# base file $1 should be a copy of $2. Uses git apply to remove
> +# lines from $1 that are not in $3, leaving only common lines.
> +create_virtual_base() {
> + sz0=$(wc -c <"$1")
> + @@DIFF@@ -u -La/"$1" -Lb/"$1" "$2" "$3" | git apply --no-add
> + sz1=$(wc -c <"$1")
> +
> + # If we do not have enough common material, it is not
> + # worth trying two-file merge using common subsections.
> + expr $sz0 \< $sz1 \* 2 >/dev/null || : >"$1"
> +}
> +
This rewrite is wrong. It should be
> + sz0=$(wc -c <"$1")
> + @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$3" | git apply --no-add
> + sz1=$(wc -c <"$1")
for it to make sense. "diff $1 $3" is a change to go from $1 to $3;
with "-La/$1 -Lb/$1", we declare that the change is to be applied to
$1, and use --no-add to only use the removal from the diff when we
edit $1 using this mechanism.
The end effect is to in-place edit "$1" to remove what is not common
with "$3", and sz0/sz1 computation is done on "$1" for this reason.
Does it (i.e. "$1") shrink sufficiently when we remove the material
that is not common in it (i.e. "$1") and "$3"?
This part is a two-file operation between $1 and $3; there is
nothing you would want to pass $2 to influence what the above three
lines do.
It may happen that the caller has two copies of the same thing,
$orig and $src1, and uses one for $1 and the other for $2, so you
won't observe the damage from the incorrect rewriting of the above
logic, but it invites the next caller to incorrectly feed something
totally unrelated to $1 and $2.
Please fix it to a function that takes two temporary paths, not
three.
^ permalink raw reply
* Re: [PATCH 2/2] shell: new no-interactive-login command to print a custom message
From: Junio C Hamano @ 2013-03-10 5:04 UTC (permalink / raw)
To: Jonathan Nieder
Cc: Ethan Reesor, git, Jeff King, Sitaram Chamarty,
Ramkumar Ramachandra, Greg Brockman
In-Reply-To: <20130309220011.GC24777@elie.Belkin>
Jonathan Nieder <jrnieder@gmail.com> writes:
> If I disable git-shell's interactive mode by removing the
> ~/git-shell-commands directory, attempts to use 'ssh' in produce a
> message intended for the administrator:
Sorry, but -ECANTPARSE. s/in produce/produces/ perhaps? Or if you
meant "ssh in" as a verb, then "attempts to ssh in to the service
produces a message". I dunno.
Patch text looks good, including the documentation.
Thanks.
^ permalink raw reply
* Re: [PATCH 2/2] shell: new no-interactive-login command to print a custom message
From: Jonathan Nieder @ 2013-03-10 5:21 UTC (permalink / raw)
To: Junio C Hamano
Cc: Ethan Reesor, git, Jeff King, Sitaram Chamarty,
Ramkumar Ramachandra, Greg Brockman
In-Reply-To: <7v38w3etfw.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
>> If I disable git-shell's interactive mode by removing the
>> ~/git-shell-commands directory, attempts to use 'ssh' in produce a
>> message intended for the administrator:
>
> Sorry, but -ECANTPARSE. s/in produce/produces/ perhaps? Or if you
> meant "ssh in" as a verb, then "attempts to ssh in to the service
> produces a message". I dunno.
Sloppy of me. Yes, it should say something like this:
If I disable git-shell's interactive mode by removing the
~/git-shell-commands directory, attempts to ssh in to the service
produce a message intended for the administrator:
^ permalink raw reply
* [PATCH v2 0/6] Exclude optimizations
From: Nguyễn Thái Ngọc Duy @ 2013-03-10 6:14 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <1362802190-7331-1-git-send-email-pclouds@gmail.com>
v2 includes strncmp_equal and directory level pattern filter. user
time of "git ls-files --exclude-standard -o" on webkit.git below.
Looking pretty good.
before after
user 0m0.607s 0m0.365s
user 0m0.613s 0m0.366s
user 0m0.613s 0m0.374s
user 0m0.621s 0m0.374s
user 0m0.621s 0m0.377s
user 0m0.622s 0m0.381s
user 0m0.624s 0m0.381s
user 0m0.626s 0m0.383s
user 0m0.628s 0m0.384s
user 0m0.638s 0m0.384s
Nguyễn Thái Ngọc Duy (6):
match_pathname: avoid calling strncmp if baselen is 0
dir.c: inline convenient *_icase helpers
match_basename: use strncmp instead of strcmp
match_{base,path}name: replace strncmp_icase with strnequal_icase
dir.c: pass pathname length to last_exclude_matching
exclude: filter patterns by directory level
attr.c | 5 ++-
dir.c | 114 ++++++++++++++++++++++++++++++++++++++++++++---------------------
dir.h | 27 +++++++++++++---
3 files changed, 104 insertions(+), 42 deletions(-)
--
1.8.1.2.536.gf441e6d
^ permalink raw reply
* [PATCH v2 1/6] match_pathname: avoid calling strncmp if baselen is 0
From: Nguyễn Thái Ngọc Duy @ 2013-03-10 6:14 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <1362896070-17456-1-git-send-email-pclouds@gmail.com>
This reduces "git status" user time by a little bit. This is the
sorted results of 10 consecutive runs of "git ls-files
--exclude-standard -o" on webkit.git, compiled with gcc -O2:
before after
user 0m0.607s 0m0.554s
user 0m0.613s 0m0.564s
user 0m0.613s 0m0.571s
user 0m0.621s 0m0.576s
user 0m0.621s 0m0.578s
user 0m0.622s 0m0.579s
user 0m0.624s 0m0.583s
user 0m0.626s 0m0.584s
user 0m0.628s 0m0.586s
user 0m0.638s 0m0.592s
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
dir.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dir.c b/dir.c
index 57394e4..b3cd66c 100644
--- a/dir.c
+++ b/dir.c
@@ -662,8 +662,8 @@ int match_pathname(const char *pathname, int pathlen,
* may not end with a trailing slash though.
*/
if (pathlen < baselen + 1 ||
- (baselen && pathname[baselen] != '/') ||
- strncmp_icase(pathname, base, baselen))
+ (baselen && (pathname[baselen] != '/' ||
+ strncmp_icase(pathname, base, baselen))))
return 0;
namelen = baselen ? pathlen - baselen - 1 : pathlen;
--
1.8.1.2.536.gf441e6d
^ permalink raw reply related
* [PATCH v2 2/6] dir.c: inline convenient *_icase helpers
From: Nguyễn Thái Ngọc Duy @ 2013-03-10 6:14 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <1362896070-17456-1-git-send-email-pclouds@gmail.com>
Like the previous patch, this cuts down the number of str*cmp calls in
read_directory (which does _a lot_). Again sorted results on webkit.git:
before after
user 0m0.554s 0m0.548s
user 0m0.564s 0m0.549s
user 0m0.571s 0m0.554s
user 0m0.576s 0m0.557s
user 0m0.578s 0m0.558s
user 0m0.579s 0m0.559s
user 0m0.583s 0m0.562s
user 0m0.584s 0m0.564s
user 0m0.586s 0m0.566s
user 0m0.592s 0m0.569s
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
dir.c | 16 ----------------
dir.h | 18 +++++++++++++++---
2 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/dir.c b/dir.c
index b3cd66c..9960a37 100644
--- a/dir.c
+++ b/dir.c
@@ -21,22 +21,6 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, in
int check_only, const struct path_simplify *simplify);
static int get_dtype(struct dirent *de, const char *path, int len);
-/* helper string functions with support for the ignore_case flag */
-int strcmp_icase(const char *a, const char *b)
-{
- return ignore_case ? strcasecmp(a, b) : strcmp(a, b);
-}
-
-int strncmp_icase(const char *a, const char *b, size_t count)
-{
- return ignore_case ? strncasecmp(a, b, count) : strncmp(a, b, count);
-}
-
-int fnmatch_icase(const char *pattern, const char *string, int flags)
-{
- return fnmatch(pattern, string, flags | (ignore_case ? FNM_CASEFOLD : 0));
-}
-
inline int git_fnmatch(const char *pattern, const char *string,
int flags, int prefix)
{
diff --git a/dir.h b/dir.h
index c3eb4b5..560ade4 100644
--- a/dir.h
+++ b/dir.h
@@ -200,9 +200,21 @@ extern int remove_dir_recursively(struct strbuf *path, int flag);
/* tries to remove the path with empty directories along it, ignores ENOENT */
extern int remove_path(const char *path);
-extern int strcmp_icase(const char *a, const char *b);
-extern int strncmp_icase(const char *a, const char *b, size_t count);
-extern int fnmatch_icase(const char *pattern, const char *string, int flags);
+/* helper string functions with support for the ignore_case flag */
+static inline int strcmp_icase(const char *a, const char *b)
+{
+ return ignore_case ? strcasecmp(a, b) : strcmp(a, b);
+}
+
+static inline int strncmp_icase(const char *a, const char *b, size_t count)
+{
+ return ignore_case ? strncasecmp(a, b, count) : strncmp(a, b, count);
+}
+
+static inline int fnmatch_icase(const char *pattern, const char *string, int flags)
+{
+ return fnmatch(pattern, string, flags | (ignore_case ? FNM_CASEFOLD : 0));
+}
/*
* The prefix part of pattern must not contains wildcards.
--
1.8.1.2.536.gf441e6d
^ permalink raw reply related
* [PATCH v2 3/6] match_basename: use strncmp instead of strcmp
From: Nguyễn Thái Ngọc Duy @ 2013-03-10 6:14 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <1362896070-17456-1-git-send-email-pclouds@gmail.com>
strncmp is provided length information which could be taken advantage
by the underlying implementation. Even better, we need to check if the
lengths are equal before calling strncmp, eliminating a bit of strncmp
calls.
before after
user 0m0.548s 0m0.516s
user 0m0.549s 0m0.523s
user 0m0.554s 0m0.532s
user 0m0.557s 0m0.533s
user 0m0.558s 0m0.535s
user 0m0.559s 0m0.542s
user 0m0.562s 0m0.546s
user 0m0.564s 0m0.551s
user 0m0.566s 0m0.556s
user 0m0.569s 0m0.561s
While at there, fix an inconsistency about pattern/patternlen in how
attr handles EXC_FLAG_MUSTBEDIR. When parse_exclude_pattern detects
this flag, it sets patternlen _not_ to include the trailing slash and
expects the caller to trim it. add_exclude does, parse_attr_line does
not.
In attr.c, the pattern could be "foo/" while patternlen tells us it
only has 3 chars. Some functions do not care about patternlen and will
see the pattern as "foo/" while others may see it as "foo". This patch
makes patternlen 4 in this case. (Although for a piece of mind,
perhaps we should trim it to "foo" like exclude, and never pass a
pathname like "abc/" to match_{base,path}name)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
attr.c | 2 ++
dir.c | 8 +++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/attr.c b/attr.c
index e2f9377..1818ba5 100644
--- a/attr.c
+++ b/attr.c
@@ -255,6 +255,8 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
&res->u.pat.patternlen,
&res->u.pat.flags,
&res->u.pat.nowildcardlen);
+ if (res->u.pat.flags & EXC_FLAG_MUSTBEDIR)
+ res->u.pat.patternlen++;
if (res->u.pat.flags & EXC_FLAG_NEGATIVE) {
warning(_("Negative patterns are ignored in git attributes\n"
"Use '\\!' for literal leading exclamation."));
diff --git a/dir.c b/dir.c
index 9960a37..46b24db 100644
--- a/dir.c
+++ b/dir.c
@@ -610,12 +610,14 @@ int match_basename(const char *basename, int basenamelen,
int flags)
{
if (prefix == patternlen) {
- if (!strcmp_icase(pattern, basename))
+ if (patternlen == basenamelen &&
+ !strncmp_icase(pattern, basename, patternlen))
return 1;
} else if (flags & EXC_FLAG_ENDSWITH) {
if (patternlen - 1 <= basenamelen &&
- !strcmp_icase(pattern + 1,
- basename + basenamelen - patternlen + 1))
+ !strncmp_icase(pattern + 1,
+ basename + basenamelen - patternlen + 1,
+ patternlen - 1))
return 1;
} else {
if (fnmatch_icase(pattern, basename, 0) == 0)
--
1.8.1.2.536.gf441e6d
^ permalink raw reply related
* [PATCH v2 4/6] match_{base,path}name: replace strncmp_icase with strnequal_icase
From: Nguyễn Thái Ngọc Duy @ 2013-03-10 6:14 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <1362896070-17456-1-git-send-email-pclouds@gmail.com>
We could also optimize for ignore_case, assuming that non-ascii
characters are not used in most repositories. We could check that all
patterns and pathnames are ascii-only, then use git's toupper()
before after
user 0m0.516s 0m0.433s
user 0m0.523s 0m0.437s
user 0m0.532s 0m0.443s
user 0m0.533s 0m0.448s
user 0m0.535s 0m0.449s
user 0m0.542s 0m0.452s
user 0m0.546s 0m0.453s
user 0m0.551s 0m0.458s
user 0m0.556s 0m0.459s
user 0m0.561s 0m0.462s
Suggested-by: Fredrik Gustafsson <iveqy@iveqy.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
dir.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/dir.c b/dir.c
index 46b24db..7b6a625 100644
--- a/dir.c
+++ b/dir.c
@@ -21,6 +21,25 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, in
int check_only, const struct path_simplify *simplify);
static int get_dtype(struct dirent *de, const char *path, int len);
+/*
+ * This function is more like memequal_icase than strnequal_icase as
+ * it does not check for NUL. The caller is not supposed to pass a
+ * length longer than both input strings
+ */
+static inline strnequal_icase(const char *a, const char *b, int n)
+{
+ if (!ignore_case) {
+ while (n && *a == *b) {
+ a++;
+ b++;
+ n--;
+ }
+ return n == 0;
+ }
+
+ return !strncmp_icase(a, b, n);
+}
+
inline int git_fnmatch(const char *pattern, const char *string,
int flags, int prefix)
{
@@ -611,11 +630,11 @@ int match_basename(const char *basename, int basenamelen,
{
if (prefix == patternlen) {
if (patternlen == basenamelen &&
- !strncmp_icase(pattern, basename, patternlen))
+ strnequal_icase(pattern, basename, patternlen))
return 1;
} else if (flags & EXC_FLAG_ENDSWITH) {
if (patternlen - 1 <= basenamelen &&
- !strncmp_icase(pattern + 1,
+ strnequal_icase(pattern + 1,
basename + basenamelen - patternlen + 1,
patternlen - 1))
return 1;
@@ -649,7 +668,7 @@ int match_pathname(const char *pathname, int pathlen,
*/
if (pathlen < baselen + 1 ||
(baselen && (pathname[baselen] != '/' ||
- strncmp_icase(pathname, base, baselen))))
+ !strnequal_icase(pathname, base, baselen))))
return 0;
namelen = baselen ? pathlen - baselen - 1 : pathlen;
@@ -663,7 +682,7 @@ int match_pathname(const char *pathname, int pathlen,
if (prefix > namelen)
return 0;
- if (strncmp_icase(pattern, name, prefix))
+ if (!strnequal_icase(pattern, name, prefix))
return 0;
pattern += prefix;
name += prefix;
--
1.8.1.2.536.gf441e6d
^ permalink raw reply related
* [PATCH v2 5/6] dir.c: pass pathname length to last_exclude_matching
From: Nguyễn Thái Ngọc Duy @ 2013-03-10 6:14 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <1362896070-17456-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
dir.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/dir.c b/dir.c
index 7b6a625..880b5e6 100644
--- a/dir.c
+++ b/dir.c
@@ -764,9 +764,9 @@ int is_excluded_from_list(const char *pathname,
*/
static struct exclude *last_exclude_matching(struct dir_struct *dir,
const char *pathname,
+ int pathlen,
int *dtype_p)
{
- int pathlen = strlen(pathname);
int i, j;
struct exclude_list_group *group;
struct exclude *exclude;
@@ -793,10 +793,12 @@ static struct exclude *last_exclude_matching(struct dir_struct *dir,
* scans all exclude lists to determine whether pathname is excluded.
* Returns 1 if true, otherwise 0.
*/
-static int is_excluded(struct dir_struct *dir, const char *pathname, int *dtype_p)
+static int is_excluded(struct dir_struct *dir,
+ const char *pathname, int pathlen,
+ int *dtype_p)
{
struct exclude *exclude =
- last_exclude_matching(dir, pathname, dtype_p);
+ last_exclude_matching(dir, pathname, pathlen, dtype_p);
if (exclude)
return exclude->flags & EXC_FLAG_NEGATIVE ? 0 : 1;
return 0;
@@ -859,7 +861,8 @@ struct exclude *last_exclude_matching_path(struct path_exclude_check *check,
if (ch == '/') {
int dt = DT_DIR;
exclude = last_exclude_matching(check->dir,
- path->buf, &dt);
+ path->buf, path->len,
+ &dt);
if (exclude) {
check->exclude = exclude;
return exclude;
@@ -871,7 +874,7 @@ struct exclude *last_exclude_matching_path(struct path_exclude_check *check,
/* An entry in the index; cannot be a directory with subentries */
strbuf_setlen(path, 0);
- return last_exclude_matching(check->dir, name, dtype);
+ return last_exclude_matching(check->dir, name, namelen, dtype);
}
/*
@@ -1249,7 +1252,7 @@ static enum path_treatment treat_one_path(struct dir_struct *dir,
const struct path_simplify *simplify,
int dtype, struct dirent *de)
{
- int exclude = is_excluded(dir, path->buf, &dtype);
+ int exclude = is_excluded(dir, path->buf, path->len, &dtype);
if (exclude && (dir->flags & DIR_COLLECT_IGNORED)
&& exclude_matches_pathspec(path->buf, path->len, simplify))
dir_add_ignored(dir, path->buf, path->len);
--
1.8.1.2.536.gf441e6d
^ permalink raw reply related
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