* [PATCH] Fail properly when cloning from invalid HTTP URL
From: pasky @ 2008-08-07 0:06 UTC (permalink / raw)
To: gitster; +Cc: git, barkalow, Petr Baudis
From: Petr Baudis <pasky@suse.cz>
Currently, when cloning from invalid HTTP URL, git clone will possibly
return curl error, then a confusing message about remote HEAD and then
return success and leave an empty repository behind, confusing either
the end-user or the automated service calling it (think repo.or.cz).
This patch changes the error() calls in get_refs_via_curl() to die()s,
akin to the other get_refs_*() functions.
Cc: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
transport.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/transport.c b/transport.c
index 6eb65b8..b88b89b 100644
--- a/transport.c
+++ b/transport.c
@@ -464,16 +464,15 @@ static struct ref *get_refs_via_curl(struct transport *transport)
if (results.curl_result != CURLE_OK) {
strbuf_release(&buffer);
if (missing_target(&results)) {
+ die("%s not found: did you run git update-server-info on the server?", refs_url);
return NULL;
} else {
- error("%s", curl_errorstr);
- return NULL;
+ die("%s download error - %s", refs_url, curl_errorstr);
}
}
} else {
strbuf_release(&buffer);
- error("Unable to start request");
- return NULL;
+ die("Unable to start HTTP request");
}
data = buffer.buf;
--
1.5.6.3.392.g292f1
^ permalink raw reply related
* Re: Documentation: user-manual: "git commit -a" doesn't motivate .gitignore
From: Jonathan Nieder @ 2008-08-06 22:54 UTC (permalink / raw)
To: Miklos Vajna; +Cc: git
In-Reply-To: <Pine.GSO.4.62.0808061725450.21683@harper.uchicago.edu>
On Wed, 6 Aug 2008, Jonathan Nieder wrote:
> Subject: git commit --addremove: add and update all files
>
> This makes git commit -A a shortcut for git add -A && git commit. It
> saves keystrokes, but more importantly it seems to be conceptually the
> right thing thing for users who have perfect .gitignore files and want
> to ignore the index.
> ---
> builtin-commit.c | 18 +++++++++++++++---
> 1 files changed, 15 insertions(+), 3 deletions(-)
I was too hasty - the patch is insane in a number of ways. But hopefully
the intent is clear :)
Jonathan
^ permalink raw reply
* Re: Documentation: user-manual: "git commit -a" doesn't motivate .gitignore
From: Jonathan Nieder @ 2008-08-06 22:29 UTC (permalink / raw)
To: Miklos Vajna; +Cc: git
In-Reply-To: <20080806214747.GY32057@genesis.frugalware.org>
Miklos Vajna wrote:
> On Wed, Aug 06, 2008 at 04:22:00PM -0500, Jonathan Nieder <jrnieder@uchicago.edu> wrote:
> > happy to know. Maybe the sort of person that wants to track the
> > exact contents of the working tree would prefer
> > "git commit -a -i ." over "git commit -a"?
>
> If you want so, then probably git add -A && git commit is easier.
Hmm. I don't want it myself, but it seemed like the spirit behind
the lines I mentioned in the user manual. Maybe something like this
(untested) would serve such people even better.
If anyone actually wants this, I'd be glad to make tests and document
it. Thanks for the pointer.
-- snipsnip --
Subject: git commit --addremove: add and update all files
This makes git commit -A a shortcut for git add -A && git commit. It
saves keystrokes, but more importantly it seems to be conceptually the
right thing thing for users who have perfect .gitignore files and want
to ignore the index.
---
builtin-commit.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index b783e6e..e3f645e 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -50,7 +50,8 @@ static char *logfile, *force_author;
static const char *template_file;
static char *edit_message, *use_message;
static char *author_name, *author_email, *author_date;
-static int all, edit_flag, also, interactive, only, amend, signoff;
+static int all, addremove, edit_flag, also, interactive, only;
+static int amend, signoff;
static int quiet, verbose, no_verify, allow_empty;
static char *untracked_files_arg;
/*
@@ -99,6 +100,7 @@ static struct option builtin_commit_options[] = {
OPT_GROUP("Commit contents options"),
OPT_BOOLEAN('a', "all", &all, "commit all changed files"),
+ OPT_BOOLEAN('A', "addremove", &addremove, "commit all changed files, including untracked"),
OPT_BOOLEAN('i', "include", &also, "add specified files to index for commit"),
OPT_BOOLEAN(0, "interactive", &interactive, "interactively add files"),
OPT_BOOLEAN('o', "only", &only, "commit only specified files"),
@@ -788,8 +790,8 @@ static int parse_and_validate_options(int argc, const char *argv[],
free(enc);
}
- if (!!also + !!only + !!all + !!interactive > 1)
- die("Only one of --include/--only/--all/--interactive can be used.");
+ if (!!also + !!only + !!all + !!addremove + !!interactive > 1)
+ die("Only one of --include/--only/--all/--addremove/--interactive can be used.");
if (argc == 0 && (also || (only && !amend)))
die("No paths with --include/--only does not make sense.");
if (argc == 0 && only && amend)
@@ -823,6 +825,16 @@ static int parse_and_validate_options(int argc, const char *argv[],
else if (interactive && argc > 0)
die("Paths with --interactive does not make sense.");
+ if (addremove) {
+ all = 1;
+ also = 1;
+ }
+ if (addremove && !argc) {
+ static const char *here[2] = {".", NULL };
+ argc = 1;
+ *argv = here;
+ }
+
return argc;
}
--
1.6.0.rc1.228.ge730
^ permalink raw reply related
* git blame and cherry-picking
From: Steven Grimm @ 2008-08-06 22:18 UTC (permalink / raw)
To: Git Users List
What, if any, is the approved way to get git blame to follow cherry-
picked changes? Right now blame is good about showing you the actual
responsible revision and author in the case of merges, but if you
cherry-pick a change with "-n" (to test before committing), the
modifications are attributed to the person who did the cherry-pick
instead of the cherry-picked revision's author. Even without the "-n"
option, the changes are attributed to the cherry-pick *revision*
instead of the original one.
My horrible hack workaround for now is to temporarily put a grafts
entry in place to make git think the cherry-pick revisions I'm
interested in are actually merges. That requires me to know that a
given revision is a cherry-pick and I have to be careful to remove my
fake graft afterwards. What's more, it can result in some strange and
seemingly nonsensical "merge" topologies if, e.g., a newer change is
cherry-picked before an older one.
Surely there must be a better way...?
-Steve
^ permalink raw reply
* Re: [PATCH] perl/Makefile: handle paths with spaces in the NO_PERL_MAKEMAKER section
From: Brandon Casey @ 2008-08-06 22:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <7vy739nbmp.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
> Brandon Casey <casey@nrlssc.navy.mil> writes:
>
>> There are problems here with spaces, single quotes, and double quotes.
>> I'll follow up in another email.
>
> I guess we've opened up a large can of worms. Let's have the minimum fix
> that says "We do support whitespace in these paths but no other funnies"
> and leave the more intrusive one for post 1.6.0, for now.
I think those two patches I just sent are enough.
You can apply the double-quote escaping patch I sent earlier if you want
(the one that escapes double quotes in the macros compiled in c programs).
But we'd have a problem installing the perl scripts using MakeMaker, and
we'd have a problem _running_ the perl scripts since the single double
quote causes a syntax error in the perl script. Let's wait till someone
wants to have " in their path shows up (and let them figure out how to
fix it).
-brandon
^ permalink raw reply
* [PATCH] perl/Makefile: make NO_PERL_MAKEMAKER section more robust
From: Brandon Casey @ 2008-08-06 21:48 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <7v7iaurwe4.fsf@gitster.siamese.dyndns.org>
This adds the double single quote escaping that is performed for
GIT_BUILD_OPTIONS to the paths in the install section to protect
against paths with spaces, quotes or other funny characters in them.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
perl/Makefile | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/perl/Makefile b/perl/Makefile
index b8547db..4c6b2a2 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -29,13 +29,14 @@ $(makfile): ../GIT-CFLAGS Makefile
'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
echo ' cp private-Error.pm blib/lib/Error.pm' >> $@
echo install: >> $@
- echo ' mkdir -p $(instdir_SQ)' >> $@
- echo ' $(RM) $(instdir_SQ)/Git.pm; cp Git.pm $(instdir_SQ)' >> $@
- echo ' $(RM) $(instdir_SQ)/Error.pm' >> $@
+ echo " mkdir -p "\''$(subst ','\'',$(instdir_SQ))'\' >> $@
+ echo " $(RM) "\''$(subst ','\'',$(instdir_SQ))/Git.pm'\' >> $@
+ echo " cp Git.pm "\''$(subst ','\'',$(instdir_SQ))'\' >> $@
+ echo " $(RM) "\''$(subst ','\'',$(instdir_SQ))/Error.pm'\' >> $@
'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
- echo ' cp private-Error.pm $(instdir_SQ)/Error.pm' >> $@
+ echo " cp private-Error.pm "\''$(subst ','\'',$(instdir_SQ))/Error.pm'\' >> $@
echo instlibdir: >> $@
- echo ' echo $(instdir_SQ)' >> $@
+ echo " echo "\''$(subst ','\'',$(instdir_SQ))'\' >> $@
else
$(makfile): Makefile.PL ../GIT-CFLAGS
$(PERL_PATH) $< PREFIX='$(prefix_SQ)'
--
1.6.0.rc1.89.g2e7ef.dirty
^ permalink raw reply related
* Re: Documentation: user-manual: "git commit -a" doesn't motivate .gitignore
From: Miklos Vajna @ 2008-08-06 21:47 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: git
In-Reply-To: <Pine.GSO.4.62.0808061603340.18817@harper.uchicago.edu>
[-- Attachment #1: Type: text/plain, Size: 321 bytes --]
On Wed, Aug 06, 2008 at 04:22:00PM -0500, Jonathan Nieder <jrnieder@uchicago.edu> wrote:
> happy to know. Maybe the sort of person that wants to track the
> exact contents of the working tree would prefer
> "git commit -a -i ." over "git commit -a"?
If you want so, then probably git add -A && git commit is easier.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* [PATCH] perl/Makefile: handle paths with spaces by adding additional quoting
From: Brandon Casey @ 2008-08-06 21:38 UTC (permalink / raw)
To: Junio C Hamano, Git Mailing List
In-Reply-To: <7vy739nbmp.fsf@gitster.siamese.dyndns.org>
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
Junio C Hamano wrote:
> Brandon Casey <casey@nrlssc.navy.mil> writes:
>
>> There are problems here with spaces, single quotes, and double quotes.
>> I'll follow up in another email.
>
> I guess we've opened up a large can of worms. Let's have the minimum fix
> that says "We do support whitespace in these paths but no other funnies"
> and leave the more intrusive one for post 1.6.0, for now.
That is this patch.
BUT. It produces some strangeties in the perl.mak file.
PREFIX looks great:
PREFIX = '/home/casey/opt/test spaces/'
but then down in the $(MAKE_APERL_FILE) section we get something like:
PREFIX=''/home/casey/opt/test spaces/''
because MakeMaker was already single quoting it.
Everything compiles and installs correctly for me.
In addition to putting a space in the prefix path, I also tried semicolon,
colon, and backslash. semicolon didn't work, but it didn't work before either.
colon and backslash worked. A backslash in the prefix path produced some
complaints when compiling some of the source files caused by the macros that
I mentioned earlier that are used by some of the files. The warning was
'unknown escape sequence ...'. The backslash was interpreted as an escape
sequence and then just dropped, so the path compiled into the object files
was wrong. I guess this doesn't happen on windows?
Summary: with this patch spaces in the prefix path work. It didn't break
anything that I tested.
Maybe there's a MakeMaker expert in the audience?
-brandon
perl/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/perl/Makefile b/perl/Makefile
index b8547db..6d2a200 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -38,7 +38,7 @@ $(makfile): ../GIT-CFLAGS Makefile
echo ' echo $(instdir_SQ)' >> $@
else
$(makfile): Makefile.PL ../GIT-CFLAGS
- $(PERL_PATH) $< PREFIX='$(prefix_SQ)'
+ $(PERL_PATH) $< PREFIX=\''$(prefix_SQ)'\'
endif
# this is just added comfort for calling make directly in perl dir
--
1.5.6.2
^ permalink raw reply related
* Documentation: user-manual: "git commit -a" doesn't motivate .gitignore
From: Jonathan Nieder @ 2008-08-06 21:22 UTC (permalink / raw)
To: git
"git commit -a" ignores untracked files and follows all tracked
files, regardless of whether they are listed in .gitignore. So
don't use it to motivate gitignore.
Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
---
I noticed this while reading through the git-scm book, which
looks very good. If I am missing something, I would be very
happy to know. Maybe the sort of person that wants to track the
exact contents of the working tree would prefer
"git commit -a -i ." over "git commit -a"?
Documentation/user-manual.txt | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 43f4e39..f421689 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -1128,8 +1128,8 @@ This typically includes files generated by a build process or temporary
backup files made by your editor. Of course, 'not' tracking files with git
is just a matter of 'not' calling "`git-add`" on them. But it quickly becomes
annoying to have these untracked files lying around; e.g. they make
-"`git add .`" and "`git commit -a`" practically useless, and they keep
-showing up in the output of "`git status`".
+"`git add .`" practically useless, and they keep showing up in the output of
+"`git status`".
You can tell git to ignore certain files by creating a file called .gitignore
in the top level of your working directory, with contents such as:
--
1.6.0.rc1.228.ge730
^ permalink raw reply related
* Re: [PATCH] files given on the command line are relative to $cwd
From: Junio C Hamano @ 2008-08-06 20:59 UTC (permalink / raw)
To: Olivier Marin
Cc: git list, Luciano Rocha, pascal, Pierre Habouzit,
Kristian Høgsberg
In-Reply-To: <7vtzdxnbgk.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> Olivier Marin <dkr+ml.git@free.fr> writes:
>
>> Junio C Hamano a écrit :
>>>
>>> static int parse_and_validate_options(int argc, const char *argv[],
>>> - const char * const usage[])
>>> + const char * const usage[],
>>> + const char *prefix)
>>> {
>>> int f = 0;
>>>
>>> argc = parse_options(argc, argv, builtin_commit_options, usage, 0);
>>> + logfile = parse_options_fix_filename(prefix, logfile);
>>
>> It breaks the "git commit -F -" case, no?
>
> Does it? Ah, yeah, t7500 #15 does not go down to a subdirectory.
Ok, this squashed in on top of the previous one should cover the case.
Thanks for saving me in time from a major embarrassment. I already tagged
1.5.6.5 with the botched one but haven't pushed it out, so I can safely
rewind.
---
parse-options.c | 2 +-
t/t7500-commit.sh | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/parse-options.c b/parse-options.c
index d771bf4..12c8822 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -432,7 +432,7 @@ int parse_opt_approxidate_cb(const struct option *opt, const char *arg,
*/
extern const char *parse_options_fix_filename(const char *prefix, const char *file)
{
- if (!file || !prefix || is_absolute_path(file))
+ if (!file || !prefix || is_absolute_path(file) || !strcmp("-", file))
return file;
return prefix_filename(prefix, strlen(prefix), file);
}
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index 2ab791b..823256a 100755
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
@@ -159,4 +159,12 @@ test_expect_success 'commit message from file (2)' '
commit_msg_is "Log in sub directory"
'
+test_expect_success 'commit message from stdin' '
+ (
+ cd subdir &&
+ echo "Log with foo word" | git commit --allow-empty -F -
+ ) &&
+ commit_msg_is "Log with foo word"
+'
+
test_done
^ permalink raw reply related
* Re: [PATCH] files given on the command line are relative to $cwd
From: Pierre Habouzit @ 2008-08-06 20:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git list, Luciano Rocha, pascal, Kristian Høgsberg
In-Reply-To: <7vr692oufw.fsf@gitster.siamese.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 828 bytes --]
On Wed, Aug 06, 2008 at 06:43:47PM +0000, Junio C Hamano wrote:
> When running "git commit -F file" and "git tag -F file" from a
> subdirectory, we should take it as relative to the directory we started
> from, not relative to the top-level directory.
>
> This adds a helper function "parse_options_fix_filename()" to make it more
> convenient to fix this class of issues. Ideally, parse_options() should
> support a new type of option, "OPT_FILENAME", to do this uniformly, but
> this patch is meant to go to 'maint' to fix it minimally.
I'm going in vacation tomorrow so I'm not likely to do that soon, but
I agree it's sensible.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [PATCH] files given on the command line are relative to $cwd
From: Junio C Hamano @ 2008-08-06 20:19 UTC (permalink / raw)
To: Olivier Marin
Cc: git list, Luciano Rocha, pascal, Pierre Habouzit,
Kristian Høgsberg
In-Reply-To: <489A061B.7010508@free.fr>
Olivier Marin <dkr+ml.git@free.fr> writes:
> Junio C Hamano a écrit :
>>
>> static int parse_and_validate_options(int argc, const char *argv[],
>> - const char * const usage[])
>> + const char * const usage[],
>> + const char *prefix)
>> {
>> int f = 0;
>>
>> argc = parse_options(argc, argv, builtin_commit_options, usage, 0);
>> + logfile = parse_options_fix_filename(prefix, logfile);
>
> It breaks the "git commit -F -" case, no?
Does it? Ah, yeah, t7500 #15 does not go down to a subdirectory.
^ permalink raw reply
* Re: [PATCH] perl/Makefile: handle paths with spaces in the NO_PERL_MAKEMAKER section
From: Junio C Hamano @ 2008-08-06 20:15 UTC (permalink / raw)
To: Brandon Casey; +Cc: Git Mailing List
In-Reply-To: <lh6XIUcjpbjj8G8Ot7RQFlDitUn1njsc350QhnNmQkcgxlfluBPGZw@cipher.nrlssc.navy.mil>
Brandon Casey <casey@nrlssc.navy.mil> writes:
> There are problems here with spaces, single quotes, and double quotes.
> I'll follow up in another email.
I guess we've opened up a large can of worms. Let's have the minimum fix
that says "We do support whitespace in these paths but no other funnies"
and leave the more intrusive one for post 1.6.0, for now.
^ permalink raw reply
* Re: [PATCH] files given on the command line are relative to $cwd
From: Olivier Marin @ 2008-08-06 20:14 UTC (permalink / raw)
To: Junio C Hamano
Cc: git list, Luciano Rocha, pascal, Pierre Habouzit,
Kristian Høgsberg
In-Reply-To: <7vr692oufw.fsf@gitster.siamese.dyndns.org>
Junio C Hamano a écrit :
>
> static int parse_and_validate_options(int argc, const char *argv[],
> - const char * const usage[])
> + const char * const usage[],
> + const char *prefix)
> {
> int f = 0;
>
> argc = parse_options(argc, argv, builtin_commit_options, usage, 0);
> + logfile = parse_options_fix_filename(prefix, logfile);
It breaks the "git commit -F -" case, no?
Olivier.
^ permalink raw reply
* [PATCH 2/2] git-svn: Allow deep branch names by supporting multi-globs
From: Marcus Griep @ 2008-08-06 19:58 UTC (permalink / raw)
To: Git Mailing List; +Cc: Eric Wong
From 3b95061c8d19b2285cdbf94001f3b718c8264c32 Mon Sep 17 00:00:00 2001
From: Marcus Griep <marcus@griep.us>
Date: Tue, 5 Aug 2008 15:13:20 -0400
Subject: [PATCH 2/2] git-svn: Allow deep branch names by supporting multi-globs
Some repositories use a deep branching strategy, such as:
branches/1.0/1.0.rc1
branches/1.0/1.0.rc2
branches/1.0/1.0.rtm
branches/1.0/1.0.gold
Only allowing a single glob stiffles this.
This change allows for a single glob 'set' to accept this deep branching
strategy.
The ref glob depth must match the branch glob depth. When using the -b or -t
options for init or clone, this is automatically done.
For example, using the above branches:
svn-remote.svn.branches = branches/*/*:refs/remote/*/*
gives the following branch names:
1.0/1.0.rc1
1.0/1.0.rc2
1.0/1.0.rtm
1.0/1.0.gold
Signed-off-by: Marcus Griep <marcus@griep.us>
---
git-svn.perl | 53 +++++++---
t/t9108-git-svn-glob.sh | 9 +-
t/t9108-git-svn-multi-glob.sh | 155 ++++++++++++++++++++++++++++
t/t9125-git-svn-multi-glob-branch-names.sh | 40 +++++++
4 files changed, 238 insertions(+), 19 deletions(-)
create mode 100755 t/t9108-git-svn-multi-glob.sh
create mode 100755 t/t9125-git-svn-multi-glob-branch-names.sh
diff --git a/git-svn.perl b/git-svn.perl
index 95d11c2..dc80c56 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -981,7 +981,7 @@ sub complete_url_ls_init {
die "--prefix='$pfx' must have a trailing slash '/'\n";
}
command_noisy('config', "svn-remote.$gs->{repo_id}.$n",
- "$remote_path:refs/remotes/$pfx*");
+ "$remote_path:refs/remotes/$pfx*" . ('/*' x (($remote_path =~ tr/*/*/)-1)));
}
sub verify_ref {
@@ -4113,16 +4113,35 @@ sub gs_fetch_loop_common {
Git::SVN::gc();
}
+sub get_dir_globbed {
+ my ($self, $left, $depth, $r) = @_;
+
+ my @x = eval { $self->get_dir($left, $r) };
+ return unless scalar @x == 3;
+ my $dirents = $x[0];
+ my @finalents;
+ foreach my $de (keys %$dirents) {
+ next if $dirents->{$de}->{kind} != $SVN::Node::dir;
+ if ($depth > 1) {
+ foreach my $dir ($self->get_dir_globbed($left.'/'.$de, $depth - 1, $r)) {
+ push @finalents, "$de/$dir";
+ }
+ } else {
+ push @finalents, $de;
+ }
+ }
+ @finalents;
+}
+
sub match_globs {
my ($self, $exists, $paths, $globs, $r) = @_;
sub get_dir_check {
my ($self, $exists, $g, $r) = @_;
- my @x = eval { $self->get_dir($g->{path}->{left}, $r) };
- return unless scalar @x == 3;
- my $dirents = $x[0];
- foreach my $de (keys %$dirents) {
- next if $dirents->{$de}->{kind} != $SVN::Node::dir;
+
+ my @dirs = $self->get_dir_globbed($g->{path}->{left}, $g->{path}->{depth}, $r);
+
+ foreach my $de (@dirs) {
my $p = $g->{path}->full_path($de);
next if $exists->{$p};
next if (length $g->{path}->{right} &&
@@ -4904,16 +4923,20 @@ sub new {
my ($class, $glob) = @_;
my $re = $glob;
$re =~ s!/+$!!g; # no need for trailing slashes
- my $nr = $re =~ tr/*/*/;
- if ($nr > 1) {
- die "Only one '*' wildcard expansion ",
- "is supported (got $nr): '$glob'\n";
- } elsif ($nr == 0) {
+ $re =~ m!^([^*]*)(\*(?:/\*)*)([^*]*)$!;
+ my $temp = $re;
+ my ($left, $right) = ($1, $3);
+ $re = $2;
+ my $depth = $re =~ tr/*/*/;
+ if ($depth != $temp =~ tr/*/*/) {
+ die "Only one set of wildcard directories (e.g. '*' or '*/*/*') is supported: '$glob'\n";
+ }
+ if ($depth == 0) {
die "One '*' is needed for glob: '$glob'\n";
}
- $re =~ s!^(.*)\*(.*)$!\(\[^/\]+\)!g;
- my ($left, $right) = ($1, $2);
- $re = quotemeta($left) . $re . quotemeta($right);
+ $re =~ s!\*!\[^/\]*!g;
+# $re =~ s!\?!\[^/\]!g;
+ $re = quotemeta($left) . "($re)" . quotemeta($right);
if (length $left && !($left =~ s!/+$!!g)) {
die "Missing trailing '/' on left side of: '$glob' ($left)\n";
}
@@ -4922,7 +4945,7 @@ sub new {
}
my $left_re = qr/^\/\Q$left\E(\/|$)/;
bless { left => $left, right => $right, left_regex => $left_re,
- regex => qr/$re/, glob => $glob }, $class;
+ regex => qr/$re/, glob => $glob, depth => $depth }, $class;
}
sub full_path {
diff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh
index ef6d88e..46958e5 100755
--- a/t/t9108-git-svn-glob.sh
+++ b/t/t9108-git-svn-glob.sh
@@ -52,7 +52,8 @@ test_expect_success 'test refspec globbing' '
test "`git rev-parse refs/remotes/tags/end~1`" = \
"`git rev-parse refs/remotes/branches/start`" &&
test "`git rev-parse refs/remotes/branches/start~2`" = \
- "`git rev-parse refs/remotes/trunk`"
+ "`git rev-parse refs/remotes/trunk`" &&
+ test_must_fail git rev-parse refs/remotes/tags/end@3
'
echo try to try > expect.two
@@ -83,14 +84,14 @@ test_expect_success 'test left-hand-side only globbing' '
cmp expect.two output.two
'
-echo "Only one '*' wildcard expansion is supported (got 2): 'branches/*/*'" > expect.three
+echo "Only one set of wildcard directories (e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'" > expect.three
echo "" >> expect.three
-test_expect_success 'test disallow multi-globs' '
+test_expect_success 'test disallow multiple globs' '
git config --add svn-remote.three.url "$svnrepo" &&
git config --add svn-remote.three.fetch trunk:refs/remotes/three/trunk &&
git config --add svn-remote.three.branches \
- "branches/*/*:refs/remotes/three/branches/*" &&
+ "branches/*/t/*:refs/remotes/three/branches/*" &&
git config --add svn-remote.three.tags \
"tags/*/*:refs/remotes/three/tags/*" &&
cd tmp &&
diff --git a/t/t9108-git-svn-multi-glob.sh b/t/t9108-git-svn-multi-glob.sh
new file mode 100755
index 0000000..1d80cb1
--- /dev/null
+++ b/t/t9108-git-svn-multi-glob.sh
@@ -0,0 +1,155 @@
+#!/bin/sh
+# Copyright (c) 2007 Eric Wong
+test_description='git-svn globbing refspecs'
+. ./lib-git-svn.sh
+
+cat > expect.end <<EOF
+the end
+hi
+start a new branch
+initial
+EOF
+
+test_expect_success 'test refspec globbing' '
+ mkdir -p trunk/src/a trunk/src/b trunk/doc &&
+ echo "hello world" > trunk/src/a/readme &&
+ echo "goodbye world" > trunk/src/b/readme &&
+ svn import -m "initial" trunk "$svnrepo"/trunk &&
+ svn co "$svnrepo" tmp &&
+ cd tmp &&
+ mkdir branches branches/v1 tags &&
+ svn add branches tags &&
+ svn cp trunk branches/v1/start &&
+ svn commit -m "start a new branch" &&
+ svn up &&
+ echo "hi" >> branches/v1/start/src/b/readme &&
+ poke branches/v1/start/src/b/readme &&
+ echo "hey" >> branches/v1/start/src/a/readme &&
+ poke branches/v1/start/src/a/readme &&
+ svn commit -m "hi" &&
+ svn up &&
+ svn cp branches/v1/start tags/end &&
+ echo "bye" >> tags/end/src/b/readme &&
+ poke tags/end/src/b/readme &&
+ echo "aye" >> tags/end/src/a/readme &&
+ poke tags/end/src/a/readme &&
+ svn commit -m "the end" &&
+ echo "byebye" >> tags/end/src/b/readme &&
+ poke tags/end/src/b/readme &&
+ svn commit -m "nothing to see here"
+ cd .. &&
+ git config --add svn-remote.svn.url "$svnrepo" &&
+ git config --add svn-remote.svn.fetch \
+ "trunk/src/a:refs/remotes/trunk" &&
+ git config --add svn-remote.svn.branches \
+ "branches/*/*/src/a:refs/remotes/branches/*/*" &&
+ git config --add svn-remote.svn.tags\
+ "tags/*/src/a:refs/remotes/tags/*" &&
+ git-svn multi-fetch &&
+ git log --pretty=oneline refs/remotes/tags/end | \
+ sed -e "s/^.\{41\}//" > output.end &&
+ cmp expect.end output.end &&
+ test "`git rev-parse refs/remotes/tags/end~1`" = \
+ "`git rev-parse refs/remotes/branches/v1/start`" &&
+ test "`git rev-parse refs/remotes/branches/v1/start~2`" = \
+ "`git rev-parse refs/remotes/trunk`" &&
+ test_must_fail git rev-parse refs/remotes/tags/end@3
+ '
+
+echo try to try > expect.two
+echo nothing to see here >> expect.two
+cat expect.end >> expect.two
+
+test_expect_success 'test left-hand-side only globbing' '
+ git config --add svn-remote.two.url "$svnrepo" &&
+ git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&
+ git config --add svn-remote.two.branches \
+ "branches/*/*:refs/remotes/two/branches/*/*" &&
+ git config --add svn-remote.two.tags \
+ "tags/*:refs/remotes/two/tags/*" &&
+ cd tmp &&
+ echo "try try" >> tags/end/src/b/readme &&
+ poke tags/end/src/b/readme &&
+ svn commit -m "try to try"
+ cd .. &&
+ git-svn fetch two &&
+ test `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 &&
+ test `git rev-list refs/remotes/two/branches/v1/start | wc -l` -eq 3 &&
+ test `git rev-parse refs/remotes/two/branches/v1/start~2` = \
+ `git rev-parse refs/remotes/two/trunk` &&
+ test `git rev-parse refs/remotes/two/tags/end~3` = \
+ `git rev-parse refs/remotes/two/branches/v1/start` &&
+ git log --pretty=oneline refs/remotes/two/tags/end | \
+ sed -e "s/^.\{41\}//" > output.two &&
+ cmp expect.two output.two
+ '
+cat > expect.four <<EOF
+adios
+adding more
+Changed 2 in v2/start
+Another versioned branch
+initial
+EOF
+
+test_expect_success 'test another branch' '
+ (
+ cd tmp &&
+ mkdir branches/v2 &&
+ svn add branches/v2 &&
+ svn cp trunk branches/v2/start &&
+ svn commit -m "Another versioned branch" &&
+ svn up &&
+ echo "hello" >> branches/v2/start/src/b/readme &&
+ poke branches/v2/start/src/b/readme &&
+ echo "howdy" >> branches/v2/start/src/a/readme &&
+ poke branches/v2/start/src/a/readme &&
+ svn commit -m "Changed 2 in v2/start" &&
+ svn up &&
+ svn cp branches/v2/start tags/next &&
+ echo "bye" >> tags/next/src/b/readme &&
+ poke tags/next/src/b/readme &&
+ echo "aye" >> tags/next/src/a/readme &&
+ poke tags/next/src/a/readme &&
+ svn commit -m "adding more" &&
+ echo "byebye" >> tags/next/src/b/readme &&
+ poke tags/next/src/b/readme &&
+ svn commit -m "adios"
+ ) &&
+ git config --add svn-remote.four.url "$svnrepo" &&
+ git config --add svn-remote.four.fetch trunk:refs/remotes/four/trunk &&
+ git config --add svn-remote.four.branches \
+ "branches/*/*:refs/remotes/four/branches/*/*" &&
+ git config --add svn-remote.four.tags \
+ "tags/*:refs/remotes/four/tags/*" &&
+ git-svn fetch four &&
+ test `git rev-list refs/remotes/four/tags/next | wc -l` -eq 5 &&
+ test `git rev-list refs/remotes/four/branches/v2/start | wc -l` -eq 3 &&
+ test `git rev-parse refs/remotes/four/branches/v2/start~2` = \
+ `git rev-parse refs/remotes/four/trunk` &&
+ test `git rev-parse refs/remotes/four/tags/next~2` = \
+ `git rev-parse refs/remotes/four/branches/v2/start` &&
+ git log --pretty=oneline refs/remotes/four/tags/next | \
+ sed -e "s/^.\{41\}//" > output.four &&
+ cmp expect.four output.four
+ '
+
+echo "Only one set of wildcard directories (e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'" > expect.three
+echo "" >> expect.three
+
+test_expect_success 'test disallow multiple globs' '
+ git config --add svn-remote.three.url "$svnrepo" &&
+ git config --add svn-remote.three.fetch trunk:refs/remotes/three/trunk &&
+ git config --add svn-remote.three.branches \
+ "branches/*/t/*:refs/remotes/three/branches/*/*" &&
+ git config --add svn-remote.three.tags \
+ "tags/*:refs/remotes/three/tags/*" &&
+ cd tmp &&
+ echo "try try" >> tags/end/src/b/readme &&
+ poke tags/end/src/b/readme &&
+ svn commit -m "try to try"
+ cd .. &&
+ test_must_fail git-svn fetch three &> stderr.three &&
+ cmp expect.three stderr.three
+ '
+
+test_done
diff --git a/t/t9125-git-svn-multi-glob-branch-names.sh b/t/t9125-git-svn-multi-glob-branch-names.sh
new file mode 100755
index 0000000..f7c7836
--- /dev/null
+++ b/t/t9125-git-svn-multi-glob-branch-names.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Eric Wong
+#
+
+test_description='git-svn multi-glob branch names'
+. ./lib-git-svn.sh
+
+test_expect_success 'setup svnrepo' '
+ mkdir project project/trunk project/branches project/branches/v14.1 project/tags &&
+ echo foo > project/trunk/foo &&
+ svn import -m "$test_description" project "$svnrepo/project" &&
+ rm -rf project &&
+ svn cp -m "fun" "$svnrepo/project/trunk" \
+ "$svnrepo/project/branches/v14.1/beta" &&
+ svn cp -m "more fun!" "$svnrepo/project/branches/v14.1/beta" \
+ "$svnrepo/project/branches/v14.1/gold" &&
+ start_httpd
+ '
+
+test_expect_success 'test clone with multi-glob in branch names' '
+ git svn clone -T trunk -b branches/*/* -t tags "$svnrepo/project" project &&
+ cd project &&
+ git rev-parse "refs/remotes/v14.1/beta" &&
+ git rev-parse "refs/remotes/v14.1/gold" &&
+ cd ..
+ '
+
+test_expect_success 'test dcommit to multi-globbed branch' "
+ cd project &&
+ git reset --hard 'refs/remotes/v14.1/gold' &&
+ echo hello >> foo &&
+ git commit -m 'hello' -- foo &&
+ git svn dcommit &&
+ cd ..
+ "
+
+stop_httpd
+
+test_done
--
1.5.4.3
--
Marcus Griep
GPG Key ID: 0x5E968152
——
http://www.boohaunt.net
את.ψο´
^ permalink raw reply related
* [PATCH 1/2] Fix multi-glob assertion in git-svn
From: Marcus Griep @ 2008-08-06 19:55 UTC (permalink / raw)
To: Git Mailing List; +Cc: Eric Wong
From 81b736f4a815ebded8978e63f2cba393528a57e0 Mon Sep 17 00:00:00 2001
From: Marcus Griep <marcus@griep.us>
Date: Tue, 5 Aug 2008 15:45:05 -0400
Subject: [PATCH 1/2] Fix multi-glob assertion in git-svn
Signed-off-by: Marcus Griep <marcus@griep.us>
---
git-svn.perl | 5 +++--
t/t9108-git-svn-glob.sh | 19 +++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index cf6dbbc..95d11c2 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -4904,14 +4904,15 @@ sub new {
my ($class, $glob) = @_;
my $re = $glob;
$re =~ s!/+$!!g; # no need for trailing slashes
- my $nr = ($re =~ s!^(.*)\*(.*)$!\(\[^/\]+\)!g);
- my ($left, $right) = ($1, $2);
+ my $nr = $re =~ tr/*/*/;
if ($nr > 1) {
die "Only one '*' wildcard expansion ",
"is supported (got $nr): '$glob'\n";
} elsif ($nr == 0) {
die "One '*' is needed for glob: '$glob'\n";
}
+ $re =~ s!^(.*)\*(.*)$!\(\[^/\]+\)!g;
+ my ($left, $right) = ($1, $2);
$re = quotemeta($left) . $re . quotemeta($right);
if (length $left && !($left =~ s!/+$!!g)) {
die "Missing trailing '/' on left side of: '$glob' ($left)\n";
diff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh
index f6f71d0..ef6d88e 100755
--- a/t/t9108-git-svn-glob.sh
+++ b/t/t9108-git-svn-glob.sh
@@ -83,4 +83,23 @@ test_expect_success 'test left-hand-side only globbing' '
cmp expect.two output.two
'
+echo "Only one '*' wildcard expansion is supported (got 2): 'branches/*/*'" > expect.three
+echo "" >> expect.three
+
+test_expect_success 'test disallow multi-globs' '
+ git config --add svn-remote.three.url "$svnrepo" &&
+ git config --add svn-remote.three.fetch trunk:refs/remotes/three/trunk &&
+ git config --add svn-remote.three.branches \
+ "branches/*/*:refs/remotes/three/branches/*" &&
+ git config --add svn-remote.three.tags \
+ "tags/*/*:refs/remotes/three/tags/*" &&
+ cd tmp &&
+ echo "try try" >> tags/end/src/b/readme &&
+ poke tags/end/src/b/readme &&
+ svn commit -m "try to try"
+ cd .. &&
+ test_must_fail git-svn fetch three &> stderr.three &&
+ cmp expect.three stderr.three
+ '
+
test_done
--
1.5.4.3
--
Marcus Griep
GPG Key ID: 0x5E968152
——
http://www.boohaunt.net
את.ψο´
^ permalink raw reply related
* Re: [PATCH] perl/Makefile: handle paths with spaces in the NO_PERL_MAKEMAKER section
From: Brandon Casey @ 2008-08-06 19:31 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <7v7iaurwe4.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
> Brandon Casey <casey@nrlssc.navy.mil> writes:
>
>> Junio C Hamano wrote:
>>> Brandon Casey <casey@nrlssc.navy.mil> writes:
>>>
>>>> Use double quotes to protect against paths which may contain spaces.
>>>> ...
>>>> + echo ' mkdir -p "$(instdir_SQ)"' >> $@
>>> Is this sufficient? We seem to apply double-sq when writing shell
>>> scriptlet in GIT-BUILD-OPTIONS from the main Makefile, and I suspect you
>>> would need to do something similar.
>> It seems to be sufficient. The double quotes survived into my perl.mak file
>> and the two perl modules were installed correctly when I supplied a prefix
>> with spaces. Is there something else to be concerned about?
>
> I think the generic way GIT-BUILD-OPTIONS writing is done covers cases
> where the installation directory has funnies other than whitespace, e.g.
> double quotes. Is your 'echo "$(instdir_SQ)"' sufficient?
DOUBLE QUOTE ISSUE:
I added a double quote to my prefix, and the build fails at compiling config.c
line 589. The failure is caused by the macro ETC_GITCONFIG which is set in the
Makefile and contains the prefix string, which contains the single double quote.
This of course causes a syntax error. So it looks like the cleansing done to
ETC_GITCONFIG doesn't handle this.
Doing this allows me to compile:
ETC_GITCONFIG_SQ = $(subst ",\",$(subst ','\'',$(ETC_GITCONFIG)))
The patch at the end of this email applies the same treatment to the other
variables I needed to get git to compile. If this is the correct fix, then
the other variables used as macros in git source files would need to be
hunted down... at least SHA1_HEADER_SQ, but maybe others?
SPACE ISSUE:
Also, the installation of the perl modules fails when I have a space in the
path and NO_PERL_MAKEMAKER is _not_ set. IOW the perl makemaker install fails
for me when there is a space in the path. This has nothing to do with the
double quote I was talking about above, I think it would fail with double quote
too.
The line assigning PREFIX in my perl.mak looks like:
PREFIX = /home/casey/opt/test spaces/
Shouldn't that argument have quotes around it?
The errors look like:
make -C perl prefix='/home/casey/opt/test spaces/' DESTDIR='' install
make[1]: Entering directory `/home/casey/scratch/git/master/perl'
make[2]: Entering directory `/home/casey/scratch/git/master/perl'
Installing /home/casey/opt/test/private-Error.3pm
Installing /home/casey/opt/test/Git.3pm
Writing /home/casey/opt/test
Can't open file /home/casey/opt/test: Is a directory at /usr/lib/perl5/5.8.5/ExtUtils/Install.pm line 209
make[2]: *** [pure_site_install] Error 255
make[2]: Leaving directory `/home/casey/scratch/git/master/perl'
make[1]: *** [install] Error 2
make[1]: Leaving directory `/home/casey/scratch/git/master/perl'
make: *** [install] Error 2
private-Error.3pm and Git.3pm showed up in /home/casey/opt/test/
There are problems here with spaces, single quotes, and double quotes.
I'll follow up in another email.
MakeMaker version 6.17 (Revision: 1.133)
perl v5.8.5
-brandon
diff --git a/Makefile b/Makefile
index 0d373f7..affc288 100644
--- a/Makefile
+++ b/Makefile
@@ -1031,15 +1031,15 @@ endif
# Shell quote (do not use $(call) to accommodate ancient setups);
SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
-ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
+ETC_GITCONFIG_SQ = $(subst ",\",$(subst ','\'',$(ETC_GITCONFIG)))
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
bindir_SQ = $(subst ','\'',$(bindir))
-mandir_SQ = $(subst ','\'',$(mandir))
-infodir_SQ = $(subst ','\'',$(infodir))
-gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
-template_dir_SQ = $(subst ','\'',$(template_dir))
-htmldir_SQ = $(subst ','\'',$(htmldir))
+mandir_SQ = $(subst ",\",$(subst ','\'',$(mandir)))
+infodir_SQ = $(subst ",\",$(subst ','\'',$(infodir)))
+gitexecdir_SQ = $(subst ",\",$(subst ','\'',$(gitexecdir)))
+template_dir_SQ = $(subst ",\",$(subst ','\'',$(template_dir)))
+htmldir_SQ = $(subst ",\",$(subst ','\'',$(htmldir)))
prefix_SQ = $(subst ','\'',$(prefix))
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
^ permalink raw reply related
* [PATCH] files given on the command line are relative to $cwd
From: Junio C Hamano @ 2008-08-06 18:43 UTC (permalink / raw)
To: git list; +Cc: Luciano Rocha, pascal, Pierre Habouzit, Kristian Høgsberg
In-Reply-To: <7vy73aqe9m.fsf@gitster.siamese.dyndns.org>
When running "git commit -F file" and "git tag -F file" from a
subdirectory, we should take it as relative to the directory we started
from, not relative to the top-level directory.
This adds a helper function "parse_options_fix_filename()" to make it more
convenient to fix this class of issues. Ideally, parse_options() should
support a new type of option, "OPT_FILENAME", to do this uniformly, but
this patch is meant to go to 'maint' to fix it minimally.
One thing to note is that value for "commit template file" that comes from
the command line is taken as relative to $cwd just like other parameters,
but when it comes from the configuration varilable 'commit.template', it
is taken as relative to the working tree root as before. I think this
difference actually is sensible (not that I particularly think
commit.template itself is sensible).
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-commit.c | 11 +++++++----
builtin-tag.c | 1 +
parse-options.c | 12 ++++++++++++
parse-options.h | 2 ++
t/t7500-commit.sh | 11 +++++++++++
5 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index bcbea38..0c6d1f4 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -45,7 +45,7 @@ static enum {
COMMIT_PARTIAL,
} commit_style;
-static char *logfile, *force_author;
+static const char *logfile, *force_author;
static const char *template_file;
static char *edit_message, *use_message;
static char *author_name, *author_email, *author_date;
@@ -700,11 +700,14 @@ static int message_is_empty(struct strbuf *sb, int start)
}
static int parse_and_validate_options(int argc, const char *argv[],
- const char * const usage[])
+ const char * const usage[],
+ const char *prefix)
{
int f = 0;
argc = parse_options(argc, argv, builtin_commit_options, usage, 0);
+ logfile = parse_options_fix_filename(prefix, logfile);
+ template_file = parse_options_fix_filename(prefix, template_file);
if (logfile || message.len || use_message)
use_editor = 0;
@@ -814,7 +817,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
if (wt_status_use_color == -1)
wt_status_use_color = git_use_color_default;
- argc = parse_and_validate_options(argc, argv, builtin_status_usage);
+ argc = parse_and_validate_options(argc, argv, builtin_status_usage, prefix);
index_file = prepare_index(argc, argv, prefix);
@@ -907,7 +910,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
git_config(git_commit_config, NULL);
- argc = parse_and_validate_options(argc, argv, builtin_commit_usage);
+ argc = parse_and_validate_options(argc, argv, builtin_commit_usage, prefix);
index_file = prepare_index(argc, argv, prefix);
diff --git a/builtin-tag.c b/builtin-tag.c
index 3c97c69..3f77ba9 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -411,6 +411,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
git_config(git_tag_config, NULL);
argc = parse_options(argc, argv, options, git_tag_usage, 0);
+ msgfile = parse_options_fix_filename(prefix, msgfile);
if (keyid) {
sign = 1;
diff --git a/parse-options.c b/parse-options.c
index f8d52e2..d771bf4 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -425,3 +425,15 @@ int parse_opt_approxidate_cb(const struct option *opt, const char *arg,
*(unsigned long *)(opt->value) = approxidate(arg);
return 0;
}
+
+/*
+ * This should really be OPTION_FILENAME type as a part of
+ * parse_options that take prefix to do this while parsing.
+ */
+extern const char *parse_options_fix_filename(const char *prefix, const char *file)
+{
+ if (!file || !prefix || is_absolute_path(file))
+ return file;
+ return prefix_filename(prefix, strlen(prefix), file);
+}
+
diff --git a/parse-options.h b/parse-options.h
index 4ee443d..13ad158 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -123,4 +123,6 @@ extern int parse_opt_approxidate_cb(const struct option *, const char *, int);
"use <n> digits to display SHA-1s", \
PARSE_OPT_OPTARG, &parse_opt_abbrev_cb, 0 }
+extern const char *parse_options_fix_filename(const char *prefix, const char *file);
+
#endif
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index baed6ce..026d787 100755
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
@@ -138,4 +138,15 @@ test_expect_success '--signoff' '
diff expect output
'
+test_expect_success 'commit message from file' '
+ mkdir subdir &&
+ echo "Log in top directory" >log &&
+ echo "Log in sub directory" >subdir/log &&
+ (
+ cd subdir &&
+ git commit --allow-empty -F log
+ ) &&
+ commit_msg_is "Log in sub directory"
+'
+
test_done
^ permalink raw reply related
* Re: git reset --hard isn't resetting
From: Avery Pennarun @ 2008-08-06 18:02 UTC (permalink / raw)
To: Matt Graham; +Cc: git
In-Reply-To: <1c5969370808060941q59cb8f7fhabee3ef3c5107715@mail.gmail.com>
On 8/6/08, Matt Graham <mdg149@gmail.com> wrote:
> I'm using a git svn tree in Cygwin. I tried doing an svn rebase and
> got in some weird state with local changes I can't get rid of. It's
> not an issue w/ the same repository on my linux machine.
>
> git reset --hard
> toggles 4 files between capitalization. The files don't appear to
> have changed case in svn, but it's a huge repository and not easy to
> determine with certainty.
Try:
git log --name-only
to see which patches change which files. It's a virtual certainty
that they were renamed in svn at some point.
git doesn't handle case-munging filesystems perfectly, and gets into
the situation you describe. First, you need to figure out whether you
have files with *both* cases accidentally added to your index (if git
reset toggles the capitalization, this is almost certainly the case):
git ls-tree HEAD
If you see the same files with different case, that's your problem.
Now just 'git rm' the ones with the case you don't want, and commit
the result. (Do *not* use commit -a!) 'git status' will give you
some funny messages indicating that files you *didn't* 'git rm' have
gone away in the filesystem; it's true, of course, but don't worry
about that. Now 'git reset --hard HEAD' and you should be okay.
I'm not really sure what git should do better in this case, although
the current behaviour is obviously a bit confusing.
Have fun,
Avery
^ permalink raw reply
* Re: git reset --hard isn't resetting
From: Dmitry Potapov @ 2008-08-06 18:01 UTC (permalink / raw)
To: Matt Graham; +Cc: git
In-Reply-To: <1c5969370808060941q59cb8f7fhabee3ef3c5107715@mail.gmail.com>
Hi,
On Wed, Aug 6, 2008 at 8:41 PM, Matt Graham <mdg149@gmail.com> wrote:
> I'm using a git svn tree in Cygwin. I tried doing an svn rebase and
> got in some weird state with local changes I can't get rid of. It's
> not an issue w/ the same repository on my linux machine.
>
> git reset --hard
> toggles 4 files between capitalization. The files don't appear to
> have changed case in svn, but it's a huge repository and not easy to
> determine with certainty.
What version of Git do you use?
Was this repo created with Git prior 1.5.6?
Do you have core.ignorecase set to true in .git/config?
What "git ls-files" says for these files?
What "ls" says for these files?
Dmitry
^ permalink raw reply
* Re: something fishy with Git commit and log from file
From: Pascal Obry @ 2008-08-06 17:08 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Luciano Rocha, git list
In-Reply-To: <7vy73aqe9m.fsf@gitster.siamese.dyndns.org>
Junio C Hamano a écrit :
> Perhaps something like this. This must be another one of those
> regressions introduced in C rewrite.
Works fine now. Thanks.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
^ permalink raw reply
* Re: something fishy with Git commit and log from file
From: Junio C Hamano @ 2008-08-06 16:50 UTC (permalink / raw)
To: pascal; +Cc: Luciano Rocha, git list
In-Reply-To: <4899D119.1080403@obry.net>
Pascal Obry <pascal@obry.net> writes:
> Junio C Hamano a écrit :
>> Pascal Obry <pascal@obry.net> writes:
>>
>>> So definitely a Git bug! Can be reproduced with:
>>>
>>> $ mkdir repo && cd repo
>>> $ git init
>>> $ mkdir dir
>>> $ cd dir
>>> $ echo file > file
>>> $ echo log > log
>>> $ git add file
>>> $ git commit --file=log
>>> fatal: could not read log file 'log': No such file or directory
>>
>> Try it without cding down to "dir".
>
> Yes it works.
Perhaps something like this. This must be another one of those
regressions introduced in C rewrite.
diff --git a/builtin-commit.c b/builtin-commit.c
index b783e6e..fcc9c59 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -469,7 +469,10 @@ static int prepare_to_commit(const char *index_file, const char *prefix)
die("could not read log from standard input");
hook_arg1 = "message";
} else if (logfile) {
- if (strbuf_read_file(&sb, logfile, 0) < 0)
+ const char *lf = logfile;
+ if (prefix)
+ lf = prefix_filename(prefix, strlen(prefix), logfile);
+ if (strbuf_read_file(&sb, lf, 0) < 0)
die("could not read log file '%s': %s",
logfile, strerror(errno));
hook_arg1 = "message";
^ permalink raw reply related
* git reset --hard isn't resetting
From: Matt Graham @ 2008-08-06 16:41 UTC (permalink / raw)
To: git
Hi,
I'm using a git svn tree in Cygwin. I tried doing an svn rebase and
got in some weird state with local changes I can't get rid of. It's
not an issue w/ the same repository on my linux machine.
git reset --hard
toggles 4 files between capitalization. The files don't appear to
have changed case in svn, but it's a huge repository and not easy to
determine with certainty.
I first encountered this during a rebase, so I rebranched master from
git-svn HEAD and the problem followed me there.
Any tips about how to work around it or investigate further would be
appreciated.
scrollback of toggling filenames is pasted below.
thanks
mgraham@mgraham-wks /src/project.git
$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
# modified: dim_grade.dsx
# modified: dim_institution.dsx
# modified: dim_section.dsx
# modified: dim_term.dsx
#
no changes added to commit (use "git add" and/or "git commit -a")
mgraham@mgraham-wks /src/project.git
$ git reset --hard
HEAD is now at 6170b8f RPrasad - For the time being switched to
MockAuthenticator; while working on resolving the LDAP issue.
mgraham@mgraham-wks /src/project.git
$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
# modified: DIM_GRADE.dsx
# modified: DIM_INSTITUTION.dsx
# modified: DIM_SECTION.dsx
# modified: DIM_TERM.dsx
#
no changes added to commit (use "git add" and/or "git commit -a")
^ permalink raw reply
* Re: something fishy with Git commit and log from file
From: Pascal Obry @ 2008-08-06 16:28 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Luciano Rocha, git list
In-Reply-To: <7v3alirw6b.fsf@gitster.siamese.dyndns.org>
Junio C Hamano a écrit :
> Pascal Obry <pascal@obry.net> writes:
>
>> So definitely a Git bug! Can be reproduced with:
>>
>> $ mkdir repo && cd repo
>> $ git init
>> $ mkdir dir
>> $ cd dir
>> $ echo file > file
>> $ echo log > log
>> $ git add file
>> $ git commit --file=log
>> fatal: could not read log file 'log': No such file or directory
>
> Try it without cding down to "dir".
Yes it works. It also works if I do:
$ echo log > ../log
instead of
$ echo log > log
Git is looking for the log file at the Git root.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
^ permalink raw reply
* Re: git-svn does not seems to work with crlf convertion enabled.
From: Dmitry Potapov @ 2008-08-06 16:11 UTC (permalink / raw)
To: Petr Baudis; +Cc: Johannes Schindelin, Alexander Litvinov, git
In-Reply-To: <20080806111545.GD32184@machine.or.cz>
On Wed, Aug 6, 2008 at 3:15 PM, Petr Baudis <pasky@suse.cz> wrote:
>
> If not, why do you want to drop git-svn from Windows Git? It seems
> that the CRLF issue has trivial workaround to set autocrlf=false;
> this will make git-svn-tracked repositories useful only on Windows,
> but I'd bet this is fine for large majority of Windows git-svn users?
Actually, it is not so simple. If you have svn properties setup correctly
for your text files (i.e. svn:eol-style=native) than autocrlf=false is
not what you want, because then SVN uses LF as EOL when stores this files.
In many case, just setting svn:eol-style correctly in SVN may solve the
problem.
However, to make git-svn work reliable in present files with different
ending, it should import files from SVN without applying any filter.
Therefore, the --no-filters option was recently added to git-hash-object.
Adding its use to git-svn should be easy (I have not had time to test it):
===
diff --git a/perl/Git.pm b/perl/Git.pm
index 087d3d0..438b7fd 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -829,7 +829,7 @@ sub _open_hash_and_insert_object_if_needed {
($self->{hash_object_pid}, $self->{hash_object_in},
$self->{hash_object_out}, $self->{hash_object_ctx}) =
- command_bidi_pipe(qw(hash-object -w --stdin-paths));
+ command_bidi_pipe(qw(hash-object -w --stdin-paths
--no-filters));
}
sub _close_hash_and_insert_object {
===
This should solve all problem with git-svn fetch. However, if you want to
respect svn:eol-style and when you commit your changes, that will require
synchronization svn:eol-style with values for crlf in your .gitattributes,
which is a much more ambitious task.
Dmitry
^ 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