* Re: What's in git.git (stable)
From: Johannes Schindelin @ 2006-12-16 0:14 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jakub Narebski
In-Reply-To: <7vac1on2oh.fsf@assigned-by-dhcp.cox.net>
Hi,
On Fri, 15 Dec 2006, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > On Fri, 15 Dec 2006, Jakub Narebski wrote:
> >
> >> Junio C Hamano wrote:
> >>
> >> > (Jakub, please do not drop people from cc: list; you were asked
> >> > more than once).
> >>
> >> The problem is that I'm not subscribed to git mailing list;
> >
> > So subscribe. I am sure I lost quite some of your responses to my emails,
> > _just_ because you happen to kill me from the Cc: list.
> >
> > IOW if you expect answers, _please_ adher to net standards.
>
> FWIW, I also read the list traffic through gmane news gateway.
So, how do you tackle the problem Jakub evidently has, namely to reply to
all the people who your reply refers to?
Ciao,
Dscho
^ permalink raw reply
* Re: svn versus git
From: Nguyen Thai Ngoc Duy @ 2006-12-16 0:26 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Junio C Hamano, Johannes Schindelin, git
In-Reply-To: <Pine.LNX.4.64.0612151736470.18171@xanadu.home>
On 12/16/06, Nicolas Pitre <nico@cam.org> wrote:
> On Fri, 15 Dec 2006, Junio C Hamano wrote:
>
> > * we add 'git ls' command to give Porcelain-ish access to
> > ls-tree and ls-files.
>
> That seems the most sensible to me.
I agree.
--
^ permalink raw reply
* Re: What's in git.git (stable)
From: Junio C Hamano @ 2006-12-16 0:30 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, Jakub Narebski
In-Reply-To: <Pine.LNX.4.63.0612160113090.3635@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>> FWIW, I also read the list traffic through gmane news gateway.
>
> So, how do you tackle the problem Jakub evidently has, namely to reply to
> all the people who your reply refers to?
I do not "tackle".
I just tell Gnus to follow-up, which does not always do the
right thing [*1*], and I just try to be careful and fix up To:
and Cc: fields by hand as necessary. The time spent on that on
my part is _worth_ spending than inconveniencing others.
It's just a common courtesy, not "tackling".
[Footnote]
*1* ... most likely because I haven't configured it to do the
right thing, and/or the sender or the gateway puts a wrong
Reply-To: or Mail-Followup-To: header and it ends up honoring
them.
^ permalink raw reply
* Re: git-fetch fails with error code 128
From: Junio C Hamano @ 2006-12-16 0:37 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Andy Parkins, git
In-Reply-To: <Pine.LNX.4.64.0612151706150.18171@xanadu.home>
Nicolas Pitre <nico@cam.org> writes:
> I really doubt it is a compatibility problem. The provided error
> message may only result from the fact that patch_delta() has returned
> NULL.
>
> And since patch-delta is really simple, it doesn't have many reasons for
> returning NULL: either the object store on either the remote or local
> side is corrupted in which case a git-fsck-objects --full should catch
> that, or the system ran out of memory.
Hmmmm. True and sad. Sad because I do not offhand think of
places to trim the memory usage.
^ permalink raw reply
* Re: [RFC] Submodules in GIT
From: Torgil Svensson @ 2006-12-16 1:13 UTC (permalink / raw)
To: Josef Weidendorfer; +Cc: R. Steve McKown, Linus Torvalds, git
In-Reply-To: <e7bda7770612151543o39c9d233q91ea643a134196d3@mail.gmail.com>
On 12/16/06, Torgil Svensson <torgil.svensson@gmail.com> wrote:
> I'm very open to suggestions here, but the concept growing in my head
> is based around Linus 'module'-file and keep things simple. A git
> configuration file that specifies:
> * link name for reference
> * local path to link
> * submodule source
> * submodule path to tree/blob
> * submodule commit / HEAD / branch
> * options (depth-limit , ...)
>
> I'm reconsidering having the path-name in the link, it should be
> sufficient to have two SHA1's, one for the commit and one for the
> tree/blob. Super-module should have the tree/blob in it's database so
> that the link part only is there for version information and reference
> (checking dirty state or history on the submodule). This way it easy
> to clone the super-project and use it without having to map up all
> sub-project sources. Sub-project sources is not important for version
> information and could always be specified in the project in a
> README-type of file.
>
See it as the link only is there for the version handling between
different modules and it's the module file that give an UI to the the
link (which project, branch, ....). Many users will not care whats
behind those links, but if they want to edit the link they have to
create the modules file or fetch it somewhere - it may even be
provided and version controlled in the project itself.
example tree object:
100644 blob <sha1 of blob> README
100644 blob <sha1 of blob> REPORTING-BUGS
100644 link <sha1 of blob> <sha1 of commit>
040000 tree <sha1 of tree> arch
040000 tree <sha1 of tree> block
040000 link <sha1 of tree> <sha1 of commit>
Note that the links functions exactly as the blobs and trees in the
database. The difference is that they origin from _a_subproject_ (we
don't care which in this stage) with the specified commit SHA1. If the
link isn't represented in the modules file, it's no big deal, it can
be added later on if needed.
If the blame-game begins or if we want to check what we're using on a
submodule level we can always pinpoint the exact file/tree content and
^ permalink raw reply
* Re: [RFC] Submodules in GIT
From: Torgil Svensson @ 2006-12-16 1:20 UTC (permalink / raw)
To: Josef Weidendorfer; +Cc: R. Steve McKown, Linus Torvalds, git
In-Reply-To: <e7bda7770612151713k418434e6gd8d565e49a766477@mail.gmail.com>
On 12/16/06, Torgil Svensson <torgil.svensson@gmail.com> wrote:
>
> example tree object:
>
> 100644 blob <sha1 of blob> README
> 100644 blob <sha1 of blob> REPORTING-BUGS
> 100644 link <sha1 of blob> <sha1 of commit>
> 040000 tree <sha1 of tree> arch
> 040000 tree <sha1 of tree> block
> 040000 link <sha1 of tree> <sha1 of commit>
>
Sorry, I was sloppy and forgot the names:
100644 blob <sha1 of blob> README
100644 blob <sha1 of blob> REPORTING-BUGS
100644 link <sha1 of blob> <sha1 of commit> AUTHORS
040000 tree <sha1 of tree> arch
040000 tree <sha1 of tree> block
040000 link <sha1 of tree> <sha1 of commit> misc
Now it doesn't looks like trees/blobs anymore so maybe a link object is handy:
100644 blob <sha1 of blob> README
100644 blob <sha1 of blob> REPORTING-BUGS
100644 link <sha1 of link> AUTHORS
040000 tree <sha1 of tree> arch
040000 tree <sha1 of tree> block
040000 link <sha1 of link> misc
link-object:
<sha1 of commit>
^ permalink raw reply
* Re: [RFC] Submodules in GIT
From: Jakub Narebski @ 2006-12-16 1:34 UTC (permalink / raw)
To: git
In-Reply-To: <e7bda7770612151720w2e65fe83s9942e1ec1f7092a2@mail.gmail.com>
Torgil Svensson wrote:
> On 12/16/06, Torgil Svensson <torgil.svensson@gmail.com> wrote:
>>
>> example tree object:
>>
>> 100644 blob <sha1 of blob> README
>> 100644 blob <sha1 of blob> REPORTING-BUGS
>> 100644 link <sha1 of blob> <sha1 of commit>
>> 040000 tree <sha1 of tree> arch
>> 040000 tree <sha1 of tree> block
>> 040000 link <sha1 of tree> <sha1 of commit>
>>
>
> Sorry, I was sloppy and forgot the names:
>
> 100644 blob <sha1 of blob> README
> 100644 blob <sha1 of blob> REPORTING-BUGS
> 100644 link <sha1 of blob> <sha1 of commit> AUTHORS
> 040000 tree <sha1 of tree> arch
> 040000 tree <sha1 of tree> block
> 040000 link <sha1 of tree> <sha1 of commit> misc
>
> Now it doesn't looks like trees/blobs anymore so maybe a link object
> is handy:
>
> 100644 blob <sha1 of blob> README
> 100644 blob <sha1 of blob> REPORTING-BUGS
> 100644 link <sha1 of link> AUTHORS
> 040000 tree <sha1 of tree> arch
> 040000 tree <sha1 of tree> block
> 040000 link <sha1 of link> misc
>
> link-object:
> <sha1 of commit>
> <sha1 of tree/blob>
What do you need <sha1 of tree/blob> for in link-object? Wouldn't you
use usually the sha1 of top tree of a commit, which is uniquely defined
by commit object, so you need only <ahs1 of commit>?
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [RFC] Submodules in GIT
From: Linus Torvalds @ 2006-12-16 1:49 UTC (permalink / raw)
To: Torgil Svensson; +Cc: Josef Weidendorfer, R. Steve McKown, git
In-Reply-To: <e7bda7770612151713k418434e6gd8d565e49a766477@mail.gmail.com>
On Sat, 16 Dec 2006, Torgil Svensson wrote:
>
> 100644 blob <sha1 of blob> README
> 100644 blob <sha1 of blob> REPORTING-BUGS
> 100644 link <sha1 of blob> <sha1 of commit>
> 040000 tree <sha1 of tree> arch
> 040000 tree <sha1 of tree> block
> 040000 link <sha1 of tree> <sha1 of commit>
That 040000 needs to be something else.
In order for something like a git-fsck-objects to know that it's a link,
it needs to be marked as such.
In git, we never just randomly open an object by SHA1, and then figure out
its type. We always open things by explicitly knowing both the type and
the SHA1, and if the object we find has the wrong type, that's a
consistency error in the database (or the user).
^ permalink raw reply
* Re: [RFC] Submodules in GIT
From: Linus Torvalds @ 2006-12-16 2:12 UTC (permalink / raw)
To: Torgil Svensson; +Cc: Josef Weidendorfer, R. Steve McKown, git
In-Reply-To: <Pine.LNX.4.64.0612151747470.3849@woody.osdl.org>
On Fri, 15 Dec 2006, Linus Torvalds wrote:
>
> On Sat, 16 Dec 2006, Torgil Svensson wrote:
> >
> > 100644 blob <sha1 of blob> README
> > 100644 blob <sha1 of blob> REPORTING-BUGS
> > 100644 link <sha1 of blob> <sha1 of commit>
> > 040000 tree <sha1 of tree> arch
> > 040000 tree <sha1 of tree> block
> > 040000 link <sha1 of tree> <sha1 of commit>
>
> That 040000 needs to be something else.
Side note: that's not to say that I would really see why you'd want to
have both the tree and the commit SHA1's, and why you seemingly think that
the links don't need a filename. Hmm?
If you require the tree objects to be in the database, you might as well
require that the commit object be there. But you could make rules that say
that subprojects don't need the whole commit history, for example (which
is just a shallow clone in the subproject).
^ permalink raw reply
* [PATCH 2/2] Align section headers of 'git status' to new 'git add'.
From: Shawn O. Pearce @ 2006-12-16 2:53 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <0191094fd2ac0afb27b31b9a90d98dfa4ec03b17.1166237566.git.spearce@spearce.org>
Now that 'git add' is considered a first-class UI for 'update-index'
and that the 'git add' documentation states "Even modified files
must be added to the set of changes about to be committed" we should
make the output of 'git status' align with that documentation and
common usage.
So now we see a status output such as:
# Added but not yet committed:
# (will commit)
#
# new file: x
#
# Changed but not added:
# (use "git add file1 file2" to include for commit)
#
# modified: x
#
# Untracked files:
# (use "git add" on files to include for commit)
#
# y
which just reads better in the context of using 'git add' to
manipulate a commit (and not a checkin, whatever the heck that is).
We also now support 'color.status.added' as an alias for the existing
'color.status.updated', as this alias more closely aligns with the
current output and documentation.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
Documentation/config.txt | 4 ++--
Documentation/git-reset.txt | 2 +-
Documentation/tutorial-2.txt | 10 +++++-----
wt-status.c | 9 +++++----
4 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index a3587f8..9154804 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -166,8 +166,8 @@ color.status::
color.status.<slot>::
Use customized color for status colorization. `<slot>` is
one of `header` (the header text of the status message),
- `updated` (files which are updated but not committed),
- `changed` (files which are changed but not updated in the index),
+ `added` or `updated` (files which are added but not committed),
+ `changed` (files which are changed but not added in the index),
or `untracked` (files which are not tracked by git). The values of
these variables may be specified as in color.diff.<slot>.
diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
index 73a0ffc..4a4ceb6 100644
--- a/Documentation/git-reset.txt
+++ b/Documentation/git-reset.txt
@@ -31,7 +31,7 @@ OPTIONS
--soft::
Does not touch the index file nor the working tree at all, but
requires them to be in a good order. This leaves all your changed
- files "Updated but not checked in", as gitlink:git-status[1] would
+ files "Added but not yet committed", as gitlink:git-status[1] would
put it.
--hard::
diff --git a/Documentation/tutorial-2.txt b/Documentation/tutorial-2.txt
index 6389de5..eb2ba6b 100644
--- a/Documentation/tutorial-2.txt
+++ b/Documentation/tutorial-2.txt
@@ -342,23 +342,23 @@ situation:
------------------------------------------------
$ git status
#
-# Updated but not checked in:
+# Added but not yet committed:
# (will commit)
#
# new file: closing.txt
#
#
-# Changed but not updated:
-# (use git-update-index to mark for commit)
+# Changed but not added:
+# (use "git add file1 file2" to include for commit)
#
# modified: file.txt
#
------------------------------------------------
Since the current state of closing.txt is cached in the index file,
-it is listed as "updated but not checked in". Since file.txt has
+it is listed as "added but not yet committed". Since file.txt has
changes in the working directory that aren't reflected in the index,
-it is marked "changed but not updated". At this point, running "git
+it is marked "changed but not added". At this point, running "git
commit" would create a commit that added closing.txt (with its new
contents), but that didn't modify file.txt.
diff --git a/wt-status.c b/wt-status.c
index 2173d4f..c388ce1 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -21,7 +21,8 @@ static int parse_status_slot(const char *var, int offset)
{
if (!strcasecmp(var+offset, "header"))
return WT_STATUS_HEADER;
- if (!strcasecmp(var+offset, "updated"))
+ if (!strcasecmp(var+offset, "updated")
+ || !strcasecmp(var+offset, "added"))
return WT_STATUS_UPDATED;
if (!strcasecmp(var+offset, "changed"))
return WT_STATUS_CHANGED;
@@ -146,7 +147,7 @@ static void wt_status_print_updated_cb(struct diff_queue_struct *q,
if (q->queue[i]->status == 'U')
continue;
if (!shown_header) {
- wt_status_print_header("Updated but not checked in",
+ wt_status_print_header("Added but not yet committed",
"will commit");
s->commitable = 1;
shown_header = 1;
@@ -163,7 +164,7 @@ static void wt_status_print_changed_cb(struct diff_queue_struct *q,
{
int i;
if (q->nr)
- wt_status_print_header("Changed but not updated", use_add_msg);
+ wt_status_print_header("Changed but not added", use_add_msg);
for (i = 0; i < q->nr; i++)
wt_status_print_filepair(WT_STATUS_CHANGED, q->queue[i]);
if (q->nr)
@@ -178,7 +179,7 @@ void wt_status_print_initial(struct wt_status *s)
read_cache();
if (active_nr) {
s->commitable = 1;
- wt_status_print_header("Updated but not checked in",
+ wt_status_print_header("Added but not yet committed",
"will commit");
}
for (i = 0; i < active_nr; i++) {
--
^ permalink raw reply related
* [PATCH 1/2] Suggest use of "git add file1 file2" when there is nothing to commit.
From: Shawn O. Pearce @ 2006-12-16 2:53 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
If a user modifies files and runs 'git commit' (without the very
useful -a option) and they have not yet updated the index they
are probably coming from another SCM-like tool which would perform
the same as 'git commit -a' in this case. Showing the user their
current status and a final line of "nothing to commit" is not very
reassuring, as the user might believe that Git did not recognize
their files were modified.
Instead we can suggest as part of the 'nothing to commit' message
that the user invoke 'git add' to add files to their next commit.
Suggested by Andy Parkins' Git 'niggles' list
(<200612132237.10051.andyparkins@gmail.com>).
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
git-commit.sh | 2 +-
wt-status.c | 11 ++++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/git-commit.sh b/git-commit.sh
index 05828bb..2672def 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -515,7 +515,7 @@ then
current="$(git-rev-parse --verify HEAD)"
else
if [ -z "$(git-ls-files)" ]; then
- echo >&2 Nothing to commit
+ echo >&2 'nothing to commit (use "git add file1 file2" to include for commit)'
exit 1
fi
PARENTS=""
diff --git a/wt-status.c b/wt-status.c
index 6e9414d..2173d4f 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -15,6 +15,7 @@ static char wt_status_colors[][COLOR_MAXLEN] = {
"\033[31m", /* WT_STATUS_CHANGED: red */
"\033[31m", /* WT_STATUS_UNTRACKED: red */
};
+static const char* use_add_msg = "use \"git add file1 file2\" to include for commit";
static int parse_status_slot(const char *var, int offset)
{
@@ -162,8 +163,7 @@ static void wt_status_print_changed_cb(struct diff_queue_struct *q,
{
int i;
if (q->nr)
- wt_status_print_header("Changed but not updated",
- "use git-add on files to include for commit");
+ wt_status_print_header("Changed but not updated", use_add_msg);
for (i = 0; i < q->nr; i++)
wt_status_print_filepair(WT_STATUS_CHANGED, q->queue[i]);
if (q->nr)
@@ -249,8 +249,7 @@ static void wt_status_print_untracked(const struct wt_status *s)
continue;
}
if (!shown_header) {
- wt_status_print_header("Untracked files",
- "use \"git add\" to add to commit");
+ wt_status_print_header("Untracked files", use_add_msg);
shown_header = 1;
}
color_printf(color(WT_STATUS_HEADER), "#\t");
@@ -292,7 +291,9 @@ void wt_status_print(struct wt_status *s)
if (s->verbose && !s->is_initial)
wt_status_print_verbose(s);
if (!s->commitable)
- printf("%s\n", s->amend ? "# No changes" : "nothing to commit");
+ printf("%s (%s)\n",
+ s->amend ? "# No changes" : "nothing to commit",
+ use_add_msg);
}
int git_status_config(const char *k, const char *v)
--
1.4.4.2.g053a
^ permalink raw reply related
* Re: What's in git.git (stable)
From: Shawn Pearce @ 2006-12-16 2:54 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Andreas Ericsson, git
In-Reply-To: <7vslfgomdg.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> Andreas Ericsson <ae@op5.se> writes:
>
> > Shawn Pearce wrote:
> >>
> >> About the only trouble that can cause is a failed push when
> >> git-receive-pack needs to generate the reflog entry but cannot
> >> get the user's committer data because their gecos information
> >> doesn't exist.
> >
> > In that case, it would be best if it let the commit go through using
> > only the username. Reflogs are fixable afterwards, so there's no real
> > harm done.
>
> This sounds sensible, regardless of the current discussion on
> the default 'logallrefupdates' setting.
>
> Volunteers?
Its a good idea. I'll do it later tonight, after dinner.
--
^ permalink raw reply
* Re: [PATCH] Avoid accessing a slow working copy during diffcore operations.
From: Junio C Hamano @ 2006-12-16 6:03 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git, Alex Riesen
In-Reply-To: <20061214111557.GA24297@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> writes:
> If Git is compiled with NO_FAST_WORKING_DIRECTORY set then we will
> avoid looking at the working directory when the blob in question
> is available within a packfile and the caller doesn't need the data
> unpacked into a temporary file.
I'd take the patch as is, but...
> -static int work_tree_matches(const char *name, const unsigned char *sha1)
> +static int work_tree_matches(const char *name, const unsigned char *sha1, int want_file)
this feels wrong. It is not about "work tree matches" anymore.
reuse_worktree_copy(), perhaps.
> @@ -1193,6 +1193,20 @@ static int work_tree_matches(const char *name, const unsigned char *sha1)
> if (!active_cache)
> return 0;
>
> +#ifdef NO_FAST_WORKING_DIRECTORY
> + /* We want to avoid the working directory if our caller
> + * doesn't need the data in a normal file, this system
> + * is rather slow with its stat/open/mmap/close syscalls,
> + * and the object is contained in a pack file. The pack
> + * is probably already open and will be faster to obtain
> + * the data through than the working directory. Loose
> + * objects however would tend to be slower as they need
> + * to be individually opened and inflated.
> + */
> + if (!want_file && has_sha1_pack(sha1, NULL))
> + return 0;
> +#endif
> +
Also I'd prefer doing this without #ifdef;
if (defined(NO_FAST_WORKING_DIRECTORY) &&
!want_file && has_sha1_pack(sha1, NULL))
return 0;
^ permalink raw reply
* Re: [PATCH] make commit message a little more consistent and conforting
From: Junio C Hamano @ 2006-12-16 6:18 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Shawn Pearce, Andreas Ericsson, Andy Parkins, git
In-Reply-To: <Pine.LNX.4.64.0612151317380.18171@xanadu.home>
Nicolas Pitre <nico@cam.org> writes:
> What about this (on top of my previous patch):
Looks good.
^ permalink raw reply
* [RFC/PATCH 1/2] git-svn: remove support for the svn command-line client
From: Eric Wong @ 2006-12-16 7:58 UTC (permalink / raw)
To: git; +Cc: seth, Eric Wong
In-Reply-To: <m28xh8amxa.fsf@ziti.local>
Using the command-line client was great for prototyping and
getting something working quickly. Eventually I found time
to study the library documentation and add support for using
the libraries which are much faster and more flexible when
it comes to supporting new features.
Note that we require version 1.1 of the SVN libraries, whereas
we supported the command-line svn client down to version 1.0.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
Note: this requires the Git.pm usage patch I posted earlier
git-svn.perl | 883 ++------------------------------
t/Makefile | 10 +-
t/lib-git-svn.sh | 15 +-
t/t9100-git-svn-basic.sh | 4 +-
t/t9104-git-svn-follow-parent.sh | 7 -
t/t9105-git-svn-commit-diff.sh | 7 -
t/t9106-git-svn-commit-diff-clobber.sh | 7 -
7 files changed, 51 insertions(+), 882 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index f453c9a..077e920 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -32,17 +32,20 @@ my %SKIP = ( 'svn:wc:ra_dav:version-url' => 1,
);
sub fatal (@) { print STDERR @_; exit 1 }
-# If SVN:: library support is added, please make the dependencies
-# optional and preserve the capability to use the command-line client.
-# use eval { require SVN::... } to make it lazy load
-# We don't use any modules not in the standard Perl distribution:
+require SVN::Core; # use()-ing this causes segfaults for me... *shrug*
+require SVN::Ra;
+require SVN::Delta;
+if ($SVN::Core::VERSION lt '1.1.0') {
+ fatal "Need SVN::Core 1.1.0 or better (got $SVN::Core::VERSION)\n";
+}
+push @SVN::Git::Editor::ISA, 'SVN::Delta::Editor';
+push @SVN::Git::Fetcher::ISA, 'SVN::Delta::Editor';
+*SVN::Git::Fetcher::process_rm = *process_rm;
use Carp qw/croak/;
use IO::File qw//;
use File::Basename qw/dirname basename/;
use File::Path qw/mkpath/;
use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev pass_through/;
-use File::Spec qw//;
-use File::Copy qw/copy/;
use POSIX qw/strftime/;
use IPC::Open3;
use Memoize;
@@ -52,22 +55,7 @@ memoize('revisions_eq');
memoize('cmt_metadata');
memoize('get_commit_time');
-my ($SVN, $_use_lib);
-
-sub nag_lib {
- print STDERR <<EOF;
-! Please consider installing the SVN Perl libraries (version 1.1.0 or
-! newer). You will generally get better performance and fewer bugs,
-! especially if you:
-! 1) have a case-insensitive filesystem
-! 2) replace symlinks with files (and vice-versa) in commits
-
-EOF
-}
-
-$_use_lib = 1 unless $ENV{GIT_SVN_NO_LIB};
-libsvn_load();
-nag_lib() unless $_use_lib;
+my ($SVN);
my $_optimize_commits = 1 unless $ENV{GIT_SVN_NO_OPTIMIZE_COMMITS};
my $sha1 = qr/[a-f\d]{40}/;
@@ -84,7 +72,7 @@ my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,
$_username, $_config_dir, $_no_auth_cache, $_xfer_delta,
$_pager, $_color);
my (@_branch_from, %tree_map, %users, %rusers, %equiv);
-my ($_svn_co_url_revs, $_svn_pg_peg_revs, $_svn_can_do_switch);
+my ($_svn_can_do_switch);
my @repo_path_split_cache;
my %fc_opts = ( 'no-ignore-externals' => \$_no_ignore_ext,
@@ -193,7 +181,6 @@ usage(1) unless defined $cmd;
init_vars();
load_authors() if $_authors;
load_all_refs() if $_branch_all_refs;
-svn_compat_check() unless $_use_lib;
migration_check() unless $cmd =~ /^(?:init|rebuild|multi-init|commit-diff)$/;
$cmd{$cmd}->[0]->(@ARGV);
exit 0;
@@ -281,32 +268,6 @@ sub rebuild {
$newest_rev = $rev if ($rev > $newest_rev);
}
command_close_pipe($rev_list, $ctx);
-
- goto out if $_use_lib;
- if (!chdir $SVN_WC) {
- svn_cmd_checkout($SVN_URL, $latest, $SVN_WC);
- chdir $SVN_WC or croak $!;
- }
-
- my $pid = fork;
- defined $pid or croak $!;
- if ($pid == 0) {
- my @svn_up = qw(svn up);
- push @svn_up, '--ignore-externals' unless $_no_ignore_ext;
- sys(@svn_up,"-r$newest_rev");
- $ENV{GIT_INDEX_FILE} = $GIT_SVN_INDEX;
- index_changes();
- exec('git-write-tree') or croak $!;
- }
- waitpid $pid, 0;
- croak $? if $?;
-out:
- if ($_upgrade) {
- print STDERR <<"";
-Keeping deprecated refs/head/$GIT_SVN-HEAD for now. Please remove it
-when you have upgraded your tools and habits to use refs/remotes/$GIT_SVN
-
- }
}
sub init {
@@ -335,69 +296,13 @@ sub init {
sub fetch {
check_upgrade_needed();
$SVN_URL ||= file_to_s("$GIT_SVN_DIR/info/url");
- my $ret = $_use_lib ? fetch_lib(@_) : fetch_cmd(@_);
+ my $ret = fetch_lib(@_);
if ($ret->{commit} && !verify_ref('refs/heads/master^0')) {
command_noisy(qw(update-ref refs/heads/master),$ret->{commit});
}
return $ret;
}
-sub fetch_cmd {
- my (@parents) = @_;
- my @log_args = -d $SVN_WC ? ($SVN_WC) : ($SVN_URL);
- unless ($_revision) {
- $_revision = -d $SVN_WC ? 'BASE:HEAD' : '0:HEAD';
- }
- push @log_args, "-r$_revision";
- push @log_args, '--stop-on-copy' unless $_no_stop_copy;
-
- my $svn_log = svn_log_raw(@log_args);
-
- my $base = next_log_entry($svn_log) or croak "No base revision!\n";
- # don't need last_revision from grab_base_rev() because
- # user could've specified a different revision to skip (they
- # didn't want to import certain revisions into git for whatever
- # reason, so trust $base->{revision} instead.
- my (undef, $last_commit) = svn_grab_base_rev();
- unless (-d $SVN_WC) {
- svn_cmd_checkout($SVN_URL,$base->{revision},$SVN_WC);
- chdir $SVN_WC or croak $!;
- read_uuid();
- $last_commit = git_commit($base, @parents);
- assert_tree($last_commit);
- } else {
- chdir $SVN_WC or croak $!;
- read_uuid();
- # looks like a user manually cp'd and svn switch'ed
- unless ($last_commit) {
- sys(qw/svn revert -R ./);
- assert_svn_wc_clean($base->{revision});
- $last_commit = git_commit($base, @parents);
- assert_tree($last_commit);
- }
- }
- my @svn_up = qw(svn up);
- push @svn_up, '--ignore-externals' unless $_no_ignore_ext;
- my $last = $base;
- while (my $log_msg = next_log_entry($svn_log)) {
- if ($last->{revision} >= $log_msg->{revision}) {
- croak "Out of order: last >= current: ",
- "$last->{revision} >= $log_msg->{revision}\n";
- }
- # Revert is needed for cases like:
- # https://svn.musicpd.org/Jamming/trunk (r166:167), but
- # I can't seem to reproduce something like that on a test...
- sys(qw/svn revert -R ./);
- assert_svn_wc_clean($last->{revision});
- sys(@svn_up,"-r$log_msg->{revision}");
- $last_commit = git_commit($log_msg, $last_commit, @parents);
- $last = $log_msg;
- }
- close $svn_log->{fh};
- $last->{commit} = $last_commit;
- return $last;
-}
-
sub fetch_lib {
my (@parents) = @_;
$SVN_URL ||= file_to_s("$GIT_SVN_DIR/info/url");
@@ -498,35 +403,10 @@ sub commit {
die "Failed to rev-parse $c\n";
}
}
- $_use_lib ? commit_lib(@revs) : commit_cmd(@revs);
+ commit_lib(@revs);
print "Done committing ",scalar @revs," revisions to SVN\n";
}
-sub commit_cmd {
- my (@revs) = @_;
-
- chdir $SVN_WC or croak "Unable to chdir $SVN_WC: $!\n";
- my $info = svn_info('.');
- my $fetched = fetch();
- if ($info->{Revision} != $fetched->{revision}) {
- print STDERR "There are new revisions that were fetched ",
- "and need to be merged (or acknowledged) ",
- "before committing.\n";
- exit 1;
- }
- $info = svn_info('.');
- read_uuid($info);
- my $last = $fetched;
- foreach my $c (@revs) {
- my $mods = svn_checkout_tree($last, $c);
- if (scalar @$mods == 0) {
- print "Skipping, no changes detected\n";
- next;
- }
- $last = svn_commit_tree($last, $c);
- }
-}
-
sub commit_lib {
my (@revs) = @_;
my ($r_last, $cmt_last) = svn_grab_base_rev();
@@ -649,32 +529,6 @@ sub dcommit {
sub show_ignore {
$SVN_URL ||= file_to_s("$GIT_SVN_DIR/info/url");
- $_use_lib ? show_ignore_lib() : show_ignore_cmd();
-}
-
-sub show_ignore_cmd {
- require File::Find or die $!;
- if (defined $_revision) {
- die "-r/--revision option doesn't work unless the Perl SVN ",
- "libraries are used\n";
- }
- chdir $SVN_WC or croak $!;
- my %ign;
- File::Find::find({wanted=>sub{if(lstat $_ && -d _ && -d "$_/.svn"){
- s#^\./##;
- @{$ign{$_}} = svn_propget_base('svn:ignore', $_);
- }}, no_chdir=>1},'.');
-
- print "\n# /\n";
- foreach (@{$ign{'.'}}) { print '/',$_ if /\S/ }
- delete $ign{'.'};
- foreach my $i (sort keys %ign) {
- print "\n# ",$i,"\n";
- foreach (@{$ign{$i}}) { print '/',$i,'/',$_ if /\S/ }
- }
-}
-
-sub show_ignore_lib {
my $repo;
$SVN ||= libsvn_connect($SVN_URL);
my $r = defined $_revision ? $_revision : $SVN->get_latest_revnum;
@@ -706,11 +560,7 @@ sub graft_branches {
}
}
unless ($_no_graft_copy) {
- if ($_use_lib) {
- graft_file_copy_lib($grafts,$l_map,$u);
- } else {
- graft_file_copy_cmd($grafts,$l_map,$u);
- }
+ graft_file_copy_lib($grafts,$l_map,$u);
}
}
graft_tree_joins($grafts);
@@ -838,10 +688,6 @@ sub commit_diff_usage {
}
sub commit_diff {
- if (!$_use_lib) {
- print STDERR "commit-diff must be used with SVN libraries\n";
- exit 1;
- }
my $ta = shift or commit_diff_usage();
my $tb = shift or commit_diff_usage();
if (!eval { $SVN_URL = shift || file_to_s("$GIT_SVN_DIR/info/url") }) {
@@ -1042,8 +888,7 @@ sub complete_url_ls_init {
}
$var = $url . $var;
}
- chomp(my @ls = $_use_lib ? libsvn_ls_fullurl($var)
- : safe_qx(qw/svn ls --non-interactive/, $var));
+ my @ls = libsvn_ls_fullurl($var);
my $old = $GIT_SVN;
defined(my $pid = fork) or croak $!;
if (!$pid) {
@@ -1156,37 +1001,6 @@ sub graft_tree_joins {
});
}
-# this isn't funky-filename safe, but good enough for now...
-sub graft_file_copy_cmd {
- my ($grafts, $l_map, $u) = @_;
- my $paths = $l_map->{$u};
- my $pfx = common_prefix([keys %$paths]);
- $SVN_URL ||= $u.$pfx;
- my $pid = open my $fh, '-|';
- defined $pid or croak $!;
- unless ($pid) {
- my @exec = qw/svn log -v/;
- push @exec, "-r$_revision" if defined $_revision;
- exec @exec, $u.$pfx or croak $!;
- }
- my ($r, $mp) = (undef, undef);
- while (<$fh>) {
- chomp;
- if (/^\-{72}$/) {
- $mp = $r = undef;
- } elsif (/^r(\d+) \| /) {
- $r = $1 unless defined $r;
- } elsif (/^Changed paths:/) {
- $mp = 1;
- } elsif ($mp && m#^ [AR] /(\S.*?) \(from /(\S+?):(\d+)\)$#) {
- my ($p1, $p0, $r0) = ($1, $2, $3);
- my $c = find_graft_path_commit($paths, $p1, $r);
- next unless $c;
- find_graft_path_parents($grafts, $paths, $c, $p0, $r0);
- }
- }
-}
-
sub graft_file_copy_lib {
my ($grafts, $l_map, $u) = @_;
my $tree_paths = $l_map->{$u};
@@ -1277,15 +1091,9 @@ sub graft_merge_msg {
sub read_uuid {
return if $SVN_UUID;
- if ($_use_lib) {
- my $pool = SVN::Pool->new;
- $SVN_UUID = $SVN->get_uuid($pool);
- $pool->clear;
- } else {
- my $info = shift || svn_info('.');
- $SVN_UUID = $info->{'Repository UUID'} or
- croak "Repository UUID unreadable\n";
- }
+ my $pool = SVN::Pool->new;
+ $SVN_UUID = $SVN->get_uuid($pool);
+ $pool->clear;
}
sub verify_ref {
@@ -1293,19 +1101,6 @@ sub verify_ref {
eval { command_oneline([ 'rev-parse', $ref ], { STDERR => 0 }) };
}
-sub quiet_run {
- my $pid = fork;
- defined $pid or croak $!;
- if (!$pid) {
- open my $null, '>', '/dev/null' or croak $!;
- open STDERR, '>&', $null or croak $!;
- open STDOUT, '>&', $null or croak $!;
- exec @_ or croak $!;
- }
- waitpid $pid, 0;
- return $?;
-}
-
sub repo_path_split {
my $full_url = shift;
$full_url =~ s#/+$##;
@@ -1317,21 +1112,8 @@ sub repo_path_split {
return ($u, $full_url);
}
}
- if ($_use_lib) {
- my $tmp = libsvn_connect($full_url);
- return ($tmp->{repos_root}, $tmp->{svn_path});
- } else {
- my ($url, $path) = ($full_url =~ m!^([a-z\+]+://[^/]*)(.*)$!i);
- $path =~ s#^/+##;
- my @paths = split(m#/+#, $path);
- while (quiet_run(qw/svn ls --non-interactive/, $url)) {
- my $n = shift @paths || last;
- $url .= "/$n";
- }
- push @repo_path_split_cache, qr/^(\Q$url\E)/;
- $path = join('/',@paths);
- return ($url, $path);
- }
+ my $tmp = libsvn_connect($full_url);
+ return ($tmp->{repos_root}, $tmp->{svn_path});
}
sub setup_git_svn {
@@ -1347,31 +1129,6 @@ sub setup_git_svn {
}
-sub assert_svn_wc_clean {
- return if $_use_lib;
- my ($svn_rev) = @_;
- croak "$svn_rev is not an integer!\n" unless ($svn_rev =~ /^\d+$/);
- my $lcr = svn_info('.')->{'Last Changed Rev'};
- if ($svn_rev != $lcr) {
- print STDERR "Checking for copy-tree ... ";
- my @diff = grep(/^Index: /,(safe_qx(qw(svn diff),
- "-r$lcr:$svn_rev")));
- if (@diff) {
- croak "Nope! Expected r$svn_rev, got r$lcr\n";
- } else {
- print STDERR "OK!\n";
- }
- }
- my @status = grep(!/^Performing status on external/,(`svn status`));
- @status = grep(!/^\s*$/,@status);
- @status = grep(!/^X/,@status) if $_no_ignore_ext;
- if (scalar @status) {
- print STDERR "Tree ($SVN_WC) is not clean:\n";
- print STDERR $_ foreach @status;
- croak;
- }
-}
-
sub get_tree_from_treeish {
my ($treeish) = @_;
croak "Not a sha1: $treeish\n" unless $treeish =~ /^$sha1$/o;
@@ -1393,28 +1150,8 @@ sub get_tree_from_treeish {
return $expected;
}
-sub assert_tree {
- return if $_use_lib;
- my ($treeish) = @_;
- my $expected = get_tree_from_treeish($treeish);
-
- my $tmpindex = $GIT_SVN_INDEX.'.assert-tmp';
- if (-e $tmpindex) {
- unlink $tmpindex or croak $!;
- }
- my $old_index = set_index($tmpindex);
- index_changes(1);
- my $tree = command_oneline('write-tree');
- restore_index($old_index);
- if ($tree ne $expected) {
- croak "Tree mismatch, Got: $tree, Expected: $expected\n";
- }
- unlink $tmpindex;
-}
-
sub get_diff {
my ($from, $treeish) = @_;
- assert_tree($from);
print "diff-tree $from $treeish\n";
my @diff_tree = qw(diff-tree -z -r);
if ($_cp_similarity) {
@@ -1465,145 +1202,6 @@ sub get_diff {
return \@mods;
}
-sub svn_check_prop_executable {
- my $m = shift;
- return if -l $m->{file_b};
- if ($m->{mode_b} =~ /755$/) {
- chmod((0755 &~ umask),$m->{file_b}) or croak $!;
- if ($m->{mode_a} !~ /755$/) {
- sys(qw(svn propset svn:executable 1), $m->{file_b});
- }
- -x $m->{file_b} or croak "$m->{file_b} is not executable!\n";
- } elsif ($m->{mode_b} !~ /755$/ && $m->{mode_a} =~ /755$/) {
- sys(qw(svn propdel svn:executable), $m->{file_b});
- chmod((0644 &~ umask),$m->{file_b}) or croak $!;
- -x $m->{file_b} and croak "$m->{file_b} is executable!\n";
- }
-}
-
-sub svn_ensure_parent_path {
- my $dir_b = dirname(shift);
- svn_ensure_parent_path($dir_b) if ($dir_b ne File::Spec->curdir);
- mkpath([$dir_b]) unless (-d $dir_b);
- sys(qw(svn add -N), $dir_b) unless (-d "$dir_b/.svn");
-}
-
-sub precommit_check {
- my $mods = shift;
- my (%rm_file, %rmdir_check, %added_check);
-
- my %o = ( D => 0, R => 1, C => 2, A => 3, M => 3, T => 3 );
- foreach my $m (sort { $o{$a->{chg}} <=> $o{$b->{chg}} } @$mods) {
- if ($m->{chg} eq 'R') {
- if (-d $m->{file_b}) {
- err_dir_to_file("$m->{file_a} => $m->{file_b}");
- }
- # dir/$file => dir/file/$file
- my $dirname = dirname($m->{file_b});
- while ($dirname ne File::Spec->curdir) {
- if ($dirname ne $m->{file_a}) {
- $dirname = dirname($dirname);
- next;
- }
- err_file_to_dir("$m->{file_a} => $m->{file_b}");
- }
- # baz/zzz => baz (baz is a file)
- $dirname = dirname($m->{file_a});
- while ($dirname ne File::Spec->curdir) {
- if ($dirname ne $m->{file_b}) {
- $dirname = dirname($dirname);
- next;
- }
- err_dir_to_file("$m->{file_a} => $m->{file_b}");
- }
- }
- if ($m->{chg} =~ /^(D|R)$/) {
- my $t = $1 eq 'D' ? 'file_b' : 'file_a';
- $rm_file{ $m->{$t} } = 1;
- my $dirname = dirname( $m->{$t} );
- my $basename = basename( $m->{$t} );
- $rmdir_check{$dirname}->{$basename} = 1;
- } elsif ($m->{chg} =~ /^(?:A|C)$/) {
- if (-d $m->{file_b}) {
- err_dir_to_file($m->{file_b});
- }
- my $dirname = dirname( $m->{file_b} );
- my $basename = basename( $m->{file_b} );
- $added_check{$dirname}->{$basename} = 1;
- while ($dirname ne File::Spec->curdir) {
- if ($rm_file{$dirname}) {
- err_file_to_dir($m->{file_b});
- }
- $dirname = dirname $dirname;
- }
- }
- }
- return (\%rmdir_check, \%added_check);
-
- sub err_dir_to_file {
- my $file = shift;
- print STDERR "Node change from directory to file ",
- "is not supported by Subversion: ",$file,"\n";
- exit 1;
- }
- sub err_file_to_dir {
- my $file = shift;
- print STDERR "Node change from file to directory ",
- "is not supported by Subversion: ",$file,"\n";
- exit 1;
- }
-}
-
-
-sub svn_checkout_tree {
- my ($from, $treeish) = @_;
- my $mods = get_diff($from->{commit}, $treeish);
- return $mods unless (scalar @$mods);
- my ($rm, $add) = precommit_check($mods);
-
- my %o = ( D => 1, R => 0, C => -1, A => 3, M => 3, T => 3 );
- foreach my $m (sort { $o{$a->{chg}} <=> $o{$b->{chg}} } @$mods) {
- if ($m->{chg} eq 'C') {
- svn_ensure_parent_path( $m->{file_b} );
- sys(qw(svn cp), $m->{file_a}, $m->{file_b});
- apply_mod_line_blob($m);
- svn_check_prop_executable($m);
- } elsif ($m->{chg} eq 'D') {
- sys(qw(svn rm --force), $m->{file_b});
- } elsif ($m->{chg} eq 'R') {
- svn_ensure_parent_path( $m->{file_b} );
- sys(qw(svn mv --force), $m->{file_a}, $m->{file_b});
- apply_mod_line_blob($m);
- svn_check_prop_executable($m);
- } elsif ($m->{chg} eq 'M') {
- apply_mod_line_blob($m);
- svn_check_prop_executable($m);
- } elsif ($m->{chg} eq 'T') {
- svn_check_prop_executable($m);
- apply_mod_line_blob($m);
- if ($m->{mode_a} =~ /^120/ && $m->{mode_b} !~ /^120/) {
- sys(qw(svn propdel svn:special), $m->{file_b});
- } else {
- sys(qw(svn propset svn:special *),$m->{file_b});
- }
- } elsif ($m->{chg} eq 'A') {
- svn_ensure_parent_path( $m->{file_b} );
- apply_mod_line_blob($m);
- sys(qw(svn add), $m->{file_b});
- svn_check_prop_executable($m);
- } else {
- croak "Invalid chg: $m->{chg}\n";
- }
- }
-
- assert_tree($treeish);
- if ($_rmdir) { # remove empty directories
- handle_rmdir($rm, $add);
- }
- assert_tree($treeish);
- return $mods;
-}
-
sub libsvn_checkout_tree {
my ($from, $treeish, $ed) = @_;
my $mods = get_diff($from, $treeish);
@@ -1621,44 +1219,6 @@ sub libsvn_checkout_tree {
return $mods;
}
-# svn ls doesn't work with respect to the current working tree, but what's
-# in the repository. There's not even an option for it... *sigh*
-# (added files don't show up and removed files remain in the ls listing)
-sub svn_ls_current {
- my ($dir, $rm, $add) = @_;
- chomp(my @ls = safe_qx('svn','ls',$dir));
- my @ret = ();
- foreach (@ls) {
- s#/$##; # trailing slashes are evil
- push @ret, $_ unless $rm->{$dir}->{$_};
- }
- if (exists $add->{$dir}) {
- push @ret, keys %{$add->{$dir}};
- }
- return \@ret;
-}
-
-sub handle_rmdir {
- my ($rm, $add) = @_;
-
- foreach my $dir (sort {length $b <=> length $a} keys %$rm) {
- my $ls = svn_ls_current($dir, $rm, $add);
- next if (scalar @$ls);
- sys(qw(svn rm --force),$dir);
-
- my $dn = dirname $dir;
- $rm->{ $dn }->{ basename $dir } = 1;
- $ls = svn_ls_current($dn, $rm, $add);
- while (scalar @$ls == 0 && $dn ne File::Spec->curdir) {
- sys(qw(svn rm --force),$dn);
- $dir = basename $dn;
- $dn = dirname $dn;
- $rm->{ $dn }->{ $dir } = 1;
- $ls = svn_ls_current($dn, $rm, $add);
- }
- }
-}
-
sub get_commit_message {
my ($commit, $commit_msg) = (@_);
my %log_msg = ( msg => '' );
@@ -1704,56 +1264,6 @@ sub set_svn_commit_env {
}
}
-sub svn_commit_tree {
- my ($last, $commit) = @_;
- my $commit_msg = "$GIT_SVN_DIR/.svn-commit.tmp.$$";
- my $log_msg = get_commit_message($commit, $commit_msg);
- my ($oneline) = ($log_msg->{msg} =~ /([^\n\r]+)/);
- print "Committing $commit: $oneline\n";
-
- set_svn_commit_env();
- my @ci_output = safe_qx(qw(svn commit -F),$commit_msg);
- $ENV{LC_ALL} = 'C';
- unlink $commit_msg;
- my ($committed) = ($ci_output[$#ci_output] =~ /(\d+)/);
- if (!defined $committed) {
- my $out = join("\n",@ci_output);
- print STDERR "W: Trouble parsing \`svn commit' output:\n\n",
- $out, "\n\nAssuming English locale...";
- ($committed) = ($out =~ /^Committed revision \d+\./sm);
- defined $committed or die " FAILED!\n",
- "Commit output failed to parse committed revision!\n",
- print STDERR " OK\n";
- }
-
- my @svn_up = qw(svn up);
- push @svn_up, '--ignore-externals' unless $_no_ignore_ext;
- if ($_optimize_commits && ($committed == ($last->{revision} + 1))) {
- push @svn_up, "-r$committed";
- sys(@svn_up);
- my $info = svn_info('.');
- my $date = $info->{'Last Changed Date'} or die "Missing date\n";
- if ($info->{'Last Changed Rev'} != $committed) {
- croak "$info->{'Last Changed Rev'} != $committed\n"
- }
- my ($Y,$m,$d,$H,$M,$S,$tz) = ($date =~
- /(\d{4})\-(\d\d)\-(\d\d)\s
- (\d\d)\:(\d\d)\:(\d\d)\s([\-\+]\d+)/x)
- or croak "Failed to parse date: $date\n";
- $log_msg->{date} = "$tz $Y-$m-$d $H:$M:$S";
- $log_msg->{author} = $info->{'Last Changed Author'};
- $log_msg->{revision} = $committed;
- $log_msg->{msg} .= "\n";
- $log_msg->{parents} = [ $last->{commit} ];
- $log_msg->{commit} = git_commit($log_msg, $commit);
- return $log_msg;
- }
- # resync immediately
- push @svn_up, "-r$last->{revision}";
- sys(@svn_up);
- return fetch("$committed=$commit");
-}
-
sub rev_list_raw {
my ($fh, $c) = command_output_pipe(qw/rev-list --pretty=raw/, @_);
return { fh => $fh, ctx => $c, t => { } };
@@ -1782,177 +1292,6 @@ sub next_rev_list_entry {
return ($x != $rl->{t}) ? $x : undef;
}
-# read the entire log into a temporary file (which is removed ASAP)
-# and store the file handle + parser state
-sub svn_log_raw {
- my (@log_args) = @_;
- my $log_fh = IO::File->new_tmpfile or croak $!;
- my $pid = fork;
- defined $pid or croak $!;
- if (!$pid) {
- open STDOUT, '>&', $log_fh or croak $!;
- exec (qw(svn log), @log_args) or croak $!
- }
- waitpid $pid, 0;
- croak $? if $?;
- seek $log_fh, 0, 0 or croak $!;
- return { state => 'sep', fh => $log_fh };
-}
-
-sub next_log_entry {
- my $log = shift; # retval of svn_log_raw()
- my $ret = undef;
- my $fh = $log->{fh};
-
- while (<$fh>) {
- chomp;
- if (/^\-{72}$/) {
- if ($log->{state} eq 'msg') {
- if ($ret->{lines}) {
- $ret->{msg} .= $_."\n";
- unless(--$ret->{lines}) {
- $log->{state} = 'sep';
- }
- } else {
- croak "Log parse error at: $_\n",
- $ret->{revision},
- "\n";
- }
- next;
- }
- if ($log->{state} ne 'sep') {
- croak "Log parse error at: $_\n",
- "state: $log->{state}\n",
- $ret->{revision},
- "\n";
- }
- $log->{state} = 'rev';
-
- # if we have an empty log message, put something there:
- if ($ret) {
- $ret->{msg} ||= "\n";
- delete $ret->{lines};
- return $ret;
- }
- next;
- }
- if ($log->{state} eq 'rev' && s/^r(\d+)\s*\|\s*//) {
- my $rev = $1;
- my ($author, $date, $lines) = split(/\s*\|\s*/, $_, 3);
- ($lines) = ($lines =~ /(\d+)/);
- $date = '1970-01-01 00:00:00 +0000'
- if ($_ignore_nodate && $date eq '(no date)');
- my ($Y,$m,$d,$H,$M,$S,$tz) = ($date =~
- /(\d{4})\-(\d\d)\-(\d\d)\s
- (\d\d)\:(\d\d)\:(\d\d)\s([\-\+]\d+)/x)
- or croak "Failed to parse date: $date\n";
- $ret = { revision => $rev,
- date => "$tz $Y-$m-$d $H:$M:$S",
- author => $author,
- lines => $lines,
- msg => '' };
- if (defined $_authors && ! defined $users{$author}) {
- die "Author: $author not defined in ",
- "$_authors file\n";
- }
- $log->{state} = 'msg_start';
- next;
- }
- # skip the first blank line of the message:
- if ($log->{state} eq 'msg_start' && /^$/) {
- $log->{state} = 'msg';
- } elsif ($log->{state} eq 'msg') {
- if ($ret->{lines}) {
- $ret->{msg} .= $_."\n";
- unless (--$ret->{lines}) {
- $log->{state} = 'sep';
- }
- } else {
- croak "Log parse error at: $_\n",
- $ret->{revision},"\n";
- }
- }
- }
- return $ret;
-}
-
-sub svn_info {
- my $url = shift || $SVN_URL;
-
- my $pid = open my $info_fh, '-|';
- defined $pid or croak $!;
-
- if ($pid == 0) {
- exec(qw(svn info),$url) or croak $!;
- }
-
- my $ret = {};
- # only single-lines seem to exist in svn info output
- while (<$info_fh>) {
- chomp $_;
- if (m#^([^:]+)\s*:\s*(\S.*)$#) {
- $ret->{$1} = $2;
- push @{$ret->{-order}}, $1;
- }
- }
- close $info_fh or croak $?;
- return $ret;
-}
-
-sub sys { system(@_) == 0 or croak $? }
-
-sub do_update_index {
- my ($z_cmd, $cmd, $no_text_base) = @_;
-
- my ($p, $pctx) = command_output_pipe(@$z_cmd);
-
- my ($ui, $uctx) = command_input_pipe('update-index',
- "--$cmd",'-z','--stdin');
- local $/ = "\0";
- while (my $x = <$p>) {
- chomp $x;
- if (!$no_text_base && lstat $x && ! -l _ &&
- svn_propget_base('svn:keywords', $x)) {
- my $mode = -x _ ? 0755 : 0644;
- my ($v,$d,$f) = File::Spec->splitpath($x);
- my $tb = File::Spec->catfile($d, '.svn', 'tmp',
- 'text-base',"$f.svn-base");
- $tb =~ s#^/##;
- unless (-f $tb) {
- $tb = File::Spec->catfile($d, '.svn',
- 'text-base',"$f.svn-base");
- $tb =~ s#^/##;
- }
- my @s = stat($x);
- unlink $x or croak $!;
- copy($tb, $x);
- chmod(($mode &~ umask), $x) or croak $!;
- utime $s[8], $s[9], $x;
- }
- print $ui $x,"\0";
- }
- command_close_pipe($p, $pctx);
- command_close_pipe($ui, $uctx);
-}
-
-sub index_changes {
- return if $_use_lib;
-
- if (!-f "$GIT_SVN_DIR/info/exclude") {
- open my $fd, '>>', "$GIT_SVN_DIR/info/exclude" or croak $!;
- print $fd '.svn',"\n";
- close $fd or croak $!;
- }
- my $no_text_base = shift;
- do_update_index([qw/diff-files --name-only -z/],
- 'remove',
- $no_text_base);
- do_update_index([qw/ls-files -z --others/,
- "--exclude-from=$GIT_SVN_DIR/info/exclude"],
- 'add',
- $no_text_base);
-}
-
sub s_to_file {
my ($str, $file, $mode) = @_;
open my $fd,'>',$file or croak $!;
@@ -1978,18 +1317,6 @@ sub assert_revision_unknown {
}
}
-sub trees_eq {
- my ($x, $y) = @_;
- my @x = command(qw/cat-file commit/,$x);
- my @y = command(qw/cat-file commit/,$y);
- if (($y[0] ne $x[0]) || $x[0] ne "tree $sha1"
- || $y[0] ne "tree $sha1") {
- print STDERR "Trees not equal: $y[0] != $x[0]\n";
- return 0
- }
- return 1;
-}
-
sub git_commit {
my ($log_msg, @parents) = @_;
assert_revision_unknown($log_msg->{revision});
@@ -2014,12 +1341,10 @@ sub git_commit {
my $tree = $log_msg->{tree};
if (!defined $tree) {
my $index = set_index($GIT_SVN_INDEX);
- index_changes();
$tree = command_oneline('write-tree');
croak $? if $?;
restore_index($index);
}
-
# just in case we clobber the existing ref, we still want that ref
# as our parent:
if (my $cur = verify_ref("refs/remotes/$GIT_SVN^0")) {
@@ -2104,102 +1429,6 @@ sub set_commit_env {
$ENV{GIT_AUTHOR_DATE} = $ENV{GIT_COMMITTER_DATE} = $log_msg->{date};
}
-sub apply_mod_line_blob {
- my $m = shift;
- if ($m->{mode_b} =~ /^120/) {
- blob_to_symlink($m->{sha1_b}, $m->{file_b});
- } else {
- blob_to_file($m->{sha1_b}, $m->{file_b});
- }
-}
-
-sub blob_to_symlink {
- my ($blob, $link) = @_;
- defined $link or croak "\$link not defined!\n";
- croak "Not a sha1: $blob\n" unless $blob =~ /^$sha1$/o;
- if (-l $link || -f _) {
- unlink $link or croak $!;
- }
-
- my $dest = `git-cat-file blob $blob`; # no newline, so no chomp
- symlink $dest, $link or croak $!;
-}
-
-sub blob_to_file {
- my ($blob, $file) = @_;
- defined $file or croak "\$file not defined!\n";
- croak "Not a sha1: $blob\n" unless $blob =~ /^$sha1$/o;
- if (-l $file || -f _) {
- unlink $file or croak $!;
- }
-
- open my $blob_fh, '>', $file or croak "$!: $file\n";
- my $pid = fork;
- defined $pid or croak $!;
-
- if ($pid == 0) {
- open STDOUT, '>&', $blob_fh or croak $!;
- exec('git-cat-file','blob',$blob) or croak $!;
- }
- waitpid $pid, 0;
- croak $? if $?;
-
- close $blob_fh or croak $!;
-}
-
-sub safe_qx {
- my $pid = open my $child, '-|';
- defined $pid or croak $!;
- if ($pid == 0) {
- exec(@_) or croak $!;
- }
- my @ret = (<$child>);
- close $child or croak $?;
- die $? if $?; # just in case close didn't error out
- return wantarray ? @ret : join('',@ret);
-}
-
-sub svn_compat_check {
- if ($_follow_parent) {
- print STDERR 'E: --follow-parent functionality is only ',
- "available when SVN libraries are used\n";
- exit 1;
- }
- my @co_help = safe_qx(qw(svn co -h));
- unless (grep /ignore-externals/,@co_help) {
- print STDERR "W: Installed svn version does not support ",
- "--ignore-externals\n";
- $_no_ignore_ext = 1;
- }
- if (grep /usage: checkout URL\[\@REV\]/,@co_help) {
- $_svn_co_url_revs = 1;
- }
- if (grep /\[TARGET\[\@REV\]\.\.\.\]/, `svn propget -h`) {
- $_svn_pg_peg_revs = 1;
- }
-
- # I really, really hope nobody hits this...
- unless (grep /stop-on-copy/, (safe_qx(qw(svn log -h)))) {
- print STDERR <<'';
-W: The installed svn version does not support the --stop-on-copy flag in
- the log command.
- Lets hope the directory you're tracking is not a branch or tag
- and was never moved within the repository...
-
- $_no_stop_copy = 1;
- }
-}
-
-# *sigh*, new versions of svn won't honor -r<rev> without URL@<rev>,
-# (and they won't honor URL@<rev> without -r<rev>, too!)
-sub svn_cmd_checkout {
- my ($url, $rev, $dir) = @_;
- my @cmd = ('svn','co', "-r$rev");
- push @cmd, '--ignore-externals' unless $_no_ignore_ext;
- $url .= "\@$rev" if $_svn_co_url_revs;
- sys(@cmd, $url, $dir);
-}
-
sub check_upgrade_needed {
if (!-r $REVDB) {
-d $GIT_SVN_DIR or mkpath([$GIT_SVN_DIR]);
@@ -2277,12 +1506,6 @@ sub rload_authors {
close $authors or croak $!;
}
-sub svn_propget_base {
- my ($p, $f) = @_;
- $f .= '@BASE' if $_svn_pg_peg_revs;
- return safe_qx(qw/svn propget/, $p, $f);
-}
-
sub git_svn_each {
my $sub = shift;
foreach (command(qw/rev-parse --symbolic --all/)) {
@@ -2682,33 +1905,6 @@ sub show_commit_normal {
}
}
-sub libsvn_load {
- return unless $_use_lib;
- $_use_lib = eval {
- require SVN::Core;
- if ($SVN::Core::VERSION lt '1.1.0') {
- die "Need SVN::Core 1.1.0 or better ",
- "(got $SVN::Core::VERSION) ",
- "Falling back to command-line svn\n";
- }
- require SVN::Ra;
- require SVN::Delta;
- push @SVN::Git::Editor::ISA, 'SVN::Delta::Editor';
- push @SVN::Git::Fetcher::ISA, 'SVN::Delta::Editor';
- *SVN::Git::Fetcher::process_rm = *process_rm;
- my $kill_stupid_warnings = $SVN::Node::none.$SVN::Node::file.
- $SVN::Node::dir.$SVN::Node::unknown.
- $SVN::Node::none.$SVN::Node::file.
- $SVN::Node::dir.$SVN::Node::unknown.
- $SVN::Auth::SSL::CNMISMATCH.
- $SVN::Auth::SSL::NOTYETVALID.
- $SVN::Auth::SSL::EXPIRED.
- $SVN::Auth::SSL::UNKNOWNCA.
- $SVN::Auth::SSL::OTHER;
- 1;
- };
-}
-
sub _simple_prompt {
my ($cred, $realm, $default_username, $may_save, $pool) = @_;
$may_save = undef if $_no_auth_cache;
@@ -3231,18 +2427,11 @@ sub revisions_eq {
my ($path, $r0, $r1) = @_;
return 1 if $r0 == $r1;
my $nr = 0;
- if ($_use_lib) {
- # should be OK to use Pool here (r1 - r0) should be small
- my $pool = SVN::Pool->new;
- libsvn_get_log($SVN, [$path], $r0, $r1,
- 0, 0, 1, sub {$nr++}, $pool);
- $pool->clear;
- } else {
- my ($url, undef) = repo_path_split($SVN_URL);
- my $svn_log = svn_log_raw("$url/$path","-r$r0:$r1");
- while (next_log_entry($svn_log)) { $nr++ }
- close $svn_log->{fh};
- }
+ # should be OK to use Pool here (r1 - r0) should be small
+ my $pool = SVN::Pool->new;
+ libsvn_get_log($SVN, [$path], $r0, $r1,
+ 0, 0, 1, sub {$nr++}, $pool);
+ $pool->clear;
return 0 if ($nr > 1);
return 1;
}
@@ -3526,6 +2715,19 @@ sub copy_remote_ref {
"refs/remotes/$GIT_SVN on $origin\n";
}
}
+
+{
+ my $kill_stupid_warnings = $SVN::Node::none.$SVN::Node::file.
+ $SVN::Node::dir.$SVN::Node::unknown.
+ $SVN::Node::none.$SVN::Node::file.
+ $SVN::Node::dir.$SVN::Node::unknown.
+ $SVN::Auth::SSL::CNMISMATCH.
+ $SVN::Auth::SSL::NOTYETVALID.
+ $SVN::Auth::SSL::EXPIRED.
+ $SVN::Auth::SSL::UNKNOWNCA.
+ $SVN::Auth::SSL::OTHER;
+}
+
package SVN::Git::Fetcher;
use vars qw/@ISA/;
use strict;
@@ -3963,13 +3165,7 @@ __END__
Data structures:
-$svn_log hashref (as returned by svn_log_raw)
-{
- fh => file handle of the log file,
- state => state of the log file parser (sep/msg/rev/msg_start...)
-}
-
-$log_msg hashref as returned by next_log_entry($svn_log)
+$log_msg hashref as returned by libsvn_log_entry()
{
msg => 'whitespace-formatted log entry
', # trailing newline is preserved
@@ -3978,7 +3174,6 @@ $log_msg hashref as returned by next_log_entry($svn_log)
author => 'committer name'
};
-
@mods = array of diff-index line hashes, each element represents one line
of diff-index output
diff --git a/t/Makefile b/t/Makefile
index c9bd9a4..250a190 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -23,13 +23,9 @@ clean:
# we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
full-svn-test:
- $(MAKE) $(TSVN) GIT_SVN_NO_LIB=0 GIT_SVN_DELTA_FETCH=1 \
- GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
- $(MAKE) $(TSVN) GIT_SVN_NO_LIB=1 GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
- $(MAKE) $(TSVN) GIT_SVN_NO_LIB=1 GIT_SVN_NO_OPTIMIZE_COMMITS=0 \
- LC_ALL=en_US.UTF-8
- $(MAKE) $(TSVN) GIT_SVN_NO_LIB=0 GIT_SVN_NO_OPTIMIZE_COMMITS=0 \
- LC_ALL=en_US.UTF-8
+ $(MAKE) $(TSVN) GIT_SVN_DELTA_FETCH=1 \
+ GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
+ $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
.PHONY: $(T) clean
.NOTPARALLEL:
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 63c6703..99ada71 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -7,17 +7,18 @@ then
exit
fi
-GIT_DIR=$PWD/.git
-GIT_SVN_DIR=$GIT_DIR/svn/git-svn
-SVN_TREE=$GIT_SVN_DIR/svn-tree
-
-perl -e 'use SVN::Core' >/dev/null 2>&1
+perl -e 'use SVN::Core; $SVN::Core::VERSION gt "1.1.0" or die' >/dev/null 2>&1
if test $? -ne 0
then
- echo 'Perl SVN libraries not found, tests requiring those will be skipped'
- GIT_SVN_NO_LIB=1
+ test_expect_success 'Perl SVN libraries not found, skipping test' :
+ test_done
+ exit
fi
+GIT_DIR=$PWD/.git
+GIT_SVN_DIR=$GIT_DIR/svn/git-svn
+SVN_TREE=$GIT_SVN_DIR/svn-tree
+
svnadmin >/dev/null 2>&1
if test $? -ne 1
then
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index f9de232..0fc462e 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -229,9 +229,7 @@ tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e
tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4
EOF
-if test -z "$GIT_SVN_NO_LIB" || test "$GIT_SVN_NO_LIB" -eq 0; then
- echo tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 >> expected
-fi
+echo tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 >> expected
test_expect_success "$name" "diff -u a expected"
diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
index 01488ff..8d2e2fe 100755
--- a/t/t9104-git-svn-follow-parent.sh
+++ b/t/t9104-git-svn-follow-parent.sh
@@ -6,13 +6,6 @@
test_description='git-svn --follow-parent fetching'
. ./lib-git-svn.sh
-if test -n "$GIT_SVN_NO_LIB" && test "$GIT_SVN_NO_LIB" -ne 0
-then
- echo 'Skipping: --follow-parent needs SVN libraries'
- test_done
- exit 0
-fi
-
test_expect_success 'initialize repo' "
mkdir import &&
cd import &&
diff --git a/t/t9105-git-svn-commit-diff.sh b/t/t9105-git-svn-commit-diff.sh
index 746c827..6323c7e 100755
--- a/t/t9105-git-svn-commit-diff.sh
+++ b/t/t9105-git-svn-commit-diff.sh
@@ -4,13 +4,6 @@
test_description='git-svn commit-diff'
. ./lib-git-svn.sh
-if test -n "$GIT_SVN_NO_LIB" && test "$GIT_SVN_NO_LIB" -ne 0
-then
- echo 'Skipping: commit-diff needs SVN libraries'
- test_done
- exit 0
-fi
-
test_expect_success 'initialize repo' "
mkdir import &&
cd import &&
diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh
index 58698b3..59b6425 100755
--- a/t/t9106-git-svn-commit-diff-clobber.sh
+++ b/t/t9106-git-svn-commit-diff-clobber.sh
@@ -4,13 +4,6 @@
test_description='git-svn commit-diff clobber'
. ./lib-git-svn.sh
-if test -n "$GIT_SVN_NO_LIB" && test "$GIT_SVN_NO_LIB" -ne 0
-then
- echo 'Skipping: commit-diff clobber needs SVN libraries'
- test_done
- exit 0
-fi
-
test_expect_success 'initialize repo' "
mkdir import &&
cd import &&
--
1.4.4.2.g0817
^ permalink raw reply related
* [RFC/PATCH 2/2] git-svn: rename 'commit' command to 'set-tree'
From: Eric Wong @ 2006-12-16 7:58 UTC (permalink / raw)
To: git; +Cc: seth, Eric Wong
In-Reply-To: <m28xh8amxa.fsf@ziti.local>
'set-tree' probably accurately describes what the command
formerly known as 'commit' does.
I'm not entirely sure that 'dcommit' should be renamed to 'commit'
just yet... Perhaps 'push' or 'push-changes'?
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
Documentation/git-svn.txt | 20 ++++++++++----------
git-svn.perl | 12 ++++++------
t/t9100-git-svn-basic.sh | 22 +++++++++++-----------
t/t9101-git-svn-props.sh | 2 +-
t/t9102-git-svn-deep-rmdir.sh | 2 +-
5 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index c589a98..f5f57e8 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -64,7 +64,7 @@ manually joining branches on commit.
against the latest changes in the SVN repository.
An optional command-line argument may be specified as an
alternative to HEAD.
- This is advantageous over 'commit' (below) because it produces
+ This is advantageous over 'set-tree' (below) because it produces
cleaner, more linear history.
'log'::
@@ -89,7 +89,7 @@ manually joining branches on commit.
Any other arguments are passed directly to `git log'
-'commit'::
+'set-tree'::
You should consider using 'dcommit' instead of this command.
Commit specified commit or tree objects to SVN. This relies on
your imported fetch data being up-to-date. This makes
@@ -172,7 +172,7 @@ This can allow you to make partial mirrors when running fetch.
-::
--stdin::
-Only used with the 'commit' command.
+Only used with the 'set-tree' command.
Read a list of commits from stdin and commit them in reverse
order. Only the leading sha1 is read from each line, so
@@ -180,7 +180,7 @@ git-rev-list --pretty=oneline output can be used.
--rmdir::
-Only used with the 'dcommit', 'commit' and 'commit-diff' commands.
+Only used with the 'dcommit', 'set-tree' and 'commit-diff' commands.
Remove directories from the SVN tree if there are no files left
behind. SVN can version empty directories, and they are not
@@ -193,7 +193,7 @@ repo-config key: svn.rmdir
-e::
--edit::
-Only used with the 'dcommit', 'commit' and 'commit-diff' commands.
+Only used with the 'dcommit', 'set-tree' and 'commit-diff' commands.
Edit the commit message before committing to SVN. This is off by
default for objects that are commits, and forced on when committing
@@ -204,7 +204,7 @@ repo-config key: svn.edit
-l<num>::
--find-copies-harder::
-Only used with the 'dcommit', 'commit' and 'commit-diff' commands.
+Only used with the 'dcommit', 'set-tree' and 'commit-diff' commands.
They are both passed directly to git-diff-tree see
gitlink:git-diff-tree[1] for more information.
@@ -276,7 +276,7 @@ ADVANCED OPTIONS
-b<refname>::
--branch <refname>::
-Used with 'fetch', 'dcommit' or 'commit'.
+Used with 'fetch', 'dcommit' or 'set-tree'.
This can be used to join arbitrary git branches to remotes/git-svn
on new commits where the tree object is equivalent.
@@ -392,11 +392,11 @@ REBASE VS. PULL
---------------
Originally, git-svn recommended that the remotes/git-svn branch be
-pulled from. This is because the author favored 'git-svn commit B'
-to commit a single head rather than the 'git-svn commit A..B' notation
+pulled from. This is because the author favored 'git-svn set-tree B'
+to commit a single head rather than the 'git-svn set-tree A..B' notation
to commit multiple commits.
-If you use 'git-svn commit A..B' to commit several diffs and you do not
+If you use 'git-svn set-tree A..B' to commit several diffs and you do not
have the latest remotes/git-svn merged into my-branch, you should use
'git rebase' to update your work branch instead of 'git pull'. 'pull'
can cause non-linear history to be flattened when committing into SVN,
diff --git a/git-svn.perl b/git-svn.perl
index 077e920..07748bc 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -107,7 +107,12 @@ my %cmd = (
init => [ \&init, "Initialize a repo for tracking" .
" (requires URL argument)",
\%init_opts ],
- commit => [ \&commit, "Commit git revisions to SVN",
+ dcommit => [ \&dcommit, 'Commit several diffs to merge with upstream',
+ { 'merge|m|M' => \$_merge,
+ 'strategy|s=s' => \$_strategy,
+ 'dry-run|n' => \$_dry_run,
+ %cmt_opts } ],
+ 'set-tree' => [ \&commit, "Set an SVN repository to a git tree-ish",
{ 'stdin|' => \$_stdin, %cmt_opts, %fc_opts, } ],
'show-ignore' => [ \&show_ignore, "Show svn:ignore listings",
{ 'revision|r=i' => \$_revision } ],
@@ -150,11 +155,6 @@ my %cmd = (
'file|F=s' => \$_file,
'revision|r=s' => \$_revision,
%cmt_opts } ],
- dcommit => [ \&dcommit, 'Commit several diffs to merge with upstream',
- { 'merge|m|M' => \$_merge,
- 'strategy|s=s' => \$_strategy,
- 'dry-run|n' => \$_dry_run,
- %cmt_opts } ],
);
my $cmd;
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 0fc462e..0edf19e 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -56,7 +56,7 @@ git update-index --add --remove dir/a/b/c/d/e/file dir/file file
git commit -m "$name"
test_expect_success "$name" \
- "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch &&
+ "git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch &&
svn up $SVN_TREE &&
test -d $SVN_TREE/dir && test ! -d $SVN_TREE/dir/a"
@@ -70,7 +70,7 @@ git update-index --add dir/file/file
git commit -m "$name"
test_expect_failure "$name" \
- 'git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch' \
+ 'git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch' \
|| true
@@ -85,7 +85,7 @@ git update-index --add -- bar
git commit -m "$name"
test_expect_failure "$name" \
- 'git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch2' \
+ 'git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch2' \
|| true
@@ -100,7 +100,7 @@ git-update-index --add bar/zzz/yyy
git commit -m "$name"
test_expect_failure "$name" \
- 'git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch3' \
+ 'git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch3' \
|| true
@@ -115,7 +115,7 @@ git update-index --add -- dir
git commit -m "$name"
test_expect_failure "$name" \
- 'git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch4' \
+ 'git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch4' \
|| true
@@ -127,7 +127,7 @@ git update-index exec.sh
git commit -m "$name"
test_expect_success "$name" \
- "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
+ "git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
svn up $SVN_TREE &&
test ! -x $SVN_TREE/exec.sh"
@@ -138,7 +138,7 @@ git update-index exec.sh
git commit -m "$name"
test_expect_success "$name" \
- "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
+ "git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
svn up $SVN_TREE &&
test -x $SVN_TREE/exec.sh"
@@ -153,7 +153,7 @@ then
git commit -m "$name"
test_expect_success "$name" \
- "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
+ "git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
svn up $SVN_TREE &&
test -L $SVN_TREE/exec.sh"
@@ -164,7 +164,7 @@ then
git commit -m "$name"
test_expect_success "$name" \
- "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
+ "git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
svn up $SVN_TREE &&
test -x $SVN_TREE/bar/zzz &&
test -L $SVN_TREE/exec-2.sh"
@@ -177,7 +177,7 @@ then
git commit -m "$name"
test_expect_success "$name" \
- "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
+ "git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
svn up $SVN_TREE &&
test -f $SVN_TREE/exec-2.sh &&
test ! -L $SVN_TREE/exec-2.sh &&
@@ -192,7 +192,7 @@ then
git update-index exec-2.sh
git commit -m 'éïâ'
export LC_ALL="$GIT_SVN_LC_ALL"
- test_expect_success "$name" "git-svn commit HEAD"
+ test_expect_success "$name" "git-svn set-tree HEAD"
unset LC_ALL
else
echo "UTF-8 locale not set, test skipped ($GIT_SVN_LC_ALL)"
diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh
index a5a235f..5543b07 100755
--- a/t/t9101-git-svn-props.sh
+++ b/t/t9101-git-svn-props.sh
@@ -74,7 +74,7 @@ test_expect_success "$name" \
'git checkout -b mybranch remotes/git-svn &&
echo Hi again >> kw.c &&
git commit -a -m "test keywoards ignoring" &&
- git-svn commit remotes/git-svn..mybranch &&
+ git-svn set-tree remotes/git-svn..mybranch &&
git pull . remotes/git-svn'
expect='/* $Id$ */'
diff --git a/t/t9102-git-svn-deep-rmdir.sh b/t/t9102-git-svn-deep-rmdir.sh
index d693d18..572aaed 100755
--- a/t/t9102-git-svn-deep-rmdir.sh
+++ b/t/t9102-git-svn-deep-rmdir.sh
@@ -21,7 +21,7 @@ test_expect_success 'mirror via git-svn' "
test_expect_success 'Try a commit on rmdir' "
git rm -f deeply/nested/directory/number/2/another &&
git commit -a -m 'remove another' &&
- git-svn commit --rmdir HEAD &&
+ git-svn set-tree --rmdir HEAD &&
svn ls -R $svnrepo | grep ^deeply/nested/directory/number/1
"
--
1.4.4.2.g0817
^ permalink raw reply related
* Re: [RFC] Submodules in GIT
From: Torgil Svensson @ 2006-12-16 8:40 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Josef Weidendorfer, R. Steve McKown, git, Linus Torvalds
In-Reply-To: <elviac$63t$1@sea.gmane.org>
On 12/16/06, Jakub Narebski <jnareb@gmail.com> wrote:
> > 100644 blob <sha1 of blob> >
> >>
> >
> > Sorry, I was sloppy and forgot the names:
> >
> > 100644 blob <sha1 of blob> README
> > 100644 blob <sha1 of blob> REPORTING-BUGS
> > 100644 link <sha1 of blob> <sha1 of commit> AUTHORS
> > 040000 tree <sha1 of tree> arch
> > 040000 tree <sha1 of tree> block
> > 040000 link <sha1 of tree> <sha1 of commit> misc
> >
> > Now it doesn't looks like trees/blobs anymore so maybe a link object
> > is handy:
> > README
> > 100644 blob <sha1 of blob> REPORTING-BUGS
> > 100644 link <sha1 of link> AUTHORS
> > 040000 tree <sha1 of tree> arch
> > 040000 tree <sha1 of tree> block
> > 040000 link <sha1 of link> misc
> >
> > link-object:
> > <sha1 of commit>
> > <sha1 of tree/blob>
>
> What do you need <sha1 of tree/blob> for in link-object? Wouldn't you
> use usually the sha1 of top tree of a commit, which is uniquely defined
> by commit object, so you need only <ahs1 of commit>?
>
1. "Sparse" repository's - In my example, I want to cherry-pick
header-files or binary-files from different projects without fetching
all, potentially huge, submodules in their entirety. Imaging having X,
kernel, gcc, gtk and libc6 as sub-projects and you really only care
about some header files.
2. Super-module directory-hierarchy independent from submodules.
Super-project want to have the header-files and binaries it's own way.
This also gives version controlled file-collections, the "release
case" in my example - collecting different binaries and header-files
from different submodules together in a new directory-structure, add
some documentation and configuration files and get the whole thing
under strong version-control down to the beginning of time for each
little component.
3. Super-module development independent of submodules - If we have the
tree/blob-object with all it contents in the database many
git-operations can act as the link (commit) wasn't there since we have
access to all relevant data to work with. This makes it easy to clone
the super-project and work on it seamlessly without having to care
about submodules or mapping up submodule repository's (unless you want
to modify the links or the data underneath it of course).
^ permalink raw reply
* Re: [RFC] Submodules in GIT
From: Torgil Svensson @ 2006-12-16 8:50 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Josef Weidendorfer, R. Steve McKown, git
In-Reply-To: <Pine.LNX.4.64.0612151809510.3557@woody.osdl.org>
On 12/16/06, Linus Torvalds <torvalds@osdl.org> wrote:
> Side note: that's not to say that I would really see why you'd want to
> have both the tree and the commit SHA1's, and why you seemingly think that
> the links don't need a filename. Hmm?
I really want that file-name back - we can call it a mind short-circuit.
> If you require the tree objects to be in the database, you might as well
> require that the commit object be there. But you could make rules that say
> that subprojects don't need the whole commit history, for example (which
> is just a shallow clone in the subproject).
You have a very good point here, this would give us the history of the
^ permalink raw reply
* [PATCH] git-clone: use wildcard specification for tracking branches
From: Junio C Hamano @ 2006-12-16 9:14 UTC (permalink / raw)
To: git
In-Reply-To: <7v4przfpir.fsf@assigned-by-dhcp.cox.net>
This stops enumerating the set of branches found on the remote
side when a clone was made in the configuration file. Instead,
a single entry that maps each remote branch to the local
tracking branch for the remote under the same name is created.
Doing it this way not only shortens the configuration file, but
automatically adjusts to a new branch added on the remote side
after the clone is made.
Unfortunately this cannot be done for the traditional layout,
where we always need to special case the 'master' to 'origin'
mapping within the local branch namespace. But that is Ok; it
will be going away before v1.5.0.
We could also lose the "primary branch" mapping at the
beginning, but that has to wait until we implement the "forbid
'git pull' when we do not have branch.$current.merge for the
current branch" policy we earlier discussed. That should also
be in v1.5.0
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
Junio C Hamano <junkio@cox.net> writes:
> Things that need to be done to complete what have been merged to
> 'master' are:
> ...
> - 'git-clone' probably should be updated to use wild-card in
> remote.origin.fetch, instead of listing all the branches it
> found when the clone was made.
git-clone.sh | 47 ++++++++++++++++++++++++++++++-----------------
1 files changed, 30 insertions(+), 17 deletions(-)
diff --git a/git-clone.sh b/git-clone.sh
index 1f5d07a..422499a 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -366,41 +366,54 @@ then
)
)
- # Write out remotes/$origin file, and update our "$head_points_at".
+ # Write out remote.$origin config, and update our "$head_points_at".
case "$head_points_at" in
?*)
- mkdir -p "$GIT_DIR/remotes" &&
+ # Local default branch
git-symbolic-ref HEAD "refs/heads/$head_points_at" &&
+
+ # Tracking branch for the primary branch at the remote.
case "$use_separate_remote" in
t) origin_track="$remote_top/$head_points_at"
git-update-ref HEAD "$head_sha1" ;;
*) origin_track="$remote_top/$origin"
git-update-ref "refs/heads/$origin" "$head_sha1" ;;
esac &&
+
+ # Upstream URL and the primary branch tracking
git-repo-config remote."$origin".url "$repo" &&
git-repo-config remote."$origin".fetch \
"refs/heads/$head_points_at:$origin_track" &&
- (cd "$GIT_DIR/$remote_top" && find . -type f -print) |
- while read dotslref
- do
- name=`expr "$dotslref" : './\(.*\)'`
- if test "z$head_points_at" = "z$name"
- then
- continue
- fi
- if test "$use_separate_remote" = '' &&
- test "z$origin" = "z$name"
- then
- continue
- fi
- git-repo-config remote."$origin".fetch "refs/heads/${name}:$remote_top/${name}" '^$'
- done &&
+
+ # Set up the mappings to track the remaining branches.
+ case "$use_separate_remote" in
+ t)
+ git-repo-config remote."$origin".fetch \
+ "refs/heads/*:$remote_top/*" '^$'
+ ;;
+ *)
+ (cd "$GIT_DIR/$remote_top" && find . -type f -print) |
+ while read dotslref
+ do
+ name=`expr "$dotslref" : './\(.*\)'`
+ if test "z$head_points_at" = "z$name" ||
+ test "z$origin" = "z$name"
+ then
+ continue
+ fi
+ git-repo-config remote."$origin".fetch \
+ "refs/heads/${name}:$remote_top/${name}" '^$'
+ done
+ ;;
+ esac &&
+
case "$use_separate_remote" in
t)
rm -f "refs/remotes/$origin/HEAD"
git-symbolic-ref "refs/remotes/$origin/HEAD" \
"refs/remotes/$origin/$head_points_at"
esac &&
+
git-repo-config branch."$head_points_at".remote "$origin" &&
git-repo-config branch."$head_points_at".merge "refs/heads/$head_points_at"
esac
^ permalink raw reply related
* [PATCH] git-pull: refuse default merge without branch.*.merge
From: Junio C Hamano @ 2006-12-16 9:36 UTC (permalink / raw)
To: git
In-Reply-To: <7vfybgjj7k.fsf@assigned-by-dhcp.cox.net>
Everybody hated the pull behaviour of merging the first branch
listed on remotes/* file (or remote.*.fetch config) into the
current branch. This finally corrects that UI wart by
forbidding "git pull" without an explicit branch name on the
command line or branch.$current.merge for the current branch.
The matching change to git-clone was made to prepare the default
branch.*.merge entry for the primary branch some time ago.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
Junio C Hamano <junkio@cox.net> writes:
> We could also lose the "primary branch" mapping at the
> beginning, but that has to wait until we implement the "forbid
> 'git pull' when we do not have branch.$current.merge for the
> current branch" policy we earlier discussed. That should also
> be in v1.5.0
And this does exactly that.
git-parse-remote.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 6ae534b..7cd79c2 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -144,7 +144,8 @@ canon_refs_list_for_fetch () {
curr_branch=$(git-symbolic-ref HEAD | \
sed -e 's|^refs/heads/||')
merge_branches=$(git-repo-config \
- --get-all "branch.${curr_branch}.merge")
+ --get-all "branch.${curr_branch}.merge") ||
+ merge_branches=.this.would.never.match.any.ref.
fi
set x $(expand_refs_wildcard "$@")
shift
^ permalink raw reply related
* Re: [PATCH] git-clone: use wildcard specification for tracking branches
From: Jakub Narebski @ 2006-12-16 9:39 UTC (permalink / raw)
To: git
In-Reply-To: <7vfybgjj7k.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> This stops enumerating the set of branches found on the remote
> side when a clone was made in the configuration file. Instead,
> a single entry that maps each remote branch to the local
> tracking branch for the remote under the same name is created.
>
> Doing it this way not only shortens the configuration file, but
> automatically adjusts to a new branch added on the remote side
> after the clone is made.
[...]
Does this deal with non-fast-forward branches like 'pu'? Does
it add $head_points_at at the beginning, before glob... wait,
this is not needed if there is branch.$head_points_at.merge.
But perhaps it still would be better to have:
[remote "origin"]
url = git://git.kernel.org/pub/scm/git/git.git
fetch = refs/heads/master:refs/remotes/origin/master
fetch = refs/heads/*:refs/remotes/origin/*
fetch =+refs/heads/pu:refs/remotes/origin/pu
[branch "master"]
remote = origin
merge = refs/heads/master ;# full spec of remote branch
But this is very nice. Thanks.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* [PATCH] git-clone: lose the artificial "first" fetch refspec
From: Junio C Hamano @ 2006-12-16 9:41 UTC (permalink / raw)
To: git
In-Reply-To: <7v3b7gji73.fsf@assigned-by-dhcp.cox.net>
Now we lost the "first refspec is the one that is merged by default"
rule, there is no reason for clone to list the remote primary branch
in the config file explicitly anymore.
We still need it for the traditional layout for other reasons,
though.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
> Junio C Hamano <junkio@cox.net> writes:
>
>> We could also lose the "primary branch" mapping at the
>> beginning, but that has to wait until we implement the "forbid
>> 'git pull' when we do not have branch.$current.merge for the
>> current branch" policy we earlier discussed. That should also
>> be in v1.5.0
>
> And this does exactly that.
Next step will be to remove the traditional layout altogether.
With the recent flurry of UI updates, I think it is sane to do
that before v1.5.0; opinions?
git-clone.sh | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/git-clone.sh b/git-clone.sh
index 422499a..68dc4f2 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -380,18 +380,18 @@ then
git-update-ref "refs/heads/$origin" "$head_sha1" ;;
esac &&
- # Upstream URL and the primary branch tracking
+ # Upstream URL
git-repo-config remote."$origin".url "$repo" &&
- git-repo-config remote."$origin".fetch \
- "refs/heads/$head_points_at:$origin_track" &&
- # Set up the mappings to track the remaining branches.
+ # Set up the mappings to track the remote branches.
case "$use_separate_remote" in
t)
git-repo-config remote."$origin".fetch \
"refs/heads/*:$remote_top/*" '^$'
;;
*)
+ git-repo-config remote."$origin".fetch \
+ "refs/heads/$head_points_at:$origin_track" &&
(cd "$GIT_DIR/$remote_top" && find . -type f -print) |
while read dotslref
do
^ permalink raw reply related
* Re: Can git be tweaked to work cross-platform, on FAT32?
From: Florian v. Savigny @ 2006-12-16 9:51 UTC (permalink / raw)
To: git; +Cc: martin.langhoff, Johannes.Schindelin
In-Reply-To: <46a038f90612132155rc987a9cs6a4fa33dd4c882c6@mail.gmail.com>
Thank you Martin and Johannes -
before proceeding by following either of your two suggestions, I
would like to make sure that there is no other way, so I would like to
ask:
1. I know, there is absolutely nothing in either of your answers that
says that the route I conceived is not possible, but anyway: DO
your answers imply that it is NOT possible (by "possible", I mean
of course: possible without re-programming the source code ;-)) to
compile git in a way that would enable it to work DIRECTLY with a
local repository on FAT32 from both Windows and Linux (or, perhaps
more simple: to work directly with a repository on FAT32 under
Linux)?
I'm repeating my question because it is impossible for me to tell
whether this would involve a rather simple change (such as: don't
use symlinks, and/or: don't care about user/group permissions), or
whether the critical differences are rather an inherent
characteristic of git, or perhaps even the libraries it uses.
And: if this were possible, I would consider it a rather attractive
idea, not only for me, hence I'd like to rule it out before
dropping it altogether.
2. ad Martin: Ouf! I have no idea of how Samba works (well, yes: I
thought it was some kind of server or client program permitting to
connect to Windows servers or clients), hence I don't get a very
clear idea of what you have in mind. I hope I have made it clear
that I am using only one computer (double-boot, simply), and that
everything is local. I am aware that Linux permits to do "virtual"
networking with localhost, but how would your scheme work on a
single machine? Can samba "pretend" there is a Windows network
behind it, while in truth, it accesses a local directory (on
FAT32)? And can git work directly in a repository it considers to
be accessible over the network only?
The interesting thing in this could be that one could use indeed
the same repository under both OSes. If I got vaguely the right
idea, that is.
3. ad Johannes: This does sound quite simple and straightforward. If I
got it right, it would involve having one repository on a, say,
ext2 partition to work with under Linux, and one on a FAT32
partition to work with under Windows, and syncing the two after
booting (fetching from FAT32) and before shutting down (pushing to
FAT32) Linux.
It is quite interesting, BTW, that git can /sync/ with a repository
on FAT32 under Linux, but not work with it.
Thanks very much for both answers! I would still be curious to know
whether there is an answer to my first question, but yours should get
me working one way or other.
Regards, Florian
^ permalink raw reply
* [PATCH] git-clone: lose the traditional 'no-separate-remote' layout
From: Junio C Hamano @ 2006-12-16 9:53 UTC (permalink / raw)
To: git
In-Reply-To: <7vvekci3ds.fsf_-_@assigned-by-dhcp.cox.net>
Finally.
The separate-remote layout is so much more organized than
traditional and easier to work with especially when you need to
deal with remote repositories with multiple branches and/or you
need to deal with more than one remote repositories, and using
traditional layout for new repositories simply does not make
much sense.
Internally we still have code for 1:1 mappings to create a bare
clone; that is a good thing and will not go away.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
Junio C Hamano <junkio@cox.net> writes:
> Next step will be to remove the traditional layout altogether.
> With the recent flurry of UI updates, I think it is sane to do
> that before v1.5.0; opinions?
And this drops it; modulo bugs, I think this is about it for
v1.5.0 around this area.
Documentation/git-clone.txt | 15 +----------
git-clone.sh | 58 +++++++++----------------------------------
2 files changed, 13 insertions(+), 60 deletions(-)
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index bfddb21..874934a 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -11,8 +11,7 @@ SYNOPSIS
[verse]
'git-clone' [--template=<template_directory>] [-l [-s]] [-q] [-n] [--bare]
[-o <name>] [-u <upload-pack>] [--reference <repository>]
- [--use-separate-remote | --no-separate-remote] <repository>
- [<directory>]
+ <repository> [<directory>]
DESCRIPTION
-----------
@@ -99,18 +98,6 @@ OPTIONS
if unset the templates are taken from the installation
defined default, typically `/usr/share/git-core/templates`.
---use-separate-remote::
- Save remotes heads under `$GIT_DIR/refs/remotes/origin/` instead
- of `$GIT_DIR/refs/heads/`. Only the local master branch is
- saved in the latter. This is the default.
-
---no-separate-remote::
- Save remotes heads in the same namespace as the local
- heads, `$GIT_DIR/refs/heads/'. In regular repositories,
- this is a legacy setup git-clone created by default in
- older Git versions, and will be removed before the next
- major release.
-
<repository>::
The (possibly remote) repository to clone from. It can
be any URL git-fetch supports.
diff --git a/git-clone.sh b/git-clone.sh
index 68dc4f2..490f3e4 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -14,7 +14,7 @@ die() {
}
usage() {
- die "Usage: $0 [--template=<template_directory>] [--no-separate-remote] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [-n] <repo> [<dir>]"
+ die "Usage: $0 [--template=<template_directory>] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [-n] <repo> [<dir>]"
}
get_repo_base() {
@@ -137,11 +137,9 @@ while
*,--template=*)
template="$1" ;;
*,-q|*,--quiet) quiet=-q ;;
- *,--use-separate-remote)
- # default
- use_separate_remote=t ;;
+ *,--use-separate-remote) ;;
*,--no-separate-remote)
- use_separate_remote= ;;
+ die "clones are always made with separate-remote layout" ;;
1,--reference) usage ;;
*,--reference)
shift; reference="$1" ;;
@@ -327,12 +325,8 @@ cd "$D" || exit
if test -z "$bare" && test -f "$GIT_DIR/REMOTE_HEAD"
then
- # Figure out which remote branch HEAD points at.
- case "$use_separate_remote" in
- '') remote_top=refs/heads ;;
- *) remote_top="refs/remotes/$origin" ;;
- esac
-
+ # a non-bare repository is always in separate-remote layout
+ remote_top="refs/remotes/$origin"
head_sha1=`cat "$GIT_DIR/REMOTE_HEAD"`
case "$head_sha1" in
'ref: refs/'*)
@@ -373,46 +367,18 @@ then
git-symbolic-ref HEAD "refs/heads/$head_points_at" &&
# Tracking branch for the primary branch at the remote.
- case "$use_separate_remote" in
- t) origin_track="$remote_top/$head_points_at"
- git-update-ref HEAD "$head_sha1" ;;
- *) origin_track="$remote_top/$origin"
- git-update-ref "refs/heads/$origin" "$head_sha1" ;;
- esac &&
+ origin_track="$remote_top/$head_points_at" &&
+ git-update-ref HEAD "$head_sha1" &&
# Upstream URL
git-repo-config remote."$origin".url "$repo" &&
# Set up the mappings to track the remote branches.
- case "$use_separate_remote" in
- t)
- git-repo-config remote."$origin".fetch \
- "refs/heads/*:$remote_top/*" '^$'
- ;;
- *)
- git-repo-config remote."$origin".fetch \
- "refs/heads/$head_points_at:$origin_track" &&
- (cd "$GIT_DIR/$remote_top" && find . -type f -print) |
- while read dotslref
- do
- name=`expr "$dotslref" : './\(.*\)'`
- if test "z$head_points_at" = "z$name" ||
- test "z$origin" = "z$name"
- then
- continue
- fi
- git-repo-config remote."$origin".fetch \
- "refs/heads/${name}:$remote_top/${name}" '^$'
- done
- ;;
- esac &&
-
- case "$use_separate_remote" in
- t)
- rm -f "refs/remotes/$origin/HEAD"
- git-symbolic-ref "refs/remotes/$origin/HEAD" \
- "refs/remotes/$origin/$head_points_at"
- esac &&
+ git-repo-config remote."$origin".fetch \
+ "refs/heads/*:$remote_top/*" '^$' &&
+ rm -f "refs/remotes/$origin/HEAD"
+ git-symbolic-ref "refs/remotes/$origin/HEAD" \
+ "refs/remotes/$origin/$head_points_at" &&
git-repo-config branch."$head_points_at".remote "$origin" &&
git-repo-config branch."$head_points_at".merge "refs/heads/$head_points_at"
^ permalink raw reply related
* Re: [RFC] Submodules in GIT
From: Jakub Narebski @ 2006-12-16 9:57 UTC (permalink / raw)
To: git
In-Reply-To: <e7bda7770612160040v1a769153p909a8cd40e5ea991@mail.gmail.com>
<opublikowany i wysłany>
Torgil Svensson wrote:
> On 12/16/06, Jakub Narebski <jnareb@gmail.com> wrote:
>>> Now it doesn't looks like trees/blobs anymore so maybe a link object
>>> is handy:
>>> README
>>> 100644 blob <sha1 of blob> REPORTING-BUGS
>>> 100644 link <sha1 of link> AUTHORS
>>> 040000 tree <sha1 of tree> arch
>>> 040000 tree <sha1 of tree> block
>>> 040000 link <sha1 of link> misc
This would be (using the submodule original proposal)
140000 link <sha1 of link> misc
>>> link-object:
>>> <sha1 of commit>
>>> <sha1 of tree/blob>
>>
>> What do you need <sha1 of tree/blob> for in link-object? Wouldn't you
>> use usually the sha1 of top tree of a commit, which is uniquely defined
>> by commit object, so you need only <sha1 of commit>?
>>
>
> 1. "Sparse" repository's - In my example, I want to cherry-pick
> header-files or binary-files from different projects without fetching
> all, potentially huge, submodules in their entirety. Imaging having X,
> kernel, gcc, gtk and libc6 as sub-projects and you really only care
> about some header files.
>
> 2. Super-module directory-hierarchy independent from submodules.
> Super-project want to have the header-files and binaries it's own way.
> This also gives version controlled file-collections, the "release
> case" in my example - collecting different binaries and header-files
> from different submodules together in a new directory-structure, add
> some documentation and configuration files and get the whole thing
> under strong version-control down to the beginning of time for each
> little component.
All fine, but this does not and I think cannot protect us from the
fact that we can have <sha1 of tree/blob> which doesn't match
<sha1 of commit>.
I think it would be better to have sparse/partial checkout first.
But that is just my idea. Because with <sha1 of tree/blob> which
is not sha1 of commit tree you might loose (I think) the ability
to merge, for example your changes to submodule with upstream.
> 3. Super-module development independent of submodules - If we have the
> tree/blob-object with all it contents in the database many
> git-operations can act as the link (commit) wasn't there since we have
> access to all relevant data to work with. This makes it easy to clone
> the super-project and work on it seamlessly without having to care
> about submodules or mapping up submodule repository's (unless you want
> to modify the links or the data underneath it of course).
This is I think irrelevant to the fact if we have only <sha1 of commit>,
or link object and also <sha1 of tree/blob>
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ 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