Git development
 help / color / mirror / Atom feed
* [PATCH TOPGIT] tg export: Implement flattening patch paths for quilt mode
From: Uwe Kleine-König @ 2008-12-23 14:32 UTC (permalink / raw)
  To: git; +Cc: martin f. krafft, Petr Baudis
In-Reply-To: <1230042744-24675-1-git-send-email-u.kleine-koenig@pengutronix.de>

The result of providing the new flag -f is that the exported patches are
all placed directly in the output directory, not in subdirectories.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 tg-export.sh |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/tg-export.sh b/tg-export.sh
index 95aa346..06b9c8d 100644
--- a/tg-export.sh
+++ b/tg-export.sh
@@ -7,6 +7,7 @@ name=
 branches=
 output=
 driver=collapse
+flatten=false
 
 
 ## Parse options
@@ -16,6 +17,8 @@ while [ -n "$1" ]; do
 	case "$arg" in
 	-b)
 		branches="$1"; shift;;
+	-f)
+		flatten=true;;
 	--quilt)
 		driver=quilt;;
 	--collapse)
@@ -34,6 +37,9 @@ done
 [ -z "$branches" -o "$driver" = "quilt" ] ||
 	die "-b works only with the quilt driver"
 
+[ "$driver" = "quilt" ] || ! "$flatten" ||
+	die "-f works only with the quilt driver"
+
 if [ -z "$branches" ]; then
 	# this check is only needed when no branches have been passed
 	name="$(git symbolic-ref HEAD | sed 's#^refs/heads/##')"
@@ -138,7 +144,18 @@ quilt()
 		return
 	fi
 
-	filename="$output/$_dep.diff"
+	if "$flatten"; then
+		bn="$(echo "$_dep.diff" | sed -e 's#_#__#g' -e 's#/#_#g')";
+		dn="";
+	else
+		bn="$(basename "$_dep.diff")";
+		dn="$(dirname "$_dep.diff")/";
+		if [ "x$dn" = "x./" ]; then
+			dn="";
+		fi;
+	fi;
+
+	filename="$output/$dn$bn";
 	if [ -e "$filename" ]; then
 		# We've already seen this dep
 		return
@@ -148,9 +165,9 @@ quilt()
 		echo "Skip empty patch $_dep";
 	else
 		echo "Exporting $_dep"
-		mkdir -p "$(dirname "$filename")"
+		mkdir -p "$output/$dn";
 		$tg patch "$_dep" >"$filename"
-		echo "$_dep.diff -p1" >>"$output/series"
+		echo "$dn$bn -p1" >>"$output/series"
 	fi
 }
 
-- 
1.5.6.5

^ permalink raw reply related

* [PATCH TOPGIT] tg export: implement skipping empty patches for collapse driver
From: Uwe Kleine-König @ 2008-12-23 14:32 UTC (permalink / raw)
  To: git; +Cc: martin f. krafft, Petr Baudis
In-Reply-To: <20081223143035.GA24087@cassiopeia.tralala>

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 README       |    1 -
 tg-export.sh |   10 +++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/README b/README
index c19985f..8be0d17 100644
--- a/README
+++ b/README
@@ -414,7 +414,6 @@ tg export
 	TODO: Make stripping of non-essential headers configurable
 	TODO: Make stripping of [PATCH] and other prefixes configurable
 	TODO: --mbox option for other mode of operation
-	TODO: prevent exporting of empty patches by the collapse driver
 	TODO: -a option to export all branches
 	TODO: For quilt exporting, use a temporary branch and remove it when
 	      done - this would allow producing conflict-less series
diff --git a/tg-export.sh b/tg-export.sh
index afb6f95..95aa346 100644
--- a/tg-export.sh
+++ b/tg-export.sh
@@ -91,9 +91,13 @@ collapsed_commit()
 			$(for p in $parent; do echo -p $p; done))"
 	fi
 
-	(printf '%s\n\n' "$SUBJECT"; cat "$playground/^msg") |
-	git stripspace |
-	git commit-tree "$(pretty_tree "$name")" -p "$parent"
+	if branch_empty "$name"; then
+		echo "$parent";
+	else
+		(printf '%s\n\n' "$SUBJECT"; cat "$playground/^msg") |
+		git stripspace |
+		git commit-tree "$(pretty_tree "$name")" -p "$parent"
+	fi;
 
 	echo "$name" >>"$playground/^ticker"
 }
-- 
1.5.6.5

^ permalink raw reply related

* a few Topgit patches
From: Uwe Kleine-König @ 2008-12-23 14:30 UTC (permalink / raw)
  To: git; +Cc: martin f. krafft, Petr Baudis

Hello,

I hacked using topgit for some time now, and found the following changes
to topgit useful:

Uwe Kleine-König (3):
      tg export: implement skipping empty patches for collapse driver
      tg export: Implement flattening patch paths for quilt mode
      tg export (quilt): Implement numbering the patches

 README       |    1 -
 tg-export.sh |   52 ++++++++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 44 insertions(+), 9 deletions(-)

You can fetch or pull these from

	git://git.pengutronix.de/git/ukl/topgit.git master

or browse them using the following URL:

	http://git.pengutronix.de/?p=ukl/topgit.git

For review I send the patches as a reply to this mail.

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König           |
Industrial Linux Solutions                    | http://www.pengutronix.de/ |

^ permalink raw reply

* Re: [announce] gc
From: Stephen Haberman @ 2008-12-23 14:22 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: git
In-Reply-To: <vpqabanc9v6.fsf@bauges.imag.fr>


> You should find a better name. I mean, one for which
> 
>   http://www.google.com/search?q=git+YOUR-NAME-HERE
> 
> has a chance to find you ...

Ah, good point.

Perhaps "git corporate hooks" or "git enterprise hooks".

I'm a little cautious about using words like corporate/enterprise as
there is nothing exclusively "corporate/enterprise" about any of the
hooks in the project, we just happened to be on a corporate/enterprise
project when we came up with them.

"git enterprise hooks" seems like a potentially good name. I can't see
people googling explicitly for the "enterprise" keyword, but the "git
hooks" seems fairly likely.

Suggestions are welcome and thanks for the feedback.

- Stephen

^ permalink raw reply

* Re: 'Theirs' merge between branches on a binary file.
From: Tim Visher @ 2008-12-23 14:05 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7v3agfhk8b.fsf@gitster.siamese.dyndns.org>

On Mon, Dec 22, 2008 at 6:18 PM, Junio C Hamano <gitster@pobox.com> wrote:

> Hmph, I meant to point you at:
>
>    http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html

Ah, yes.  There it is. :)

> I think you can use "git checkout-index --stage=3 path" if your git is
> older than that one with the option.
>
> v1.6.0.1-15-g38901a4 (checkout --ours/--theirs: allow checking out one
> side of a conflicting merge, 2008-08-30) introduced the feature.

Apparently this was added, at least to the docs, only in the latest
release?  That's kind of weird A) because the tag indicates 1.6.0.1,
not 0.6, and B) It's a pretty trivial operation in other VCSes.
Hmm... Maybe I'll try to updated the docs to make this feature a
little more visible.

Anyway, the checkout-index command does indeed work in the older
version.  That's kind of what I was looking for.  I'm now working on
compiling git under cygwin as the latest version cygwin installs for
you is 0.4!

Thanks for your help!

-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

^ permalink raw reply

* Questions about repo and git submodule
From: Emily Ren @ 2008-12-23 14:01 UTC (permalink / raw)
  To: Git Mailinglist

All,

I have some questions about android repo and git submodule.

I created a repo repository with below commands:
1.  repo init -u git://android.git.kernel.org/platform/manifest.git
2.  repo initialized in /android

1. The android dir is not a git repository, if other people clone my
android code, how does it work?
2. I want to make android dir to be a git repository, is it workable
that I create submodule for each subdirectory in another directory? Is
there a script for it?

Thank you !

Emily

^ permalink raw reply

* Re: [announce] gc
From: Matthieu Moy @ 2008-12-23 13:13 UTC (permalink / raw)
  To: Stephen Haberman; +Cc: git
In-Reply-To: <20081222212407.47c9ab1e.stephen@exigencecorp.com>

Stephen Haberman <stephen@exigencecorp.com> writes:

> Hi,
>
> This is just a small collections of hooks, scripts, and practices I
> developed while working on a not-distributed/corporate project.

You should find a better name. I mean, one for which

  http://www.google.com/search?q=git+YOUR-NAME-HERE

has a chance to find you ...

My 2 cents,

-- 
Matthieu

^ permalink raw reply

* Re: git-cvsimport fuzzy commit log matching?
From: Martin Langhoff @ 2008-12-23 12:53 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Matthias Urlichs, git
In-Reply-To: <20081223110302.GA9376@lst.de>

On Tue, Dec 23, 2008 at 9:03 AM, Christoph Hellwig <hch@lst.de> wrote:
> Any idea how to tell git-cvsimport that if we have exactly the same
> timestamp, and maybe the same author it really is the same changeset and
> we want to merge the commit message?

Right now, cvsimport relies on cvsps for this. cvsps compares author,
timestamp (with a fuzz factor 'cause cvs commits over slow networks or
hosts can span minutes - you could dial down to 0, it's the -z flag)
*and* commit msg.

What you could do is

 1 - run cvsps with export to a file (I've posted in this list how to
run it exactly as cvsimport does)
 2 - post-process cvsps ouput with perl (there's a parser already in
cvsimport ;-) )
 3 - run cvsimport with the post-processed file

Or postprocess the imported git tree as others have suggested.

hth,



martin
-- 
 martin.langhoff@gmail.com
 martin@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff

^ permalink raw reply

