* Re: preventing a push
From: Linus Torvalds @ 2007-12-18 16:32 UTC (permalink / raw)
To: Christoph Duelli; +Cc: git
In-Reply-To: <4767BDD8.9080404@melosgmbh.de>
On Tue, 18 Dec 2007, Christoph Duelli wrote:
>
> Is there a (recommended?) way to prevent accidental pushing (or pulling) from
> one repository into another (like the level command from bk days)?
I used BK for years, never knew about any level thing. I assume that was
some way to introduce an "ordering" between repositories, where you could
only push/pull in a controlled manner?
There's no obvious way to do exactly that, but the hooks git has may or
may not be ok. For example, if you want to disallow pushing into some
repository entirely (because you _only_ expect people to pull into it),
you should be able to just make a "pre-receive" hook that always returns
false. See Documentation/hooks.txt.
NOTE! There is no way to figure out what the pushing repository status is,
which is why I say there is no way to do a "level"-equivalent thing
(assuming I guessed what "level" does from the name). However, depending
on how you allow people to access the machine, the hook obviously can look
at things like $USER or other environment variables (ie you could make it
look at what machine the user connected from etc).
But nothing really ever identifies the source repository (on a "git
level") for a push: as far as git is concerned, all repositories are
equal, and your hooks would invariably have to use non-git knowledge to
figure out whether some operation should be allowed or not.
Linus
^ permalink raw reply
* Re: kha/safe and kha/experimental updated
From: Jakub Narebski @ 2007-12-18 16:39 UTC (permalink / raw)
To: Catalin Marinas; +Cc: Karl Hasselström, David Kågedal, git
In-Reply-To: <b0943d9e0712180809l4d2d01b8j32ab2a410885cc5e@mail.gmail.com>
"Catalin Marinas" <catalin.marinas@gmail.com> writes:
> Thanks again for maintaining these branches.
>
> On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> > git://repo.or.cz/stgit/kha.git safe
> > Remove "stg resolved"
>
> I'd like to keep this command. git-mergetool doesn't support the tool
> I use (emacs + ediff and more stgit-specific file extensions like
> current, patch etc.). I also don't find 'git add' to be meaningful for
> marking a conflict as solved.
I also would like to have this command kept (and shown in 'stg help'!).
Contrary to 'git add' it can check and add to index / update index
only for files with conflict; we have -r (ancestor|current|patched)
to choose one side, and we could add --check to check if there are
no conflict markers with files (useful with -a/--all).
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH] Teach diff machinery to display other prefixes than "a/" and "b/"
From: Pascal Obry @ 2007-12-18 16:45 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Pascal Obry, git
In-Reply-To: <Pine.LNX.4.64.0712181619550.23902@racer.site>
Johannes Schindelin a écrit :
> With the new option "--prefix=<prefix1>[:<prefix2>]" you can change
> the shown prefix, or suppress it (by specifying the empty string).
Why not ? But do you have a motivation for this change ? I mean why
would you want to use a completely different prefix ?
My change was only for format-patch as this is used to build patch that
some other tools can process. If we find a sensible usage for your
prefix option I'm all for it as this solves also my problem. It is just
that I think all options must have at least one usage :)
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: [PATCH] Add format-patch option --no-name-prefix.
From: Linus Torvalds @ 2007-12-18 16:50 UTC (permalink / raw)
To: Pascal Obry; +Cc: Johannes Sixt, Pascal Obry, git
In-Reply-To: <4767EE6D.5070509@obry.net>
On Tue, 18 Dec 2007, Pascal Obry wrote:
> Johannes Sixt a écrit :
> > that we need another diff option for it. Ok, on my keyboard 0 is typed
> > with the right hand, and 1 with the left hand, but... ??
>
> Because you just did not read my follow-up message :)
>
> I need this has I do not have the way to change the server applying the
> patch. So nothing wrong with my hands or fingers :)
Well, we'd also need something like that for doing recursive diffs of
submodules (since then we'd want to do the internal diff with the
submodule name appended to the prefix), so I do think this whole
"--prefix" makes sense.
But I obviously think the version by Dscho is better (exactly because it's
*not* enough to just clear the name prefix entirely), although I think
that one is broken too - using ':' to separate the prefixes is *not*
acceptable, since ':' is very possibly part of the prefix.
So I think you'd need separate arguments for the from/to prefixes, and not
try to shoehorn it into one argument. With possibly some simple form to
say "no prefix". So maybe something like
--src-prefix=<string> // default "a/"
--dst-prefix=<string> // default "b/"
--no-prefix // shorthand for --src-prefix="" --dst-prefix=""
would work for everybody?
Linus
^ permalink raw reply
* Re: kha/safe and kha/experimental updated
From: Catalin Marinas @ 2007-12-18 16:52 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Karl Hasselström, David Kågedal, git
In-Reply-To: <m3hcigot3h.fsf@roke.D-201>
On 18/12/2007, Jakub Narebski <jnareb@gmail.com> wrote:
> "Catalin Marinas" <catalin.marinas@gmail.com> writes:
>
> > Thanks again for maintaining these branches.
> >
> > On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> > > git://repo.or.cz/stgit/kha.git safe
>
> > > Remove "stg resolved"
> >
> > I'd like to keep this command. git-mergetool doesn't support the tool
> > I use (emacs + ediff and more stgit-specific file extensions like
> > current, patch etc.). I also don't find 'git add' to be meaningful for
> > marking a conflict as solved.
>
> I also would like to have this command kept (and shown in 'stg help'!).
> Contrary to 'git add' it can check and add to index / update index
> only for files with conflict; we have -r (ancestor|current|patched)
> to choose one side, and we could add --check to check if there are
> no conflict markers with files (useful with -a/--all).
I'd also like to re-add the stgit.keeporig option and additional
functionality so that the *.{ancestor,current,patched} can be left in
the working tree. Some people might use them when manually fixing
conflicts (I have a look at them from time to time when the emacs +
ediff shows a hard to understand conflict).
--
Catalin
^ permalink raw reply
* Re: [PATCH] Add format-patch option --no-name-prefix.
From: Pascal Obry @ 2007-12-18 16:54 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Johannes Sixt, Pascal Obry, git
In-Reply-To: <alpine.LFD.0.9999.0712180840060.21557@woody.linux-foundation.org>
Linus Torvalds a écrit :
> --src-prefix=<string> // default "a/"
> --dst-prefix=<string> // default "b/"
> --no-prefix // shorthand for --src-prefix="" --dst-prefix=""
>
> would work for everybody?
Fine with me.
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: preventing a push
From: Christoph Duelli @ 2007-12-18 16:53 UTC (permalink / raw)
To: Linus Torvalds, git
In-Reply-To: <alpine.LFD.0.9999.0712180819480.21557@woody.linux-foundation.org>
Linus Torvalds schrieb:
>
> On Tue, 18 Dec 2007, Christoph Duelli wrote:
>> Is there a (recommended?) way to prevent accidental pushing (or pulling) from
>> one repository into another (like the level command from bk days)?
>
> I used BK for years, never knew about any level thing. I assume that was
> some way to introduce an "ordering" between repositories, where you could
> only push/pull in a controlled manner?
Indeed, you can not move changes to a repo with a lower level.
> There's no obvious way to do exactly that, but the hooks git has may or
> may not be ok. For example, if you want to disallow pushing into some
> repository entirely (because you _only_ expect people to pull into it),
> you should be able to just make a "pre-receive" hook that always returns
> false. See Documentation/hooks.txt.
Ok, I will give hooks a try here.
> NOTE! There is no way to figure out what the pushing repository status is,
> which is why I say there is no way to do a "level"-equivalent thing
> (assuming I guessed what "level" does from the name). However, depending
> on how you allow people to access the machine, the hook obviously can look
> at things like $USER or other environment variables (ie you could make it
> look at what machine the user connected from etc).
>
> But nothing really ever identifies the source repository (on a "git
> level") for a push: as far as git is concerned, all repositories are
> equal, and your hooks would invariably have to use non-git knowledge to
> figure out whether some operation should be allowed or not.
Perhaps it would be more git-like to use branches here. An accidental
merge from a branch to another is probably less likely than an
accidental push.
Thanks, and best regards
Christoph
^ permalink raw reply
* Re: [PATCH] Teach diff machinery to display other prefixes than "a/" and "b/"
From: Johannes Schindelin @ 2007-12-18 16:58 UTC (permalink / raw)
To: Pascal Obry; +Cc: Pascal Obry, git
In-Reply-To: <4767F935.8060207@obry.net>
Hi,
On Tue, 18 Dec 2007, Pascal Obry wrote:
> Johannes Schindelin a ?crit :
> > With the new option "--prefix=<prefix1>[:<prefix2>]" you can change
> > the shown prefix, or suppress it (by specifying the empty string).
>
> Why not ? But do you have a motivation for this change ? I mean why
> would you want to use a completely different prefix ?
I vaguely remember that somebody once asked for something a la GNU patch's
-B option.
Besides, why restrict ourselves? I mean, really, my patch only adds 6/4
added/removed lines relative to your patch (part of which stems from the
fact that I did not forget the "diff --git" line). Why not take the added
value virtually for free?
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] Teach diff machinery to display other prefixes than "a/" and "b/"
From: Matthieu Moy @ 2007-12-18 17:02 UTC (permalink / raw)
To: Pascal Obry; +Cc: Johannes Schindelin, Pascal Obry, git
In-Reply-To: <4767F935.8060207@obry.net>
Pascal Obry <pascal@obry.net> writes:
> Johannes Schindelin a écrit :
>> With the new option "--prefix=<prefix1>[:<prefix2>]" you can change
>> the shown prefix, or suppress it (by specifying the empty string).
>
> Why not ? But do you have a motivation for this change ? I mean why
> would you want to use a completely different prefix ?
It can make sense when you send the patch to someone who might not
know the context in which you wrote the patch, and who's not using
git. Then
--- your-version/foo.c
+++ my-version/foo.c
can be more expressive than a/ and b/. Some people like to have orig/
and mod/ also.
I can live without --prefix=... option, but doing it general at once
is a good idea, since adding this backward-compatibly on top of your
patch would mean having several redundant options.
--
Matthieu
^ permalink raw reply
* Re: [PATCH] Add format-patch option --no-name-prefix.
From: Johannes Schindelin @ 2007-12-18 17:06 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Pascal Obry, Johannes Sixt, Pascal Obry, git
In-Reply-To: <alpine.LFD.0.9999.0712180840060.21557@woody.linux-foundation.org>
Hi,
On Tue, 18 Dec 2007, Linus Torvalds wrote:
> But I obviously think the version by Dscho is better (exactly because it's
> *not* enough to just clear the name prefix entirely), although I think
> that one is broken too - using ':' to separate the prefixes is *not*
> acceptable, since ':' is very possibly part of the prefix.
>
> So I think you'd need separate arguments for the from/to prefixes, and not
> try to shoehorn it into one argument. With possibly some simple form to
> say "no prefix". So maybe something like
>
> --src-prefix=<string> // default "a/"
> --dst-prefix=<string> // default "b/"
> --no-prefix // shorthand for --src-prefix="" --dst-prefix=""
>
> would work for everybody?
If this is preferred, please squash this:
-- snipsnap --
Documentation/diff-options.txt | 11 ++++++++---
diff.c | 24 ++++++++++++++----------
2 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 672a2d0..0d3dccc 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -211,9 +211,14 @@ endif::git-format-patch[]
--no-ext-diff::
Disallow external diff drivers.
---prefix=<prefix1>[:<prefix2>]::
- Show the given path prefixes instead of "a/" and "b/". Leave
- it empty to show no prefix at all.
+--src-prefix <prefix>::
+ Show the given source prefix instead of "a/".
+
+--dst-prefix <prefix>::
+ Show the given destination prefix instead of "b/".
+
+--no-prefix::
+ Do not show any source or destination prefix.
For more detailed explanation on these common options, see also
link:diffcore.html[diffcore documentation].
diff --git a/diff.c b/diff.c
index 095bbb5..9bc5fea 100644
--- a/diff.c
+++ b/diff.c
@@ -2317,16 +2317,20 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
else if (40 < options->abbrev)
options->abbrev = 40;
}
- else if (!strcmp(arg, "--prefix=")) {
- char *colon = strchr(arg + 9, ':');
- options->a_prefix = arg + 9;
- if (colon) {
- *colon = '\0';
- options->b_prefix = colon + 1;
- }
- else
- options->b_prefix = options->a_prefix;
- }
+ else if (!strcmp(arg, "--src-prefix")) {
+ if (ac < 2)
+ return error("--src-prefix needs a parameter");
+ options->a_prefix = arg + 1;
+ return 2;
+ }
+ else if (!strcmp(arg, "--dst-prefix")) {
+ if (ac < 2)
+ return error("--dst-prefix needs a parameter");
+ options->b_prefix = arg + 1;
+ return 2;
+ }
+ else if (!strcmp(arg, "--no-prefix"))
+ options->a_prefix = options->b_prefix = "";
else
return 0;
return 1;
^ permalink raw reply related
* Re: git-svn rebase issues (the commiter gets changed)
From: Kelvie Wong @ 2007-12-18 17:16 UTC (permalink / raw)
To: Eric Wong; +Cc: Junio C Hamano, git
In-Reply-To: <20071216032523.GA17666@muzzle>
On Dec 15, 2007 7:27 PM, Eric Wong <normalperson@yhbt.net> wrote:
> Sorry for the late reply, I've been all over the place lately.
>
> Kelvie Wong <kelvie@ieee.org> wrote:
>
> > Just did it again this morning, with a clean test branch:
> >
> > kelvie@mudd (text-edit) qt $ git checkout -b test git-svn
> > Switched to a new branch "test"
> > kelvie@mudd (test) qt $ touch test
> > kelvie@mudd (test) qt $ git add test
> > kelvie@mudd (test) qt $ git commit -a -m 'Test!'
> > Created commit 05c4016: Test!
> > 0 files changed, 0 insertions(+), 0 deletions(-)
> > create mode 100644 apps/qt/test
> > kelvie@mudd (test) qt $ git-cat-file commit HEAD
> > tree 867c0aa4c814542f0752b5d4c85fc96ba2279aac
> > parent 831ffbf25057ed30274d4216269c572cfce12184
> > author Kelvie Wong <Kelvie.Wong@safe.com> 1196352603 -0800
> > committer Kelvie Wong <Kelvie.Wong@safe.com> 1196352603 -0800
> >
> > Test!
> > kelvie@mudd (test) qt $ git svn rebase
> > <snip>
> > HEAD is now at 7319c2a... (svn commit message)
> > kelvie@mudd (test) qt $ git-cat-file commit HEAD
> > tree 4edacbd41af76ac243099467b33350887c0fb03d
> > parent 7319c2a810554aab25a688bcc2b16fc60529b59d
> > author Kelvie Wong <Kelvie.Wong@safe.com> 1196352603 -0800
> > committer ogibbins <ogibbins@e2d93294-a71b-0410-9dca-e2ea525a67c9>
> > 1196346907 +0000
> >
> > Test!
> > kelvie@mudd (test) qt $ git --version
> > git version 1.5.3.6.736.gb7f30
> >
> > And again, the committer of a local commit gets changed.
> >
> > Now, this part is more interesting:
> >
> > kelvie@mudd (test) qt $ git checkout working
> > Switched to branch "working"
> > kelvie@mudd (working) qt $ git svn rebase
> > <no fetch, just a checkout and rebase>
> >
> > And when I cat-file the commit, this time it's preserved. Wild guess
> > here (this behaviour seems kind of inconsistent), but it has to do
> > with the transition between fetch and rebase? Or is this a bug in
> > git-rebase somewhere?
>
> Ah, it looks like a bug in git-svn. The following should fix it:
>
> From 84e99bffc72c10ec7db6d5ae7af6a795b75ef724 Mon Sep 17 00:00:00 2001
> From: Eric Wong <normalperson@yhbt.net>
> Date: Sat, 15 Dec 2007 19:08:22 -0800
> Subject: [PATCH] git-svn: avoid leaving leftover committer/author info in rebase
>
> We set the 6 environment variables for controlling
> committer/author email/name/time for every commit.
>
> We do this in the parent process to be passed to
> git-commit-tree, because open3() doesn't afford us the control
> of doing it only in the child process. This means we leave them
> hanging around in the main process until the next revision comes
> around and all 6 environment variables are overwridden again.
>
> Unfortunately, for the last commit, leaving them hanging around
> means the git-rebase invocation will pick it up, rewriting the
> rebased commit with incorrect author information. This should fix
> it.
>
> Signed-off-by: Eric Wong <normalperson@yhbt.net>
> ---
> git-svn.perl | 50 +++++++++++++++++++++++++++++++++++++++-----------
> 1 files changed, 39 insertions(+), 11 deletions(-)
>
> diff --git a/git-svn.perl b/git-svn.perl
> index d411a34..7cd62fc 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -2052,18 +2052,16 @@ sub full_url {
> $self->{url} . (length $self->{path} ? '/' . $self->{path} : '');
> }
>
> -sub do_git_commit {
> - my ($self, $log_entry) = @_;
> - my $lr = $self->last_rev;
> - if (defined $lr && $lr >= $log_entry->{revision}) {
> - die "Last fetched revision of ", $self->refname,
> - " was r$lr, but we are about to fetch: ",
> - "r$log_entry->{revision}!\n";
> - }
> - if (my $c = $self->rev_map_get($log_entry->{revision})) {
> - croak "$log_entry->{revision} = $c already exists! ",
> - "Why are we refetching it?\n";
> +
> +sub set_commit_header_env {
> + my ($log_entry) = @_;
> + my %env;
> + foreach my $ned (qw/NAME EMAIL DATE/) {
> + foreach my $ac (qw/AUTHOR COMMITTER/) {
> + $env{"GIT_${ac}_${ned}"} = $ENV{"GIT_${ac}_${ned}"};
> + }
> }
> +
> $ENV{GIT_AUTHOR_NAME} = $log_entry->{name};
> $ENV{GIT_AUTHOR_EMAIL} = $log_entry->{email};
> $ENV{GIT_AUTHOR_DATE} = $ENV{GIT_COMMITTER_DATE} = $log_entry->{date};
> @@ -2074,7 +2072,36 @@ sub do_git_commit {
> $ENV{GIT_COMMITTER_EMAIL} = (defined $log_entry->{commit_email})
> ? $log_entry->{commit_email}
> : $log_entry->{email};
> + \%env;
> +}
>
> +sub restore_commit_header_env {
> + my ($env) = @_;
> + foreach my $ned (qw/NAME EMAIL DATE/) {
> + foreach my $ac (qw/AUTHOR COMMITTER/) {
> + my $k = "GIT_${ac}_${ned}";
> + if (defined $env->{$k}) {
> + $ENV{$k} = $env->{$k};
> + } else {
> + delete $ENV{$k};
> + }
> + }
> + }
> +}
> +
> +sub do_git_commit {
> + my ($self, $log_entry) = @_;
> + my $lr = $self->last_rev;
> + if (defined $lr && $lr >= $log_entry->{revision}) {
> + die "Last fetched revision of ", $self->refname,
> + " was r$lr, but we are about to fetch: ",
> + "r$log_entry->{revision}!\n";
> + }
> + if (my $c = $self->rev_map_get($log_entry->{revision})) {
> + croak "$log_entry->{revision} = $c already exists! ",
> + "Why are we refetching it?\n";
> + }
> + my $old_env = set_commit_header_env($log_entry);
> my $tree = $log_entry->{tree};
> if (!defined $tree) {
> $tree = $self->tmp_index_do(sub {
> @@ -2089,5 +2116,6 @@ sub do_git_commit {
> defined(my $pid = open3(my $msg_fh, my $out_fh, '>&STDERR', @exec))
> or croak $!;
> print $msg_fh $log_entry->{log} or croak $!;
> + restore_commit_header_env($old_env);
> unless ($self->no_metadata) {
> print $msg_fh "\ngit-svn-id: $log_entry->{metadata}\n"
> \ No newline at end of file
> --
> Eric Wong
>
kelvie@mudd (test) qt $ git cat-file commit HEAD
tree 20adec5e5b186ea4360b5866586af7cfa5e3d88a
parent 15f3ab6b0c667b4900d5a7be0e80ef4e20b5bac2
author Kelvie Wong <Kelvie.Wong@safe.com> 1197990883 -0800
committer Kelvie Wong <Kelvie.Wong@safe.com> 1197990883 -0800
test
kelvie@mudd (test) qt $ git svn rebase
<snip>
HEAD is now at ebd86b2... SnappingFactory: Fixed bizarre omission from
previous commit for this bug. (PR#12838) <omg>
Applying test
kelvie@mudd (test) qt $ git cat-file commit HEAD
tree 2f242f83496f707758a863634a803f60a77c2786
parent ebd86b245505a18603fd114862eb97ea9609d7e1
author Kelvie Wong <Kelvie.Wong@safe.com> 1197990883 -0800
committer Kelvie Wong <Kelvie.Wong@safe.com> 1197998130 +0000
test
kelvie@mudd (test) qt $ git --version
git version 1.5.4.rc0.57.g4d99a
kelvie@mudd (test) qt $ git svn --version
Use of uninitialized value in pattern match (m//) at /usr/bin/git-svn line 202.
git-svn version 1.5.4.rc0.57.g4d99a (svn 1.4.4)
kelvie@mudd (test) qt $
Looks like it did it. Thanks for the fix.
--
Kelvie Wong
^ permalink raw reply
* log/show: relative pathnames do not work in rev:path
From: Alex Riesen @ 2007-12-18 17:33 UTC (permalink / raw)
To: git
Noticed by a collegue of mine. Consider:
$ cd $GIT/t
$ git show 570f32266:t/test-lib.sh # works
$ git show 570f32266:test-lib.sh # does not work
$ git show 570f32266:./test-lib.sh # does not work
$ git show 570f32266:/t/test-lib.sh # does not work
Considering that the relative path names work as filters (and many
agreed on that being useful), it would be nice to allow relative
pathnames in blob specifications for git-show and git-cat-file.
(besides the colon is a good delimiter, even tab-completion works with it)
^ permalink raw reply
* Re: git-stash: RFC: Adopt the default behavior to other commands
From: Sergei Organov @ 2007-12-18 17:40 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Andreas Ericsson, Jakub Narebski, Sebastian Harl, Junio C Hamano,
Benoit Sigoure, git
In-Reply-To: <Pine.LNX.4.64.0712181610080.23902@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Hi,
>
> On Tue, 18 Dec 2007, Andreas Ericsson wrote:
>
>> Jakub Narebski wrote:
>>
>> > Andreas Ericsson <ae@op5.se> writes:
>> >
>> > > My point is that it would be nice if all git commands that actually
>> > > manipulate objects (create/delete/modify) had a safe default, and
>> > > that experienced users such as yourself could endure the
>> > > insufferable agony of retraining your fingers to type five more
>> > > chars so that people won't have to get bitten by surprises.
>> >
>> > Also for "git commit"?
>>
>> git commit has a very safe default; It runs "git status" and exits.
>
> Not in my universe. It starts an editor, and then commits what I
> staged.
... allowing you to abort the operation by means of providing empty
commit message. On the other hand, "git stash" has immediate effect, so
it's somewhat more dangerous. Just to be picky, anyway.
--
Sergei.
^ permalink raw reply
* Re: log/show: relative pathnames do not work in rev:path
From: Jakub Narebski @ 2007-12-18 17:50 UTC (permalink / raw)
To: Alex Riesen; +Cc: git
In-Reply-To: <20071218173321.GB2875@steel.home>
Alex Riesen <raa.lkml@gmail.com> writes:
> Noticed by a collegue of mine. Consider:
>
> $ cd $GIT/t
> $ git show 570f32266:t/test-lib.sh # works
> $ git show 570f32266:test-lib.sh # does not work
> $ git show 570f32266:./test-lib.sh # does not work
> $ git show 570f32266:/t/test-lib.sh # does not work
>
> Considering that the relative path names work as filters (and many
> agreed on that being useful), it would be nice to allow relative
> pathnames in blob specifications for git-show and git-cat-file.
>
> (besides the colon is a good delimiter, even tab-completion works with it)
If you think about it a bit, relative path names nor absolute
path names does and should not work. 570f32266:t/test-lib.sh
means path t/test-lib.sh staring from 570f32266^{tree}. Where
you are in the filesystem is not important and matters not for
this syntax. Besides if you access other branch file might be
not in filesystem (deleted file, or disjoint branch with separate
contents like 'todo' or 'html' branch in git.git repository).
Besides,
$ git show 570f32266:t/test-lib.sh # works
$ git show cc5ac8b72:test-lib.sh # also works
works... but 49d8bcd7a2df5 here is SHA-1 id of a 't/' tree
(shortened output of "git rev-parse 570f32266:t").
And I think that with bash-completion from contrib you complete
correct pathnames; don't rely on filesystem pathnames completion.
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH] Add format-patch option --no-name-prefix.
From: Pascal Obry @ 2007-12-18 17:56 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Linus Torvalds, Johannes Sixt, Pascal Obry, git
In-Reply-To: <Pine.LNX.4.64.0712181703560.23902@racer.site>
Johannes Schindelin a écrit :
> If this is preferred, please squash this:
Work fine for me.
We just need a consolidated patch with proper change log.
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
* [PATCH] git show <tag>: show the tagger
From: Johannes Schindelin @ 2007-12-18 18:01 UTC (permalink / raw)
To: git, gitster
For commit objects, the Author is shown, so do the equivalent for
tag objects, too.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
I know, it's feature freeze period. But this is arguably a
usability bug.
Well, it's not _that_ serious, so it could wait for 2.0.0, too ;-)
builtin-log.c | 39 ++++++++++++++++++++++++++++++++-------
1 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index cc3cc90..c2ad863 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -244,7 +244,29 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
return cmd_log_walk(&rev);
}
-static int show_object(const unsigned char *sha1, int suppress_header)
+static void show_tagger(char *buf, int len, struct rev_info *rev)
+{
+ char *email_end, *p;
+ unsigned long date;
+ int tz;
+
+ email_end = memchr(buf, '>', len);
+ if (!email_end)
+ return;
+ p = ++email_end;
+ while (isspace(*p))
+ p++;
+ date = strtoul(p, &p, 10);
+ while (isspace(*p))
+ p++;
+ tz = (int)strtol(p, NULL, 10);
+ printf("Tagger: %.*s\nDate: %s\n",
+ email_end - buf, buf,
+ show_date(date, tz, rev->date_mode));
+}
+
+static int show_object(const unsigned char *sha1, int show_tag_object,
+ struct rev_info *rev)
{
unsigned long size;
enum object_type type;
@@ -254,11 +276,14 @@ static int show_object(const unsigned char *sha1, int suppress_header)
if (!buf)
return error("Could not read object %s", sha1_to_hex(sha1));
- if (suppress_header)
- while (offset < size && buf[offset++] != '\n') {
- int new_offset = offset;
+ if (show_tag_object)
+ while (offset < size && buf[offset] != '\n') {
+ int new_offset = offset + 1;
while (new_offset < size && buf[new_offset++] != '\n')
; /* do nothing */
+ if (!prefixcmp(buf + offset, "tagger "))
+ show_tagger(buf + offset + 7,
+ new_offset - offset - 7, rev);
offset = new_offset;
}
@@ -299,16 +324,16 @@ int cmd_show(int argc, const char **argv, const char *prefix)
const char *name = objects[i].name;
switch (o->type) {
case OBJ_BLOB:
- ret = show_object(o->sha1, 0);
+ ret = show_object(o->sha1, 0, NULL);
break;
case OBJ_TAG: {
struct tag *t = (struct tag *)o;
- printf("%stag %s%s\n\n",
+ printf("%stag %s%s\n",
diff_get_color_opt(&rev.diffopt, DIFF_COMMIT),
t->tag,
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
- ret = show_object(o->sha1, 1);
+ ret = show_object(o->sha1, 1, &rev);
objects[i].item = (struct object *)t->tagged;
i--;
break;
--
1.5.4.rc0.70.g30f7
^ permalink raw reply related
* Re: git-stash: RFC: Adopt the default behavior to other commands
From: Johannes Schindelin @ 2007-12-18 18:03 UTC (permalink / raw)
To: Sergei Organov
Cc: Andreas Ericsson, Jakub Narebski, Sebastian Harl, Junio C Hamano,
Benoit Sigoure, git
In-Reply-To: <871w9jrjdm.fsf@osv.gnss.ru>
Hi,
On Tue, 18 Dec 2007, Sergei Organov wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > On Tue, 18 Dec 2007, Andreas Ericsson wrote:
> >
> >> Jakub Narebski wrote:
> >>
> >> > Andreas Ericsson <ae@op5.se> writes:
> >> >
> >> > > My point is that it would be nice if all git commands that
> >> > > actually manipulate objects (create/delete/modify) had a safe
> >> > > default, and that experienced users such as yourself could endure
> >> > > the insufferable agony of retraining your fingers to type five
> >> > > more chars so that people won't have to get bitten by surprises.
> >> >
> >> > Also for "git commit"?
> >>
> >> git commit has a very safe default; It runs "git status" and exits.
> >
> > Not in my universe. It starts an editor, and then commits what I
> > staged.
>
> ... allowing you to abort the operation by means of providing empty
> commit message. On the other hand, "git stash" has immediate effect, so
> it's somewhat more dangerous. Just to be picky, anyway.
Sorry, I have no time for this kind of discussions.
Ciao,
Dscho
^ permalink raw reply
* [PATCH] Teach diff machinery to display other prefixes than "a/" and "b/"
From: Johannes Schindelin @ 2007-12-18 18:56 UTC (permalink / raw)
To: gitster; +Cc: Pascal Obry, Linus Torvalds, Johannes Sixt, Pascal Obry, git
In-Reply-To: <476809EA.6080608@obry.net>
With the new options "--src-prefix <prefix>", "--dst-prefix <prefix>"
and "--no-prefix", you can now control the path prefixes of the diff
machinery. These used to by hardwired to "a/" for the source prefix
and "b/" for the destination prefix.
Initial patch by Pascal Obry. Sane option names suggested by Linus.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
On Tue, 18 Dec 2007, Pascal Obry wrote:
> Johannes Schindelin a ?crit :
> > If this is preferred, please squash this:
>
> Work fine for me.
>
> We just need a consolidated patch with proper change log.
How does this grab you?
Documentation/diff-options.txt | 9 +++++++++
diff.c | 33 +++++++++++++++++++++++++--------
diff.h | 1 +
3 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 9ecc1d7..0d3dccc 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -211,5 +211,14 @@ endif::git-format-patch[]
--no-ext-diff::
Disallow external diff drivers.
+--src-prefix <prefix>::
+ Show the given source prefix instead of "a/".
+
+--dst-prefix <prefix>::
+ Show the given destination prefix instead of "b/".
+
+--no-prefix::
+ Do not show any source or destination prefix.
+
For more detailed explanation on these common options, see also
link:diffcore.html[diffcore documentation].
diff --git a/diff.c b/diff.c
index e26584c..43f62d8 100644
--- a/diff.c
+++ b/diff.c
@@ -290,9 +290,10 @@ static void emit_rewrite_diff(const char *name_a,
const char *name_b,
struct diff_filespec *one,
struct diff_filespec *two,
- int color_diff)
+ struct diff_options *o)
{
int lc_a, lc_b;
+ int color_diff = DIFF_OPT_TST(o, COLOR_DIFF);
const char *name_a_tab, *name_b_tab;
const char *metainfo = diff_get_color(color_diff, DIFF_METAINFO);
const char *fraginfo = diff_get_color(color_diff, DIFF_FRAGINFO);
@@ -309,9 +310,9 @@ static void emit_rewrite_diff(const char *name_a,
diff_populate_filespec(two, 0);
lc_a = count_lines(one->data, one->size);
lc_b = count_lines(two->data, two->size);
- printf("%s--- a/%s%s%s\n%s+++ b/%s%s%s\n%s@@ -",
- metainfo, name_a, name_a_tab, reset,
- metainfo, name_b, name_b_tab, reset, fraginfo);
+ printf("%s--- %s%s%s%s\n%s+++ %s%s%s%s\n%s@@ -",
+ metainfo, o->a_prefix, name_a, name_a_tab, reset,
+ metainfo, o->b_prefix, name_b, name_b_tab, reset, fraginfo);
print_line_count(lc_a);
printf(" +");
print_line_count(lc_b);
@@ -1212,8 +1213,8 @@ static void builtin_diff(const char *name_a,
const char *set = diff_get_color_opt(o, DIFF_METAINFO);
const char *reset = diff_get_color_opt(o, DIFF_RESET);
- a_one = quote_two("a/", name_a + (*name_a == '/'));
- b_two = quote_two("b/", name_b + (*name_b == '/'));
+ a_one = quote_two(o->a_prefix, name_a + (*name_a == '/'));
+ b_two = quote_two(o->b_prefix, name_b + (*name_b == '/'));
lbl[0] = DIFF_FILE_VALID(one) ? a_one : "/dev/null";
lbl[1] = DIFF_FILE_VALID(two) ? b_two : "/dev/null";
printf("%sdiff --git %s %s%s\n", set, a_one, b_two, reset);
@@ -1242,8 +1243,7 @@ static void builtin_diff(const char *name_a,
if ((one->mode ^ two->mode) & S_IFMT)
goto free_ab_and_return;
if (complete_rewrite) {
- emit_rewrite_diff(name_a, name_b, one, two,
- DIFF_OPT_TST(o, COLOR_DIFF));
+ emit_rewrite_diff(name_a, name_b, one, two, o);
o->found_changes = 1;
goto free_ab_and_return;
}
@@ -2020,6 +2020,9 @@ void diff_setup(struct diff_options *options)
else
DIFF_OPT_CLR(options, COLOR_DIFF);
options->detect_rename = diff_detect_rename_default;
+
+ options->a_prefix = "a/";
+ options->b_prefix = "b/";
}
int diff_setup_done(struct diff_options *options)
@@ -2291,6 +2294,20 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
else if (40 < options->abbrev)
options->abbrev = 40;
}
+ else if (!strcmp(arg, "--src-prefix")) {
+ if (ac < 2)
+ return error("--src-prefix needs a parameter");
+ options->a_prefix = arg + 1;
+ return 2;
+ }
+ else if (!strcmp(arg, "--dst-prefix")) {
+ if (ac < 2)
+ return error("--dst-prefix needs a parameter");
+ options->b_prefix = arg + 1;
+ return 2;
+ }
+ else if (!strcmp(arg, "--no-prefix"))
+ options->a_prefix = options->b_prefix = "";
else
return 0;
return 1;
diff --git a/diff.h b/diff.h
index 7e8000a..beccf85 100644
--- a/diff.h
+++ b/diff.h
@@ -69,6 +69,7 @@ struct diff_options {
const char *orderfile;
const char *pickaxe;
const char *single_follow;
+ const char *a_prefix, *b_prefix;
unsigned flags;
int context;
int break_opt;
--
1.5.4.rc0.70.g30f7
^ permalink raw reply related
* Re: [PATCH] Teach diff machinery to display other prefixes than "a/" and "b/"
From: Pascal Obry @ 2007-12-18 19:03 UTC (permalink / raw)
To: Johannes Schindelin
Cc: gitster, Linus Torvalds, Johannes Sixt, Pascal Obry, git
In-Reply-To: <Pine.LNX.4.64.0712181855020.23902@racer.site>
Johannes Schindelin a écrit :
> With the new options "--src-prefix <prefix>", "--dst-prefix <prefix>"
> and "--no-prefix", you can now control the path prefixes of the diff
> machinery. These used to by hardwired to "a/" for the source prefix
> and "b/" for the destination prefix.
>
> Initial patch by Pascal Obry. Sane option names suggested by Linus.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Thanks this looks good to me.
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: [PATCH] Teach diff machinery to display other prefixes than "a/" and "b/"
From: Linus Torvalds @ 2007-12-18 19:05 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: gitster, Pascal Obry, Johannes Sixt, Pascal Obry, git
In-Reply-To: <Pine.LNX.4.64.0712181855020.23902@racer.site>
On Tue, 18 Dec 2007, Johannes Schindelin wrote:
>
> With the new options "--src-prefix <prefix>", "--dst-prefix <prefix>"
I really would prefer "--[src|dst]-prefix=<prefix>" as a single argument.
I think that's the more common form for long arguments, isn't it (with any
short-format arguments usually using the "-L <prefix>" kind of form)?
Linus
^ permalink raw reply
* Re: [PATCH] provide advance warning of some future pack default changes
From: Jeff King @ 2007-12-18 19:30 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Junio C Hamano, Martin Langhoff, Nicolas Pitre, Joel Becker,
Jakub Narebski, git
In-Reply-To: <Pine.LNX.4.64.0712181329340.23902@racer.site>
On Tue, Dec 18, 2007 at 01:30:49PM +0000, Johannes Schindelin wrote:
> > Yes, it should be, but I think there will be a few user-visible fallouts
> > (like "--abbrev $foo" in scripts should now be "--abbrev-default $foo"
> > for safety).
>
> But we are on our way to fix this, no? IOW this warrants not a version
> bump, but an extended feature freeze/bug fix period (like Junio suggested,
> until January).
I think the resolution seems to be that we will now support "--abbrev
foo", though we didn't in the past. Because the "foo" here is optional,
the old "git log --abbrev HEAD" is ambiguous. In this case we'll see
that "HEAD" isn't a number and DWIM. But that means a script trying to
be unambiguous should use "git log --abbrev-default $foo" to make sure
that "$foo" doesn't accidentally match as a number.
So there will be user-visible changes (though I don't expect them to be
huge...there simply aren't that many variables with optional arguments).
-Peff
^ permalink raw reply
* [PATCH v4] Teach diff machinery to display other prefixes than "a/" and "b/"
From: Johannes Schindelin @ 2007-12-18 19:32 UTC (permalink / raw)
To: Linus Torvalds; +Cc: gitster, Pascal Obry, Johannes Sixt, Pascal Obry, git
In-Reply-To: <alpine.LFD.0.9999.0712181059220.21557@woody.linux-foundation.org>
With the new options "--src-prefix=<prefix>", "--dst-prefix=<prefix>"
and "--no-prefix", you can now control the path prefixes of the diff
machinery. These used to by hardwired to "a/" for the source prefix
and "b/" for the destination prefix.
Initial patch by Pascal Obry. Sane option names suggested by Linus.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
On Tue, 18 Dec 2007, Linus Torvalds wrote:
> On Tue, 18 Dec 2007, Johannes Schindelin wrote:
> >
> > With the new options "--src-prefix <prefix>", "--dst-prefix
> > <prefix>"
>
> I really would prefer "--[src|dst]-prefix=<prefix>" as a single
> argument.
>
> I think that's the more common form for long arguments, isn't it
> (with any short-format arguments usually using the "-L <prefix>"
> kind of form)?
Incidentally, this fixes src-prefix and dst-prefix (I wrote av[1]
instead of arg + 1, but forgot to commit).
So now, it is tested at least once per option.
Documentation/diff-options.txt | 9 +++++++++
diff.c | 25 +++++++++++++++++--------
diff.h | 1 +
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 9ecc1d7..1a78635 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -211,5 +211,14 @@ endif::git-format-patch[]
--no-ext-diff::
Disallow external diff drivers.
+--src-prefix=<prefix>::
+ Show the given source prefix instead of "a/".
+
+--dst-prefix=<prefix>::
+ Show the given destination prefix instead of "b/".
+
+--no-prefix::
+ Do not show any source or destination prefix.
+
For more detailed explanation on these common options, see also
link:diffcore.html[diffcore documentation].
diff --git a/diff.c b/diff.c
index e26584c..61fd492 100644
--- a/diff.c
+++ b/diff.c
@@ -290,9 +290,10 @@ static void emit_rewrite_diff(const char *name_a,
const char *name_b,
struct diff_filespec *one,
struct diff_filespec *two,
- int color_diff)
+ struct diff_options *o)
{
int lc_a, lc_b;
+ int color_diff = DIFF_OPT_TST(o, COLOR_DIFF);
const char *name_a_tab, *name_b_tab;
const char *metainfo = diff_get_color(color_diff, DIFF_METAINFO);
const char *fraginfo = diff_get_color(color_diff, DIFF_FRAGINFO);
@@ -309,9 +310,9 @@ static void emit_rewrite_diff(const char *name_a,
diff_populate_filespec(two, 0);
lc_a = count_lines(one->data, one->size);
lc_b = count_lines(two->data, two->size);
- printf("%s--- a/%s%s%s\n%s+++ b/%s%s%s\n%s@@ -",
- metainfo, name_a, name_a_tab, reset,
- metainfo, name_b, name_b_tab, reset, fraginfo);
+ printf("%s--- %s%s%s%s\n%s+++ %s%s%s%s\n%s@@ -",
+ metainfo, o->a_prefix, name_a, name_a_tab, reset,
+ metainfo, o->b_prefix, name_b, name_b_tab, reset, fraginfo);
print_line_count(lc_a);
printf(" +");
print_line_count(lc_b);
@@ -1212,8 +1213,8 @@ static void builtin_diff(const char *name_a,
const char *set = diff_get_color_opt(o, DIFF_METAINFO);
const char *reset = diff_get_color_opt(o, DIFF_RESET);
- a_one = quote_two("a/", name_a + (*name_a == '/'));
- b_two = quote_two("b/", name_b + (*name_b == '/'));
+ a_one = quote_two(o->a_prefix, name_a + (*name_a == '/'));
+ b_two = quote_two(o->b_prefix, name_b + (*name_b == '/'));
lbl[0] = DIFF_FILE_VALID(one) ? a_one : "/dev/null";
lbl[1] = DIFF_FILE_VALID(two) ? b_two : "/dev/null";
printf("%sdiff --git %s %s%s\n", set, a_one, b_two, reset);
@@ -1242,8 +1243,7 @@ static void builtin_diff(const char *name_a,
if ((one->mode ^ two->mode) & S_IFMT)
goto free_ab_and_return;
if (complete_rewrite) {
- emit_rewrite_diff(name_a, name_b, one, two,
- DIFF_OPT_TST(o, COLOR_DIFF));
+ emit_rewrite_diff(name_a, name_b, one, two, o);
o->found_changes = 1;
goto free_ab_and_return;
}
@@ -2020,6 +2020,9 @@ void diff_setup(struct diff_options *options)
else
DIFF_OPT_CLR(options, COLOR_DIFF);
options->detect_rename = diff_detect_rename_default;
+
+ options->a_prefix = "a/";
+ options->b_prefix = "b/";
}
int diff_setup_done(struct diff_options *options)
@@ -2291,6 +2294,12 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
else if (40 < options->abbrev)
options->abbrev = 40;
}
+ else if (!prefixcmp(arg, "--src-prefix="))
+ options->a_prefix = arg + 13;
+ else if (!prefixcmp(arg, "--dst-prefix="))
+ options->b_prefix = arg + 13;
+ else if (!strcmp(arg, "--no-prefix"))
+ options->a_prefix = options->b_prefix = "";
else
return 0;
return 1;
diff --git a/diff.h b/diff.h
index 7e8000a..beccf85 100644
--- a/diff.h
+++ b/diff.h
@@ -69,6 +69,7 @@ struct diff_options {
const char *orderfile;
const char *pickaxe;
const char *single_follow;
+ const char *a_prefix, *b_prefix;
unsigned flags;
int context;
int break_opt;
--
1.5.4.rc0.70.g30f7
^ permalink raw reply related
* [PATCH] Fix tests for broken sed on Leopard
From: Wincent Colaiuta @ 2007-12-18 19:45 UTC (permalink / raw)
To: git; +Cc: gitster, Wincent Colaiuta
In-Reply-To: <7vzlw7zwj8.fsf@gitster.siamese.dyndns.org>
El 18/12/2007, a las 19:29, Junio C Hamano escribió:
> Could you work it around not by changing what is tested, but by changing
> the way the result (actual and expect) are compared, please? I actually
> wanted to enhance this to test with values 1023, 2047, and 4095, and
> your change will close the door for such changes.
How about the following? This swaps in perl in place of sed, which we can
hopefully rely upon to work across platforms.
Cheers,
Wincent
-------- 8< --------
Fix tests for broken sed on Leopard
The newly-added common-tail-optimization test fails on Leopard because
the broken sed implementation bails with a spurious "unterminated
substitute pattern" error because of the length of one of the
arguments.
So use perl instead of sed, and at the same time add test cases for
1024 - 1 and 4096 - 1 as suggested by Junio.
Signed-off-by: Wincent Colaiuta <win@wincent.com>
---
t/t4024-diff-optimize-common.sh | 104 ++++++++++++++++++++++++++++++---------
1 files changed, 80 insertions(+), 24 deletions(-)
diff --git a/t/t4024-diff-optimize-common.sh b/t/t4024-diff-optimize-common.sh
index 20fe87b..84dfb05 100755
--- a/t/t4024-diff-optimize-common.sh
+++ b/t/t4024-diff-optimize-common.sh
@@ -7,28 +7,12 @@ test_description='common tail optimization'
z=zzzzzzzz ;# 8
z="$z$z$z$z$z$z$z$z" ;# 64
z="$z$z$z$z$z$z$z$z" ;# 512
-z="$z$z$z$z" ;# 2048
-z2047=$(expr "$z" : '.\(.*\)') ; #2047
-
-test_expect_success setup '
-
- echo "a$z2047" >file-a &&
- echo "b" >file-b &&
- echo "$z2047" >>file-b &&
- echo "c$z2047" | tr -d "\012" >file-c &&
- echo "d" >file-d &&
- echo "$z2047" | tr -d "\012" >>file-d &&
-
- git add file-a file-b file-c file-d &&
-
- echo "A$z2047" >file-a &&
- echo "B" >file-b &&
- echo "$z2047" >>file-b &&
- echo "C$z2047" | tr -d "\012" >file-c &&
- echo "D" >file-d &&
- echo "$z2047" | tr -d "\012" >>file-d
-
-'
+z1024="$z$z"
+z1023=$(expr "$z1024" : '.\(.*\)')
+z2048="$z1024$z1024"
+z2047=$(expr "$z2048" : '.\(.*\)')
+z4096="$z2048$z2048"
+z4095=$(expr "$z4096" : '.\(.*\)')
cat >expect <<\EOF
diff --git a/file-a b/file-a
@@ -59,11 +43,83 @@ diff --git a/file-d b/file-d
+D
EOF
-test_expect_success 'diff -U0' '
+test_expect_success 'setup (1023-char sequence)' '
+
+ echo "a$z1023" >file-a &&
+ echo "b" >file-b &&
+ echo "$z1023" >>file-b &&
+ echo "c$z1023" | tr -d "\012" >file-c &&
+ echo "d" >file-d &&
+ echo "$z1023" | tr -d "\012" >>file-d &&
+
+ git add file-a file-b file-c file-d &&
+
+ echo "A$z1023" >file-a &&
+ echo "B" >file-b &&
+ echo "$z1023" >>file-b &&
+ echo "C$z1023" | tr -d "\012" >file-c &&
+ echo "D" >file-d &&
+ echo "$z1023" | tr -d "\012" >>file-d
+
+'
+
+test_expect_success 'diff -U0 (1023-char sequence)' '
+ git diff -U0 | perl -pe "s/^index.+\n//g; s/$z1023/Z/g" >actual &&
+ diff -u expect actual
+
+'
+
+test_expect_success 'setup (2047-char sequence)' '
- git diff -U0 | sed -e "/^index/d" -e "s/$z2047/Z/g" >actual &&
+ echo "a$z2047" >file-a &&
+ echo "b" >file-b &&
+ echo "$z2047" >>file-b &&
+ echo "c$z2047" | tr -d "\012" >file-c &&
+ echo "d" >file-d &&
+ echo "$z2047" | tr -d "\012" >>file-d &&
+
+ git add file-a file-b file-c file-d &&
+
+ echo "A$z2047" >file-a &&
+ echo "B" >file-b &&
+ echo "$z2047" >>file-b &&
+ echo "C$z2047" | tr -d "\012" >file-c &&
+ echo "D" >file-d &&
+ echo "$z2047" | tr -d "\012" >>file-d
+
+'
+
+test_expect_success 'diff -U0 (2047-char sequence)' '
+
+ git diff -U0 | perl -pe "s/^index.+\n//g; s/$z2047/Z/g" >actual &&
diff -u expect actual
'
+test_expect_success 'setup (4095-char sequence)' '
+
+ echo "a$z4095" >file-a &&
+ echo "b" >file-b &&
+ echo "$z4095" >>file-b &&
+ echo "c$z4095" | tr -d "\012" >file-c &&
+ echo "d" >file-d &&
+ echo "$z4095" | tr -d "\012" >>file-d &&
+
+ git add file-a file-b file-c file-d &&
+
+ echo "A$z4095" >file-a &&
+ echo "B" >file-b &&
+ echo "$z4095" >>file-b &&
+ echo "C$z4095" | tr -d "\012" >file-c &&
+ echo "D" >file-d &&
+ echo "$z4095" | tr -d "\012" >>file-d
+
+'
+
+test_expect_success 'diff -U0 (4095-char sequence)' '
+
+ git diff -U0 | perl -pe "s/^index.+\n//g; s/$z4095/Z/g" >actual &&
+ diff -u expect actual
+
+'
test_done
--
1.5.4.rc0.68.g15eb8-dirty
^ permalink raw reply related
* [PATCH] Improved submodule merge support
From: Finn Arne Gangstad @ 2007-12-18 19:50 UTC (permalink / raw)
To: gitster, git
Currently merging submodules from a super module does not work at
all, here is an example:
$ git merge change1
Updating 41dee71..6dbd2d9
Fast forward
sub-module | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
$ git merge change2
fatal: cannot read object 4a0b570e9b7c6fd36f964eb6ef55263834462235 'sub-module'
Merge with strategy recursive failed.
$ git status
# On branch mergetest
nothing to commit (working directory clean)
$ git submodule status
4a0b570e9b7c6fd36f964eb6ef55263834462235 sub-module (undefined)
So - the merge simply failed, and git status has no clue what happened.
With the following patch, this happens instead:
$ git merge change1
Updating 41dee71..6dbd2d9
Fast forward
sub-module | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
$ git merge change2
Auto-merged sub-module
CONFLICT (submodule): Merge conflict in sub-module - needs b65e6131a2705620a0b08a4ecc44427b9059e4e3
Automatic merge failed; fix conflicts and then commit the result.
$ git status
sub-module: needs merge
# On branch mergetest
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
# unmerged: sub-module
#
no changes added to commit (use "git add" and/or "git commit -a")
$ git submodule status
11253a619a520fa4b2e2c2f83cb5c897170faafd sub-module (undefined)
4a0b570e9b7c6fd36f964eb6ef55263834462235 sub-module (undefined)
b65e6131a2705620a0b08a4ecc44427b9059e4e3 sub-module (undefined)
To resolve this:
$ cd sub-module
$ git merge b65e6131a27
$ cd ..
$ git add sub-module
$ git commit -m 'merged sub-module blablabla'
$ git submodule status
eb66300641185297648b2a71e41a66b2053fdae0 sub-module (undefined)
So it actually works in some sense, and you see what you need to merge
aftwards in the submodule.
- Finn Arne
-- >8 --
Improved submodule merge support
When merging conflicting submodule changes from a supermodule, generate
a conflict message saying what went wrong. Also leave the tree in a state
where git status shows the conflict, and git submodule status gives the user
enough information to do the merge manally. Previously this would just fail.
Signed-off-by: Finn Arne Gangstad <finnag@pvv.org>
---
merge-recursive.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 2a58dad..33ccc40 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -549,6 +549,10 @@ static void update_file_flags(const unsigned char *sha,
void *buf;
unsigned long size;
+ if (S_ISGITLINK(mode))
+ die("cannot read object %s '%s': It is a submodule!",
+ sha1_to_hex(sha), path);
+
buf = read_sha1_file(sha, &type, &size);
if (!buf)
die("cannot read object %s '%s'", sha1_to_hex(sha), path);
@@ -1463,10 +1467,13 @@ static int process_entry(const char *path, struct stage_data *entry,
mfi = merge_file(&o, &a, &b,
branch1, branch2);
+ clean_merge = mfi.clean;
if (mfi.clean)
update_file(1, mfi.sha, mfi.mode, path);
+ else if (S_ISGITLINK(mfi.mode))
+ output(1, "CONFLICT (submodule): Merge conflict in %s "
+ "- needs %s", path, sha1_to_hex(b.sha1));
else {
- clean_merge = 0;
output(1, "CONFLICT (%s): Merge conflict in %s",
reason, path);
--
1.5.4.rc0.67.gf9c5
^ permalink raw reply related
* Re: [PATCH v4] Teach diff machinery to display other prefixes than "a/" and "b/"
From: Linus Torvalds @ 2007-12-18 19:55 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: gitster, Pascal Obry, Johannes Sixt, Pascal Obry, git
In-Reply-To: <Pine.LNX.4.64.0712181930130.23902@racer.site>
On Tue, 18 Dec 2007, Johannes Schindelin wrote:
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Thanks,
Linus
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox