Git development
 help / color / mirror / Atom feed
* Re: Git/Mercurial interoperability (and what about bzr?) (was: Re: [VOTE] git versus mercurial)
From: Theodore Tso @ 2008-10-28 21:31 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Pieter de Bie, Peter Krefting, Git Mailing List
In-Reply-To: <20081028191234.GS24201@genesis.frugalware.org>

On Tue, Oct 28, 2008 at 08:12:34PM +0100, Miklos Vajna wrote:
> On Tue, Oct 28, 2008 at 04:33:54PM +0100, Pieter de Bie <pdebie@ai.rug.nl> wrote:
> > fast-import yet. If I understand dscho correctly, that exists now, so it 
> > should be easy enough to integrate that as well.
> 
> That's new to me. Theodore Ts'o once mentioned on this list that there
> is a "hg fast-export" but actually he just referred to "there is a
> git2hg conversion tool in hg's contrib dir" and it has nothing with
> fast-import.

The code I was referring to was called hg-fast-export, which is part
of the "fast export" tools that front-end into git fast-import.  The
git repository can be found here:

	http://repo.or.cz/w/fast-export.git
	git://repo.or.cz/fast-export.git

I ended up using a very customized version of that script to convert
the hg e2fsprogs repository to git.

In the past I've looked at the possibility of creating a
bi-directional, incremental gateway between hg and git repositories.
The main thing which makes this difficult is that hg stores tags
in-band inside the change-controlled .hgtags file.  This means that if
you cut a release, tag it, and then create a commit to further modify
the repository, the new commit is descended from the tag commit,
whereas in git, the tag is a "bookmark" --- perhaps signed via GPG,
but not part of the revision history.

I think the git method is much more sane, but what it means is that
topologically, the commit tree for git and hg can never be identical.
It also means that if you add a tag to a git tree after making several
commits on that branch, how you reflect that in the hg repository is
highly problematic.  Do you rewrite the branch?  Do you add the tag
later on, disturbing the parent-child relationship of later commits?
How do you keep track of when a tag hg repository topology if you are
trying to maintain a bidirectional mapping between commits?

It's not impossible, but it makes it much more difficult, since in the
hg world, tag commits can be inserted between arbitrary commits.  This
also means that if you want to create a bidrectional gateway between
hg and git, it has to be a single gateway so it can keep track of this
state information.  If you try to have multiple gateways they would
need to synchronize on when a tag entered the hg universe, and with
what commit ID (and what timestamp).

						- Ted

^ permalink raw reply

* Re: [StGit PATCH] Tutorial: Importing patches
From: Catalin Marinas @ 2008-10-28 22:09 UTC (permalink / raw)
  To: Karl Hasselström; +Cc: git
In-Reply-To: <20081028204223.9539.89315.stgit@yoghurt>

Hi Karl,

Thanks for the patch.

2008/10/28 Karl Hasselström <kha@treskal.com>:
> +Importing a patch from an e-mail is simple too:
> +
> +  $ stg import --mail my-mail
> +
> +The e-mail should be in standard Git mail format (which is what e.g.
> +stglink:mail[] produces) -- that is, with the patch in-line in the
> +mail, not attached. The authorship info is taken from the mail
> +headers, and the commit message is read from the 'Subject:' line and
> +the mail body.

It actually supports importing diffs from attachments as well as long
as they are text/plain (the description is expected in the mail body).
Anyway, I think we don't have to mention this in the tutorial as most
people would use the Git mail format anyway.

-- 
Catalin

^ permalink raw reply

* Re: git bisect view's use of DISPLAY environment variable in Cygwin
From: Hannu Koivisto @ 2008-10-28 22:37 UTC (permalink / raw)
  To: git
In-Reply-To: <c07716ae0810281213k432d82d8i468f54ae03146b88@mail.gmail.com>

"Christian Couder" <christian.couder@gmail.com> writes:

> On Tue, Oct 28, 2008 at 6:51 PM, Hannu Koivisto <azure@iki.fi> wrote:
>> "Christian Couder" <christian.couder@gmail.com> writes:

> We need at least a way to detect we are under Cygwin, because we won't
> change the current behavior for all platforms.
> Is checking for the CYGWIN environment variable enough?

No, because it may not be set.  I would probably do it at compile
time using __CYGWIN__ definition.  I don't know what's the status
of merging MSysGit with "official" git but I suppose that when that
happens, __MING32__ and/or _WIN32 or something would need to be
considered as well.

>>> You can use "git bisect view log" to use "git log" even if DISPLAY is set.
>>
>> I'd rather not use undocumented functionality ;)
>
> In this case you can use any "git log" option after "git bisect view"
> (for example: git bisect view -p).

I was implying that "log" after "git bisect view" is not documented
by git-bisect(1).  "log" is not a "git log" option.

-- 
Hannu

^ permalink raw reply

* Any way to amend AuthorDate?
From: Jing Xue @ 2008-10-28 20:06 UTC (permalink / raw)
  To: git

Is there any way to amend a commit and change only the Author Date?

For instance, I have a binary file that's been checked in in two
consecutive commits. After squashing them into one, the new commit would
keep the timestamp of the earlier one of the two original commits. I
would like it to have either the later timestamp or whenever the squash
happens.

Thanks for any pointers.
-- 
Jing Xue

^ permalink raw reply

* Re: git bisect view's use of DISPLAY environment variable in Cygwin
From: Hannu Koivisto @ 2008-10-28 23:26 UTC (permalink / raw)
  To: git
In-Reply-To: <83iqrccpmk.fsf@kalahari.s2.org>

Hannu Koivisto <azure@iki.fi> writes:

> "Christian Couder" <christian.couder@gmail.com> writes:
>
>> On Tue, Oct 28, 2008 at 6:51 PM, Hannu Koivisto <azure@iki.fi> wrote:
>>> "Christian Couder" <christian.couder@gmail.com> writes:
>
>> We need at least a way to detect we are under Cygwin, because we won't
>> change the current behavior for all platforms.
>> Is checking for the CYGWIN environment variable enough?
>
> No, because it may not be set.  I would probably do it at compile
> time using __CYGWIN__ definition.  I don't know what's the status

Argh, I didn't realize git-bisect is a shell script.  For detecting
Cygwin in shell scripts I have tested if `uname` matches CYGWIN*.
For detecting Windows I have tested if PROCESSOR_ARCHITECTURE is
set.  There may well be better ways.

-- 
Hannu

^ permalink raw reply

* Re: Git/Mercurial interoperability (and what about bzr?) (was: Re: [VOTE] git versus mercurial)
From: Miklos Vajna @ 2008-10-28 23:28 UTC (permalink / raw)
  To: Theodore Tso; +Cc: Pieter de Bie, Peter Krefting, Git Mailing List
In-Reply-To: <20081028213144.GC10862@mit.edu>

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

On Tue, Oct 28, 2008 at 05:31:44PM -0400, Theodore Tso <tytso@mit.edu> wrote:
> The code I was referring to was called hg-fast-export, which is part
> of the "fast export" tools that front-end into git fast-import.  The
> git repository can be found here:
> 
> 	http://repo.or.cz/w/fast-export.git
> 	git://repo.or.cz/fast-export.git
> 
> I ended up using a very customized version of that script to convert
> the hg e2fsprogs repository to git.

My bad, I did not quote the article properly, so here is what I meant:

http://article.gmane.org/gmane.comp.version-control.git/42298

and I just wanted to say that this one does not use fast-import, so it's
not really a "hg-fast-import" (it's not something that can parse the
output of git-fast-export).

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

^ permalink raw reply

* [PATCH] Implement git-staged, an alias for 'git diff --cached'.
From: David Symonds @ 2008-10-28 23:39 UTC (permalink / raw)
  To: git, gitster; +Cc: David Symonds

Signed-off-by: David Symonds <dsymonds@gmail.com>
---
  This isn't a particularly serious patch, but is very relevant to our
  current discussion at GitTogether '08.

 .gitignore    |    1 +
 Makefile      |    1 +
 git-staged.sh |    8 ++++++++
 3 files changed, 10 insertions(+), 0 deletions(-)
 create mode 100755 git-staged.sh

diff --git a/.gitignore b/.gitignore
index bbaf9de..9353d19 100644
--- a/.gitignore
+++ b/.gitignore
@@ -118,6 +118,7 @@ git-show
 git-show-branch
 git-show-index
 git-show-ref