* Error : git svn fetch
From: chongyc @ 2008-12-23 12:25 UTC (permalink / raw)
  To: git

Hi

I found that 'git svn fetch' failed in cloning the hudson svn reposotory.

I want to git-clone the svn repository

svn repository URL : https://svn.dev.java.net/svn/hudson/
username : guest
password :


So I run followings to git-clone

[root@localhost hudson]# git --version
git version 1.6.0.6
[root@localhost hudson]# git svn init -T trunk -t tags -b branches 
https://svn.dev.java.net/svn/hudson/
[root@localhost hudson]# git svn fetch
Found possible branch point: 
https://svn.dev.java.net/svn/hudson/tags/hudson-1_230 => 
https://svn.dev.java.net/svn/hudson/branches/buildnav-1636, 10490
Initializing parent: buildnav-1636@10490
Found possible branch point: 
https://svn.dev.java.net/svn/hudson/trunk/hudson/main => 
https://svn.dev.java.net/svn/hudson/tags/hudson-1_230, 10450
Initializing parent: buildnav-1636@10450
Found branch parent: (buildnav-1636@10490) a1c395e5db063ca1ffbbe008e309c5
11d56219e0
Following parent with do_switch
remoting/pom.xml was not found in commit 
a1c395e5db063ca1ffbbe008e309c511d56219e0 (r10447)
[root@localhost hudson]#

What shall I do to git-clone it ?

Please help me

>From chongyc 

^ permalink raw reply

* Error : git svn fetch
From: chongyc @ 2008-12-23 12:13 UTC (permalink / raw)
  To: git

Hi

I found that 'git svn fetch' failed in cloning the hudson svn reposotory.

I want to git-clone the svn repository

svn repository URL : https://svn.dev.java.net/svn/hudson/
username : guest
password :


So I run followings to git-clone

[root@localhost hudson]# git --version
git version 1.6.0.6
[root@localhost hudson]# git svn init -T trunk -t tags -b branches 
https://svn.dev.java.net/svn/hudson/
[root@localhost hudson]# git svn fetch
Found possible branch point: 
https://svn.dev.java.net/svn/hudson/tags/hudson-1_230 => 
https://svn.dev.java.net/svn/hudson/branches/buildnav-1636, 10490
Initializing parent: buildnav-1636@10490
Found possible branch point: 
https://svn.dev.java.net/svn/hudson/trunk/hudson/main => 
https://svn.dev.java.net/svn/hudson/tags/hudson-1_230, 10450
Initializing parent: buildnav-1636@10450
Found branch parent: (buildnav-1636@10490) a1c395e5db063ca1ffbbe008e309c5
11d56219e0
Following parent with do_switch
remoting/pom.xml was not found in commit 
a1c395e5db063ca1ffbbe008e309c511d56219e0 (r10447)
[root@localhost hudson]#

What shall I do to git-clone it ?

Please help me

>From chongyc 

^ permalink raw reply

* Error : git svn fetch
From: chongyc @ 2008-12-23 12:12 UTC (permalink / raw)
  To: git

Hi

I found that 'git svn fetch' failed in cloning the hudson svn reposotory.

I want to git-clone the svn repository

svn repository URL : https://svn.dev.java.net/svn/hudson/
username : guest
password :


So I run followings to git-clone

[root@localhost hudson]# git --version
git version 1.6.0.6
[root@localhost hudson]# git svn init -T trunk -t tags -b branches 
https://svn.dev.java.net/svn/hudson/
[root@localhost hudson]# git svn fetch
Found possible branch point: 
https://svn.dev.java.net/svn/hudson/tags/hudson-1_230 => 
https://svn.dev.java.net/svn/hudson/branches/buildnav-1636, 10490
Initializing parent: buildnav-1636@10490
Found possible branch point: 
https://svn.dev.java.net/svn/hudson/trunk/hudson/main => 
https://svn.dev.java.net/svn/hudson/tags/hudson-1_230, 10450
Initializing parent: buildnav-1636@10450
Found branch parent: (buildnav-1636@10490) a1c395e5db063ca1ffbbe008e309c5
11d56219e0
Following parent with do_switch
remoting/pom.xml was not found in commit 
a1c395e5db063ca1ffbbe008e309c511d56219e0 (r10447)
[root@localhost hudson]#

What shall I do to git-clone it ?

Please help me

>From chongyc 

^ permalink raw reply

* Can `git config` override entries in .gitconfig?
From: Nicholas LaRoche @ 2008-12-23 12:05 UTC (permalink / raw)
  To: git

Is there a direct way to change the user.email entry for a git 
repository for one user (applied to all previous commits)?

I tried `git config --unset user.email` followed by `git config 
user.email email2` but it just sets a second field called user.email 
that shows up in `git config -l` as a duplicate. My ~/.gitconfig file 
contains email1 for the user.email entry.

Also, when the repository is created can I specify a second set of 
contact information (i.e. using a project specific email) which isn't a 
part of ~/.gitconfig?

