* Re: Switching from CVS to GIT
From: Eli Zaretskii @ 2007-10-16 12:53 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: ae, barkalow, raa.lkml, tsuna, git
In-Reply-To: <Pine.LNX.4.64.0710161324490.25221@racer.site>
> Date: Tue, 16 Oct 2007 13:29:41 +0100 (BST)
> From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> cc: Andreas Ericsson <ae@op5.se>, barkalow@iabervon.org, raa.lkml@gmail.com,
> tsuna@lrde.epita.fr, git@vger.kernel.org
>
> > > removed: README
> > > untracked: readme
> >
> > This is a non-issue, then: Windows filesystems are case-preserving, so
> > if `README' became `readme', someone deliberately renamed it, in which
> > case it's okay for git to react as above.
>
> No, it is not. On FAT filesystems, for example, I experienced Windows
> happily naming a file "head" which was created under then name "HEAD".
What program did that, and how did you see that the file was named
"head" instead of "HEAD"? (The latter question is because Explorer,
for example, does not show the file names exactly like they are
written in the directory, it capitalises them. But this is
application-level code; in the directory the file names are written
like you gave them in the argument to whatever "create file" API you
used.
> No. It can also be the output of a program which deletes the file first,
> and then (since the filesystem is so "conveniently" case insensitive)
> creates it again, with a lowercase filename.
>
> And don't you tell me that there are no such programs. I have to use
> them, and they are closed source.
Can you name them?
> > Something for Windows users to decide, I guess. It's not hard to
> > refactor this, it just needs a motivated volunteer.
>
> You?
Maybe some day.
> > Unless that 10K is a typo and you really meant 100K, I don't think 10K
> > files should take several seconds to scan on Windows. I just tried
> > "find -print" on a directory with 32K files in 4K subdirectories, and
> > it took 8 sec elapsed with a hot cache. So 10K files should take at
> > most 2 seconds, even without optimizing file traversal code. Doing
> > the same with native Windows system calls ("dir /s") brings that down
> > to 4 seconds for 32K files.
>
> On Linux, I would have hit Control-C already. Such an operation typically
> takes less than 0.1 seconds.
We were not comparing Linux with Windows, we were talking about
Windows user experience. On Windows 4 seconds is not too long.
^ permalink raw reply
* Re: Switching from CVS to GIT
From: Johannes Schindelin @ 2007-10-16 12:39 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Daniel Barkalow, raa.lkml, ae, tsuna, git
In-Reply-To: <E1IhgT2-0000bg-O6@fencepost.gnu.org>
Hi,
[culled make-w32, as per explicit request]
On Tue, 16 Oct 2007, Eli Zaretskii wrote:
> > Date: Tue, 16 Oct 2007 01:56:46 -0400 (EDT)
> > From: Daniel Barkalow <barkalow@iabervon.org>
> > cc: raa.lkml@gmail.com, Johannes.Schindelin@gmx.de, ae@op5.se,
> > tsuna@lrde.epita.fr, git@vger.kernel.org, make-w32@gnu.org
> >
> > Ah, that's helpful. We don't actually care too much about the
> > particular info in stat; we just want to know quickly if the file has
> > changed, so we can hash only the ones that have been touched and get
> > the actual content changes.
>
> As I wrote in my other message, using native APIs improves performance
> by at least a factor of two.
Somehow this does not appeal to my "portability is good" side. You know,
if we had to do such trickeries for every platform we support, we'd soon
be as big as Subversion *cough*.
For me, this is the most annoying part about programming Win32. They went
out of their way to make it incompatible with everything else, and as a
consequence it is a PITA to maintain crossplatform programs.
> > The tricky thing is that, while the optimization process is running,
> > other programs may be reading the database, so (1) the files that are
> > no longer needed, because better-optimized versions are in place, may
> > be open in another task
>
> Is this because another user might be accessing the database, or are
> there other popular use cases that cause this? If the former, then this
> is not terribly important on Windows, since the situation when more than
> one user is logged and actively works is quite rare, basically limited
> to some scheduled task (the equivalent of a cron job) running for some
> user while another one is logged in interactively.
Quite to the contrary. Explorer often accesses files it should not lock.
On the machine I test msysGit on, this is the most common reason for a
test case to fail: it cannot delete the temporary directory, which
_should_ be unused. Indeed, a second after that, it _is_ unused.
Ciao,
Dscho
^ permalink raw reply
* Re: Switching from CVS to GIT
From: Peter Karlsson @ 2007-10-16 12:38 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Eli Zaretskii, Andreas Ericsson, barkalow, raa.lkml, tsuna, git
In-Reply-To: <Pine.LNX.4.64.0710161324490.25221@racer.site>
> No, it is not. On FAT filesystems, for example, I experienced Windows
> happily naming a file "head" which was created under then name "HEAD".
If you create a file name with only capital letters, I believe Explorer
and the file browser will display the name with an initial capital, and
the rest lowercase, or in all lowercase. IIRC, this is because such a
file is saved with only an MS-DOS name and no LFN entry, and those have
special rules to avoid them being displayed in all-uppercase.
I believe it is possible to create a LFN entry for such a file, but I
can't remember right now how to do it.
--
\\// Peter - http://www.softwolves.pp.se/
^ permalink raw reply
* Problem with git-svnimport
From: VAUCHER Laurent @ 2007-10-16 12:30 UTC (permalink / raw)
To: git
Hi.
Trying to convert a svn repository to git, I encountered the following
error:
Use of uninitialized value in hash element at /usr/bin/git-svnimport
line 534.
Line 534 reads:
my $gitrev = $branches{$srcbranch}{$therev};
I have installed packages git-core and git-svn on Ubuntu. These
package have versions: "1:1.5.2.5-2-feisty1"
The tool seems to choke on tags or branches with special characters
(underscore, for instance).
Laurent.
^ permalink raw reply
* Re: Switching from CVS to GIT
From: Johannes Schindelin @ 2007-10-16 12:33 UTC (permalink / raw)
To: Steffen Prohaska
Cc: Git Mailing List, Eli Zaretskii, Daniel Barkalow, Alex Riesen,
tsuna, Andreas Ericsson
In-Reply-To: <2EA3BEC9-5B13-44D3-B190-CA77499F642C@zib.de>
Hi,
[culled make-w32 list by explicit request]
On Tue, 16 Oct 2007, Steffen Prohaska wrote:
> On Oct 16, 2007, at 7:14 AM, Andreas Ericsson wrote:
>
> > Eli Zaretskii wrote:
> > > > Date: Mon, 15 Oct 2007 20:45:02 -0400 (EDT)
> > > > From: Daniel Barkalow <barkalow@iabervon.org>
> > > > cc: Alex Riesen <raa.lkml@gmail.com>, Johannes.Schindelin@gmx.de,
> > > > ae@op5.se, tsuna@lrde.epita.fr, git@vger.kernel.org,
> > > > make-w32@gnu.org
> > > >
> > > > I believe the hassle is that readdir doesn't necessarily report a
> > > > README in a directory which is supposed to have a README, when it
> > > > has a readme instead.
> > > Sorry I'm asking potentially stupid questions out of ignorance: why
> > > would you want readdir to return `README' when you have `readme'?
> >
> > Because it might have been checked in as README, and since git is case
> > sensitive that is what it'll think should be there when it reads the
> > directories. If it's not, users get to see
> >
> > removed: README
> > untracked: readme
> >
> > and there's really no easy way out of this one, since users on a case-
> > sensitive filesystem might be involved in this project too, so it
> > could be an intentional rename, but we don't know for sure. Just
> > clobbering the in-git file is wrong, but overwriting a file on disk is
> > wrong too. git tries hard to not ever lose any data for the user.
>
> Maybe we need a configuration similar to core.autocrlf (which controls
> newline conversion) to control filename comparison and normalization?
>
> Most obviously for the case (in-)sensitivity on Windows, but I also
> remember the unicode normalization happening on Mac's HFS filesystem
> that caused trouble in the past.
Robin Rosenberg has some preliminary code for that. The idea is to wrap
all filesystem operations in cache.h, and do a filename normalisation
first.
Ciao,
Dscho
^ permalink raw reply
* Re: Switching from CVS to GIT
From: Johannes Schindelin @ 2007-10-16 12:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Andreas Ericsson, barkalow, raa.lkml, tsuna, git
In-Reply-To: <E1Ihfrl-0007w1-3I@fencepost.gnu.org>
Hi,
[by explicit request culling make-w32 from the Cc list]
On Tue, 16 Oct 2007, Eli Zaretskii wrote:
> > Date: Tue, 16 Oct 2007 07:14:56 +0200
> > From: Andreas Ericsson <ae@op5.se>
> > CC: Daniel Barkalow <barkalow@iabervon.org>, raa.lkml@gmail.com,
> > Johannes.Schindelin@gmx.de, tsuna@lrde.epita.fr, git@vger.kernel.org,
> > make-w32@gnu.org
> >
> > > Sorry I'm asking potentially stupid questions out of ignorance: why
> > > would you want readdir to return `README' when you have `readme'?
> > >
> >
> > Because it might have been checked in as README, and since git is case
> > sensitive that is what it'll think should be there when it reads the
> > directories. If it's not, users get to see
> >
> > removed: README
> > untracked: readme
>
> This is a non-issue, then: Windows filesystems are case-preserving, so
> if `README' became `readme', someone deliberately renamed it, in which
> case it's okay for git to react as above.
No, it is not. On FAT filesystems, for example, I experienced Windows
happily naming a file "head" which was created under then name "HEAD".
This is the single reason why I cannot have non-bare repositories on a USB
stick.
> > could be an intentional rename, but we don't know for sure.
>
> It _must_ have been an intentional rename.
No. It can also be the output of a program which deletes the file first,
and then (since the filesystem is so "conveniently" case insensitive)
creates it again, with a lowercase filename.
And don't you tell me that there are no such programs. I have to use
them, and they are closed source.
Sigh.
> > To be honest though, there are so many places which do the
> > readdir+stat that I don't think it'd be worth factoring it out
>
> Something for Windows users to decide, I guess. It's not hard to
> refactor this, it just needs a motivated volunteer.
You?
> > I *think* (correct me if I'm wrong) that git is still faster
> > than a whole bunch of other scm's on windows, but to one who's used to
> > its performance on Linux that waiting several seconds to scan 10k files
> > just feels wrong.
>
> Unless that 10K is a typo and you really meant 100K, I don't think 10K
> files should take several seconds to scan on Windows. I just tried
> "find -print" on a directory with 32K files in 4K subdirectories, and
> it took 8 sec elapsed with a hot cache. So 10K files should take at
> most 2 seconds, even without optimizing file traversal code. Doing
> the same with native Windows system calls ("dir /s") brings that down
> to 4 seconds for 32K files.
On Linux, I would have hit Control-C already. Such an operation typically
takes less than 0.1 seconds.
> On the other hand, what packages have 100K files?
Mozilla, KDE, OpenOffice.org, X.org, ....
Ciao,
Dscho
^ permalink raw reply
* Re: should git command and git-command be equivalent?
From: David Symonds @ 2007-10-16 12:28 UTC (permalink / raw)
To: Matthieu Moy; +Cc: franky, git
In-Reply-To: <vpqk5pnmoah.fsf@bauges.imag.fr>
On 16/10/2007, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
> "franky" <yinping@kooxoo.com> writes:
>
> >> Also, you can use aliases (for example, I type "git st" to do "git
> >> status") with "git whatever", but not with "git-whatever" (unless you
> >> define the alias in your shell).
> > I try "git st", but it complains "git: 'st' is not a git-command".
>
> Sure, I'm talking about aliases, so what I meant is that I had
>
> [alias]
> st = status
>
> in ~/.gitconfig.
If you use the contrib/completion/git-completion.bash script, you can
type "git st<TAB>", and it'll complete it for you. Well, it did, until
git-stash came along and ruined it...
At any rate, the bash completion also completes things like branch
names, which can be immensely helpful.
Dave.
^ permalink raw reply
* Re: Switching from CVS to GIT
From: Eli Zaretskii @ 2007-10-16 12:18 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy
Cc: prohaska, git, raa.lkml, ae, tsuna, Johannes.Schindelin
In-Reply-To: <fcaeb9bf0710160309y51101fbaicae463a10612010c@mail.gmail.com>
> Date: Tue, 16 Oct 2007 17:09:08 +0700
> From: "Nguyen Thai Ngoc Duy" <pclouds@gmail.com>
> Cc: prohaska@zib.de, git@vger.kernel.org, raa.lkml@gmail.com, ae@op5.se,
> tsuna@lrde.epita.fr, Johannes.Schindelin@gmx.de
>
> > Where can one find this port of busybox's ash?
> >
>
> http://repo.or.cz/w/git/pclouds.git?a=shortlog;h=gitbox
>
> In directory box/shell.
Thanks!
^ permalink raw reply
* RE: Is there any plan to support partial checkout or submoudule improvement?
From: franky @ 2007-10-16 11:53 UTC (permalink / raw)
To: 'Johannes Schindelin'; +Cc: 'Lars Hjemli', git
In-Reply-To: <Pine.LNX.4.64.0710161158350.25221@racer.site>
> [please do not top post. Only keep the parts of the original message that
> you are responding to, and put your answers just below. It is a matter of
> simple economy: it takes you just a couple of minutes, but spares those
> "millions" of readers the minutes to understand what you're talking about.
> In addition, it is a matter of politeness.]
Thanks for the hint, and I have corrected this.
> On Tue, 16 Oct 2007, franky wrote:
>
> > I want a single "git-pull" to deploy a new version and a
> > single "git-reset" to back to versions before [on partial checkouts]
>
> You are talking as if your partial checkout was a project in its own
> right. Then make it so. Do not use a partial checkout, but make that a
> submodule.
As I said in the first email, the submodule way suffers from the multiple
commit problem: src and bin as two submodules of project, three commits (for
the 3 dirs separately) are needed when src directory changes and compiled
binaries being put in bin directory. It's annoying to have to give 3 commit
logs.
franky
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* RE: Is there any plan to support partial checkout or submoudule improvement?
From: franky @ 2007-10-16 11:45 UTC (permalink / raw)
To: 'Lars Hjemli'; +Cc: git
In-Reply-To: <8c5c35580710160350h53a7b5c4k374067372d4aac1d@mail.gmail.com>
> The <revspec> can be a tag. So you can easily create a wrapper script
> to allow such things as
>
> $ ./deploy.sh v1.2.3
> $ ./deploy.sh HEAD
> $ ./deploy.sh master
> $ ./deploy.sh <sha1>
But it is an online services, I must take care, so I prefer the incremental
update to avoid overwriting deployment directory fully each time. Another
consideration, Full update also introduces the busy network traffic.
franky
^ permalink raw reply
* Re: [PATCH 6/7] Bisect: factorise "bisect_{bad,good,dunno}" into "bisect_state".
From: Johannes Schindelin @ 2007-10-16 11:20 UTC (permalink / raw)
To: Christian Couder; +Cc: Junio Hamano, git
In-Reply-To: <200710160828.05137.chriscool@tuxfamily.org>
Hi,
[finally, a technical argument on "dunno". Maybe we really need
git-bikeshed@vger.kernel.org? ;-)]
On Tue, 16 Oct 2007, Christian Couder wrote:
> Le lundi 15 octobre 2007, Johannes Schindelin a ?crit :
> >
> > On Mon, 15 Oct 2007, Christian Couder wrote:
> > >
> > > But the new "bisect_state" takes one more argument, because the first
> > > one must be "good" "bad" or "dunno".
> > >
> > > So when there is only one argument HEAD is used, and when there are
> > > 2 arguments, $2 is used as the good|bad|dunno rev.
> >
> > Ah, that explains it! But do you not need to do
> > "2,bad|2,good|2,dunno" in that case? Or even better: "2,*"?
>
> Perhaps it would be an improvement at least in speed for "2,good" or
> "2,dunno".
I see: the later case catches them. Colour me satisfied with your patch.
> I wanted to keep exactly the same processing as there was before, in case
> something like "git bisect good v1.5.3.3..v1.5.3.4" was supported. But it
> seems it doesn't work. I don't know if it's a bug or a feature.
I think v1.5.3.3..v1.5.3.4 expands to ^v1.5.3.3 v1.5.3.4, which might
explain what you are experiencing.
OTOH "git bisect good v1.5.3.3..v1.5.3.4" does not make sense. bisect
assumes that all ancestors of a good commit are good, too.
Ciao,
Dscho
^ permalink raw reply
* Re: What's cooking in git/spearce.git (topics)
From: Johannes Schindelin @ 2007-10-16 11:16 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git
In-Reply-To: <20071016060456.GC13801@spearce.org>
Hi,
first let me thank you for being the interim maintainer. I know it is
much work, and I frankly do not have the time, or nerve, to do it. Out of
curiousity: did you use the scripts in "todo" to send these emails?
On Tue, 16 Oct 2007, Shawn O. Pearce wrote:
> * lt/diff-rename (Tue Oct 2 19:28:19 2007 -0700) 1 commit
> + optimize diffcore-delta by sorting hash entries.
AFAIR this was ready to go to master, with a 5-10% speedup or so, just
needing a bit of testing. Which it should have gotten by now.
> * kh/commit (Mon Sep 17 20:06:47 2007 -0400) 4 commits
> + Export rerere() and launch_editor().
> + Introduce entry point add_interactive and add_files_to_cache
> + Enable wt-status to run against non-standard index file.
> + Enable wt-status output to a given FILE pointer.
This is the beginning of the builtin-commit. The option parser has to go
in before that (it was split out from the builtin-commit series), and the
(minimal) adjustments to builtin-commit.c for the now-changed option
parser have to be done.
So I think this topic should stay in master until builtin-commit is there,
too.
> * js/stash-create (Mon Jul 9 00:51:23 2007 -0700) 2 commits
> + rebase: allow starting from a dirty tree.
> + stash: implement "stash create"
This needs more work in rebase-i, and Junio indicated that he's not
completely happy with it.
It would serve to be able to rebase in a dirty tree, by first stashing
away the changes, and then applying them on top of the rebased branch.
I think that this would avoid many "Huh?" effects, but it should try to
"git stash apply --index" first, falling back to "git stash apply".
Something like that would be very nice for git-pull, too, I guess.
However, I have not thought through all implications.
Ciao,
Dscho
^ permalink raw reply
* Re: Switching from CVS to GIT
From: Peter Karlsson @ 2007-10-16 11:13 UTC (permalink / raw)
To: git list
In-Reply-To: <20071014221446.GC2776@steel.home>
> - it is the only OS in the world with multi-root (/a/b/c and /a/b/c
> can be not the same, depending on what current "drive" is) and
> multi-cwd, which hasn't had formed itself into a problem yet, but
> surely will
It's not the only OS with drive letters (although I don't see Git
coming to my Symbian OS phone any time soon), but there is only one
root. The problem is that it isn't addressable in the file system, and
that the concept of what is the root is different depending on what you
ask (either it's above the drive letters, or "My Computer").
You can create a search path rooted in "My Computer" if you want (using
shell APIs), but you probably can't get a readable text representation
of it.
> - it has only one argument (limited in size) passed to started
> programs, which means that there is no possible way to safely pass
> file and text arguments on command line (more than one, that is)
Well, there are many other ways of passing arguments than on the
command line, but they are probably difficult to access from console
applications (things like DDE or whatever the current implementation is
called).
--
\\// Peter - http://www.softwolves.pp.se/
^ permalink raw reply
* RE: Is there any plan to support partial checkout or submoudule improvement?
From: Johannes Schindelin @ 2007-10-16 11:02 UTC (permalink / raw)
To: franky; +Cc: 'Lars Hjemli', git
In-Reply-To: <20071016082720.E5EDA7E6F@mail.kooxoo.com>
Hi,
[please do not top post. Only keep the parts of the original message that
you are responding to, and put your answers just below. It is a matter of
simple economy: it takes you just a couple of minutes, but spares those
"millions" of readers the minutes to understand what you're talking about.
In addition, it is a matter of politeness.]
On Tue, 16 Oct 2007, franky wrote:
> I want a single "git-pull" to deploy a new version and a
> single "git-reset" to back to versions before [on partial checkouts]
You are talking as if your partial checkout was a project in its own
right. Then make it so. Do not use a partial checkout, but make that a
submodule.
One reason _not_ to support partial checkouts is exactly to avoid people
falling into that mousetrap of thinking that they can sensibly merge
_parts_ of the HEAD.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] Make the output of "git svn clone" less confusing.
From: David Kågedal @ 2007-10-16 11:00 UTC (permalink / raw)
To: Eric Wong; +Cc: git
In-Reply-To: <20071016093228.GA30503@soma>
Eric Wong <normalperson@yhbt.net> writes:
>> diff --git a/git-svn.perl b/git-svn.perl
>> index 777e436..d4450ca 100755
>> --- a/git-svn.perl
>> +++ b/git-svn.perl
>> @@ -286,6 +286,7 @@ sub do_git_init_db {
>>
>> sub init_subdir {
>> my $repo_path = shift or return;
>> + print "Creating directory $repo_path\n";
>> mkpath([$repo_path]) unless -d $repo_path;
>> chdir $repo_path or die "Couldn't chdir to $repo_path: $!\n";
>
> Since mkpath() isn't guaranteed to get called, maybe putting a
>
> print "Entering directory $repo_path\n"
>
> right before the chdir is better.
You're probably right.
> The other option would be to alter git-init to print the absolute path
> of the repository being initialized...
Absolute paths don't sound like a great idea to me. Ideally, I'd like
to see the path I gave it, or something relative to the working
directory. That is, *my* working directory, and not some internal one
because one of the tools did a chdir.
Can't we make init_subdir in git-svn not chdir, instead? Like this,
highly untested?
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -288,8 +288,7 @@ sub init_subdir {
my $repo_path = shift or return;
print "Creating directory $repo_path\n";
mkpath([$repo_path]) unless -d $repo_path;
- chdir $repo_path or die "Couldn't chdir to $repo_path: $!\n";
- $ENV{GIT_DIR} = '.git';
+ $ENV{GIT_DIR} = '$repo_path/.git';
}
sub cmd_clone {
--
David Kågedal
^ permalink raw reply
* Re: Git User's Survey 2007 unfinished summary continued
From: Johannes Schindelin @ 2007-10-16 10:51 UTC (permalink / raw)
To: Nicolas Pitre
Cc: Shawn O. Pearce, Steven Grimm, Reece Dunn, Linus Torvalds,
J. Bruce Fields, Jakub Narebski, git
In-Reply-To: <alpine.LFD.0.9999.0710152245530.19446@xanadu.home>
Hi,
On Mon, 15 Oct 2007, Nicolas Pitre wrote:
> On Mon, 15 Oct 2007, Shawn O. Pearce wrote:
>
> > Nicolas Pitre <nico@cam.org> wrote:
> > > BTW I have patches here reworking the progress code for a more compact
> > > display which should mitigate this issue quite a bit.
> >
> > git-gui is scraping the output of the current progress meter using
> > a regex and then building a graphical progress bar from that output.
>
> Erk!
>
> > Any change in how git produces the progress bar should still keep
> > it in a form that git-gui can regex match and scrape, preferably
> > without needing to know what version of git it is pulling that
> > output from. For example just teach git-gui to try two different
> > regexps, new format and if that doesn't match then try the old
> > (aka current) format.
>
> I think my new format might be easier for you as the "title" and the
> actual percentage and count is now on the same line.
That might have been an advantage if Shawn did not do the code already.
As it is, he'll have to maintain two different regexes, _and_ detect when
to use which.
Ciao,
Dscho
^ permalink raw reply
* Re: Is there any plan to support partial checkout or submoudule improvement?
From: Lars Hjemli @ 2007-10-16 10:50 UTC (permalink / raw)
To: franky; +Cc: git
In-Reply-To: <20071016095622.CE14F7E6F@mail.kooxoo.com>
On 10/16/07, franky <yinping@kooxoo.com> wrote:
> lars said:
> > $ git archive --remote=<repo> <revspec> <path> | tar -x
>
> I can't know deployment version easily
The <revspec> can be a tag. So you can easily create a wrapper script
to allow such things as
$ ./deploy.sh v1.2.3
$ ./deploy.sh HEAD
$ ./deploy.sh master
$ ./deploy.sh <sha1>
(note: for this to work with the git:// protocol, git-daemon needs
--enable=upload-archive)
--
larsh
^ permalink raw reply
* cogito and remote#branch, was Re: [PATCH] Git homepage: remove all the references to Cogito
From: Johannes Schindelin @ 2007-10-16 10:49 UTC (permalink / raw)
To: Petr Baudis; +Cc: Paolo Ciarrocchi, git
In-Reply-To: <20071016021933.GH12156@machine.or.cz>
Hi,
On Tue, 16 Oct 2007, Petr Baudis wrote:
> On Mon, Oct 15, 2007 at 11:38:00PM +0200, Paolo Ciarrocchi wrote:
> > @@ -286,15 +285,6 @@ a gitweb interface, at <a href="http://repo.or.cz/">http://repo.or.cz/</a>.</p>
> >
> > <dl>
> >
> > -<dt id="cogito">Cogito</dt>
> > -<dd>
> > -<a href="http://git.or.cz/cogito/">Cogito</a>
> > -is a popular version control system on top of Git.
> > -It aims at seamless user interface and ease of use, providing
> > -generally smoother user experience than the "raw" Git interface
> > -and indeed also many other version control systems. However, it
> > -also lacks many advanced capabilities of Git and is currently
> > -being slowly phased out.</dd>
> >
> > <dt id="stgit">StGIT</dt>
> > <dd><a href="http://www.procode.org/stgit/">Stacked Git</a> provides
>
> I'm not sure this is good idea, Cogito is still quite frequently used
> and it should be documented that it exists.
I agree. But maybe it could be marked as unmaintained? Maybe someone
steps up to maintain it. Or, even better, comes up with a list of "this
is what I like do regularly with cogito, but there's no easy way with core
git" issues.
In related news, I recently thought about the url#branch issue.
There were three arguments against it AFAIR: "#" is a comment marker, and
this syntax is not extensible to more than one branch names. And that the
branch name is not really a part of the URL.
Turns out that I am not so sure about the last two issues.
It is easily extensible to more than one branch by remote#branch1#branch2,
and in a very real sense, this is a resource locator.
And we could replace the "#" by every character that is illegal in ref
names as well as URLs. I propose SPC. ('#' is allowed in refnames.)
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] rev-list documentation: add "--bisect-all".
From: Ralf Wildenhues @ 2007-10-16 10:42 UTC (permalink / raw)
To: Christian Couder
Cc: Junio Hamano, Johannes Schindelin, Frank Lichtenheld, git
In-Reply-To: <20071016055905.55c1d280.chriscool@tuxfamily.org>
Hello,
A couple of typos:
* Christian Couder wrote on Tue, Oct 16, 2007 at 05:59:05AM CEST:
>
> diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
> index 7cd0e89..f6dd0c4 100644
> --- a/Documentation/git-rev-list.txt
> +++ b/Documentation/git-rev-list.txt
[...]
> @@ -354,6 +355,21 @@ the expected number of commits to be tested if `bisect_rev`
> turns out to be bad to `bisect_bad`, and the number of commits
> we are bisecting right now to `bisect_all`.
>
> +--bisect-all::
> +
> +This outputs all the commit objects between the included and excluded
> +commits, ordered by their distance to the included and excluded
> +commits. The farthest from them is displayed first. (This is the only
> +one displayed by `--bisect`.)
> +
> +This is usefull because it makes it easy to choose a good commit to
s/usefull/useful/
> +test when you want to avoid to test some of them for some reason (they
> +may not compile for example).
> +
> +This option can be used along with `--bisect-vars`, in this case,
> +after all the sorted commit objects, there will be the same text as if
> +`--bisect-vars` has been used alone.
s/has/had/
Cheers,
Ralf
^ permalink raw reply
* Re: On Tabs and Spaces
From: Adam Piatyszek @ 2007-10-16 10:16 UTC (permalink / raw)
To: Lars Hjemli; +Cc: Michael Witten, git
In-Reply-To: <8c5c35580710160204s5a4f9fb3j68c0a86c4d080cb7@mail.gmail.com>
* Lars Hjemli [16 X 2007 11:04]:
>>From http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/CodingStyle;h=7f1730f1a1ae2e9a6f368bdb10ff65f4568863d5;hb=HEAD
>
> (defun linux-c-mode ()
> "C mode with adjusted defaults for use with the Linux kernel."
> (interactive)
> (c-mode)
> (c-set-style "K&R")
> (setq tab-width 8)
> (setq indent-tabs-mode t)
> (setq c-basic-offset 8))
>
>
> And to use this only in a specific directory:
>
> (setq auto-mode-alist (cons '("/usr/src/linux.*/.*\\.[ch]$" . linux-c-mode)
> auto-mode-alist))
Thanks!
But it seems that the above settings are still imperfect, since they
mixes tabs and spaces when aligning. For instance:
int some_function(int some_variable)
{
<T> int result;
<T> result = execute_another_function(some_variable,
<T> <T> <T> <T> <T> ..other_variable);
<T> return result;
}
<T> - represents tab here, `.' - space
And if one change the tab size, it will result in a messy alignment in
line 5.
I guess there is no ideal solution for this in Emacs.
BR,
/Adam
--
.:. Adam Piatyszek - "ediap" .:. JID: ediap(at)jabber.org .:.
.:. ediap(at)users.sourceforge.net .:. PGP key ID: 0x1F115CCB .:.
^ permalink raw reply
* git-svn has a _lot_ of metadata
From: Karl Hasselström @ 2007-10-16 10:22 UTC (permalink / raw)
To: Eric Wong; +Cc: git list
I just imported an svn repository with about 120 tags and 140
branches, and with some repacking got the pack file down to a
comfortable 80 MB. However, .git is over 600 MB, owing to about 520 MB
of git-svn metadata. (This wasn't a problem when I only tracked a
handful of branches, since they're only a few megs apiece.)
There appears to be two kinds of metadata that takes up a significant
fraction of the space.
* An index file is saved for each branch and tag. I presume this
corresponds to the branch head, and is used to speed up importing
of new revisions to that branch. However, recreating an index with
git-read-tree is very fast, so I don't think these need to be
saved between git-svn runs.
* A "rev_db" file is saved for each branch and tag. This is a text
file with one sha1 per line -- I seem to remember that line X of
this file is the commit sha1 of svn revision X. For revisions that
didn't touch this branch/tag, there's a line of 40 zeros. And
since every revision touches just one branch, it's almost all
zeros unless the number of branches is very small.
This could probably be stored _much_ more efficiently. Just
gzipping it with the standard options shrinks it by between a
factor of 4 (for one of the busiest branches) and 300 (for a tag,
which is written just once). But I understand that we need quick
random access here?
The index files should be easy enough to erase between runs, if they
indeed just correspond to the branch head. The rev_db files are
trickier; exactly what kind of lookups are required? Could it perhaps
be done with just one file, instead of one per branch/tag?
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply
* Re: Switching from CVS to GIT
From: Nguyen Thai Ngoc Duy @ 2007-10-16 10:09 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: prohaska, git, raa.lkml, ae, tsuna, Johannes.Schindelin
In-Reply-To: <uprzfithw.fsf@gnu.org>
On 10/16/07, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Tue, 16 Oct 2007 09:24:50 +0700
> > From: "Nguyen Thai Ngoc Duy" <pclouds@gmail.com>
> > Cc: "Git Mailing List" <git@vger.kernel.org>, "Alex Riesen" <raa.lkml@gmail.com>,
> > "Eli Zaretskii" <eliz@gnu.org>, "Andreas Ericsson" <ae@op5.se>,
> > tsuna@lrde.epita.fr,
> > "Johannes Schindelin" <Johannes.Schindelin@gmx.de>
> >
> > I did try hard to find the legendary
> > zsh for Windows before giving up and porting busybox's ash instead.
>
> Where can one find this port of busybox's ash?
>
http://repo.or.cz/w/git/pclouds.git?a=shortlog;h=gitbox
In directory box/shell.
--
Duy
^ permalink raw reply
* [PATCH 3/3] git-cvsexportcommit.perl: git-apply no longer needs --binary
From: Michael Witten @ 2007-10-16 8:08 UTC (permalink / raw)
To: git; +Cc: Michael Witten
In-Reply-To: <1192522094-4988-2-git-send-email-mfwitten@mit.edu>
Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
git-cvsexportcommit.perl | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 869c8b5..22c3d2f 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -129,7 +129,7 @@ my $context = $opt_p ? '' : '-C1';
print "Checking if patch will apply\n";
my @stat;
-open APPLY, "GIT_DIR= git-apply $context --binary --summary --numstat<.cvsexportcommit.diff|" || die "cannot patch";
+open APPLY, "GIT_DIR= git-apply $context --summary --numstat<.cvsexportcommit.diff|" || die "cannot patch";
@stat=<APPLY>;
close APPLY || die "Cannot patch";
my (@bfiles,@files,@afiles,@dfiles);
@@ -215,7 +215,7 @@ if ($dirty) {
}
print "Applying\n";
-`GIT_DIR= git-apply $context --binary --summary --numstat --apply <.cvsexportcommit.diff` || die "cannot patch";
+`GIT_DIR= git-apply $context --summary --numstat --apply <.cvsexportcommit.diff` || die "cannot patch";
print "Patch applied successfully. Adding new files and directories to CVS\n";
my $dirtypatch = 0;
--
1.5.3.4.207.g6d7480-dirty
^ permalink raw reply related
* [PATCH 1/3] git-cvsexportcommit.perl tabified
From: Michael Witten @ 2007-10-16 8:08 UTC (permalink / raw)
To: git; +Cc: Michael Witten
Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
This patch attempts to tabify this code.
Please be gentle, this is my second time
submitting a patch.
git-cvsexportcommit.perl | 284 +++++++++++++++++++++++-----------------------
1 files changed, 141 insertions(+), 143 deletions(-)
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index a33fa8d..b330c3d 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -12,7 +12,7 @@ use Data::Dumper;
use File::Basename qw(basename dirname);
unless ($ENV{GIT_DIR} && -r $ENV{GIT_DIR}){
- die "GIT_DIR is not defined or is unreadable";
+ die "GIT_DIR is not defined or is unreadable";
}
our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d, $opt_u);
@@ -25,15 +25,13 @@ die "Need at least one commit identifier!" unless @ARGV;
my @cvs;
if ($opt_d) {
- @cvs = ('cvs', '-d', $opt_d);
+ @cvs = ('cvs', '-d', $opt_d);
} else {
- @cvs = ('cvs');
+ @cvs = ('cvs');
}
# setup a tempdir
-our ($tmpdir, $tmpdirname) = tempdir('git-cvsapplycommit-XXXXXX',
- TMPDIR => 1,
- CLEANUP => 1);
+our ($tmpdir, $tmpdirname) = tempdir('git-cvsapplycommit-XXXXXX', TMPDIR => 1, CLEANUP => 1);
# resolve target commit
my $commit;
@@ -41,18 +39,18 @@ $commit = pop @ARGV;
$commit = safe_pipe_capture('git-rev-parse', '--verify', "$commit^0");
chomp $commit;
if ($?) {
- die "The commit reference $commit did not resolve!";
+ die "The commit reference $commit did not resolve!";
}
# resolve what parent we want
my $parent;
if (@ARGV) {
- $parent = pop @ARGV;
- $parent = safe_pipe_capture('git-rev-parse', '--verify', "$parent^0");
- chomp $parent;
- if ($?) {
- die "The parent reference did not resolve!";
- }
+ $parent = pop @ARGV;
+ $parent = safe_pipe_capture('git-rev-parse', '--verify', "$parent^0");
+ chomp $parent;
+ if ($?) {
+ die "The parent reference did not resolve!";
+ }
}
# find parents from the commit itself
@@ -65,44 +63,44 @@ my $title;
my $msg = '';
foreach my $line (@commit) {
- chomp $line;
- if ($stage eq 'headers' && $line eq '') {
- $stage = 'msg';
- next;
- }
-
- if ($stage eq 'headers') {
- if ($line =~ m/^parent (\w{40})$/) { # found a parent
- push @parents, $1;
- } elsif ($line =~ m/^author (.+) \d+ [-+]\d+$/) {
- $author = $1;
- } elsif ($line =~ m/^committer (.+) \d+ [-+]\d+$/) {
- $committer = $1;
+ chomp $line;
+ if ($stage eq 'headers' && $line eq '') {
+ $stage = 'msg';
+ next;
}
- } else {
- $msg .= $line . "\n";
- unless ($title) {
- $title = $line;
+
+ if ($stage eq 'headers') {
+ if ($line =~ m/^parent (\w{40})$/) { # found a parent
+ push @parents, $1;
+ } elsif ($line =~ m/^author (.+) \d+ [-+]\d+$/) {
+ $author = $1;
+ } elsif ($line =~ m/^committer (.+) \d+ [-+]\d+$/) {
+ $committer = $1;
+ }
+ } else {
+ $msg .= $line . "\n";
+ unless ($title) {
+ $title = $line;
+ }
}
- }
}
if ($parent) {
- my $found;
- # double check that it's a valid parent
- foreach my $p (@parents) {
- if ($p eq $parent) {
- $found = 1;
- last;
- }; # found it
- }
- die "Did not find $parent in the parents for this commit!" if !$found and !$opt_P;
+ my $found;
+ # double check that it's a valid parent
+ foreach my $p (@parents) {
+ if ($p eq $parent) {
+ $found = 1;
+ last;
+ }; # found it
+ }
+ die "Did not find $parent in the parents for this commit!" if !$found and !$opt_P;
} else { # we don't have a parent from the cmdline...
- if (@parents == 1) { # it's safe to get it from the commit
- $parent = $parents[0];
- } else { # or perhaps not!
- die "This commit has more than one parent -- please name the parent you want to use explicitly";
- }
+ if (@parents == 1) { # it's safe to get it from the commit
+ $parent = $parents[0];
+ } else { # or perhaps not!
+ die "This commit has more than one parent -- please name the parent you want to use explicitly";
+ }
}
$opt_v && print "Applying to CVS commit $commit from parent $parent\n";
@@ -110,14 +108,14 @@ $opt_v && print "Applying to CVS commit $commit from parent $parent\n";
# grab the commit message
open(MSG, ">.msg") or die "Cannot open .msg for writing";
if ($opt_m) {
- print MSG $opt_m;
+ print MSG $opt_m;
}
print MSG $msg;
if ($opt_a) {
- print MSG "\n\nAuthor: $author\n";
- if ($author ne $committer) {
- print MSG "Committer: $committer\n";
- }
+ print MSG "\n\nAuthor: $author\n";
+ if ($author ne $committer) {
+ print MSG "Committer: $committer\n";
+ }
}
close MSG;
@@ -153,70 +151,70 @@ map { s/\\([0-7]{3})/sprintf('%c',oct $1)/eg } @bfiles,@files;
my $dirty;
my @dirs;
foreach my $p (@afiles) {
- my $path = dirname $p;
- while (!-d $path and ! grep { $_ eq $path } @dirs) {
- unshift @dirs, $path;
- $path = dirname $path;
- }
+ my $path = dirname $p;
+ while (!-d $path and ! grep { $_ eq $path } @dirs) {
+ unshift @dirs, $path;
+ $path = dirname $path;
+ }
}
# ... check dirs,
foreach my $d (@dirs) {
- if (-e $d) {
- $dirty = 1;
- warn "$d exists and is not a directory!\n";
- }
+ if (-e $d) {
+ $dirty = 1;
+ warn "$d exists and is not a directory!\n";
+ }
}
# ... query status of all files that we have a directory for and parse output of 'cvs status' to %cvsstat.
my @canstatusfiles;
foreach my $f (@files) {
- my $path = dirname $f;
- next if (grep { $_ eq $path } @dirs);
- push @canstatusfiles, $f;
+ my $path = dirname $f;
+ next if (grep { $_ eq $path } @dirs);
+ push @canstatusfiles, $f;
}
my %cvsstat;
if (@canstatusfiles) {
- if ($opt_u) {
- my @updated = safe_pipe_capture(@cvs, 'update', @canstatusfiles);
- print @updated;
- }
- my @cvsoutput;
- @cvsoutput= safe_pipe_capture(@cvs, 'status', @canstatusfiles);
- my $matchcount = 0;
- foreach my $l (@cvsoutput) {
- chomp $l;
- if ( $l =~ /^File:/ and $l =~ /Status: (.*)$/ ) {
- $cvsstat{$canstatusfiles[$matchcount]} = $1;
- $matchcount++;
- }
- }
+ if ($opt_u) {
+ my @updated = safe_pipe_capture(@cvs, 'update', @canstatusfiles);
+ print @updated;
+ }
+ my @cvsoutput;
+ @cvsoutput= safe_pipe_capture(@cvs, 'status', @canstatusfiles);
+ my $matchcount = 0;
+ foreach my $l (@cvsoutput) {
+ chomp $l;
+ if ( $l =~ /^File:/ and $l =~ /Status: (.*)$/ ) {
+ $cvsstat{$canstatusfiles[$matchcount]} = $1;
+ $matchcount++;
+ }
+ }
}
# ... validate new files,
foreach my $f (@afiles) {
- if (defined ($cvsstat{$f}) and $cvsstat{$f} ne "Unknown") {
- $dirty = 1;
- warn "File $f is already known in your CVS checkout -- perhaps it has been added by another user. Or this may indicate that it exists on a different branch. If this is the case, use -f to force the merge.\n";
- warn "Status was: $cvsstat{$f}\n";
- }
+ if (defined ($cvsstat{$f}) and $cvsstat{$f} ne "Unknown") {
+ $dirty = 1;
+ warn "File $f is already known in your CVS checkout -- perhaps it has been added by another user. Or this may indicate that it exists on a different branch. If this is the case, use -f to force the merge.\n";
+ warn "Status was: $cvsstat{$f}\n";
+ }
}
# ... validate known files.
foreach my $f (@files) {
- next if grep { $_ eq $f } @afiles;
- # TODO:we need to handle removed in cvs
- unless (defined ($cvsstat{$f}) and $cvsstat{$f} eq "Up-to-date") {
- $dirty = 1;
- warn "File $f not up to date but has status '$cvsstat{$f}' in your CVS checkout!\n";
- }
+ next if grep { $_ eq $f } @afiles;
+ # TODO:we need to handle removed in cvs
+ unless (defined ($cvsstat{$f}) and $cvsstat{$f} eq "Up-to-date") {
+ $dirty = 1;
+ warn "File $f not up to date but has status '$cvsstat{$f}' in your CVS checkout!\n";
+ }
}
if ($dirty) {
- if ($opt_f) { warn "The tree is not clean -- forced merge\n";
- $dirty = 0;
- } else {
- die "Exiting: your CVS tree is not clean for this merge.";
- }
+ if ($opt_f) { warn "The tree is not clean -- forced merge\n";
+ $dirty = 0;
+ } else {
+ die "Exiting: your CVS tree is not clean for this merge.";
+ }
}
print "Applying\n";
@@ -225,30 +223,30 @@ print "Applying\n";
print "Patch applied successfully. Adding new files and directories to CVS\n";
my $dirtypatch = 0;
foreach my $d (@dirs) {
- if (system(@cvs,'add',$d)) {
- $dirtypatch = 1;
- warn "Failed to cvs add directory $d -- you may need to do it manually";
- }
+ if (system(@cvs,'add',$d)) {
+ $dirtypatch = 1;
+ warn "Failed to cvs add directory $d -- you may need to do it manually";
+ }
}
foreach my $f (@afiles) {
- if (grep { $_ eq $f } @bfiles) {
- system(@cvs, 'add','-kb',$f);
- } else {
- system(@cvs, 'add', $f);
- }
- if ($?) {
- $dirtypatch = 1;
- warn "Failed to cvs add $f -- you may need to do it manually";
- }
+ if (grep { $_ eq $f } @bfiles) {
+ system(@cvs, 'add','-kb',$f);
+ } else {
+ system(@cvs, 'add', $f);
+ }
+ if ($?) {
+ $dirtypatch = 1;
+ warn "Failed to cvs add $f -- you may need to do it manually";
+ }
}
foreach my $f (@dfiles) {
- system(@cvs, 'rm', '-f', $f);
- if ($?) {
- $dirtypatch = 1;
- warn "Failed to cvs rm -f $f -- you may need to do it manually";
- }
+ system(@cvs, 'rm', '-f', $f);
+ if ($?) {
+ $dirtypatch = 1;
+ warn "Failed to cvs rm -f $f -- you may need to do it manually";
+ }
}
print "Commit to CVS\n";
@@ -257,25 +255,25 @@ my @commitfiles = map { unless (m/\s/) { '\''.$_.'\''; } else { $_; }; } (@files
my $cmd = join(' ', @cvs)." commit -F .msg @commitfiles";
if ($dirtypatch) {
- print "NOTE: One or more hunks failed to apply cleanly.\n";
- print "You'll need to apply the patch in .cvsexportcommit.diff manually\n";
- print "using a patch program. After applying the patch and resolving the\n";
- print "problems you may commit using:";
- print "\n $cmd\n\n";
- exit(1);
+ print "NOTE: One or more hunks failed to apply cleanly.\n";
+ print "You'll need to apply the patch in .cvsexportcommit.diff manually\n";
+ print "using a patch program. After applying the patch and resolving the\n";
+ print "problems you may commit using:";
+ print "\n $cmd\n\n";
+ exit(1);
}
if ($opt_c) {
- print "Autocommit\n $cmd\n";
- print safe_pipe_capture(@cvs, 'commit', '-F', '.msg', @files);
- if ($?) {
- die "Exiting: The commit did not succeed";
- }
- print "Committed successfully to CVS\n";
- # clean up
- unlink(".msg");
+ print "Autocommit\n $cmd\n";
+ print safe_pipe_capture(@cvs, 'commit', '-F', '.msg', @files);
+ if ($?) {
+ die "Exiting: The commit did not succeed";
+ }
+ print "Committed successfully to CVS\n";
+ # clean up
+ unlink(".msg");
} else {
- print "Ready for you to commit, just run:\n\n $cmd\n";
+ print "Ready for you to commit, just run:\n\n $cmd\n";
}
# clean up
@@ -297,25 +295,25 @@ END
# to work around shell problems with weird characters in arguments
# if the exec returns non-zero we die
sub safe_pipe_capture {
- my @output;
- if (my $pid = open my $child, '-|') {
- @output = (<$child>);
- close $child or die join(' ',@_).": $! $?";
- } else {
- exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
- }
- return wantarray ? @output : join('',@output);
+ my @output;
+ if (my $pid = open my $child, '-|') {
+ @output = (<$child>);
+ close $child or die join(' ',@_).": $! $?";
+ } else {
+ exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
+ }
+ return wantarray ? @output : join('',@output);
}
sub safe_pipe_capture_blob {
- my $output;
- if (my $pid = open my $child, '-|') {
- local $/;
- undef $/;
- $output = (<$child>);
- close $child or die join(' ',@_).": $! $?";
- } else {
- exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
- }
- return $output;
+ my $output;
+ if (my $pid = open my $child, '-|') {
+ local $/;
+ undef $/;
+ $output = (<$child>);
+ close $child or die join(' ',@_).": $! $?";
+ } else {
+ exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
+ }
+ return $output;
}
--
1.5.3.4.207.g6d7480-dirty
^ permalink raw reply related
* [PATCH] git-cvsexportcommit.perl tabified
From: Michael Witten @ 2007-10-16 9:56 UTC (permalink / raw)
To: git; +Cc: spearce, Michael Witten
---
This patch can be applied to spearce/next
The other patch for removing --binary should
still be applicable.
git-cvsexportcommit.perl | 277 +++++++++++++++++++++++-----------------------
1 files changed, 139 insertions(+), 138 deletions(-)
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 6b0123c..9dac7aa 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -12,7 +12,7 @@ use Data::Dumper;
use File::Basename qw(basename dirname);
unless ($ENV{GIT_DIR} && -r $ENV{GIT_DIR}){
- die "GIT_DIR is not defined or is unreadable";
+ die "GIT_DIR is not defined or is unreadable";
}
our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d, $opt_u);
@@ -36,18 +36,18 @@ $commit = pop @ARGV;
$commit = safe_pipe_capture('git-rev-parse', '--verify', "$commit^0");
chomp $commit;
if ($?) {
- die "The commit reference $commit did not resolve!";
+ die "The commit reference $commit did not resolve!";
}
# resolve what parent we want
my $parent;
if (@ARGV) {
- $parent = pop @ARGV;
- $parent = safe_pipe_capture('git-rev-parse', '--verify', "$parent^0");
- chomp $parent;
- if ($?) {
- die "The parent reference did not resolve!";
- }
+ $parent = pop @ARGV;
+ $parent = safe_pipe_capture('git-rev-parse', '--verify', "$parent^0");
+ chomp $parent;
+ if ($?) {
+ die "The parent reference did not resolve!";
+ }
}
# find parents from the commit itself
@@ -60,44 +60,44 @@ my $title;
my $msg = '';
foreach my $line (@commit) {
- chomp $line;
- if ($stage eq 'headers' && $line eq '') {
- $stage = 'msg';
- next;
- }
-
- if ($stage eq 'headers') {
- if ($line =~ m/^parent (\w{40})$/) { # found a parent
- push @parents, $1;
- } elsif ($line =~ m/^author (.+) \d+ [-+]\d+$/) {
- $author = $1;
- } elsif ($line =~ m/^committer (.+) \d+ [-+]\d+$/) {
- $committer = $1;
+ chomp $line;
+ if ($stage eq 'headers' && $line eq '') {
+ $stage = 'msg';
+ next;
}
- } else {
- $msg .= $line . "\n";
- unless ($title) {
- $title = $line;
+
+ if ($stage eq 'headers') {
+ if ($line =~ m/^parent (\w{40})$/) { # found a parent
+ push @parents, $1;
+ } elsif ($line =~ m/^author (.+) \d+ [-+]\d+$/) {
+ $author = $1;
+ } elsif ($line =~ m/^committer (.+) \d+ [-+]\d+$/) {
+ $committer = $1;
+ }
+ } else {
+ $msg .= $line . "\n";
+ unless ($title) {
+ $title = $line;
+ }
}
- }
}
if ($parent) {
- my $found;
- # double check that it's a valid parent
- foreach my $p (@parents) {
- if ($p eq $parent) {
- $found = 1;
- last;
- }; # found it
- }
- die "Did not find $parent in the parents for this commit!" if !$found and !$opt_P;
+ my $found;
+ # double check that it's a valid parent
+ foreach my $p (@parents) {
+ if ($p eq $parent) {
+ $found = 1;
+ last;
+ }; # found it
+ }
+ die "Did not find $parent in the parents for this commit!" if !$found and !$opt_P;
} else { # we don't have a parent from the cmdline...
- if (@parents == 1) { # it's safe to get it from the commit
- $parent = $parents[0];
- } else { # or perhaps not!
- die "This commit has more than one parent -- please name the parent you want to use explicitly";
- }
+ if (@parents == 1) { # it's safe to get it from the commit
+ $parent = $parents[0];
+ } else { # or perhaps not!
+ die "This commit has more than one parent -- please name the parent you want to use explicitly";
+ }
}
$opt_v && print "Applying to CVS commit $commit from parent $parent\n";
@@ -105,14 +105,14 @@ $opt_v && print "Applying to CVS commit $commit from parent $parent\n";
# grab the commit message
open(MSG, ">.msg") or die "Cannot open .msg for writing";
if ($opt_m) {
- print MSG $opt_m;
+ print MSG $opt_m;
}
print MSG $msg;
if ($opt_a) {
- print MSG "\n\nAuthor: $author\n";
- if ($author ne $committer) {
- print MSG "Committer: $committer\n";
- }
+ print MSG "\n\nAuthor: $author\n";
+ if ($author ne $committer) {
+ print MSG "Committer: $committer\n";
+ }
}
close MSG;
@@ -148,70 +148,71 @@ map { s/\\([0-7]{3})/sprintf('%c',oct $1)/eg } @bfiles,@files;
my $dirty;
my @dirs;
foreach my $p (@afiles) {
- my $path = dirname $p;
- while (!-d $path and ! grep { $_ eq $path } @dirs) {
- unshift @dirs, $path;
- $path = dirname $path;
- }
+ my $path = dirname $p;
+ while (!-d $path and ! grep { $_ eq $path } @dirs) {
+ unshift @dirs, $path;
+ $path = dirname $path;
+ }
}
# ... check dirs,
foreach my $d (@dirs) {
- if (-e $d) {
- $dirty = 1;
- warn "$d exists and is not a directory!\n";
- }
+ if (-e $d) {
+ $dirty = 1;
+ warn "$d exists and is not a directory!\n";
+ }
}
# ... query status of all files that we have a directory for and parse output of 'cvs status' to %cvsstat.
my @canstatusfiles;
foreach my $f (@files) {
- my $path = dirname $f;
- next if (grep { $_ eq $path } @dirs);
- push @canstatusfiles, $f;
+ my $path = dirname $f;
+ next if (grep { $_ eq $path } @dirs);
+ push @canstatusfiles, $f;
}
my %cvsstat;
if (@canstatusfiles) {
- if ($opt_u) {
- my @updated = safe_pipe_capture(@cvs, 'update', @canstatusfiles);
- print @updated;
- }
- my @cvsoutput;
- @cvsoutput= safe_pipe_capture(@cvs, 'status', @canstatusfiles);
- my $matchcount = 0;
- foreach my $l (@cvsoutput) {
- chomp $l;
- if ( $l =~ /^File:/ and $l =~ /Status: (.*)$/ ) {
- $cvsstat{$canstatusfiles[$matchcount]} = $1;
- $matchcount++;
- }
- }
+ if ($opt_u) {
+ my @updated = safe_pipe_capture(@cvs, 'update', @canstatusfiles);
+ print @updated;
+ }
+ my @cvsoutput;
+ @cvsoutput= safe_pipe_capture(@cvs, 'status', @canstatusfiles);
+ my $matchcount = 0;
+ foreach my $l (@cvsoutput) {
+ chomp $l;
+ if ( $l =~ /^File:/ and $l =~ /Status: (.*)$/ ) {
+ $cvsstat{$canstatusfiles[$matchcount]} = $1;
+ $matchcount++;
+ }
+ }
}
# ... validate new files,
foreach my $f (@afiles) {
- if (defined ($cvsstat{$f}) and $cvsstat{$f} ne "Unknown") {
- $dirty = 1;
- warn "File $f is already known in your CVS checkout -- perhaps it has been added by another user. Or this may indicate that it exists on a different branch. If this is the case, use -f to force the merge.\n";
- warn "Status was: $cvsstat{$f}\n";
- }
+ if (defined ($cvsstat{$f}) and $cvsstat{$f} ne "Unknown") {
+ $dirty = 1;
+ warn "File $f is already known in your CVS checkout -- perhaps it has been added by another user. Or this may indicate that it exists on a different branch. If this is the case, use -f to force the merge.\n";
+ warn "Status was: $cvsstat{$f}\n";
+ }
}
# ... validate known files.
foreach my $f (@files) {
- next if grep { $_ eq $f } @afiles;
- # TODO:we need to handle removed in cvs
- unless (defined ($cvsstat{$f}) and $cvsstat{$f} eq "Up-to-date") {
- $dirty = 1;
- warn "File $f not up to date but has status '$cvsstat{$f}' in your CVS checkout!\n";
- }
+ next if grep { $_ eq $f } @afiles;
+ # TODO:we need to handle removed in cvs
+ unless (defined ($cvsstat{$f}) and $cvsstat{$f} eq "Up-to-date") {
+ $dirty = 1;
+ warn "File $f not up to date but has status '$cvsstat{$f}' in your CVS checkout!\n";
+ }
}
if ($dirty) {
- if ($opt_f) { warn "The tree is not clean -- forced merge\n";
- $dirty = 0;
- } else {
- die "Exiting: your CVS tree is not clean for this merge.";
- }
+ if ($opt_f) {
+ warn "The tree is not clean -- forced merge\n";
+ $dirty = 0;
+ } else {
+ die "Exiting: your CVS tree is not clean for this merge.";
+ }
}
print "Applying\n";
@@ -220,30 +221,30 @@ print "Applying\n";
print "Patch applied successfully. Adding new files and directories to CVS\n";
my $dirtypatch = 0;
foreach my $d (@dirs) {
- if (system(@cvs,'add',$d)) {
- $dirtypatch = 1;
- warn "Failed to cvs add directory $d -- you may need to do it manually";
- }
+ if (system(@cvs,'add',$d)) {
+ $dirtypatch = 1;
+ warn "Failed to cvs add directory $d -- you may need to do it manually";
+ }
}
foreach my $f (@afiles) {
- if (grep { $_ eq $f } @bfiles) {
- system(@cvs, 'add','-kb',$f);
- } else {
- system(@cvs, 'add', $f);
- }
- if ($?) {
- $dirtypatch = 1;
- warn "Failed to cvs add $f -- you may need to do it manually";
- }
+ if (grep { $_ eq $f } @bfiles) {
+ system(@cvs, 'add','-kb',$f);
+ } else {
+ system(@cvs, 'add', $f);
+ }
+ if ($?) {
+ $dirtypatch = 1;
+ warn "Failed to cvs add $f -- you may need to do it manually";
+ }
}
foreach my $f (@dfiles) {
- system(@cvs, 'rm', '-f', $f);
- if ($?) {
- $dirtypatch = 1;
- warn "Failed to cvs rm -f $f -- you may need to do it manually";
- }
+ system(@cvs, 'rm', '-f', $f);
+ if ($?) {
+ $dirtypatch = 1;
+ warn "Failed to cvs rm -f $f -- you may need to do it manually";
+ }
}
print "Commit to CVS\n";
@@ -252,25 +253,25 @@ my @commitfiles = map { unless (m/\s/) { '\''.$_.'\''; } else { $_; }; } (@files
my $cmd = join(' ', @cvs)." commit -F .msg @commitfiles";
if ($dirtypatch) {
- print "NOTE: One or more hunks failed to apply cleanly.\n";
- print "You'll need to apply the patch in .cvsexportcommit.diff manually\n";
- print "using a patch program. After applying the patch and resolving the\n";
- print "problems you may commit using:";
- print "\n $cmd\n\n";
- exit(1);
+ print "NOTE: One or more hunks failed to apply cleanly.\n";
+ print "You'll need to apply the patch in .cvsexportcommit.diff manually\n";
+ print "using a patch program. After applying the patch and resolving the\n";
+ print "problems you may commit using:";
+ print "\n $cmd\n\n";
+ exit(1);
}
if ($opt_c) {
- print "Autocommit\n $cmd\n";
- print safe_pipe_capture(@cvs, 'commit', '-F', '.msg', @files);
- if ($?) {
- die "Exiting: The commit did not succeed";
- }
- print "Committed successfully to CVS\n";
- # clean up
- unlink(".msg");
+ print "Autocommit\n $cmd\n";
+ print safe_pipe_capture(@cvs, 'commit', '-F', '.msg', @files);
+ if ($?) {
+ die "Exiting: The commit did not succeed";
+ }
+ print "Committed successfully to CVS\n";
+ # clean up
+ unlink(".msg");
} else {
- print "Ready for you to commit, just run:\n\n $cmd\n";
+ print "Ready for you to commit, just run:\n\n $cmd\n";
}
# clean up
@@ -292,25 +293,25 @@ END
# to work around shell problems with weird characters in arguments
# if the exec returns non-zero we die
sub safe_pipe_capture {
- my @output;
- if (my $pid = open my $child, '-|') {
- @output = (<$child>);
- close $child or die join(' ',@_).": $! $?";
- } else {
- exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
- }
- return wantarray ? @output : join('',@output);
+ my @output;
+ if (my $pid = open my $child, '-|') {
+ @output = (<$child>);
+ close $child or die join(' ',@_).": $! $?";
+ } else {
+ exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
+ }
+ return wantarray ? @output : join('',@output);
}
sub safe_pipe_capture_blob {
- my $output;
- if (my $pid = open my $child, '-|') {
- local $/;
- undef $/;
- $output = (<$child>);
- close $child or die join(' ',@_).": $! $?";
- } else {
- exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
- }
- return $output;
+ my $output;
+ if (my $pid = open my $child, '-|') {
+ local $/;
+ undef $/;
+ $output = (<$child>);
+ close $child or die join(' ',@_).": $! $?";
+ } else {
+ exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
+ }
+ return $output;
}
--
1.5.3.4.209.g397ef-dirty
^ 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