+git-staged
 git-stash
 git-status
 git-stripspace
diff --git a/Makefile b/Makefile
index d6f3695..1b23e53 100644
--- a/Makefile
+++ b/Makefile
@@ -262,6 +262,7 @@ SCRIPT_SH += git-rebase.sh
 SCRIPT_SH += git-repack.sh
 SCRIPT_SH += git-request-pull.sh
 SCRIPT_SH += git-sh-setup.sh
+SCRIPT_SH += git-staged.sh
 SCRIPT_SH += git-stash.sh
 SCRIPT_SH += git-submodule.sh
 SCRIPT_SH += git-web--browse.sh
diff --git a/git-staged.sh b/git-staged.sh
new file mode 100755
index 0000000..bfd36e7
--- /dev/null
+++ b/git-staged.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+USAGE=''
+SUBDIRECTORY_OK='Yes'
+OPTIONS_SPEC=
+. git-sh-setup
+
+git diff --cached
-- 
1.6.0

^ permalink raw reply related

* Re: [PATCH 0/3] symref rename/delete fixes
From: Miklos Vajna @ 2008-10-28 23:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, Brandon Casey, git
In-Reply-To: <cover.1225136865.git.vmiklos@frugalware.org>

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

On Mon, Oct 27, 2008 at 08:50:19PM +0100, Miklos Vajna <vmiklos@frugalware.org> wrote:
> Here they are. The first is updated: the delete_ref() part is unchanged,
> but the rename_ref() part is dropped and it just bails out with an error
> if it detects a symref. The testcase is updated according to this as
> well.
> 
> The two others are just rebased on top of the new first one, no
> functional changes.

I forgot to fetch and did not notice the previous round is already in
'next'. Just forget about these patches then, I'll rebase the relevant
part against mv/maint-branch-m-symref and resend.

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

^ permalink raw reply

* Re: [PATCH] Implement git-staged, an alias for 'git diff --cached'.
From: Jeff King @ 2008-10-28 23:46 UTC (permalink / raw)
  To: David Symonds; +Cc: git, gitster
In-Reply-To: <1225237145-95435-1-git-send-email-dsymonds@gmail.com>

On Tue, Oct 28, 2008 at 04:39:05PM -0700, David Symonds wrote:

> --- /dev/null
> +++ b/git-staged.sh
> @@ -0,0 +1,8 @@
> +#!/bin/sh
> +
> +USAGE=''
> +SUBDIRECTORY_OK='Yes'
> +OPTIONS_SPEC=
> +. git-sh-setup
> +
> +git diff --cached

Do you even need to do sh-setup? How about

  #!/bin/sh
  exec git diff --cached "$@"

-Peff

^ permalink raw reply

* [PATCH] Implement git-staged, an alias for 'git diff --cached'.
From: David Symonds @ 2008-10-28 23:59 UTC (permalink / raw)
  To: git, gitster, Jeff King; +Cc: David Symonds
In-Reply-To: <1225237145-95435-1-git-send-email-dsymonds@gmail.com>

Signed-off-by: David Symonds <dsymonds@gmail.com>
---
 .gitignore    |    1 +
 Makefile      |    1 +
 git-staged.sh |    2 ++
 3 files changed, 4 insertions(+), 0 deletions(-)
 create mode 100755 git-staged.sh

diff --git a/.gitignore b/.gitignore
index bbaf9de..9353d19 100644
--- a/.gitignore
+++ b/.gitignore
@@ -118,6 +118,7 @@ git-show
 git-show-branch
 git-show-index
 git-show-ref
+git-staged
 git-stash
 git-status
 git-stripspace
diff --git a/Makefile b/Makefile
index d6f3695..1b23e53 100644
--- a/Makefile
+++ b/Makefile
@@ -262,6 +262,7 @@ SCRIPT_SH += git-rebase.sh
 SCRIPT_SH += git-repack.sh
 SCRIPT_SH += git-request-pull.sh
 SCRIPT_SH += git-sh-setup.sh
+SCRIPT_SH += git-staged.sh
 SCRIPT_SH += git-stash.sh
 SCRIPT_SH += git-submodule.sh
 SCRIPT_SH += git-web--browse.sh