output of `git config -l`:
user.email=email1
..
..
user.email=email2

Regards,
Nick

^ permalink raw reply

* Re: What's cooking in git.git (Dec 2008, #03; Sun, 21)
From: Jeff King @ 2008-12-23 12:05 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin
In-Reply-To: <7vr641pvid.fsf@gitster.siamese.dyndns.org>

On Sun, Dec 21, 2008 at 04:23:22AM -0800, Junio C Hamano wrote:

> * js/notes (Sat Dec 20 13:06:03 2008 +0100) 4 commits
>  - Add an expensive test for git-notes
>  - Speed up git notes lookup
>  - Add a script to edit/inspect notes
>  - Introduce commit notes

I haven't had much time to really look at this closely, and I probably
won't for another week or so due to the holidays. But from my cursory
examination, I think I want to propose something that is a bit
different. So if nobody objects (and I think Dscho already said he was
going to be out of touch for two weeks due to the holidays) I'd like
this to remain in pu for the time being.

-Peff

^ permalink raw reply

* Re: Applying patches from a patch set
From: Mark Ryden @ 2008-12-23 11:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vabaqy5kx.fsf@gitster.siamese.dyndns.org>

Hello,
  I tried usuing slrn with mutt; mutt seems to me better.
I saved 15 git patches from one patch set into a mailbox
using mutt.
Now I tried:
git am maibox
and got this error:

Patch is empty.  Was it split wrong?

This error occurred after "git am maibox" applied the first 6 patches
in this patch set.

looking at that seventh patch shows that it seems to be perfectly
ok.

Any ideas what can be wrong here?
Regards,
Mark


On Sat, Dec 20, 2008 at 10:06 PM, Junio C Hamano <gitster@pobox.com> wrote:
> "Mark Ryden" <markryde@gmail.com> writes:
>
>> Hello,
>>   I am subscribed to some linux kernel subsystem mailing list; in this
>> list there are sometimes patchsets with more than
>> 30-40 patches.
>> I am using gmail web interface client.
>>
>> In order to apply a patch set I copy and paste each patch from the
>> patchset into a file, and then apply that patch.
>> I assume that there is a better way.
>> Recently I encountered a fatal error when doing so (and I am not sure
>> what caused it).
>>
>> So my question is: does anyone know a more elegant way of applying a
>> large patchset ?
>> Maybe there is better mail client with which this process can be done easily ?
>
> First mistake(?) is you seem to be doing copy&paste from browser.  Don't.
> It can easily damage whitespaces.  Find out how your webmail interface
> allows you to save selected messages in a mbox and let you download it.
>
> Then
>
>        $ git am that-mbox-file
>
>
>
>
>

^ permalink raw reply

* Re: git-cvsimport fuzzy commit log matching?
From: Pierre Habouzit @ 2008-12-23 11:06 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Matthias Urlichs, git
In-Reply-To: <20081223110302.GA9376@lst.de>

