* [BUG] Recent git-svn gets checksum errors on very large fetches
From: Avery Pennarun @ 2008-06-25 3:23 UTC (permalink / raw)
To: Git Mailing List, aroben
My svn repo has 17000+ files in 1000+ directories. I managed to
narrow my problem down to this sequence of steps:
mkdir poo
cd poo
git init
git svn init file:///home/averyp/svn.bak/branches/MyBranch
git svn fetch -r3095 2>&1 | tee git.out
Which culminates in:
Checksum mismatch: ThirdParty/whateverdir/blahblah
expected: c342eaa17fe219a764c06642bb951474
got: 848bbb56e4c22755ffb687fb70ae1ac6
For extra excitement, if I run the same command multiple times, the
exact file (blahblah) with the checksum mismatch differs each time.
However, it tends to be a file approximately the same "distance" down
in the fetch: it's almost always in whateverdir, which contains only
333 out of the 17000 files.
This leads me to believe there's a race condition or buffer problem
somewhere causing the problem. Using git-bisect, I discovered that it
works fine in git 1.5.5.1, and that this patch is the one to blame:
commit ffe256f9bac8a40ff751a9341a5869d98f72c285
Author: Adam Roben <aroben@apple.com>
Date: Fri May 23 16:19:41 2008 +0200
git-svn: Speed up fetch
Figures. :)
Reverting it directly seems to cause a conflict, so I can't test for
sure that the latest master with this patch reverted would work
correctly.
Not quite sure what could be at fault here, or what to do next.
Unfortunately it's hard to assemble a test case for timing-related
problems like this. Thoughts?
Thanks,
Avery
^ permalink raw reply
* [PATCH] Ask for "git program" when asking for "git-program" over SSH connection
From: Junio C Hamano @ 2008-06-25 3:26 UTC (permalink / raw)
To: しらいしななこ
Cc: Miklos Vajna, pclouds, Johannes Schindelin, Pieter de Bie, git
In-Reply-To: <7v1w2m8ahi.fsf@gitster.siamese.dyndns.org>
The daemon expects to see the dashed form and we cannot change older
servers. But when invoking programs on the remote end over SSH, the
command line the client side build is under client's control.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* This I haven't even compile tested at all, but it feels right. We
probably should do this before bindir=>libexecdir move; as long as this
is in place on the client side the version running on the server end
should not matter.
connect.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/connect.c b/connect.c
index e92af29..fd1da26 100644
--- a/connect.c
+++ b/connect.c
@@ -589,6 +589,10 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
conn = xcalloc(1, sizeof(*conn));
strbuf_init(&cmd, MAX_CMD_LEN);
+ if (protocol != PROTO_GIT && !strncmp(prog, "git-", 4)) {
+ strbuf_addstr(&cmd, "git ");
+ prog += 4;
+ }
strbuf_addstr(&cmd, prog);
strbuf_addch(&cmd, ' ');
sq_quote_buf(&cmd, path);
--
1.5.6.56.g29b0d
^ permalink raw reply related
* Re: What's cooking in git.git (topics)
From: Shawn O. Pearce @ 2008-06-25 3:26 UTC (permalink / raw)
To: しらいしななこ,
Junio C Hamano
Cc: Miklos Vajna, pclouds, Johannes Schindelin, Pieter de Bie, git
In-Reply-To: <20080625120832.6117@nanako3.lavabit.com>
<nanako3@lavabit.com> wrote:
> Quoting Junio C Hamano <gitster@pobox.com>:
> > Miklos Vajna <vmiklos@frugalware.org> writes:
> >> On Tue, Jun 24, 2008 at 04:16:36PM -0700, Junio C Hamano <gitster@pobox.com> wrote:
> >>> It most likely makes sense to do (3) anyway. upload-pack, receive-pack,
> >>> anything else?
> >>
> >> I think that's all.
> >
> > Then that would be this patch on top of nd/dashless topic.
> >
> > Makefile | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 929136b..babf16b 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1268,7 +1268,7 @@ install: all
> > $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
> > $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
> > $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
> > - $(INSTALL) git$X '$(DESTDIR_SQ)$(bindir_SQ)'
> > + $(INSTALL) git$X git-upload-pack$X git-receive-pack$X '$(DESTDIR_SQ)$(bindir_SQ)'
> > $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
> > $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
> > ifndef NO_TCLTK
>
> Doesn't "git archive --remote=<repo>" also execute git program on a remote machine?
Yes, it runs git-upload-archive on the remote side. The three
primary services for the remote side are documented in daemon.c:
403 static struct daemon_service daemon_service[] = {
404 { "upload-archive", "uploadarch", upload_archive, 0, 1 },
405 { "upload-pack", "uploadpack", upload_pack, 1, 1 },
406 { "receive-pack", "receivepack", receive_pack, 0, 1 },
407 };
(with git- prefixes).
IMHO all three need to be in $PATH, along with git and gitk, through
at least a major revision release cycle to give clients a chance to
upgrade to something that uses "git foo" rather than "git-foo" when
talking to the remote.
--
Shawn.
^ permalink raw reply
* Re: What's cooking in git.git (topics)
From: Shawn O. Pearce @ 2008-06-25 3:32 UTC (permalink / raw)
To: Jakub Narebski
Cc: Junio C Hamano, Miklos Vajna, Johannes Schindelin, Pieter de Bie,
git
In-Reply-To: <m3fxr2jruy.fsf@localhost.localdomain>
Jakub Narebski <jnareb@gmail.com> wrote:
>
> What does "git ls-remote server:/home/vmiklos/git/test" invoke on server?
FYI, it actually runs git-upload-pack, gets the list of advertised
refs, then closes the connection immediately. The other side sees
the client hang up and just terminates silently, since the client
didn't "want" anything packed and sent.
--
Shawn.
^ permalink raw reply
* Re: [PATCH] Ask for "git program" when asking for "git-program" over SSH connection
From: Shawn O. Pearce @ 2008-06-25 3:45 UTC (permalink / raw)
To: Junio C Hamano
Cc: しらいしななこ,
Miklos Vajna, pclouds, Johannes Schindelin, Pieter de Bie, git
In-Reply-To: <7vprq66vqd.fsf_-_@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
> The daemon expects to see the dashed form and we cannot change older
> servers. But when invoking programs on the remote end over SSH, the
> command line the client side build is under client's control.
...
> diff --git a/connect.c b/connect.c
> index e92af29..fd1da26 100644
> --- a/connect.c
> +++ b/connect.c
> @@ -589,6 +589,10 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
> conn = xcalloc(1, sizeof(*conn));
>
> strbuf_init(&cmd, MAX_CMD_LEN);
> + if (protocol != PROTO_GIT && !strncmp(prog, "git-", 4)) {
> + strbuf_addstr(&cmd, "git ");
> + prog += 4;
> + }
Nack on that implementation.
I think this is a problem for systems based on say gitosis,
or some pattern like it. Day-job doesn't use gitosis, but
has switched to a Perl based forced ssh tool that smells a
lot like gitosis. Gitosis is popular.
github probably uses something similar. But nobody knows (or
probably cares) since they don't release their source.
gitosis is likely looking for "$git-upload-pack '(.*)'$" to be
in the $SSH_ORIGINAL_COMMAND environment variable, if you send
"git upload-pack 'path.git'" I think its going to reject.
What's really bad about your patch is you cannot work around it as a
user by setting --upload-pack on the command line, or in the config,
because down at the very deepest level you are switching the "git-"
to "git " and ignoring what the user has supplied you.
Sorry, but I think this change needs to go higher up, to the default
values that --upload-pack and remote.$name.uploadpack override,
so the user can at least work around it when we break her ability
to use github, gitosis, or anything like it.
--
Shawn.
^ permalink raw reply
* Re: [JGIT PATCH 00/10] Support writing pack index version 2
From: Shawn O. Pearce @ 2008-06-25 3:54 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: Marek Zawirski, git
In-Reply-To: <200806250048.29892.robin.rosenberg.lists@dewire.com>
Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
>
> Ocular review looks fine, but nevertheless some tests break.
Dammit.
> org.spearce.jgit.lib.PackIndexV2Test
> testIteratorMethodsContract(org.spearce.jgit.lib.PackIndexV2Test)
> java.io.IOException: Unreadable pack index: /home/me/SW/EGIT.contrib/org.spearce.jgit.test/tst/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2
> at org.spearce.jgit.lib.PackIndex.open(PackIndex.java:95)
...
> at org.spearce.jgit.lib.PackIndexV1.<init>(PackIndexV1.java:75)
Yea, OK, I know what that is. I busted PackIndex.isTOC.
I asked it to compare a 4 byte array (TOC only) to an 8 byte array
(TOC + version) and of course 4 != 8 so it fails. Thus all V2
index files look like V1 files. Only they aren't; and then all
hell breaks loose when we start treating parts of the V2 index as
different sections of the V1 index.
I'll post a replacement patch in a minute.
> Together with Marek's packwrite patches the list gets even longer (his patches alone are "green"). I'm
> not including them here.
That's because Marek's branch includes additional tests for features
he added to PackIndexV2. But all PackIndexV2 reading is busted.
--
Shawn.
^ permalink raw reply
* [JGIT PATCH 06/10 v2] Reuse the magic tOc constant for pack index headers
From: Shawn O. Pearce @ 2008-06-25 4:01 UTC (permalink / raw)
To: Robin Rosenberg, Marek Zawirski; +Cc: git
In-Reply-To: <1214273408-70793-7-git-send-email-spearce@spearce.org>
We need this constant to detect version 2 index files at read time,
but we also need it to create version 2 index files.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
Fixed isTOC test to return true when h.length == 8, which
is always the case as it has both the TOC and the version.
Also rebased into my branch:
repo.or.cz:/srv/git/egit/spearce.git index-v2
With this patch in the series all tests pass again.
.../src/org/spearce/jgit/lib/PackIndex.java | 6 +++++-
.../src/org/spearce/jgit/lib/PackIndexWriter.java | 3 +++
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PackIndex.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PackIndex.java
index 3935d4f..c5718fa 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/PackIndex.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PackIndex.java
@@ -104,7 +104,11 @@ public abstract class PackIndex implements Iterable<PackIndex.MutableEntry> {
}
private static boolean isTOC(final byte[] h) {
- return h[0] == -1 && h[1] == 't' && h[2] == 'O' && h[3] == 'c';
+ final byte[] toc = PackIndexWriter.TOC;
+ for (int i = 0; i < toc.length; i++)
+ if (h[i] != toc[i])
+ return false;
+ return true;
}
/**
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PackIndexWriter.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PackIndexWriter.java
index 473e6cf..c9b27d2 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/PackIndexWriter.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PackIndexWriter.java
@@ -55,6 +55,9 @@ import org.spearce.jgit.util.NB;
* to the byte offset within the pack where the object's data can be read.
*/
public abstract class PackIndexWriter {
+ /** Magic constant indicating post-version 1 format. */
+ protected static final byte[] TOC = { -1, 't', 'O', 'c' };
+
/**
* Create a new writer for the oldest (most widely understood) format.
* <p>
--
1.5.6.74.g8a5e
--
Shawn.
^ permalink raw reply related
* Re: [JGIT PATCH 4/4] LsTree: Enable pattern matching in LsTree
From: Shawn O. Pearce @ 2008-06-25 4:09 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git, Marek Zawirski, Florian Koeberle
In-Reply-To: <1214343392-5341-5-git-send-email-robin.rosenberg@dewire.com>
Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/filter/WildCardTreeFilter.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/filter/WildCardTreeFilter.java
> index ce6da5e..8b22e25 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/treewalk/filter/WildCardTreeFilter.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/filter/WildCardTreeFilter.java
> @@ -76,7 +76,7 @@ public class WildCardTreeFilter extends TreeFilter {
> if (walker.isRecursive() && walker.isSubtree())
> return true;
> matcher.reset();
> - matcher.append(walker.getPathString());
> + matcher.append(walker.getName());
> if (matcher.isMatch())
> return true;
> return false;
Are we only supporting `jgit ls-tree . '*.c'` ?
Or do we want to allow `jgit ls-tree . 'src/*.c'`?
ls-tree is only a little sample program that is not likely to have
a lot of real-world users calling it; but is a good demonstration
of how to use TreeWalk. So I really don't care either way.
The WildCardTreeFilter on the other hand could be applied to a
RevWalk, such as to grab history for not just 'foo.c' but anything
that matches 'f*.c'. But then you have to ask, why is the filter
limited to testing only the last component of the path? Why can't
it test 'src/f*.c'?
Otherwise everything in your series up until here makes sense and
looks good to me. Be nice if the tree filter wasn't so abusive in
needing to look at every path in the project, as that would really
hurt if it was applied to a RevWalk. But its not required to be
fast, if you ask for fnmatch paths, you get what you asked for...
--
Shawn.
^ permalink raw reply
* Re: [PATCH] Keep some git-* programs in $(bindir)
From: Shawn O. Pearce @ 2008-06-25 4:17 UTC (permalink / raw)
To: Junio C Hamano
Cc: しらいしななこ,
Miklos Vajna, pclouds, Johannes Schindelin, Pieter de Bie, git
In-Reply-To: <7v1w2m8ahi.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
> * しらいしななこ <nanako3@lavabit.com> writes:
> > Doesn't "git archive --remote=<repo>" also execute git program on a remote machine?
>
> diff --git a/Makefile b/Makefile
> index 929136b..742e7d3 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1268,7 +1268,7 @@ install: all
> $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
> $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
> $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
> - $(INSTALL) git$X '$(DESTDIR_SQ)$(bindir_SQ)'
> + $(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-archive$X '$(DESTDIR_SQ)$(bindir_SQ)'
I think you mean git-upload-archive, given what daemon.c says.
Or line 34 of builtin-archive.c, which calls git-upload-archive
by way of git_connect().
--
Shawn.
^ permalink raw reply
* Re: [PATCH] Keep some git-* programs in $(bindir)
From: Daniel Barkalow @ 2008-06-25 4:19 UTC (permalink / raw)
To: Junio C Hamano
Cc: しらいしななこ,
Miklos Vajna, pclouds, Johannes Schindelin, Pieter de Bie, git
In-Reply-To: <7v1w2m8ahi.fsf@gitster.siamese.dyndns.org>
On Tue, 24 Jun 2008, Junio C Hamano wrote:
> Otherwise remote executions directly over ssh won't find them as they used
> to. --upload-pack and --receive-pack options _could_ be used on the
> client side, but things should keep working out-of-box for older clients.
>
> Later versions of clients (fetch-pack and send-pack) probably could start
> asking for these programs with dashless form, but that is a different
> topic.
Should they use "git upload-pack" or should they look for their helper
programs in a libexec dir? I don't think that either of these programs is
useful to run independantly, but I don't know if finding a program that
doesn't go in $PATH on a remote machine is going to be any fun.
-Daniel
*This .sig lefti ntentionally blank*
^ permalink raw reply
* [PATCH] repack.usedeltabaseoffset config option now defaults to "true"
From: Nicolas Pitre @ 2008-06-25 4:24 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
As announced for 1.6.0.
Access over the native protocol by old git versions is unaffected as
this capability is negociated by the protocol. Otherwise setting this
config option to "false" and doing a 'git repack -a -d' is enough to
remain compatible with ancient git versions (older than 1.4.4).
Signed-off-by: Nicolas Pitre <nico@cam.org>
---
Documentation/config.txt | 10 +++++++---
git-repack.sh | 6 +-----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 1e09a57..c7fbc63 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -996,9 +996,13 @@ remotes.<group>::
<group>". See linkgit:git-remote[1].
repack.usedeltabaseoffset::
- Allow linkgit:git-repack[1] to create packs that uses
- delta-base offset. Defaults to false.
-
+ By default, linkgit:git-repack[1] creates packs that use
+ delta-base offset. If you need to share your repository with
+ git older than version 1.4.4, either directly or via a dumb
+ protocol such as http, then you need to set this option to
+ "false" and repack. Access from old git versions over the
+ native protocol are unaffected by this option.
+
show.difftree::
The default linkgit:git-diff-tree[1] arguments to be used
for linkgit:git-show[1].
diff --git a/git-repack.sh b/git-repack.sh
index 072d1b4..8c3bc13 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -44,11 +44,7 @@ do
shift
done
-# Later we will default repack.UseDeltaBaseOffset to true
-default_dbo=false
-
-case "`git config --bool repack.usedeltabaseoffset ||
- echo $default_dbo`" in
+case "`git config --bool repack.usedeltabaseoffset || echo true`" in
true)
extra="$extra --delta-base-offset" ;;
esac
--
1.5.6.56.g29b0d
^ permalink raw reply related
* [PATCH] pack.indexversion config option now defaults to 2
From: Nicolas Pitre @ 2008-06-25 4:25 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
As announced for 1.6.0.
Git older than version 1.5.2 (or any other git version with this option
set to 1) may revert to version 1 of the pack index by manually deleting
all .idx files and recreating them using 'git index-pack'. Communication
over the git native protocol is unaffected since the pack index is never
transferred.
Signed-off-by: Nicolas Pitre <nico@cam.org>
---
Documentation/config.txt | 6 +++---
pack-write.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index c7fbc63..f72dd47 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -937,9 +937,9 @@ pack.indexVersion::
legacy pack index used by Git versions prior to 1.5.2, and 2 for
the new pack index with capabilities for packs larger than 4 GB
as well as proper protection against the repacking of corrupted
- packs. Version 2 is selected and this config option ignored
- whenever the corresponding pack is larger than 2 GB. Otherwise
- the default is 1.
+ packs. Version 2 is the default. Note that version 2 is enforced
+ and this config option ignored whenever the corresponding pack is
+ larger than 2 GB.
pack.packSizeLimit::
The default maximum size of a pack. This setting only affects
diff --git a/pack-write.c b/pack-write.c
index f52cabe..a8f0269 100644
--- a/pack-write.c
+++ b/pack-write.c
@@ -2,7 +2,7 @@
#include "pack.h"
#include "csum-file.h"
-uint32_t pack_idx_default_version = 1;
+uint32_t pack_idx_default_version = 2;
uint32_t pack_idx_off32_limit = 0x7fffffff;
static int sha1_compare(const void *_a, const void *_b)
--
1.5.6.56.g29b0d
^ permalink raw reply related
* [StGit PATCH 1/2] Convert "stg refresh" to the new infrastructure
From: Karl Hasselström @ 2008-06-25 4:30 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
And in the process, make it more powerful: it will now first create a
temp patch containing the updates, and then try to merge it into the
patch to be updated. If that patch is applied, this is done by
popping, pushing, and coalescing; if it is unapplied, it is done with
an in-index merge.
The temp patch creation and merging is logged in two separate stages,
so that the user can undo them separately.
Also, whenever path limiting is used, we will now use a temporary
index in order to avoid including all staged updates (since they may
touch stuff outside the path limiters).
Support for the --force, --undo, and --annotate flags were dropped.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
I've been working on this for some time -- it turned out to be bigger
than I'd thought. What do you think (especially about the double
logging that enables undoing)?
This was the last step before I was planning to remove the --undo
flags from everywhere. But I think I'll look over the log format first
(unless you want to do it -- in case we should get all this stuff
committed to a public non-rebasing development branch, since rebasing
gets really confusing when more than one person is working on things).
stgit/commands/refresh.py | 316 +++++++++++++++++++++++++++++----------------
stgit/lib/git.py | 62 ++++++++-
stgit/lib/stack.py | 9 +
stgit/lib/transaction.py | 11 +-
t/t3100-reset.sh | 2
5 files changed, 275 insertions(+), 125 deletions(-)
diff --git a/stgit/commands/refresh.py b/stgit/commands/refresh.py
index 4695c62..7afc55e 100644
--- a/stgit/commands/refresh.py
+++ b/stgit/commands/refresh.py
@@ -1,6 +1,8 @@
+# -*- coding: utf-8 -*-
__copyright__ = """
Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>
+Copyright (C) 2008, Karl Hasselström <kha@treskal.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
@@ -16,125 +18,209 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
-import sys, os
-from optparse import OptionParser, make_option
-
-from stgit.commands.common import *
-from stgit.utils import *
-from stgit.out import *
-from stgit import stack, git
-from stgit.config import config
-
+from optparse import make_option
+from stgit.commands import common
+from stgit.lib import git, transaction
+from stgit import utils
help = 'generate a new commit for the current patch'
usage = """%prog [options] [<files or dirs>]
-Include the latest tree changes in the current patch. This command
-generates a new GIT commit object with the patch details, the previous
-one no longer being visible. The '--force' option is useful
-when a commit object was created with a different tool
-but the changes need to be included in the current patch."""
-
-directory = DirectoryHasRepository()
-options = [make_option('-f', '--force',
- help = 'force the refresh even if HEAD and '\
- 'top differ',
- action = 'store_true'),
- make_option('--update',
- help = 'only update the current patch files',
- action = 'store_true'),
- make_option('--index',
- help = 'use the current contents of the index instead of looking at the working directory',
- action = 'store_true'),
- make_option('--undo',
- help = 'revert the commit generated by the last refresh',
- action = 'store_true'),
- make_option('-a', '--annotate', metavar = 'NOTE',
- help = 'annotate the patch log entry'),
+Include the latest work tree and index changes in the current patch.
+This command generates a new git commit object for the patch; the old
+commit is no longer visible.
+
+You may optionally list one or more files or directories relative to
+the current working directory; if you do, only matching files will be
+updated.
+
+Behind the scenes, stg refresh first creates a new temporary patch
+with your updates, and then merges that patch into the patch you asked
+to have refreshed. If you asked to refresh a patch other than the
+topmost patch, there can be conflicts; in that case, the temporary
+patch will be left for you to take care of, for example with stg
+coalesce.
+
+The creation of the temporary patch is recorded in a separate entry in
+the patch stack log; this means that one undo step will undo the merge
+between the other patch and the temp patch, and two undo steps will
+additionally get rid of the temp patch."""
+
+directory = common.DirectoryHasRepositoryLib()
+options = [make_option('-u', '--update', action = 'store_true',
+ help = 'only update the current patch files'),
+ make_option('-i', '--index', action = 'store_true',
+ help = ('only include changes from the index, not'
+ ' from the work tree')),
make_option('-p', '--patch',
- help = 'refresh (applied) PATCH instead of the top one')
- ]
-
-def func(parser, options, args):
- """Generate a new commit for the current or given patch.
- """
- args = git.ls_files(args)
- directory.cd_to_topdir()
-
- autoresolved = config.get('stgit.autoresolved')
- if autoresolved != 'yes':
- check_conflicts()
-
- if options.patch:
- if args or options.update:
- raise CmdException, \
- 'Only full refresh is available with the --patch option'
- patch = options.patch
- if not crt_series.patch_applied(patch):
- raise CmdException, 'Patches "%s" not applied' % patch
+ help = 'refresh PATCH instead of the topmost patch')]
+
+def get_patch(stack, given_patch):
+ """Get the name of the patch we are to refresh."""
+ if given_patch:
+ patch_name = given_patch
+ if not stack.patches.exists(patch_name):
+ raise common.CmdException('%s: no such patch' % patch_name)
+ return patch_name
else:
- patch = crt_series.get_current()
- if not patch:
- raise CmdException, 'No patches applied'
-
- if options.index:
- if args or options.update:
- raise CmdException, \
- 'Only full refresh is available with the --index option'
- if options.patch:
- raise CmdException, \
- '--patch is not compatible with the --index option'
-
- if not options.force:
- check_head_top_equal(crt_series)
-
- if options.undo:
- out.start('Undoing the refresh of "%s"' % patch)
- crt_series.undo_refresh()
- out.done()
- return
-
- if not options.index:
- files = [path for (stat, path) in git.tree_status(files = args, verbose = True)]
-
- if options.index or files or not crt_series.head_top_equal():
- if options.patch:
- applied = crt_series.get_applied()
- between = applied[:applied.index(patch):-1]
- pop_patches(crt_series, between, keep = True)
- elif options.update:
- rev1 = git_id(crt_series, '//bottom')
- rev2 = git_id(crt_series, '//top')
- patch_files = git.barefiles(rev1, rev2).split('\n')
- files = [f for f in files if f in patch_files]
- if not files:
- out.info('No modified files for updating patch "%s"' % patch)
- return
-
- out.start('Refreshing patch "%s"' % patch)
-
- if autoresolved == 'yes':
- resolved_all()
-
- if options.index:
- crt_series.refresh_patch(cache_update = False,
- backup = True, notes = options.annotate)
- else:
- crt_series.refresh_patch(files = files,
- backup = True, notes = options.annotate)
-
- if crt_series.empty_patch(patch):
- out.done('empty patch')
- else:
- out.done()
-
- if options.patch:
- between.reverse()
- push_patches(crt_series, between)
- elif options.annotate:
- # only annotate the top log entry as there is no need to
- # refresh the patch and generate a full commit
- crt_series.log_patch(crt_series.get_patch(patch), None,
- notes = options.annotate)
+ if not stack.patchorder.applied:
+ raise common.CmdException(
+ 'Cannot refresh top patch, because no patches are applied')
+ return stack.patchorder.applied[-1]
+
+def list_files(stack, patch_name, args, index, update):
+ """Figure out which files to update."""
+ if index:
+ # --index: Don't update the index.
+ return set()
+ paths = stack.repository.default_iw.changed_files(
+ stack.head.data.tree, args or [])
+ if update:
+ # --update: Restrict update to the paths that were already
+ # part of the patch.
+ paths &= stack.patches.get(patch_name).files()
+ return paths
+
+def write_tree(stack, paths, temp_index):
+ """Possibly update the index, and then write its tree.
+ @return: The written tree.
+ @rtype: L{Tree<stgit.git.Tree>}"""
+ def go(index):
+ if paths:
+ iw = git.IndexAndWorktree(index, stack.repository.default_worktree)
+ iw.update_index(paths)
+ return index.write_tree()
+ if temp_index:
+ index = stack.repository.temp_index()
+ try:
+ index.read_tree(stack.head)
+ return go(index)
+ finally:
+ index.delete()
+ stack.repository.default_iw.update_index(paths)
else:
- out.info('Patch "%s" is already up to date' % patch)
+ return go(stack.repository.default_index)
+
+def make_temp_patch(stack, patch_name, paths, temp_index):
+ """Commit index to temp patch, in a complete transaction. If any path
+ limiting is in effect, use a temp index."""
+ tree = write_tree(stack, paths, temp_index)
+ commit = stack.repository.commit(git.CommitData(
+ tree = tree, parents = [stack.head],
+ message = 'Refresh of %s' % patch_name))
+ temp_name = utils.make_patch_name('refresh-temp', stack.patches.exists)
+ trans = transaction.StackTransaction(stack,
+ 'refresh (create temporary patch)')
+ trans.patches[temp_name] = commit
+ trans.applied.append(temp_name)
+ return trans.run(stack.repository.default_iw,
+ print_current_patch = False), temp_name
+
+def absorb_applied(trans, iw, patch_name, temp_name):
+ """Absorb the temp patch (C{temp_name}) into the given patch
+ (C{patch_name}), which must be applied.
+
+ @return: C{True} if we managed to absorb the temp patch, C{False}
+ if we had to leave it for the user to deal with."""
+ temp_absorbed = False
+ try:
+ # Pop any patch on top of the patch we're refreshing.
+ to_pop = trans.applied[trans.applied.index(patch_name)+1:]
+ if len(to_pop) > 1:
+ popped = trans.pop_patches(lambda pn: pn in to_pop)
+ assert not popped # no other patches were popped
+ trans.push_patch(temp_name, iw)
+ assert to_pop.pop() == temp_name
+
+ # Absorb the temp patch.
+ temp_cd = trans.patches[temp_name].data
+ assert trans.patches[patch_name] == temp_cd.parent
+ trans.patches[patch_name] = trans.stack.repository.commit(
+ trans.patches[patch_name].data.set_tree(temp_cd.tree))
+ popped = trans.delete_patches(lambda pn: pn == temp_name, quiet = True)
+ assert not popped # the temp patch was topmost
+ temp_absorbed = True
+
+ # Push back any patch we were forced to pop earlier.
+ for pn in to_pop:
+ trans.push_patch(pn, iw)
+ except transaction.TransactionHalted:
+ pass
+ return temp_absorbed
+
+def absorb_unapplied(trans, iw, patch_name, temp_name):
+ """Absorb the temp patch (C{temp_name}) into the given patch
+ (C{patch_name}), which must be unapplied.
+
+ @param iw: Not used.
+ @return: C{True} if we managed to absorb the temp patch, C{False}
+ if we had to leave it for the user to deal with."""
+
+ # Pop the temp patch.
+ popped = trans.pop_patches(lambda pn: pn == temp_name)
+ assert not popped # the temp patch was topmost
+
+ # Try to create the new tree of the refreshed patch. (This is the
+ # same operation as pushing the temp patch onto the patch we're
+ # trying to refresh -- but we don't have a worktree to spill
+ # conflicts to, so if the simple merge doesn't succeed, we have to
+ # give up.)
+ patch_cd = trans.patches[patch_name].data
+ temp_cd = trans.patches[temp_name].data
+ new_tree = trans.stack.repository.simple_merge(
+ base = temp_cd.parent.data.tree,
+ ours = patch_cd.tree, theirs = temp_cd.tree)
+ if new_tree:
+ # It worked. Refresh the patch with the new tree, and delete
+ # the temp patch.
+ trans.patches[patch_name] = trans.stack.repository.commit(
+ patch_cd.set_tree(new_tree))
+ popped = trans.delete_patches(lambda pn: pn == temp_name, quiet = True)
+ assert not popped # the temp patch was not applied
+ return True
+ else:
+ # Nope, we couldn't create the new tree, so we'll just have to
+ # leave the temp patch for the user.
+ return False
+
+def absorb(stack, patch_name, temp_name):
+ """Absorb the temp patch into the target patch."""
+ trans = transaction.StackTransaction(stack, 'refresh')
+ iw = stack.repository.default_iw
+ f = { True: absorb_applied, False: absorb_unapplied
+ }[patch_name in trans.applied]
+ if f(trans, iw, patch_name, temp_name):
+ def info_msg(): pass
+ else:
+ def info_msg():
+ out.warn('The new changes did not apply cleanly to %s.'
+ % patch_name, 'They were saved in %s.' % temp_name)
+ r = trans.run(iw)
+ info_msg()
+ return r
+
+def func(parser, options, args):
+ """Generate a new commit for the current or given patch."""
+
+ # Catch illegal argument combinations.
+ path_limiting = bool(args or options.update)
+ if options.index and path_limiting:
+ raise common.CmdException(
+ 'Only full refresh is available with the --index option')
+
+ stack = directory.repository.current_stack
+ patch_name = get_patch(stack, options.patch)
+ paths = list_files(stack, patch_name, args, options.index, options.update)
+
+ # Make sure there are no conflicts in the files we want to
+ # refresh.
+ if stack.repository.default_index.conflicts() & paths:
+ raise common.CmdException(
+ 'Cannot refresh -- resolve conflicts first')
+
+ # Commit index to temp patch, and absorb it into the target patch.
+ retval, temp_name = make_temp_patch(
+ stack, patch_name, paths, temp_index = path_limiting)
+ if retval != utils.STGIT_SUCCESS:
+ return retval
+ return absorb(stack, patch_name, temp_name)
diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index 4c2605b..2aecf10 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -511,6 +511,14 @@ class RunWithEnvCwd(RunWithEnv):
@type env: dict
@param env: Extra environment"""
return RunWithEnv.run(self, args, env).cwd(self.cwd)
+ def run_in_cwd(self, args):
+ """Run the given command with an environment given by self.env and
+ self.env_in_cwd, without changing the current working
+ directory.
+
+ @type args: list of strings
+ @param args: Command and argument vector"""
+ return RunWithEnv.run(self, args, self.env_in_cwd)
class Repository(RunWithEnv):
"""Represents a git repository."""
@@ -655,6 +663,32 @@ class Repository(RunWithEnv):
assert isinstance(t2, Tree)
return self.run(['git', 'diff-tree', '-p'] + list(diff_opts)
+ [t1.sha1, t2.sha1]).raw_output()
+ def diff_tree_files(self, t1, t2):
+ """Given two L{Tree}s C{t1} and C{t2}, iterate over all files for
+ which they differ. For each file, yield a tuple with the old
+ file mode, the new file mode, the old blob, the new blob, the
+ status, the old filename, and the new filename. Except in case
+ of a copy or a rename, the old and new filenames are
+ identical."""
+ assert isinstance(t1, Tree)
+ assert isinstance(t2, Tree)
+ i = iter(self.run(['git', 'diff-tree', '-r', '-z'] + [t1.sha1, t2.sha1]
+ ).raw_output().split('\0'))
+ try:
+ while True:
+ x = i.next()
+ if not x:
+ continue
+ omode, nmode, osha1, nsha1, status = x[1:].split(' ')
+ fn1 = i.next()
+ if status[0] in ['C', 'R']:
+ fn2 = i.next()
+ else:
+ fn2 = fn1
+ yield (omode, nmode, self.get_blob(osha1),
+ self.get_blob(nsha1), status, fn1, fn2)
+ except StopIteration:
+ pass
class MergeException(exception.StgException):
"""Exception raised when a merge fails for some reason."""
@@ -678,6 +712,9 @@ class Index(RunWithEnv):
def read_tree(self, tree):
self.run(['git', 'read-tree', tree.sha1]).no_output()
def write_tree(self):
+ """Write the index contents to the repository.
+ @return: The resulting L{Tree}
+ @rtype: L{Tree}"""
try:
return self.__repository.get_tree(
self.run(['git', 'write-tree']).discard_stderr(
@@ -719,6 +756,7 @@ class Worktree(object):
def __init__(self, directory):
self.__directory = directory
env = property(lambda self: { 'GIT_WORK_TREE': '.' })
+ env_in_cwd = property(lambda self: { 'GIT_WORK_TREE': self.directory })
directory = property(lambda self: self.__directory)
class CheckoutException(exception.StgException):
@@ -735,6 +773,7 @@ class IndexAndWorktree(RunWithEnvCwd):
index = property(lambda self: self.__index)
env = property(lambda self: utils.add_dict(self.__index.env,
self.__worktree.env))
+ env_in_cwd = property(lambda self: self.__worktree.env_in_cwd)
cwd = property(lambda self: self.__worktree.directory)
def checkout_hard(self, tree):
assert isinstance(tree, Tree)
@@ -768,11 +807,24 @@ class IndexAndWorktree(RunWithEnvCwd):
raise MergeConflictException()
else:
raise MergeException('Index/worktree dirty')
- def changed_files(self):
- return self.run(['git', 'diff-files', '--name-only']).output_lines()
- def update_index(self, files):
- self.run(['git', 'update-index', '--remove', '-z', '--stdin']
- ).input_nulterm(files).discard_output()
+ def changed_files(self, tree, pathlimits = []):
+ """Return the set of files in the worktree that have changed with
+ respect to C{tree}. The listing is optionally restricted to
+ those files that match any of the path limiters given.
+
+ The path limiters are relative to the current working
+ directory; the returned file names are relative to the
+ repository root."""
+ assert isinstance(tree, Tree)
+ return set(self.run_in_cwd(
+ ['git', 'diff-index', tree.sha1, '--name-only', '-z', '--']
+ + list(pathlimits)).raw_output().split('\0')[:-1])
+ def update_index(self, paths):
+ """Update the index with files from the worktree. C{paths} is an
+ iterable of paths relative to the root of the repository."""
+ cmd = ['git', 'update-index', '--remove']
+ self.run(cmd + ['-z', '--stdin']
+ ).input_nulterm(paths).discard_output()
class Branch(object):
"""Represents a Git branch."""
diff --git a/stgit/lib/stack.py b/stgit/lib/stack.py
index 2d686e6..3cf66e7 100644
--- a/stgit/lib/stack.py
+++ b/stgit/lib/stack.py
@@ -86,6 +86,15 @@ class Patch(object):
return self.name in self.__stack.patchorder.applied
def is_empty(self):
return self.commit.data.is_nochange()
+ def files(self):
+ """Return the set of files this patch touches."""
+ fs = set()
+ for (_, _, _, _, _, oldname, newname
+ ) in self.__stack.repository.diff_tree_files(
+ self.commit.data.tree, self.commit.data.parent.data.tree):
+ fs.add(oldname)
+ fs.add(newname)
+ return fs
class PatchOrder(object):
"""Keeps track of patch order, and which patches are applied.
diff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py
index 0c8d9a5..ac0594d 100644
--- a/stgit/lib/transaction.py
+++ b/stgit/lib/transaction.py
@@ -163,7 +163,8 @@ class StackTransaction(object):
if iw:
self.__checkout(self.__stack.head.data.tree, iw,
allow_bad_head = True)
- def run(self, iw = None, allow_bad_head = False):
+ def run(self, iw = None, allow_bad_head = False,
+ print_current_patch = True):
"""Execute the transaction. Will either succeed, or fail (with an
exception) and do nothing."""
self.__check_consistency()
@@ -203,7 +204,8 @@ class StackTransaction(object):
self.__patches = _TransPatchMap(self.__stack)
self.__conflicting_push()
write(self.__msg + ' (CONFLICT)')
- _print_current_patch(old_applied, self.__applied)
+ if print_current_patch:
+ _print_current_patch(old_applied, self.__applied)
if self.__error:
return utils.STGIT_CONFLICT
@@ -239,7 +241,7 @@ class StackTransaction(object):
self.__print_popped(popped)
return popped1
- def delete_patches(self, p):
+ def delete_patches(self, p, quiet = False):
"""Delete all patches pn for which p(pn) is true. Return the list of
other patches that had to be popped to accomplish this. Always
succeeds."""
@@ -257,7 +259,8 @@ class StackTransaction(object):
if p(pn):
s = ['', ' (empty)'][self.patches[pn].data.is_nochange()]
self.patches[pn] = None
- out.info('Deleted %s%s' % (pn, s))
+ if not quiet:
+ out.info('Deleted %s%s' % (pn, s))
return popped
def push_patch(self, pn, iw = None):
diff --git a/t/t3100-reset.sh b/t/t3100-reset.sh
index 1805091..a721d6d 100755
--- a/t/t3100-reset.sh
+++ b/t/t3100-reset.sh
@@ -142,7 +142,7 @@ cat > expected.txt <<EOF
222
EOF
test_expect_success '... and undo the refresh' '
- stg reset master.stgit^~1 &&
+ stg reset master.stgit^~2 &&
test "$(echo $(stg applied))" = "p1 p2" &&
test "$(echo $(stg unapplied))" = "" &&
test_cmp expected.txt a
^ permalink raw reply related
* [StGit PATCH 2/2] New refresh tests
From: Karl Hasselström @ 2008-06-25 4:30 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20080625042337.6044.53357.stgit@yoghurt>
Test stg refresh more extensively -- including some things it only
recently learned to do.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
t/t2300-refresh-subdir.sh | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/t/t2300-refresh-subdir.sh b/t/t2300-refresh-subdir.sh
index 92c1cc8..d731a11 100755
--- a/t/t2300-refresh-subdir.sh
+++ b/t/t2300-refresh-subdir.sh
@@ -4,7 +4,7 @@ test_description='Test the refresh command from a subdirectory'
stg init
test_expect_success 'Refresh from a subdirectory' '
- stg new foo -m foo &&
+ stg new p0 -m p0 &&
echo foo >> foo.txt &&
mkdir bar &&
echo bar >> bar/bar.txt &&
@@ -45,4 +45,31 @@ test_expect_success 'Refresh subdirectories recursively' '
[ "$(stg status)" = "" ]
'
+test_expect_success 'refresh -u' '
+ echo baz >> bar/baz.txt &&
+ stg new p1 -m p1 &&
+ git add bar/baz.txt &&
+ stg refresh --index &&
+ echo xyzzy >> foo.txt &&
+ echo xyzzy >> bar/bar.txt &&
+ echo xyzzy >> bar/baz.txt &&
+ stg refresh -u &&
+ test "$(echo $(stg status))" = "M bar/bar.txt M foo.txt"
+'
+
+test_expect_success 'refresh -u -p <subdir>' '
+ echo xyzzy >> bar/baz.txt &&
+ stg refresh -p p0 -u bar &&
+ test "$(echo $(stg status))" = "M bar/baz.txt M foo.txt"
+'
+
+test_expect_success 'refresh an unapplied patch' '
+ stg refresh -u &&
+ stg goto p0 &&
+ test "$(stg status)" = "M foo.txt" &&
+ stg refresh -p p1 &&
+ test "$(stg status)" = "" &&
+ test "$(echo $(stg files p1))" = "A bar/baz.txt M foo.txt"
+'
+
test_done
^ permalink raw reply related
* Re: [PATCH] Ask for "git program" when asking for "git-program" over SSH connection
From: Junio C Hamano @ 2008-06-25 4:32 UTC (permalink / raw)
To: Shawn O. Pearce
Cc: しらいしななこ,
Miklos Vajna, pclouds, Johannes Schindelin, Pieter de Bie, git
In-Reply-To: <20080625034538.GW11793@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> writes:
> Sorry, but I think this change needs to go higher up, to the default
> values that --upload-pack and remote.$name.uploadpack override,
> so the user can at least work around it when we break her ability
> to use github, gitosis, or anything like it.
Well, the thing is, "higher up" would not have enough clue to see if it
needs to give dashed form (for git-daemon) or space form (for ssh), so
that suggestion won't help much.
I do not care too much about closed source service, but gitosis should be
able to update the pattern to allow "git[ -]upload-pack" reasonably
easily.
Any other suggestions that is workable?
^ permalink raw reply
* Re: [PATCH] pack.indexversion config option now defaults to 2
From: Linus Torvalds @ 2008-06-25 4:32 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Junio C Hamano, git
In-Reply-To: <alpine.LFD.1.10.0806250025130.2979@xanadu.home>
On Wed, 25 Jun 2008, Nicolas Pitre wrote:
>
> Git older than version 1.5.2 (or any other git version with this option
> set to 1) may revert to version 1 of the pack index by manually deleting
> all .idx files and recreating them using 'git index-pack'. Communication
> over the git native protocol is unaffected since the pack index is never
> transferred.
Rather than talk about when it does _not_ matter, wouldn't it be better to
talk about when it _can_ matter?
Namely when using dumb protocols, either http or rsync, with the other end
being some ancient git thing (and it is worth mentioning version of what
counts as 'ancient' too, I can't remember, probably means that pretty much
nobody else can either).
Linus
^ permalink raw reply
* Re: [PATCH] Keep some git-* programs in $(bindir)
From: Shawn O. Pearce @ 2008-06-25 4:37 UTC (permalink / raw)
To: Daniel Barkalow
Cc: Junio C Hamano,
しらいしななこ,
Miklos Vajna, pclouds, Johannes Schindelin, Pieter de Bie, git
In-Reply-To: <alpine.LNX.1.00.0806250015580.19665@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> wrote:
> On Tue, 24 Jun 2008, Junio C Hamano wrote:
>
> > Otherwise remote executions directly over ssh won't find them as they used
> > to. --upload-pack and --receive-pack options _could_ be used on the
> > client side, but things should keep working out-of-box for older clients.
> >
> > Later versions of clients (fetch-pack and send-pack) probably could start
> > asking for these programs with dashless form, but that is a different
> > topic.
>
> Should they use "git upload-pack" or should they look for their helper
> programs in a libexec dir? I don't think that either of these programs is
> useful to run independantly, but I don't know if finding a program that
> doesn't go in $PATH on a remote machine is going to be any fun.
IMHO they should in the future use "git upload-pack".
But this may not work with all servers, especially those that
use $SSH_ORIGINAL_COMMAND to dispatch to the correct command,
or abort if the user tries to request something dangerous.
Gitosis comes to mind.
I'm not sure we can get away with doing this in 1.6.0 as it is
effectively a network protocol breakage. We have thus far never
caused a newer client to fail talking to an older server. I'm
not sure we should start doing that in 1.6.0.
My vote is we keep the dashed form of these 3 commands in the
$PATH during 1.6 and remove them in 1.7, but when we do it we
must ensure there is a way to still request dashed form found
through $PATH when passing --upload-pack as an argument.
--
Shawn.
^ permalink raw reply
* Re: [PATCH] Ask for "git program" when asking for "git-program" over SSH connection
From: Shawn O. Pearce @ 2008-06-25 4:44 UTC (permalink / raw)
To: Junio C Hamano
Cc: しらいしななこ,
Miklos Vajna, pclouds, Johannes Schindelin, Pieter de Bie, git
In-Reply-To: <7vk5ge6soc.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
>
> > Sorry, but I think this change needs to go higher up, to the default
> > values that --upload-pack and remote.$name.uploadpack override,
> > so the user can at least work around it when we break her ability
> > to use github, gitosis, or anything like it.
>
> Well, the thing is, "higher up" would not have enough clue to see if it
> needs to give dashed form (for git-daemon) or space form (for ssh), so
> that suggestion won't help much.
Actually I'd go the other direction. Allow the higher up level
to supply "git upload-pack" and convert it to git- for the git://
protocol. Possible patch below.
> I do not care too much about closed source service, but gitosis should be
> able to update the pattern to allow "git[ -]upload-pack" reasonably
> easily.
Pasky also has to update:
$ git ls-remote --upload-pack='git upload-pack' repo.or.cz:/srv/git/egit.git
fatal: unrecognized command 'git upload-pack '/srv/git/egit.git''
fatal: The remote end hung up unexpectedly
;-)
> Any other suggestions that is workable?
diff --git a/builtin-clone.c b/builtin-clone.c
index 5c5acb4..98d0f0f 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -37,7 +37,7 @@ static int option_quiet, option_no_checkout, option_bare;
static int option_local, option_no_hardlinks, option_shared;
static char *option_template, *option_reference, *option_depth;
static char *option_origin = NULL;
-static char *option_upload_pack = "git-upload-pack";
+static char *option_upload_pack = "git upload-pack";
static struct option builtin_clone_options[] = {
OPT__QUIET(&option_quiet),
@@ -58,7 +58,7 @@ static struct option builtin_clone_options[] = {
OPT_STRING('o', "origin", &option_origin, "branch",
"use <branch> instead or 'origin' to track upstream"),
OPT_STRING('u', "upload-pack", &option_upload_pack, "path",
- "path to git-upload-pack on the remote"),
+ "path to git upload-pack on the remote"),
OPT_STRING(0, "depth", &option_depth, "depth",
"create a shallow clone of that depth"),
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index f4dbcf0..b0efd01 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -14,7 +14,7 @@ static int transfer_unpack_limit = -1;
static int fetch_unpack_limit = -1;
static int unpack_limit = 100;
static struct fetch_pack_args args = {
- /* .uploadpack = */ "git-upload-pack",
+ /* .uploadpack = */ "git upload-pack",
};
static const char fetch_pack_usage[] =
diff --git a/connect.c b/connect.c
index e92af29..dbabd93 100644
--- a/connect.c
+++ b/connect.c
@@ -576,8 +576,8 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
* from extended components with a NUL byte.
*/
packet_write(fd[1],
- "%s %s%chost=%s%c",
- prog, path, 0,
+ "git-%s %s%chost=%s%c",
+ prog + 4, path, 0,
target_host, 0);
free(target_host);
free(url);
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 695a409..0f82a93 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -255,10 +255,10 @@ get_uploadpack () {
case "$data_source" in
config)
uplp=$(git config --get "remote.$1.uploadpack")
- echo ${uplp:-git-upload-pack}
+ echo ${uplp:-git upload-pack}
;;
*)
- echo "git-upload-pack"
+ echo "git upload-pack"
;;
esac
}
diff --git a/transport.c b/transport.c
index 3ff8519..351b7f5 100644
--- a/transport.c
+++ b/transport.c
@@ -762,10 +762,10 @@ struct transport *transport_get(struct remote *remote, const char *url)
data->thin = 1;
data->conn = NULL;
- data->uploadpack = "git-upload-pack";
+ data->uploadpack = "git upload-pack";
if (remote && remote->uploadpack)
data->uploadpack = remote->uploadpack;
- data->receivepack = "git-receive-pack";
+ data->receivepack = "git receive-pack";
if (remote && remote->receivepack)
data->receivepack = remote->receivepack;
}
--
Shawn.
^ permalink raw reply related
* Re: [PATCH] pack.indexversion config option now defaults to 2
From: Junio C Hamano @ 2008-06-25 4:59 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Nicolas Pitre, git
In-Reply-To: <alpine.LFD.1.10.0806242130450.22069@hp.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Wed, 25 Jun 2008, Nicolas Pitre wrote:
>>
>> Git older than version 1.5.2 (or any other git version with this option
>> set to 1) may revert to version 1 of the pack index by manually deleting
>> all .idx files and recreating them using 'git index-pack'. Communication
>> over the git native protocol is unaffected since the pack index is never
>> transferred.
>
> Rather than talk about when it does _not_ matter, wouldn't it be better to
> talk about when it _can_ matter?
>
> Namely when using dumb protocols, either http or rsync, with the other end
> being some ancient git thing (and it is worth mentioning version of what
> counts as 'ancient' too, I can't remember, probably means that pretty much
> nobody else can either).
I agree with you that the description of the change (in the commit log)
and the instruction (in the documentation) could be more helpful and
explicit.
For the other "usedeltabaseoffset" change, I think the insn in the
documentation Nico added is reasonable:
+ By default, linkgit:git-repack[1] creates packs that use
+ delta-base offset. If you need to share your repository with
+ git older than version 1.4.4, either directly or via a dumb
+ protocol such as http, then you need to set this option to
+ "false" and repack. Access from old git versions over the
+ native protocol are unaffected by this option.
except perhaps that the "set false and repack" should be clarified
further, perhaps like:
... then you need to set this option to "false" and repack using
git that is newer than (and including) v1.5.0.
I am basing the above 1.5.0 on description of b6945f5 (git-repack:
repo.usedeltabaseoffset, 2006-10-13).
On the "indexVersion" change, the documentation reads:
pack.indexVersion::
Specify the default pack index version. Valid values are 1 for
legacy pack index used by Git versions prior to 1.5.2, and 2 for
the new pack index with capabilities for packs larger than 4 GB
as well as proper protection against the repacking of corrupted
+ packs. Version 2 is the default. Note that version 2 is enforced
+ and this config option ignored whenever the corresponding pack is
+ larger than 2 GB.
which lacks the recovery insn (and it is int strictly the fault of this
patch, but we should have done this when we introduced the v2 idx). I
think a separate paragraph after the above would be necessary and
sufficient:
If you have an ancient git that does not understand the version 2
`*.idx` file, cloning or fetching over a non native protocol
(e.g. "http" and "rsync") which will copy both `*.pack` file and
corresponding `*.idx` file from the other side may give you a
repository that cannot be accessed with your old git. If the
`*.pack` file is smaller than 2 GB, however, you can use
`git-index-pack` on the `*.pack` to regenerate the `*.idx` file.
^ permalink raw reply
* Re: [PATCH] Ask for "git program" when asking for "git-program" over SSH connection
From: Junio C Hamano @ 2008-06-25 5:09 UTC (permalink / raw)
To: Shawn O. Pearce
Cc: しらいしななこ,
Miklos Vajna, pclouds, Johannes Schindelin, Pieter de Bie, git
In-Reply-To: <20080625044409.GE11793@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> writes:
>> Any other suggestions that is workable?
>
> diff --git a/builtin-clone.c b/builtin-clone.c
> index 5c5acb4..98d0f0f 100644
> --- a/builtin-clone.c
> +++ b/builtin-clone.c
> @@ -37,7 +37,7 @@ static int option_quiet, option_no_checkout, option_bare;
<< a patch to conditionally change "git-program" default to "git program"
snipped >>
How would that help client that talk with git-daemon, unlike what I sent
earlier?
^ permalink raw reply
* Re: [PATCH] Ask for "git program" when asking for "git-program" over SSH connection
From: Junio C Hamano @ 2008-06-25 5:13 UTC (permalink / raw)
To: Shawn O. Pearce
Cc: しらいしななこ,
Miklos Vajna, pclouds, Johannes Schindelin, Pieter de Bie, git
In-Reply-To: <7v8wwu6qxr.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
>
>>> Any other suggestions that is workable?
>>
>> diff --git a/builtin-clone.c b/builtin-clone.c
>> index 5c5acb4..98d0f0f 100644
>> --- a/builtin-clone.c
>> +++ b/builtin-clone.c
>> @@ -37,7 +37,7 @@ static int option_quiet, option_no_checkout, option_bare;
>
> << a patch to conditionally change "git-program" default to "git program"
> snipped >>
Typofix: s/cond/uncond/;
> How would that help client that talk with git-daemon, unlike what I sent
> earlier?
If we force --upload-pack workaround to _everybody_ we are already lost.
Also I think the previous one still lets you work it around by giving a
full path, like "/usr/local/bin/git-upload-pack", because "/usr" does not
match "git-" ;-)
^ permalink raw reply
* Re: [PATCH] Ship sample hooks with .sample suffix
From: Peter Baumann @ 2008-06-25 5:18 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Christian Holtje
In-Reply-To: <7vtzfi8dvk.fsf_-_@gitster.siamese.dyndns.org>
On Tue, Jun 24, 2008 at 07:09:03PM -0700, Junio C Hamano wrote:
> We used to mark hooks we ship as samples by making them unexecutable, but
> some filesystems cannot tell what is executable and what is not.
>
> This makes it much more explicit. The hooks are suffixed with .sample
> (but now are made executable), so enabling it is still one step operation
> (instead of "chmod +x $hook", you would do "mv $hook.sample $hook") but
> now they won't get accidentally enabled on systems without executable bit.
>
Wouldn't it be better to name the hooks $hook.deactivated so its obvious
to anybody that they are not executed? Just my 2 cents.
-Peter
^ permalink raw reply
* Re: [PATCH] Ask for "git program" when asking for "git-program" over SSH connection
From: Junio C Hamano @ 2008-06-25 5:27 UTC (permalink / raw)
To: Shawn O. Pearce
Cc: しらいしななこ,
Miklos Vajna, pclouds, Johannes Schindelin, Pieter de Bie, git
In-Reply-To: <7v4p7i6qs1.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> If we force --upload-pack workaround to _everybody_ we are already lost.
>
> Also I think the previous one still lets you work it around by giving a
> full path, like "/usr/local/bin/git-upload-pack", because "/usr" does not
> match "git-" ;-)
Ok, let's map this out seriously.
* 1.6.0 will install the server-side programs in $(bindir) so that
people coming over ssh will find them on the $PATH
* In 1.6.0 (and 1.5.6.1), we will change "git daemon" to accept both
"git-program" and "git program" forms. When the spaced form is used, it
will behave as if the dashed form is requested. This is a prerequisite
for client side change to start asking for "git program".
* In the near future, there will no client-side change. "git-program"
will be asked for.
* 6 months after 1.6.0 ships, hopefully all the deployed server side will
be running that version or newer. Client side will start asking for
"git program" by default, but we can still override with --upload-pack
and friends.
* 12 months after client side changes, everybody will be running that
version or newer. We stop installing the server side programs in
$(bindir) but people coming over ssh will be asking for "git program"
and "git" will be on the $PATH so there is no issue.
The above 6 and 12 are yanked out of thin air and I am of course open to
tweaking them, but I think the above order of events would be workable.
^ permalink raw reply
* Re: [PATCH] cmd_reset: don't trash uncommitted changes unless told to
From: Johannes Gilger @ 2008-06-25 5:29 UTC (permalink / raw)
To: git
In-Reply-To: <1214346098-24584-1-git-send-email-stevenrwalter@gmail.com>
On 24/06/08 18:21, Steven Walter wrote:
> Give "reset --hard" a -f (force) flag, without which it will refuse to
> proceed if there are changes in the index or working tree.
Oh no. I can only agree and repeat myself, as I think this is nonsense.
git is a tool, and like every tool you can hurt yourself with it if you
don't read the manual and follow really simple guidelines. I used git
reset --hard on a test-repo before using it on my real code, and it has
never bit me since. Why do we have --hard then? It would be "An option
which does nothing unless you also specify -f on the command-line".
Just my opinion, but I think quite a few people feel the same
Regards,
Jojo
--
Johannes Gilger <heipei@hackvalue.de>
http://hackvalue.de/heipei/
GPG-Key: 0x42F6DE81
GPG-Fingerprint: BB49 F967 775E BB52 3A81 882C 58EE B178 42F6 DE81
^ permalink raw reply
* Re: [PATCH] Ask for "git program" when asking for "git-program" over SSH connection
From: Junio C Hamano @ 2008-06-25 5:30 UTC (permalink / raw)
To: Shawn O. Pearce
Cc: しらいしななこ,
Miklos Vajna, pclouds, Johannes Schindelin, Pieter de Bie, git
In-Reply-To: <20080625044409.GE11793@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> writes:
> Pasky also has to update:
>
> $ git ls-remote --upload-pack='git upload-pack' repo.or.cz:/srv/git/egit.git
> fatal: unrecognized command 'git upload-pack '/srv/git/egit.git''
> fatal: The remote end hung up unexpectedly
Of course. I am assuming that he runs git-shell for user account, and
that's what the change in 'next' is about.
^ 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