diff --git a/git-staged.sh b/git-staged.sh
new file mode 100755
index 0000000..85582ec
--- /dev/null
+++ b/git-staged.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec git diff --cached $*
-- 
1.6.0

^ permalink raw reply related

* [PATCH] git branch -m: forbid renaming of a symref
From: Miklos Vajna @ 2008-10-29  0:05 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, Brandon Casey, git
In-Reply-To: <20081028234541.GY24201@genesis.frugalware.org>

There may be cases where one would really want to rename the symbolic
ref without changing its value, but "git branch -m" is not such a
use-case.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---

This applies on top of 'mv/maint-branch-m-symref'.

 refs.c            |   29 +++++++++++++----------------
 t/t3200-branch.sh |    8 ++++----
 2 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/refs.c b/refs.c
index b39e6f2..8a38e08 100644
--- a/refs.c
+++ b/refs.c
@@ -964,14 +964,14 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)
 	struct stat loginfo;
 	int log = !lstat(git_path("logs/%s", oldref), &loginfo);
 	const char *symref = NULL;
-	int is_symref = 0;
 
 	if (log && S_ISLNK(loginfo.st_mode))
 		return error("reflog for %s is a symlink", oldref);
 
 	symref = resolve_ref(oldref, orig_sha1, 1, &flag);
 	if (flag & REF_ISSYMREF)
-		is_symref = 1;
+		return error("refname %s is a symbolic ref, renaming it is not supported",
+			oldref);
 	if (!symref)
 		return error("refname %s not found", oldref);
 
@@ -1035,20 +1035,17 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)
 	}
 	logmoved = log;
 
-	if (!is_symref) {
-		lock = lock_ref_sha1_basic(newref, NULL, 0, NULL);
-		if (!lock) {
-			error("unable to lock %s for update", newref);
-			goto rollback;
-		}
-		lock->force_write = 1;
-		hashcpy(lock->old_sha1, orig_sha1);
-		if (write_ref_sha1(lock, orig_sha1, logmsg)) {
-			error("unable to write current sha1 into %s", newref);
-			goto rollback;
-		}
-	} else
-		create_symref(newref, symref, logmsg);
+	lock = lock_ref_sha1_basic(newref, NULL, 0, NULL);
+	if (!lock) {
+		error("unable to lock %s for update", newref);
+		goto rollback;
+	}
+	lock->force_write = 1;
+	hashcpy(lock->old_sha1, orig_sha1);
+	if (write_ref_sha1(lock, orig_sha1, logmsg)) {
+		error("unable to write current sha1 into %s", newref);
+		goto rollback;
+	}
 
 	return 0;
 
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index fdeb1f5..25e9971 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -112,13 +112,13 @@ test_expect_success 'config information was renamed, too' \
 	"test $(git config branch.s.dummy) = Hello &&
 	 test_must_fail git config branch.s/s/dummy"
 
-test_expect_success 'renaming a symref' \
+test_expect_success 'renaming a symref is not allowed' \
 '
 	git symbolic-ref refs/heads/master2 refs/heads/master &&
-	git branch -m master2 master3 &&
-	git symbolic-ref refs/heads/master3 &&
+	test_must_fail git branch -m master2 master3 &&
+	git symbolic-ref refs/heads/master2 &&
 	test -f .git/refs/heads/master &&
-	! test -f .git/refs/heads/master2
+	! test -f .git/refs/heads/master3
 '
 
 test_expect_success \
-- 
1.6.0.2

^ permalink raw reply related

* Re: git bisect view's use of DISPLAY environment variable in Cygwin
From: Johannes Schindelin @ 2008-10-29  0:46 UTC (permalink / raw)
  To: Hannu Koivisto; +Cc: git
In-Reply-To: <83ej20cndw.fsf@kalahari.s2.org>

Hi,

On Wed, 29 Oct 2008, Hannu Koivisto wrote:

> Hannu Koivisto <azure@iki.fi> writes:
> 
> > "Christian Couder" <christian.couder@gmail.com> writes:
> >
> >> On Tue, Oct 28, 2008 at 6:51 PM, Hannu Koivisto <azure@iki.fi> wrote:
> >>> "Christian Couder" <christian.couder@gmail.com> writes:
> >
> >> We need at least a way to detect we are under Cygwin, because we 
> >> won't change the current behavior for all platforms. Is checking for 
> >> the CYGWIN environment variable enough?
> >
> > No, because it may not be set.  I would probably do it at compile time 
> > using __CYGWIN__ definition.  I don't know what's the status
> 
> Argh, I didn't realize git-bisect is a shell script.  For detecting 
> Cygwin in shell scripts I have tested if `uname` matches CYGWIN*. For 
> detecting Windows I have tested if PROCESSOR_ARCHITECTURE is set.  
> There may well be better ways.

I submitted a patch a while ago, saying

	bisect view: call gitk if Cygwin's SESSIONNAME variable is set

See 
http://repo.or.cz/w/git/dscho.git?a=commitdiff;h=a2637a3a003646c69ab5a6b85f0ee1bfac15e0b0

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH] Implement git-staged, an alias for 'git diff --cached'.
From: Jeff King @ 2008-10-29  0:39 UTC (permalink / raw)
  To: David Symonds; +Cc: git, gitster
In-Reply-To: <1225238368-98594-1-git-send-email-dsymonds@gmail.com>

On Tue, Oct 28, 2008 at 04:59:28PM -0700, David Symonds wrote:

> --- /dev/null
> +++ b/git-staged.sh
> @@ -0,0 +1,2 @@
> +#!/bin/sh
> +exec git diff --cached $*

This is broken for arguments with spaces. Use "$@" instead.

But I think this isn't a serious patch anyway, so we are probably
wasting too much time on it. ;P

-Peff

^ permalink raw reply

* [PATCH] Implement git-staged, an alias for 'git diff --cached'.
From: David Symonds @ 2008-10-29  0:44 UTC (permalink / raw)
  To: git, gitster, Jeff King; +Cc: David Symonds
In-Reply-To: <20081029003931.GA7291@sigill.intra.peff.net>

Signed-off-by: David Symonds <dsymonds@gmail.com>
---
 .gitignore    |    1 +
 Makefile      |    1 +
 git-staged.sh |    2 ++
 3 files changed, 4 insertions(+), 0 deletions(-)
 create mode 100755 git-staged.sh

diff --git a/.gitignore b/.gitignore
index bbaf9de..9353d19 100644
--- a/.gitignore
+++ b/.gitignore
@@ -118,6 +118,7 @@ git-show
 git-show-branch
 git-show-index
 git-show-ref
+git-staged
 git-stash
 git-status
 git-stripspace
diff --git a/Makefile b/Makefile
index d6f3695..1b23e53 100644
--- a/Makefile
+++ b/Makefile
@@ -262,6 +262,7 @@ SCRIPT_SH += git-rebase.sh
 SCRIPT_SH += git-repack.sh
 SCRIPT_SH += git-request-pull.sh
 SCRIPT_SH += git-sh-setup.sh
+SCRIPT_SH += git-staged.sh
 SCRIPT_SH += git-stash.sh
 SCRIPT_SH += git-submodule.sh
 SCRIPT_SH += git-web--browse.sh
diff --git a/git-staged.sh b/git-staged.sh
new file mode 100755
index 0000000..66a5e33
--- /dev/null
+++ b/git-staged.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec git diff --cached "$@"
-- 
1.6.0

^ permalink raw reply related

* Re: [PATCH] Implement git-staged, an alias for 'git diff --cached'.
From: Johannes Schindelin @ 2008-10-29  1:02 UTC (permalink / raw)
  To: David Symonds; +Cc: git, gitster, Jeff King
In-Reply-To: <1225241048-99267-1-git-send-email-dsymonds@gmail.com>

Hi,

On Tue, 28 Oct 2008, David Symonds wrote:

> diff --git a/.gitignore b/.gitignore
> index bbaf9de..9353d19 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -118,6 +118,7 @@ git-show
>  git-show-branch
>  git-show-index
>  git-show-ref
> +git-staged

Would it not be better to teach "git show --staged" to do that, and to add 
a command pair "git stage <file>" and "git unstage <file>" to do the 
obvious?

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH] Implement git-staged, an alias for 'git diff --cached'.
From: Jeff King @ 2008-10-29  0:58 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: David Symonds, git, gitster
In-Reply-To: <alpine.DEB.1.00.0810290201400.22125@pacific.mpi-cbg.de.mpi-cbg.de>

On Wed, Oct 29, 2008 at 02:02:29AM +0100, Johannes Schindelin wrote:

> > +git-staged
> 
> Would it not be better to teach "git show --staged" to do that, and to add 
> a command pair "git stage <file>" and "git unstage <file>" to do the 
> obvious?

Yes, I think half of the discussion went on IRC. But I don't think "git
staged" is a good idea. I think a "--staged" alias for "--cached" in
"git diff" makes a lot more sense.

-Peff

^ permalink raw reply

* Re: [PATCH] Implement git-staged, an alias for 'git diff --cached'.
From: Stephan Beyer @ 2008-10-29  1:01 UTC (permalink / raw)
  To: Jeff King; +Cc: David Symonds, git, gitster
In-Reply-To: <20081029003931.GA7291@sigill.intra.peff.net>

Hi,

> > --- /dev/null
> > +++ b/git-staged.sh
> > @@ -0,0 +1,2 @@
> > +#!/bin/sh
> > +exec git diff --cached $*
> 
> This is broken for arguments with spaces. Use "$@" instead.
> 
> But I think this isn't a serious patch anyway, so we are probably
> wasting too much time on it. ;P

I'm still not understanding, what it's for.
Usability? Because doing
	git config --global alias.staged 'diff --cached'
is lame?

Regards,
  Stephan

PS: Btw, if ever meant serious, it's missing an insertion into
    command-list.txt and serious documentation.
    But I think you know that. :-)

-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

^ permalink raw reply

* exporting the last N days of a repository
From: Geoff Russell @ 2008-10-29  1:01 UTC (permalink / raw)
  To: git

I want to export "the last N days" of a repository to create a copy
which has an origin which is
the state of the repository N days ago and has all the history between
then and now.

Can fast-export do this?

Cheers,
Geoff Russell

^ permalink raw reply

* [PATCH] git show <tree>: show mode and hash, and handle -r
From: Johannes Schindelin @ 2008-10-29  1:09 UTC (permalink / raw)
  To: gitster, git, schacon


Now, git show <tree> shows some more information, and with the -r option,
it recurses into subdirectories.

Requested by Scott Chacon.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

	The only quirk is the command line parsing for -r: we cannot use 
	DIFF_OPT_TST(&rev.diffopt, RECURSIVE), because that is switched 
	on not only by cmd_log_init(), but implicitly by 
	diff_setup_done(), because FORMAT_PATCH is selected by git-show.

 builtin-log.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index 3796dda..b00d353 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -297,8 +297,12 @@ static int show_tree_object(const unsigned char *sha1,
 		const char *base, int baselen,
 		const char *pathname, unsigned mode, int stage, void *context)
 {
-	printf("%s%s\n", pathname, S_ISDIR(mode) ? "/" : "");
-	return 0;
+	int *recursive = context;
+	printf("%06o %s %.*s%s%s\n", mode,
+			find_unique_abbrev(sha1, DEFAULT_ABBREV),
+			baselen, base,
+			pathname, S_ISDIR(mode) ? "/" : "");
+	return *recursive ? READ_TREE_RECURSIVE : 0;
 }
 
 int cmd_show(int argc, const char **argv, const char *prefix)
@@ -306,6 +310,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
 	struct rev_info rev;
 	struct object_array_entry *objects;
 	int i, count, ret = 0;
+	int tree_recursive = 0;
 
 	git_config(git_log_config, NULL);
 
@@ -319,6 +324,11 @@ int cmd_show(int argc, const char **argv, const char *prefix)
 	rev.always_show_header = 1;
 	rev.ignore_merges = 0;
 	rev.no_walk = 1;
+	for (i = 1; i < argc && strcmp(argv[i], "--"); i++)
+		if (!strcmp(argv[i], "-r")) {
+			tree_recursive = 1;
+			break;
+		}
 	cmd_log_init(argc, argv, prefix, &rev);
 
 	count = rev.pending.nr;
@@ -348,7 +358,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
 					name,
 					diff_get_color_opt(&rev.diffopt, DIFF_RESET));
 			read_tree_recursive((struct tree *)o, "", 0, 0, NULL,
-					show_tree_object, NULL);
+					show_tree_object, &tree_recursive);
 			break;
 		case OBJ_COMMIT:
 			rev.pending.nr = rev.pending.alloc = 0;
-- 
1.6.0.2.763.g72663

^ permalink raw reply related

* Re: [PATCH] Implement git-staged, an alias for 'git diff --cached'.
From: Jeff King @ 2008-10-29  1:05 UTC (permalink / raw)
  To: Stephan Beyer; +Cc: David Symonds, git, gitster
In-Reply-To: <20081029010107.GB12065@leksak.fem-net>

On Wed, Oct 29, 2008 at 02:01:07AM +0100, Stephan Beyer wrote:

> I'm still not understanding, what it's for.
> Usability? Because doing
> 	git config --global alias.staged 'diff --cached'
> is lame?

You are missing some of the context, which is that we just had a big
in-person debate about how the staged nomenclature is confusing. We call
things "cached", "staged", and "index", depending on the command.

So this is an attempt to rectify that.

-Peff

^ permalink raw reply

* Encoding problems using git-svn
From: James North @ 2008-10-29  3:14 UTC (permalink / raw)
  To: git

Hi,

I'm using git-svn on a system with ISO-8859-1 encoding. The problem is
when I try to use "git svn dcommit" to send changes to a remote svn
(also ISO-8859-1).

Seems like git-svn is sending commit messages with utf-8 (just a
guessing...) and they look bad on the remote svn log. E.g. "Ca?\241a
de cami?\243n"

I have tried using i18n.commitencoding=ISO-8859-1 as suggested by the
warning when doing "git svn dcommit" but messages still are sent with
wrong encoding.

I'm mising something?

Thanks everyone

^ permalink raw reply

* Re: git export to svn
From: Warren Harris @ 2008-10-29  3:40 UTC (permalink / raw)
  To: Björn Steinbrink; +Cc: J.H., git
In-Reply-To: <20081026171519.GD3612@atjola.homenet>

Björn - Thanks again for your help...

On Oct 26, 2008, at 10:15 AM, Björn Steinbrink wrote:

>>
>> Since I'm trying to export my git repo to svn, the svn repo is
>> completely empty.
>
> OK, the "r58084" made me think that your code is based on something  
> that
> is already in the SVN repo. But apperently, that's just a shared svn
> repo, right?

Right

>
> This should do and uses a graft to simplify the process a bit:
>
> Initialize git-svn:
> git svn init -s --prefix=svn/ https://svn/svn/SANDBOX/warren/test2
>
> The --prefix gives you remote tracking branches like "svn/trunk" which
> is nice because you don't get ambiguous names if you call your local
> branch just "trunk" then. And -s is a shortcut for the standard
> trunk/tags/branches layout.
>
>
> Fetch the initial stuff from svn:
> git svn fetch
>
> Now look up the hash of your root commit (should show a single  
> commit):
> git rev-list --parents master | grep '^.\{40\}$'
>
> Then get the hash of the empty trunk commit:
> git rev-parse svn/trunk
>
> Create the graft:
> echo <root-commit-hash> <svn-trunk-commit-hash> >> .git/info/grafts
>
> Now, "gitk" should show svn/trunk as the first commit on which your
> master branch is based.
>
> Make the graft permanent:
> git filter-branch -- ^svn/trunk --all
>
> Drop the graft:
> rm .git/info/grafts
>
> gitk should still show svn/trunk in the ancestry of master
>
> Linearize your history on top of trunk:
> git svn rebase
>
> And now "git svn dcommit -n" should tell you that it is going to  
> commit
> to trunk.

This worked. The only downside was that all of our svn users  
subscribed to the checkins mailing list got a flood of messages from  
me, but otherwise it worked like a charm. (I see that the original git  
commit dates were not preserved in svn, but that doesn't matter too  
much...)

>
>
>
> Alternatively, if rebase gives just too many conflicts, you can do:
>
> git svn init -s --prefix=svn/ https://svn/svn/SANDBOX/warren/test2
> git svn fetch
> git checkout -b trunk svn/trunk
> git merge master
> git svn dcommit
>
> That will just create a single huge commit in svn. But the history  
> will
> be retained in git. You can then work on the new "trunk" branch or  
> move
> your master branch, so it points to the same commit as trunk and then
> drop the "trunk" branch or whatever. It just matters that your new  
> work
> is based upon the dcommited merge commit, so "svn/trunk" is in your
> branch's history.

This didn't work for me. (I had tried the first procedure on a test  
tree, then this one on a different test tree, and ultimately went back  
to the first procedure for my real git repo.) I ended up with an empty  
svn tree. For the record, here's what happened:

$ git svn fetch
W: Ignoring error from SVN, path probably does not exist: (175002): RA  
layer request failed: REPORT of '/svn/!svn/bc/100': Could not read  
chunk size: Secure connection truncated (https://svn)
W: Do not be alarmed at the above message git-svn is just searching  
aggressively for old history.
This may take a while on large repositories
r58382 = 9b9d5f01e4a3aca714eb5f61a9f05ab657cc7bc5 (svn/trunk)
Checked out HEAD:
   https://svn/svn/test3/trunk r58382

$ git checkout -b trunk svn/trunk
Switched to a new branch "trunk"

$ git merge master
Already up-to-date.

$ git svn dcommit
Committing to https://svn/svn/test3/trunk ...

$ cd tmp/svn-test3/

$ svn co https://svn/svn/test3/trunk
Checked out revision 58385.

$ ls -al trunk/
total 88
drwxr-xr-x  11 warren  staff    374 Oct 28 18:15 .
drwxr-xr-x   3 warren  staff    102 Oct 28 18:15 ..
drwxr-xr-x   9 warren  staff    306 Oct 28 18:15 .svn


Now one thing that might be different than what you prescribed is that  
our svn repo uses different conventions for branches and tags, so I  
didn't use 'git svn init -s', although I doubt that matters.

Anyway, I'm up and running in svn with your first procedure, so my  
problem is solved. Thanks.

Warren

^ permalink raw reply

* [PATCH 1/1] diff: support making output friendlier for fine, grand users
From: Petr Baudis @ 2008-10-29  5:23 UTC (permalink / raw)
  To: git
  Cc: Johannes Schindelin, Scott Chacon, Tom Preston-Werner, Jeff King,
	J.H., Sam Vilain, Christian Couder, Kai Blin

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Scott Chacon <schacon@gmail.com>
Signed-off-by: Tom Preston-Werner <tom@github.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: J.H. <warthog19@eaglescrag.net>
Signed-off-by: Sam Vilain <sam@vilain.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Kai Blin <kai@samba.org>
Acked-by: Petr Baudis <pasky@suse.cz>
Enabled-by: Cascade "Smooth" Amber <clarity@tiedhouse.com>
---
 diff.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/diff.c b/diff.c
index e368fef..0e2c14a 100644
--- a/diff.c
+++ b/diff.c
@@ -2489,6 +2489,9 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
 	else if (!prefixcmp(arg, "--output=")) {
 		options->file = fopen(arg + strlen("--output="), "w");
 		options->close_file = 1;
+	}
+	else if (!strcmp(arg, "--pirate")) {
+		printf("Arrrr!  These be yer fine changes, me 'earty!!\n");
 	} else
 		return 0;
 	return 1;
-- 
1.5.4.5

^ permalink raw reply related

* Re: [PATCH] git show <tree>: show mode and hash, and handle -r
From: Johannes Sixt @ 2008-10-29  7:20 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: gitster, git, schacon
In-Reply-To: <alpine.DEB.1.00.0810290207330.22125@pacific.mpi-cbg.de.mpi-cbg.de>

Johannes Schindelin schrieb:
> Now, git show <tree> shows some more information, and with the -r option,
> it recurses into subdirectories.
> 
> Requested by Scott Chacon.
> 
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> 
> 	The only quirk is the command line parsing for -r: we cannot use 
> 	DIFF_OPT_TST(&rev.diffopt, RECURSIVE), because that is switched 
> 	on not only by cmd_log_init(), but implicitly by 
> 	diff_setup_done(), because FORMAT_PATCH is selected by git-show.

This comment should for sure go into the commit message.

-- Hannes

^ permalink raw reply

* nice google video on "contributing with git"
From: Christian MICHON @ 2008-10-29  7:24 UTC (permalink / raw)
  To: Git Mailing List, Johannes Schindelin

taken 2 days ago apparently :)

http://www.youtube.com/watch?v=j45cs5_nY2k

-- 
Christian
--
http://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !

^ 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