[-- Attachment #1: Type: text/plain, Size: 2186 bytes --]

On Tue, Dec 23, 2008 at 11:03:02AM +0000, Christoph Hellwig wrote:
> I'm currently trying to get clean git imports of the XFS userspace
> repositories.  These are funky in the way they were initially kept in
> ptools, and SGI-internal SCM that was built ontop of RCS which changeset
> added ontop.  So we know that commits actually were done in atomic
> changesets.  But ptools has the "nice" feature of allowing both per-file
> and per-changeset commits.   Due to the per-file commits git-cvsimport
> often misdetects a single changeset as multiple individual changes, ala:
> 
> 
> commit 0d47d43b5878c6e7d7b516a793a82f0076d22089
> Author: Barry Naujok <bnaujok@sgi.com>
> Date:   Mon Jul 16 15:52:53 2007 +0000
> 
>     Perform parallel processing based on AG stride/concat unit
>     Merge of master-melb:xfs-cmds:29143a by kenmcd.
> 
>       Queue up AGs per thread based on ag stride
> 
> commit 1fa4685db126fd3071e008a6d18f9d51209ab305
> Author: Barry Naujok <bnaujok@sgi.com>
> Date:   Mon Jul 16 15:52:53 2007 +0000
> 
>     Perform parallel processing based on AG stride/concat unit
>     Merge of master-melb:xfs-cmds:29143a by kenmcd.
> 
>       Handle ag stride command line option and setup threads as required
> 
> commit a73288784e77c2411687f6778adb4c0b0f9dcdff
> Author: Barry Naujok <bnaujok@sgi.com>
> Date:   Mon Jul 16 15:52:53 2007 +0000
> 
>     Perform parallel processing based on AG stride/concat unit
>     Merge of master-melb:xfs-cmds:29143a by kenmcd.
> 
>       Execute bits changed from x-- to ---
>       Queue up AGs per thread based on ag stride
> 
> and so on.
> 
> Any idea how to tell git-cvsimport that if we have exactly the same
> timestamp, and maybe the same author it really is the same changeset and
> we want to merge the commit message?

Why not using a fancy git-filterbranch script to squash them together
instead ? It's probably less work than to try to modify your cvs
importer to work the exact way you want.

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* git-cvsimport fuzzy commit log matching?
From: Christoph Hellwig @ 2008-12-23 11:03 UTC (permalink / raw)
  To: Matthias Urlichs; +Cc: git

I'm currently trying to get clean git imports of the XFS userspace
repositories.  These are funky in the way they were initially kept in
ptools, and SGI-internal SCM that was built ontop of RCS which changeset
added ontop.  So we know that commits actually were done in atomic
changesets.  But ptools has the "nice" feature of allowing both per-file
and per-changeset commits.   Due to the per-file commits git-cvsimport
often misdetects a single changeset as multiple individual changes, ala:


commit 0d47d43b5878c6e7d7b516a793a82f0076d22089
Author: Barry Naujok <bnaujok@sgi.com>
Date:   Mon Jul 16 15:52:53 2007 +0000

    Perform parallel processing based on AG stride/concat unit
    Merge of master-melb:xfs-cmds:29143a by kenmcd.

      Queue up AGs per thread based on ag stride

commit 1fa4685db126fd3071e008a6d18f9d51209ab305
Author: Barry Naujok <bnaujok@sgi.com>
Date:   Mon Jul 16 15:52:53 2007 +0000

    Perform parallel processing based on AG stride/concat unit
    Merge of master-melb:xfs-cmds:29143a by kenmcd.

      Handle ag stride command line option and setup threads as required

commit a73288784e77c2411687f6778adb4c0b0f9dcdff
Author: Barry Naujok <bnaujok@sgi.com>
Date:   Mon Jul 16 15:52:53 2007 +0000

    Perform parallel processing based on AG stride/concat unit
    Merge of master-melb:xfs-cmds:29143a by kenmcd.

      Execute bits changed from x-- to ---
      Queue up AGs per thread based on ag stride

and so on.

Any idea how to tell git-cvsimport that if we have exactly the same
timestamp, and maybe the same author it really is the same changeset and
we want to merge the commit message?

^ permalink raw reply

* Re: [PATCH] strbuf_readlink semantics update.
From: Pierre Habouzit @ 2008-12-23 10:21 UTC (permalink / raw)
  To: git, Linus Torvalds; +Cc: Junio C Hamano
In-Reply-To: <1230026749-25360-1-git-send-email-madcoder@debian.org>

[-- Attachment #1: Type: text/plain, Size: 4021 bytes --]

when readlink fails, the strbuf shall not be destroyed. It's not how
read_file_or_gitlink works for example.

Fix strbuf_readlink callers to destroy the buffer when appropriate.

Fix read_old_data possible leaks in case of errors, since even when no
data has been read, the strbufs may have grown to prepare the reads.
strbuf_release must be called on them.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---

  I know it somehow add lines to the callers, but it's actually more
  important to keep consistency among the strbuf APIs than to save 10
  SLOCs.


 builtin-apply.c |    8 ++++++--
 combine-diff.c  |    1 +
 diff.c          |    4 +++-
 read-cache.c    |    4 +++-
 sha1_file.c     |    1 +
 strbuf.c        |    2 +-
 6 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index 07244b0..c1fe9ca 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2306,8 +2306,10 @@ static int apply_data(struct patch *patch, struct stat *st, struct cache_entry *
 		/* We have a patched copy in memory use that */
 		strbuf_add(&buf, tpatch->result, tpatch->resultsize);
 	} else if (cached) {
-		if (read_file_or_gitlink(ce, &buf))
+		if (read_file_or_gitlink(ce, &buf)) {
+			strbuf_release(&buf);
 			return error("read of %s failed", patch->old_name);
+		}
 	} else if (patch->old_name) {
 		if (S_ISGITLINK(patch->old_mode)) {
 			if (ce) {
@@ -2320,8 +2322,10 @@ static int apply_data(struct patch *patch, struct stat *st, struct cache_entry *
 				patch->fragments = NULL;
 			}
 		} else {
-			if (read_old_data(st, patch->old_name, &buf))
+			if (read_old_data(st, patch->old_name, &buf)) {
+				strbuf_release(&buf);
 				return error("read of %s failed", patch->old_name);
+			}
 		}
 	}
 
diff --git a/combine-diff.c b/combine-diff.c
index bccc018..674745d 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -706,6 +706,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
 			struct strbuf buf = STRBUF_INIT;
 
 			if (strbuf_readlink(&buf, elem->path, st.st_size) < 0) {
+				strbuf_release(&buf);
 				error("readlink(%s): %s", elem->path,
 				      strerror(errno));
 				return;
diff --git a/diff.c b/diff.c
index b57d9ac..41f7e1c 100644
--- a/diff.c
+++ b/diff.c
@@ -1778,8 +1778,10 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
 		if (S_ISLNK(st.st_mode)) {
 			struct strbuf sb = STRBUF_INIT;
 
-			if (strbuf_readlink(&sb, s->path, s->size))
+			if (strbuf_readlink(&sb, s->path, s->size)) {
+				strbuf_release(&sb);
 				goto err_empty;
+			}
 			s->size = sb.len;
 			s->data = strbuf_detach(&sb, NULL);
 			s->should_free = 1;
diff --git a/read-cache.c b/read-cache.c
index db166da..9673d91 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -104,8 +104,10 @@ static int ce_compare_link(struct cache_entry *ce, size_t expected_size)
 	enum object_type type;
 	struct strbuf sb = STRBUF_INIT;
 
-	if (strbuf_readlink(&sb, ce->name, expected_size))
+	if (strbuf_readlink(&sb, ce->name, expected_size)) {
+		strbuf_release(&sb);
 		return -1;
+	}
 
 	buffer = read_sha1_file(ce->sha1, &type, &size);
 	if (buffer) {
diff --git a/sha1_file.c b/sha1_file.c
index 52d1ead..a62b53d 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2538,6 +2538,7 @@ int index_path(unsigned char *sha1, const char *path, struct stat *st, int write
 	case S_IFLNK:
 		if (strbuf_readlink(&sb, path, st->st_size)) {
 			char *errstr = strerror(errno);
+			strbuf_release(&sb);
 			return error("readlink(\"%s\"): %s", path,
 			             errstr);
 		}
diff --git a/strbuf.c b/strbuf.c
index 254a7ee..b1f2a97 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -311,7 +311,7 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint)
 		/* .. the buffer was too small - try again */
 		hint *= 2;
 	}
-	strbuf_release(sb);
+	sb->buf[sb->len] = '\0';
 	return -1;
 }
 
-- 
1.6.1.rc4.306.g849c2


[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply related

* [PATCH] strbuf_readlink semantics update.
From: Pierre Habouzit @ 2008-12-23 10:05 UTC (permalink / raw)
  To: git, Linus Torvalds; +Cc: Pierre Habouzit, Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.0812171042120.14014@localhost.localdomain>

strbuf_* operations are meant to append their results to a current buffer
rather than _replace_ its content. Modify strbuf_readlink accordingly.

Current callers only operate on empty buffers at the moment and this
semantic change doesn't break any current code.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
 strbuf.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/strbuf.c b/strbuf.c
index bdf4954..254a7ee 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -299,12 +299,12 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint)
 		int len;
 
 		strbuf_grow(sb, hint);
-		len = readlink(path, sb->buf, hint);
+		len = readlink(path, sb->buf + sb->len, hint);
 		if (len < 0) {
 			if (errno != ERANGE)
 				break;
 		} else if (len < hint) {
-			strbuf_setlen(sb, len);
+			strbuf_setlen(sb, sb->len + len);
 			return 0;
 		}
 
-- 
1.6.1.rc4.304.g3da087


^ permalink raw reply related

* Re: Git merge conflicts and encoding of logs
From: Junio C Hamano @ 2008-12-23 10:04 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junichi Uekawa, git
In-Reply-To: <4950A422.5030100@viscovery.net>

Johannes Sixt <j.sixt@viscovery.net> writes:

> Junio C Hamano schrieb:
>> <<<<<<< HEAD:foo
>> これはサイドブランチの変更です。
>> やはり JIS コードで書いてます。
>> =======
>> 日本語のファイルです。
>> JIS コードで書いてます。
>>>>>>>>> master:foo
>> 
>> The above will probably come out as UTF-8 in this mail text, but the point
>> is that the confict side markers do not have anything but filename and the
>> branch name.  I am still scratching my head trying to see where in the
>> merge-recursive codepath you got snippet of log message.
>
> Try rebase -i instead of merge: This should put summary lines onto the
> conflict markers.

Ah, that's cherry-pick.

The fix should be around the area this weather-balloon patch touches.

Note that this does not correctly work yet, and it seems that somewhere the
string is truncated.

But I won't be debugging it further for now...

----
 builtin-revert.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git c/builtin-revert.c w/builtin-revert.c
index d48313c..47ff16f 100644
--- c/builtin-revert.c
+++ w/builtin-revert.c
@@ -244,6 +244,19 @@ static struct tree *empty_tree(void)
 	return tree;
 }
 
+static char *branch_label_to_output_encoding(char *oneline)
+{
+	if (git_log_output_encoding &&
+	    strcmp(git_log_output_encoding, git_commit_encoding)) {
+		char *it = reencode_string(oneline,
+					   git_log_output_encoding,
+					   git_commit_encoding);
+		if (it)
+			return it;
+	}
+	return oneline;
+}
+
 static int revert_or_cherry_pick(int argc, const char **argv)
 {
 	unsigned char head[20];
@@ -373,7 +386,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 	read_cache();
 	init_merge_options(&o);
 	o.branch1 = "HEAD";
-	o.branch2 = oneline;
+	o.branch2 = branch_label_to_output_encoding(oneline);
 
 	head_tree = parse_tree_indirect(head);
 	next_tree = next ? next->tree : empty_tree();

^ permalink raw reply related

* Re: Git merge conflicts and encoding of logs
From: Johannes Sixt @ 2008-12-23  8:41 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Junichi Uekawa, git
In-Reply-To: <7vprjjfgi7.fsf@gitster.siamese.dyndns.org>

Junio C Hamano schrieb:
> <<<<<<< HEAD:foo
> これはサイドブランチの変更です。
> やはり JIS コードで書いてます。
> =======
> 日本語のファイルです。
> JIS コードで書いてます。
>>>>>>>> master:foo
> 
> The above will probably come out as UTF-8 in this mail text, but the point
> is that the confict side markers do not have anything but filename and the
> branch name.  I am still scratching my head trying to see where in the
> merge-recursive codepath you got snippet of log message.

Try rebase -i instead of merge: This should put summary lines onto the
conflict markers.

-- Hannes

^ permalink raw reply

* [PATCH] handle_remote_ls_ctx can parsing href starting at http://
From: Kirill A. Korinskiy @ 2008-12-23  8:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Kirill A. Korinskiy
In-Reply-To: <7v3aghnv1t.fsf@gitster.siamese.dyndns.org>

The program call remote_ls() to get remote objects over http;
handle_remote_ls_ctx() is used to parse it's response to populated
"struct remote_ls_ctx" that is returned from remote_ls().

The handle_remote_ls_ctx() function assumed that the server will
returned local path in href field, but RFC 4918 demand of support full
URI (http://localhost/repo.git for example).

This resulted in push failure (git-http-push ask server
PROPFIND /repo.git/alhost:8080/repo.git/refs/) when a server returned
full URI.

Signed-off-by: Kirill A. Korinskiy <catap@catap.ru>
---
 http-push.c |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/http-push.c b/http-push.c
index 7c6460919bf3eba10c46cede11ffdd9c53fd2dd2..a4b7d08663504a57008f66a39fffe293f62c1d08 100644
--- a/http-push.c
+++ b/http-push.c
@@ -87,6 +87,7 @@ static struct object_list *objects;
 struct repo
 {
 	char *url;
+	char *path;
 	int path_len;
 	int has_info_refs;
 	int can_update_info_refs;
@@ -1424,9 +1425,19 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
 				ls->userFunc(ls);
 			}
 		} else if (!strcmp(ctx->name, DAV_PROPFIND_NAME) && ctx->cdata) {
-			ls->dentry_name = xmalloc(strlen(ctx->cdata) -
+			char *path = ctx->cdata;
+			if (*ctx->cdata == 'h') {
+				path = strstr(path, "//");
+				if (path) {
+					path = strchr(path+2, '/');
+				}
+			}
+			if (path) {
+				path += remote->path_len;
+			}
+			ls->dentry_name = xmalloc(strlen(path) -
 						  remote->path_len + 1);
-			strcpy(ls->dentry_name, ctx->cdata + remote->path_len);
+			strcpy(ls->dentry_name, path + remote->path_len);
 		} else if (!strcmp(ctx->name, DAV_PROPFIND_COLLECTION)) {
 			ls->dentry_flags |= IS_DIR;
 		}
@@ -2206,10 +2217,11 @@ int main(int argc, char **argv)
 		if (!remote->url) {
 			char *path = strstr(arg, "//");
 			remote->url = arg;
+			remote->path_len = strlen(arg);
 			if (path) {
-				path = strchr(path+2, '/');
-				if (path)
-					remote->path_len = strlen(path);
+				remote->path = strchr(path+2, '/');
+				if (remote->path)
+					remote->path_len = strlen(remote->path);
 			}
 			continue;
 		}
@@ -2238,8 +2250,9 @@ int main(int argc, char **argv)
 		rewritten_url = xmalloc(strlen(remote->url)+2);
 		strcpy(rewritten_url, remote->url);
 		strcat(rewritten_url, "/");
+		remote->path = rewritten_url + (remote->path - remote->url);
+		remote->path_len++;
 		remote->url = rewritten_url;
-		++remote->path_len;
 	}
 
 	/* Verify DAV compliance/lock support */
-- 
1.5.6.5

^ permalink raw reply related

* Re: Git merge conflicts and encoding of logs
From: Junio C Hamano @ 2008-12-23  8:22 UTC (permalink / raw)
  To: Junichi Uekawa; +Cc: git
In-Reply-To: <87lju7h4yb.dancerj%dancer@netfort.gr.jp>

[-- Attachment #1: Type: text/plain, Size: 2267 bytes --]

Junichi Uekawa <dancer@netfort.gr.jp> writes:

> Git merge conflict will insert '<<< first line of commit log message'
> '===' '>>>' markers to the text file that is causing a conflict.
>
> Unfortunately, the encoding of the text file may be different from the
> log message encoding, and that results in a file which has a mixed
> encoding (which is pretty hard to edit from any editor BTW).
>
> My use case is editing platex files (iso-2022-jp encoded) with log
> messages of utf-8.
>
> ... Thinking about it, it's probably the same encoding problem as git
> blame.

What 69cd8f6 (builtin-blame: Reencode commit messages according to git-log
rules., 2008-10-22) does to git-blame is to re-encode the data taken from
the commit log to i18n.logoutputencoding, and put that in the datastream.

If your commit object have names and messages in utf-8, and if you set
i18n.logoutputencoding to iso-2022-jp, that would reencode data taken from
the commit object in iso-2022-jp and sprinkle them in the blame
datastream.

The issue would be certainly similar, *if* anything on your <<</===/>>>
lines came from commit log message, but I couldn't trigger what you
describe.  I prepared a history of this shape:

   B
  /
 o---A

with ISO-2022-JP payload and UTF-8 commit log message.  Then, I added:

        [i18n]
                logoutputencoding = iso-2022-jp

which lets me read "git log -p --all" quite comfortably.  Everything comes
out as good old JISX0208.  So far, so good.

Then while on branch B, I tried to merge A, which resulted in conflicts
that looked like this:

<<<<<<< HEAD:foo
これはサイドブランチの変更です。
やはり JIS コードで書いてます。
=======
日本語のファイルです。
JIS コードで書いてます。
>>>>>>> master:foo

The above will probably come out as UTF-8 in this mail text, but the point
is that the confict side markers do not have anything but filename and the
branch name.  I am still scratching my head trying to see where in the
merge-recursive codepath you got snippet of log message.

A bundle from my test repository is attached.  You can use it to reproduce
the repository like this:
 
    $ cd /var/tmp && mkdir test && cd test && git init
    $ git pull ../x.bndl master
    $ git fetch ../x.bndl side:side


[-- Attachment #2: a bundle of the sample history --]
[-- Type: application/octet-stream, Size: 917 bytes --]

^ permalink raw reply

* Re: Merge two repos with history included? (was Re: How do I..?)
From: Alexander Gavrilov @ 2008-12-23  7:58 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Dylan Martin, git
In-Reply-To: <20081223004407.GZ21154@genesis.frugalware.org>

On Tuesday 23 December 2008 03:44:07 Miklos Vajna wrote:
> On Mon, Dec 22, 2008 at 02:04:06PM -0800, Dylan Martin <dmartin@sccd.ctc.edu> wrote:
> > I checked, and my initial SVN to git conversion does contain history.
> > 
> > I'm trying to add an exising repo as a subdir of my main repo with
> > history included.  Can anyone tell me how to do that?
> 
> I would try the following: Let's say you have super.git and foo.git, and
> you want to merge foo.git to the subdirectory 'foo' of super.git. Then
> you can do in foo.git:
> 
> mkdir foo
> mv * foo
> git add foo
> git commit -a
> 
> Then in super.git:
> 
> git pull path/to/foo.git master
> 
> And then git log --follow should work just fine on any merged files as
> well.
> 


If the conversion is one-shot, you can also try rewriting commits like this:

cd foo.git
git filter-branch --commit-filter 'TREE=$1; shift; git commit-tree $(echo -e "040000 tree $TREE\tfoo" | git mktree) "$@"' master

(Maybe there is a simpler way, though)

I used this once to merge together the history of a bunch of interrelated (and now dead) projects.

Alexander

^ permalink raw reply

* Git merge conflicts and encoding of logs
From: Junichi Uekawa @ 2008-12-23  4:48 UTC (permalink / raw)
  To: git

Hi,


Git merge conflict will insert '<<< first line of commit log message'
'===' '>>>' markers to the text file that is causing a conflict.

Unfortunately, the encoding of the text file may be different from the
log message encoding, and that results in a file which has a mixed
encoding (which is pretty hard to edit from any editor BTW).

My use case is editing platex files (iso-2022-jp encoded) with log
messages of utf-8.

http://git.debian.org/?p=tokyodebian/monthly-report.git;a=summary




... Thinking about it, it's probably the same encoding problem as git
blame.  Is there already a good way to fix this or is this something
that needs fixing?


regards,
	junichi
-- 
dancer@{netfort.gr.jp,debian.org}

^ permalink raw reply

* Re: Git with Hudson
From: Stephen Haberman @ 2008-12-23  3:00 UTC (permalink / raw)
  To: Tim Visher; +Cc: Indy Nagpal, git
In-Reply-To: <c115fd3c0812181758m5fe4af95s860181d25f1992ee@mail.gmail.com>


> I'm interested!  Please publish away!

Here's the "git2" Hudson plugin that worked well for us:

http://github.com/stephenh/hudson-git2

There is a git.hpi file checked into the target directory so that you
don't have to build it yourself.

- Stephen

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox