Git development
 help / color / mirror / Atom feed
* Re: [RFC PATCH] Add support for figuring out where in the git archive we are
From: Daniel Barkalow @ 2005-08-17  0:25 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Junio C Hamano, Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0508161536390.3553@g5.osdl.org>

On Tue, 16 Aug 2005, Linus Torvalds wrote:

> If you use the GIT_DIR environment variable approach, it assumes that all
> filenames you give it are absolute and acts the way it always did before.
>
> Comments? Like? Dislike?

I'm all in favor, at least in the general case. I suspect there'll be some
things where we have to discuss the behavior, but we can argue that when
it comes up.

I think, slightly before 1.0, we should sort the library functions into a
new set of object files with matching header files, because "setup" is not
really distinctive, and there's at least one duplicate implementation
(the ssh subprocess code in your connect.c is the same as my rsh.c in what
it does, although yours uses two pipes and mine uses a socket).

	-Daniel
*This .sig left intentionally blank*

^ permalink raw reply

* Re: FUNKY tags.
From: Martin Langhoff @ 2005-08-17  0:55 UTC (permalink / raw)
  To: Dave Jones; +Cc: git
In-Reply-To: <20050816224332.GE26455@redhat.com>

On 8/17/05, Dave Jones <davej@redhat.com> wrote:
> I've no idea what I did when I tagged those trees, but according
> to a google search, cvsps does that when it find patchsets which
> are chronologically (and thus by patchset id) earlier than the tag,
> but are tagwise after.  Spooky.

It's probably tags that were moved around with "cvs tag -F footag".
When using cvs in with a dovetail strategy, people tend to merge
BRANCH->HEAD and use a floating tag to mark how far it's been merged
in.

I am somewhat worried about cvsps getting confused by these floating
tags. Any help in teaching cvsps to ignore tags is welcome ;)


m

^ permalink raw reply

* Re: sending changesets from the middle of a git tree
From: Junio C Hamano @ 2005-08-17  0:55 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: git, Petr Baudis, Linus Torvalds
In-Reply-To: <20050817001308.ED487353CFD@atlas.denx.de>

Wolfgang Denk <wd@denx.de> writes:

> 	external diff died, stopping at common/cmd_nand.c.
> 	Some commits could not be rebased, check by hand:
> 	67a002cbe2b2850d76d797e679bc290a76666df6
>
> OK, I can edit the file to resolve the conflicts. But what  do  I  do
> then to continue?

Your rebase failed while processing 67a002... and fortunately
(well, if you are really fortunate you would not have seem it)
"some commits could not be" message says that was the only one
left.  At that point, everything up to that commit should be
migrated on top of your head.  Run gitk or git show-branches to
see where the "master" head is.  It should be pointing at the
last successful commit the rebase process has made.  I guess in
your example you had one commit between master and testing-NAND,
in which case the master head does not have moved?

Anyway, you manually resolve conflicts and make an commit from
there, which would migrate the failed 67a002... commit on top of
your master branch.  If "some commits could not be rebased"
message says more than one commit, you need to deal with the
rest of them by hand; sorry there is no automated way currently.

You have to repeat for each such commit:

 (1) Run "git-diff-tree -p <commit-id> | git-apply --index" (or
     what is in git-rebase-script which uses git-apply-patch-script);
 (2) Resolve conflict if there is one;
 (3) Run "git commit -C <commit-id>".

^ permalink raw reply

* Re: [RFC PATCH] Add support for figuring out where in the git archive we are
From: Linus Torvalds @ 2005-08-17  1:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <7vhddp5sfz.fsf@assigned-by-dhcp.cox.net>



On Tue, 16 Aug 2005, Junio C Hamano wrote:
> 
> The developement history would look nicer if you did the latter,
> but I am easy and can go either way.

Here is.

> > I'd do at least the "git-diff-tree" part and the "./" and "../" handling,
> > and convert at least the "git diff" thing to the new world order and away
> > from git-sh-setup-script?
> 
> Sounds like fun.

Mostly done. It actually works from inside subdirectories, but "." at the
top-level is still not done. Small detail. Will fix later. But it would
help if you would apply this, since I'm going to be off for dinner..

The "../" handling was pretty straightforward.

		Linus

----
Make "git diff" work inside relative subdirectories

We always show the diff as an absolute path, but pathnames to diff are
taken relative to the current working directory (and if no pathnames are
given, the default ends up being all of the current working directory).

Note that "../xyz" also works, so you can do

	cd linux/drivers/char
	git diff ../block

and it will generate a diff of the linux/drivers/block changes.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -97,7 +97,7 @@ LIB_H=cache.h object.h blob.h tree.h com
 LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o \
 	 tag.o date.o index.o diff-delta.o patch-delta.o entry.o path.o \
 	 refs.o csum-file.o pack-check.o pkt-line.o connect.o ident.o \
-	 sha1_name.o
+	 sha1_name.o setup.o
 
 LIB_H += rev-cache.h
 LIB_OBJS += rev-cache.o
diff --git a/cache.h b/cache.h
--- a/cache.h
+++ b/cache.h
@@ -140,6 +140,9 @@ extern char *get_graft_file(void);
 
 #define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"
 
+extern const char **get_pathspec(const char *prefix, char **pathspec);
+extern const char *setup_git_directory(void);
+
 #define alloc_nr(x) (((x)+16)*3/2)
 
 /* Initialize and use the cache information */
diff --git a/diff-cache.c b/diff-cache.c
--- a/diff-cache.c
+++ b/diff-cache.c
@@ -168,10 +168,11 @@ static const char diff_cache_usage[] =
 "[<common diff options>] <tree-ish> [<path>...]"
 COMMON_DIFF_OPTIONS_HELP;
 
-int main(int argc, const char **argv)
+int main(int argc, char **argv)
 {
 	const char *tree_name = NULL;
 	unsigned char sha1[20];
+	const char *prefix = setup_git_directory();
 	const char **pathspec = NULL;
 	void *tree;
 	unsigned long size;
@@ -179,15 +180,12 @@ int main(int argc, const char **argv)
 	int allow_options = 1;
 	int i;
 
-	read_cache();
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
 
 		if (!allow_options || *arg != '-') {
-			if (tree_name) {
-				pathspec = argv + i;
+			if (tree_name)
 				break;
-			}
 			tree_name = arg;
 			continue;
 		}
@@ -265,12 +263,16 @@ int main(int argc, const char **argv)
 		usage(diff_cache_usage);
 	}
 
+	pathspec = get_pathspec(prefix, argv + i);
+
 	if (find_copies_harder && detect_rename != DIFF_DETECT_COPY)
 		usage(diff_cache_usage);
 
 	if (!tree_name || get_sha1(tree_name, sha1))
 		usage(diff_cache_usage);
 
+	read_cache();
+
 	/* The rest is for paths restriction. */
 	diff_setup(diff_setup_opt);
 
diff --git a/diff-files.c b/diff-files.c
--- a/diff-files.c
+++ b/diff-files.c
@@ -41,12 +41,12 @@ static void show_modified(int oldmode, i
 	diff_change(oldmode, mode, old_sha1, sha1, path, NULL);
 }
 
-int main(int argc, const char **argv)
+int main(int argc, char **argv)
 {
 	static const unsigned char null_sha1[20] = { 0, };
 	const char **pathspec;
-	int entries = read_cache();
-	int i;
+	const char *prefix = setup_git_directory();
+	int entries, i;
 
 	while (1 < argc && argv[1][0] == '-') {
 		if (!strcmp(argv[1], "-p") || !strcmp(argv[1], "-u"))
@@ -95,8 +95,9 @@ int main(int argc, const char **argv)
 		argv++; argc--;
 	}
 
-	/* Do we have a pathspec? */
-	pathspec = (argc > 1) ? argv + 1 : NULL;
+	/* Find the directory, and set up the pathspec */
+	pathspec = get_pathspec(prefix, argv + 1);
+	entries = read_cache();
 
 	if (find_copies_harder && detect_rename != DIFF_DETECT_COPY)
 		usage(diff_files_usage);
diff --git a/diff-tree.c b/diff-tree.c
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -395,16 +395,25 @@ static int diff_tree_stdin(char *line)
 	return diff_tree_commit(commit, line);
 }
 
+static int count_paths(const char **paths)
+{
+	int i = 0;
+	while (*paths++)
+		i++;
+	return i;
+}
+
 static const char diff_tree_usage[] =
 "git-diff-tree [--stdin] [-m] [-s] [-v] [--pretty] [-t] "
 "[<common diff options>] <tree-ish> <tree-ish>"
 COMMON_DIFF_OPTIONS_HELP;
 
-int main(int argc, const char **argv)
+int main(int argc, char **argv)
 {
 	int nr_sha1;
 	char line[1000];
 	unsigned char sha1[2][20];
+	const char *prefix = setup_git_directory();
 
 	nr_sha1 = 0;
 	for (;;) {
@@ -523,11 +532,11 @@ int main(int argc, const char **argv)
 	if (find_copies_harder && detect_rename != DIFF_DETECT_COPY)
 		usage(diff_tree_usage);
 
-	if (argc > 0) {
+	paths = get_pathspec(prefix, argv);
+	if (paths) {
 		int i;
 
-		paths = argv;
-		nr_paths = argc;
+		nr_paths = count_paths(paths);
 		pathlens = xmalloc(nr_paths * sizeof(int));
 		for (i=0; i<nr_paths; i++)
 			pathlens[i] = strlen(paths[i]);
diff --git a/git-diff-script b/git-diff-script
--- a/git-diff-script
+++ b/git-diff-script
@@ -1,7 +1,5 @@
 #!/bin/sh
-. git-sh-setup-script || die "Not a git archive"
-
-rev=($(git-rev-parse --revs-only "$@"))
+rev=($(git-rev-parse --revs-only "$@")) || exit
 flags=($(git-rev-parse --no-revs --flags "$@"))
 files=($(git-rev-parse --no-revs --no-flags "$@"))
 case "${#rev[*]}" in
diff --git a/rev-parse.c b/rev-parse.c
--- a/rev-parse.c
+++ b/rev-parse.c
@@ -134,7 +134,8 @@ int main(int argc, char **argv)
 {
 	int i, as_is = 0;
 	unsigned char sha1[20];
-
+	const char *prefix = setup_git_directory();
+	
 	for (i = 1; i < argc; i++) {
 		char *arg = argv[i];
 		char *dotdot;
@@ -189,6 +190,10 @@ int main(int argc, char **argv)
 				for_each_ref(show_reference);
 				continue;
 			}
+			if (!strcmp(arg, "--show-prefix")) {
+				puts(prefix);
+				continue;
+			}
 			show_arg(arg);
 			continue;
 		}
diff --git a/setup.c b/setup.c
new file mode 100644
--- /dev/null
+++ b/setup.c
@@ -0,0 +1,110 @@
+#include "cache.h"
+
+const char **get_pathspec(const char *prefix, char **pathspec)
+{
+	char *entry = *pathspec;
+	char **p;
+	int prefixlen;
+
+	if (!prefix) {
+		char **p;
+		if (!entry)
+			return NULL;
+		p = pathspec;
+		do {
+			if (*entry != '.')
+				continue;
+			/* fixup ? */
+		} while ((entry = *++p) != NULL);
+		return (const char **) pathspec;
+	}
+
+	if (!entry) {
+		static const char *spec[2];
+		spec[0] = prefix;
+		spec[1] = NULL;
+		return spec;
+	}
+
+	/* Otherwise we have to re-write the entries.. */
+	prefixlen = strlen(prefix);
+	p = pathspec;
+	do {
+		int speclen, len = prefixlen;
+		char *n;
+
+		for (;;) {
+			if (!strcmp(entry, ".")) {
+				entry++;
+				break;
+			}
+			if (!strncmp(entry, "./", 2)) {
+				entry += 2;
+				continue;
+			}
+			if (!strncmp(entry, "../", 3)) {
+				do {
+					if (!len)
+						die("'%s' is outside repository", *p);
+					len--;
+				} while (len && prefix[len-1] != '/');
+				entry += 3;
+				continue;
+			}
+			break;
+		}
+		speclen = strlen(entry);
+		n = xmalloc(speclen + len + 1);
+		
+		memcpy(n, prefix, len);
+		memcpy(n + len, entry, speclen+1);
+		*p = n;
+	} while ((entry = *++p) != NULL);
+	return (const char **) pathspec;
+}
+
+const char *setup_git_directory(void)
+{
+	static char cwd[PATH_MAX+1];
+	int len, offset;
+
+	/*
+	 * If GIT_DIR is set explicitly, we're not going
+	 * to do any discovery
+	 */
+	if (gitenv(GIT_DIR_ENVIRONMENT))
+		return NULL;
+
+	if (!getcwd(cwd, sizeof(cwd)) || cwd[0] != '/')
+		die("Unable to read current working directory");
+
+	offset = len = strlen(cwd);
+	for (;;) {
+		/*
+		 * We always want to see a .git/HEAD and a .git/refs/
+		 * subdirectory
+		 */
+		if (!access(".git/HEAD", R_OK) && !access(".git/refs/", X_OK)) {
+			/*
+			 * Then we need either a GIT_OBJECT_DIRECTORY define
+			 * or a .git/objects/ directory
+			 */
+			if (gitenv(DB_ENVIRONMENT) || !access(".git/objects/", X_OK))
+				break;
+		}
+		chdir("..");
+		do {
+			if (!offset)
+				die("Not a git repository");
+		} while (cwd[--offset] != '/');
+	}
+
+	if (offset == len)
+		return NULL;
+
+	/* Make "offset" point to past the '/', and add a '/' at the end */
+	offset++;
+	cwd[len++] = '/';
+	cwd[len] = 0;
+	return cwd + offset;
+}

^ permalink raw reply

* Re: [RFC PATCH] Add support for figuring out where in the git archive we are
From: Junio C Hamano @ 2005-08-17  2:00 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0508161803250.3553@g5.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> Mostly done. It actually works from inside subdirectories, but "." at the
> top-level is still not done. Small detail. Will fix later. But it would
> help if you would apply this, since I'm going to be off for dinner..

Merged, pushed out, and tested.  Ouch.  Fails on t0000 test.

Next time I'll do merge, test, reject and push out, in that
order.

^ permalink raw reply

* Re: symlinked directories in refs are now unreachable
From: Matt Draisey @ 2005-08-17  0:53 UTC (permalink / raw)
  To: Junio C Hamano
In-Reply-To: <1124089116.749.39.camel@della.draisey.ca>

On Sun, 2005-08-14 at 22:12 -0700, Junio C Hamano wrote:
> I would like to know
> a use case or two to illustrate why there are symlinks pointing
> at real files outside .git/refs/ hierarchy, and how that
> arrangement is useful.

I've clearly laid out my case very badly.

Here is the patch via sed

$ sed -i -e '49s/lstat/stat/' refs.c

It changes the do_for_each_ref function to follow symlinks blindly in
both the pulling and fscking code.

The usage I have is simple.  I want to use git to give me a personal
versioned filesystem of all my current working data.  My problems are
twofold.  First, it is not obvious where the divisions between projects
should be --- for the most part, this is not distributable software, but
a haphazard collection of one-time code, and various other material that
still benefits from version control.  An all inclusive, time-based
commit of the entire directory structure turns out to be quite useful.
Obviously this use will never be anything but a personal store of data.

Secondly, I have ambitions for some of the software I put together.
These invariably are small projects that may or may not ever become
distributable.  Clearly they require their own commit history, yet given
their immature state it seems hard to justify their own objects
directory with its 256 directories for a few kilobytes of code.  Given
the existence of the GIT_OBJECT_DIRECTORY environment variable, it is a
natural step to sharing a single object store amongst the small
tightly-focused projects and the all-encompassing but unmanaged
outermost directory which already is tracking the contents of the
contained projects but knows nothing of their commit history.

Implementing a commit tool to do this is actually very easy.  All you
need do is walk up the chain of parent directories from your working
directory, noting the .git directories, until you reach one that has
an .git/objects directory then set up the environment appropriately.

The only catch is the necessity of maintaining the common object
directory.  The outermost .git directory needs refs to the contained
subprojects commit histories that it honours in fsck-cache if it is not
to silently delete them the next time you prune the repository.
Symlinking in the refs/heads directories of all subprojects is the most
straightforward way to achieve this as it automatically does the right
thing with very little maintainance.  It also keeps the real refs/heads
of the subprojects' commit histories properly localized in the
subprojects where they belong.  It seems to me that having created the
GIT_OBJECT_DIRECTORY hook, it only makes sense to follow symlinks in the
refs directories.

Matt --- http://free.draisey.ca

P.S.
This email is a bit long-winded so I didn't CC it to the mailing list.

^ permalink raw reply

* Re: FUNKY tags.
From: Dave Jones @ 2005-08-17  2:47 UTC (permalink / raw)
  To: Martin Langhoff; +Cc: git
In-Reply-To: <46a038f90508161755b43735c@mail.gmail.com>

On Wed, Aug 17, 2005 at 12:55:18PM +1200, Martin Langhoff wrote:
 > On 8/17/05, Dave Jones <davej@redhat.com> wrote:
 > > I've no idea what I did when I tagged those trees, but according
 > > to a google search, cvsps does that when it find patchsets which
 > > are chronologically (and thus by patchset id) earlier than the tag,
 > > but are tagwise after.  Spooky.
 > 
 > It's probably tags that were moved around with "cvs tag -F footag".
 > When using cvs in with a dovetail strategy, people tend to merge
 > BRANCH->HEAD and use a floating tag to mark how far it's been merged
 > in.

In my case, at least the most recent of those cvs tag operations
was just a 'cvs tag x86info-1_14'. Nothing fancy.  I'm fairly sure
there was nothing fancy about the earlier instance either.
So sure in fact, I had to look up that -F flag in the man page to find
out what it did.

x86info cvs shouldn't even have any branches, so theres no strange
head merging going on.

 > I am somewhat worried about cvsps getting confused by these floating
 > tags. Any help in teaching cvsps to ignore tags is welcome ;)

If you're curious, its a sourceforge project at cvs.sourceforge.net:/cvsroot/x86info
module is 'x86info'.  Both x86info-1_14 and x86info-1_6 are marked as funky
for reasons I'm unaware.

		Dave

^ permalink raw reply

* Re: [RFC PATCH] Add support for figuring out where in the git archive we are
From: Linus Torvalds @ 2005-08-17  2:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <7vwtml490s.fsf@assigned-by-dhcp.cox.net>



On Tue, 16 Aug 2005, Junio C Hamano wrote:
> 
> Merged, pushed out, and tested.  Ouch.  Fails on t0000 test.

It's because the new git-diff-files expects there to be a valid readable 
.git/HEAD, and is unhappy since the test hasn't updated HEAD.

This trivial patch fixes it.

		Linus
----
Fix test failure due to overly strict .git directory tests

We may not actually have a valid HEAD at all times, so relax the validity 
tests for a .git subdirectory accordingly.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-----
diff --git a/setup.c b/setup.c
--- a/setup.c
+++ b/setup.c
@@ -81,10 +81,9 @@ const char *setup_git_directory(void)
 	offset = len = strlen(cwd);
 	for (;;) {
 		/*
-		 * We always want to see a .git/HEAD and a .git/refs/
-		 * subdirectory
+		 * We always want to see a .git/refs/ subdirectory
 		 */
-		if (!access(".git/HEAD", R_OK) && !access(".git/refs/", X_OK)) {
+		if (!access(".git/refs/", X_OK)) {
 			/*
 			 * Then we need either a GIT_OBJECT_DIRECTORY define
 			 * or a .git/objects/ directory

^ permalink raw reply

* [PATCH] Be consistent in naming of remote heads
From: Kris Shannon @ 2005-08-17  3:02 UTC (permalink / raw)
  To: Git Mailing List

The _remote_name variable used for messages does not need the
refs/heads/ prefix included.

Signed-off-by: Kris Shannon <kris.shannon@gmail.com>
---

 git-parse-remote |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

9e7a4358b1792be188df87debf564e46acdb39d4
diff --git a/git-parse-remote b/git-parse-remote
--- a/git-parse-remote
+++ b/git-parse-remote
@@ -71,8 +71,8 @@ tag)
 	'')
 		_remote_head=HEAD ;;
 	*)
-		_remote_head="refs/heads/$_remote_head"
 		_remote_name="head '$_remote_head' of $_remote_name"
+		_remote_head="refs/heads/$_remote_head"
 		;;
 	esac
 	;;

^ permalink raw reply

* Re: gitk with hyperspace support
From: Linus Torvalds @ 2005-08-17  3:02 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git
In-Reply-To: <17154.33520.584666.701545@cargo.ozlabs.ibm.com>



On Wed, 17 Aug 2005, Paul Mackerras wrote:
> 
> I would like to get some feedback about what people think of the
> visual effect of this new approach, and in particular whether having
> the lines jump into hyperspace loses information that people find
> useful.

Me likee. Maybe some knob to tune how eagerly this happens?

> The new version is at:
> 
> http://ozlabs.org/~paulus/gitk/gitk.hs

".hs" made firefox think it was haskell. Confusing ;)

			Linus

^ permalink raw reply

* [PATCH] Identical trees should not trigger error in cg-diff
From: Pavel Roskin @ 2005-08-17  3:42 UTC (permalink / raw)
  To: Petr Baudis, git

Hello!

cg-diff reports error when comparing identical trees.  It's not as
useless as it may seem.  For example, I make local changes, e-mail them
upstream and then get them back via cg-update with minor changes.  I
revert the minor differences between master and origin.  Here's what I
get when I want to make sure the trees are identical (their history is
not):

$ cg-diff -r origin:master
cg-diff: trying to diff b00f462cee5b02455abdbb476fa7c9e94a9fcb4c against
itself

What's worse, cg-diff exists with exit status 1, indicating an error.  I
don't see any reason for this to be an error.  No difference between
branches is OK.  This may be especially important when cg-diff is used
non-interactively in a script.

Signed-off-by: Pavel Roskin <proski@gnu.org>

diff --git a/cg-diff b/cg-diff
--- a/cg-diff
+++ b/cg-diff
@@ -167,7 +167,7 @@ fi
 id1=$(tree-id "$id1") || exit 1
 id2=$(tree-id "$id2") || exit 1
 
-[ "$id1" = "$id2" ] && die "trying to diff $id1 against itself"
+[ "$id1" = "$id2" ] && exit 0
 
 cat $filter | xargs git-diff-tree -r -p $id1 $id2 | colorize | pager
 


-- 
Regards,
Pavel Roskin

^ permalink raw reply

* Improve handling of "." and ".." in git-diff-*
From: Linus Torvalds @ 2005-08-17  3:44 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List


This fixes up usage of ".." (without an ending slash) and "." (with or 
without the ending slash) in the git diff family.

It also fixes pathspec matching for the case of an empty pathspec, since a 
"." in the top-level directory (or enough ".." under subdirectories) will 
result in an empty pathspec. We used to not match it against anything, but 
it should in fact match everything.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
----

This is in addition to the previous fix for the t0000 testcase and applies 
independently of that.

NOTE! This does _not_ handle ".." or "." in the _middle_ of a pathspec. If 
you have people who do

	git diff net/../char/

this will not help them - it will _not_ simplify this to

	git diff char/

and only ".." and "." components at the head of the pathspec will be
honoured.

Finally, if you try to give a pathspec that goes "outside" of the .git
directory (eg, a ".." pattern at the top of the git archive), the code
will politely tell you to f*ck off and die (this is not a new feature, the
previous code drop did that too, but because we now handle it even for the
top-level case without any extra prefix, it's worth noting).

---
diff --git a/diffcore-pathspec.c b/diffcore-pathspec.c
--- a/diffcore-pathspec.c
+++ b/diffcore-pathspec.c
@@ -29,6 +29,8 @@ static int matches_pathspec(const char *
 		    name[len] == 0 ||
 		    name[len] == '/')
 			return 1;
+		if (!len)
+			return 1;
 	}
 	return 0;
 }
diff --git a/read-cache.c b/read-cache.c
--- a/read-cache.c
+++ b/read-cache.c
@@ -191,6 +191,8 @@ int ce_path_match(const struct cache_ent
 			return 1;
 		if (name[matchlen] == '/' || !name[matchlen])
 			return 1;
+		if (!matchlen)
+			return 1;
 	}
 	return 0;
 }
diff --git a/setup.c b/setup.c
--- a/setup.c
+++ b/setup.c
@@ -1,23 +1,60 @@
 #include "cache.h"
 
+static char *prefix_path(const char *prefix, int len, char *path)
+{
+	char *orig = path;
+	for (;;) {
+		char c;
+		if (*path != '.')
+			break;
+		c = path[1];
+		/* "." */
+		if (!c) {
+			path++;
+			break;
+		}
+		/* "./" */
+		if (c == '/') {
+			path += 2;
+			continue;
+		}
+		if (c != '.')
+			break;
+		c = path[2];
+		if (!c)
+			path += 2;
+		else if (c == '/')
+			path += 3;
+		else
+			break;
+		/* ".." and "../" */
+		/* Remove last component of the prefix */
+		do {
+			if (!len)
+				die("'%s' is outside repository", orig);
+			len--;
+		} while (len && prefix[len-1] != '/');
+		continue;
+	}
+	if (len) {
+		int speclen = strlen(path);
+		char *n = xmalloc(speclen + len + 1);
+	
+		memcpy(n, prefix, len);
+		memcpy(n + len, path, speclen+1);
+		path = n;
+	}
+	return path;
+}
+
 const char **get_pathspec(const char *prefix, char **pathspec)
 {
 	char *entry = *pathspec;
 	char **p;
 	int prefixlen;
 
-	if (!prefix) {
-		char **p;
-		if (!entry)
-			return NULL;
-		p = pathspec;
-		do {
-			if (*entry != '.')
-				continue;
-			/* fixup ? */
-		} while ((entry = *++p) != NULL);
-		return (const char **) pathspec;
-	}
+	if (!prefix && !entry)
+		return NULL;
 
 	if (!entry) {
 		static const char *spec[2];
@@ -27,38 +64,10 @@ const char **get_pathspec(const char *pr
 	}
 
 	/* Otherwise we have to re-write the entries.. */
-	prefixlen = strlen(prefix);
 	p = pathspec;
+	prefixlen = prefix ? strlen(prefix) : 0;
 	do {
-		int speclen, len = prefixlen;
-		char *n;
-
-		for (;;) {
-			if (!strcmp(entry, ".")) {
-				entry++;
-				break;
-			}
-			if (!strncmp(entry, "./", 2)) {
-				entry += 2;
-				continue;
-			}
-			if (!strncmp(entry, "../", 3)) {
-				do {
-					if (!len)
-						die("'%s' is outside repository", *p);
-					len--;
-				} while (len && prefix[len-1] != '/');
-				entry += 3;
-				continue;
-			}
-			break;
-		}
-		speclen = strlen(entry);
-		n = xmalloc(speclen + len + 1);
-		
-		memcpy(n, prefix, len);
-		memcpy(n + len, entry, speclen+1);
-		*p = n;
+		*p = prefix_path(prefix, prefixlen, entry);
 	} while ((entry = *++p) != NULL);
 	return (const char **) pathspec;
 }

^ permalink raw reply

* Re: Improve handling of "." and ".." in git-diff-*
From: Linus Torvalds @ 2005-08-17  3:52 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0508162037080.3553@g5.osdl.org>


On Tue, 16 Aug 2005, Linus Torvalds wrote:
> 
> This fixes up usage of ".." (without an ending slash) and "." (with or 
> without the ending slash) in the git diff family.

Btw, if it wasn't clear, with this patch you can now do

	git diff .

and it will show the diffs for everything under the current working 
directory. Similarly, you can do

	git diff ./drivers

or something like

	cd arch/i386
	git diff . ../x86-64 

and it will do the obvious thing (the "obvious thing" in the latter case
is to show the diffs for everything under _both_ arch/i386 and
arch/x86-64, but not anything outside of that - the path pattern gets
rewritten to "arch/i386" and "arch/x86-64").

		Linus

PS. A number of the other "work tree" ops can be similarly extended to
DTRT in git project subdirectories, but I wanted to finish off the "git
diff" family first, and get that one all done. I think I'm done now, and I
might tackle the other things (git-update-cache, git-checkout-cache,
git-commit-script, etc) tomorrow.

^ permalink raw reply

* [PATCH] commit-id, tree-id fail on tags
From: Pavel Roskin @ 2005-08-17  4:27 UTC (permalink / raw)
  To: Petr Baudis, git

Hello!

Tag names don't work with current cogito because commit-id and tree-id
don't parse the cg-Xnormid output properly.

Namely, if $type is empty (which is the case for tags), $normid is used
before the trailing space is stripped from it.

Signed-off-by: Pavel Roskin <proski@gnu.org>

diff --git a/commit-id b/commit-id
--- a/commit-id
+++ b/commit-id
@@ -9,8 +9,9 @@
 
 id="$1"
 normid=$(. ${COGITO_LIB}cg-Xnormid "$id") || exit 1
-type=${normid#* }; [ "$type" ] || type=$(git-cat-file -t "$normid")
+type=${normid#* }
 normid=${normid% *}
+[ "$type" ] || type=$(git-cat-file -t "$normid")
 
 if [ "$type" != "commit" ]; then
 	echo "Invalid commit id: $normid" >&2
diff --git a/tree-id b/tree-id
--- a/tree-id
+++ b/tree-id
@@ -7,8 +7,9 @@
 
 id="$1"
 normid=$(. ${COGITO_LIB}cg-Xnormid "$id") || exit 1
-type=${normid#* }; [ "$type" ] || type=$(git-cat-file -t "$normid")
+type=${normid#* }
 normid=${normid% *}
+[ "$type" ] || type=$(git-cat-file -t "$normid")
 
 if [ "$type" = "commit" ]; then
 	normid=$(git-cat-file commit "$normid" | sed -e 's/tree //;q')


-- 
Regards,
Pavel Roskin

^ permalink raw reply

* Re: [RFC PATCH] Add support for figuring out where in the git archive we are
From: Junio C Hamano @ 2005-08-17  4:30 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0508161946350.3553@g5.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> On Tue, 16 Aug 2005, Junio C Hamano wrote:
>> 
>> Merged, pushed out, and tested.  Ouch.  Fails on t0000 test.
>
> It's because the new git-diff-files expects there to be a valid readable 
> .git/HEAD, and is unhappy since the test hasn't updated HEAD.

Ah, good catch.  So with this the beginning of the tutorial
should work; I think we introduce diff-files before making a
commit.  Thanks.

^ permalink raw reply

* [PATCH] Add --symbolic flag to git-rev-parse.
From: Junio C Hamano @ 2005-08-17  5:33 UTC (permalink / raw)
  To: git

This is most useful with --all, --revs-only, --no-flags and --verify.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

    With this, "git-rev-parse --symbolic master pu" would output
    "master pu".  Why would this be useful?  The next one uses it.

 rev-parse.c |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

c7e32319f6c9338f186b62fe05919f0bc5ae7405
diff --git a/rev-parse.c b/rev-parse.c
--- a/rev-parse.c
+++ b/rev-parse.c
@@ -16,6 +16,7 @@ static int output_revs = 0;
 static int flags_only = 0;
 static int no_flags = 0;
 static int output_sq = 0;
+static int symbolic = 0;
 
 #define NORMAL 0
 #define REVERSED 1
@@ -69,17 +70,18 @@ static void show(const char *arg)
 		puts(arg);
 }
 
-static void show_rev(int type, const unsigned char *sha1)
+static void show_rev(int type, const unsigned char *sha1, const char *name)
 {
 	if (no_revs)
 		return;
 	output_revs++;
 
-	/* Hexadecimal string plus possibly a carret;
-	 * this does not have to be quoted even under output_sq.
-	 */
-	printf("%s%s%c", type == show_type ? "" : "^", sha1_to_hex(sha1),
-	       output_sq ? ' ' : '\n');
+	if (type != show_type)
+		putchar('^');
+	if (symbolic && name)
+		show(name);
+	else
+		show(sha1_to_hex(sha1));
 }
 
 static void show_rev_arg(char *rev)
@@ -117,7 +119,7 @@ static void show_default(void)
 
 		def = NULL;
 		if (!get_sha1(s, sha1)) {
-			show_rev(NORMAL, sha1);
+			show_rev(NORMAL, sha1, s);
 			return;
 		}
 		show_arg(s);
@@ -126,7 +128,7 @@ static void show_default(void)
 
 static int show_reference(const char *refname, const unsigned char *sha1)
 {
-	show_rev(NORMAL, sha1);
+	show_rev(NORMAL, sha1, refname);
 	return 0;
 }
 
@@ -186,6 +188,10 @@ int main(int argc, char **argv)
 				show_type ^= REVERSED;
 				continue;
 			}
+			if (!strcmp(arg, "--symbolic")) {
+				symbolic = 1;
+				continue;
+			}
 			if (!strcmp(arg, "--all")) {
 				for_each_ref(show_reference);
 				continue;
@@ -209,8 +215,8 @@ int main(int argc, char **argv)
 					if (no_revs)
 						continue;
 					def = NULL;
-					show_rev(NORMAL, end);
-					show_rev(REVERSED, sha1);
+					show_rev(NORMAL, end, n);
+					show_rev(REVERSED, sha1, arg);
 					continue;
 				}
 			}
@@ -220,14 +226,14 @@ int main(int argc, char **argv)
 			if (no_revs)
 				continue;
 			def = NULL;
-			show_rev(NORMAL, sha1);
+			show_rev(NORMAL, sha1, arg);
 			continue;
 		}
 		if (*arg == '^' && !get_sha1(arg+1, sha1)) {
 			if (no_revs)
 				continue;
 			def = NULL;
-			show_rev(REVERSED, sha1);
+			show_rev(REVERSED, sha1, arg+1);
 			continue;
 		}
 		show_default();

^ permalink raw reply

* [PATCH] git-commit: pass explicit path to git-diff-files.
From: Junio C Hamano @ 2005-08-17  5:34 UTC (permalink / raw)
  To: git

When running "git commit" with explicit path arguments, allow it to
take directory name.  This makes "git commit Documentation/" to commit
everything that is changed under Documentation/ directory.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 git-commit-script |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

cf2997f54cd650443368374dc0c5bcceab5b481c
diff --git a/git-commit-script b/git-commit-script
--- a/git-commit-script
+++ b/git-commit-script
@@ -88,9 +88,14 @@ esac
 case "$all" in
 t)
 	git-diff-files --name-only -z |
-	xargs -0 git-update-cache -q -- || exit 1 ;;
-esac
-git-update-cache -q --refresh -- "$@" || exit 1
+	xargs -0 git-update-cache -q --
+	;;
+*)
+	git-diff-files --name-only -z "$@" |
+	xargs -0 git-update-cache -q --
+	;;
+esac || exit 1
+git-update-cache -q --refresh || exit 1
 
 case "$verify" in
 t)

^ permalink raw reply

* [PATCH] Pass options to underlying git-rev-list from show-branches.
From: Junio C Hamano @ 2005-08-17  5:34 UTC (permalink / raw)
  To: git

This lets you say "git show-branches --max-count=30".

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

    And this is how --symbolic is used to pick out the named rev
    parameters.

 git-show-branches-script |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

34ac753b1b26d52ac502ec6ca5c2eb021818cfaa
diff --git a/git-show-branches-script b/git-show-branches-script
--- a/git-show-branches-script
+++ b/git-show-branches-script
@@ -5,15 +5,23 @@
 
 . git-sh-setup-script || die "Not a git repository"
 
+usage () {
+    die "usage: $0 <ref>..."
+}
+
 headref=`readlink $GIT_DIR/HEAD`
-case "$#" in
-0)
-	set x `cd $GIT_DIR/refs &&
-	    find heads -type f -print |
-	    sed -e 's|heads/||' |
-	    sort`
+
+case "$(git-rev-parse --no-revs)" in '') ;; *) usage ;; esac
+revs=$(git-rev-parse --revs-only --symbolic --no-flags "$@")
+flags=$(git-rev-parse --revs-only --flags "$@")
+case "$revs" in
+'')
+	revs=$(git-rev-parse --symbolic --all | sed -ne 's|^refs/heads/||p' |
+	       sort)
 	shift ;;
 esac
+set x $revs
+shift
 
 hh= in=
 for ref
@@ -22,7 +30,7 @@ do
 	*/"$ref") H='*' ;;
 	*) H='!' ;;
 	esac
-	h=`git-rev-parse --verify "$ref^0"` || exit
+	h=`git-rev-parse --verify "$ref^0" 2>/dev/null` || continue
 	l=`git-log-script --max-count=1 --pretty=oneline "$h" |
 		sed -e 's/^[^ ]* //'`
 	hh="$hh $h"
@@ -32,7 +40,7 @@ done
 set x $hh
 shift
 
-git-rev-list --pretty=oneline "$@" |
+git-rev-list --pretty=oneline $flags $@ |
 while read v l
 do
 	in=''

^ permalink raw reply

* [PATCH] Teach applymbox to keep the Subject: line.
From: Junio C Hamano @ 2005-08-17  5:47 UTC (permalink / raw)
  To: git
In-Reply-To: <7vek8t7bva.fsf@assigned-by-dhcp.cox.net>

This is a companion patch to the previous format-patch fix.
With "-k", format-patch can be told not to remove the [PATCH] in
the original commit, nor to add the [PATCH] on its own.

However, applymbox toolchain has a code to remove [PATCH] (among
other things) from the Subject: line, which is the right thing
to do when dealing with real e-mailed patches, but it interferes
with the "format-patch to applymbox" cherry-picking.  The -k
flag disables this.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 tools/git-applymbox  |   11 ++++++++---
 tools/git-applypatch |    5 ++++-
 tools/mailinfo.c     |   15 +++++++++++++++
 3 files changed, 27 insertions(+), 4 deletions(-)

6bff6a60680ef402f614abae8189c2cb198cfa49
diff --git a/tools/git-applymbox b/tools/git-applymbox
--- a/tools/git-applymbox
+++ b/tools/git-applymbox
@@ -9,7 +9,7 @@
 ## You give it a mbox-format collection of emails, and it will try to
 ## apply them to the kernel using "applypatch"
 ##
-## applymbox [ -q ] (-c .dotest/msg-number | mail_archive) [Signoff_file]"
+## applymbox [ -k ] [ -q ] (-c .dotest/msg-number | mail_archive) [Signoff_file]"
 ##
 ## The patch application may fail in the middle.  In which case:
 ## (1) look at .dotest/patch and fix it up to apply
@@ -18,10 +18,11 @@
 ## use a Signoff_file, because applypatch wants to append the sign-off
 ## message to msg-clean every time it is run.
 
-query_apply= continue= resume=t
+keep_subject= query_apply= continue= resume=t
 while case "$#" in 0) break ;; esac
 do
 	case "$1" in
+	-k)	keep_subject=-k ;;
 	-q)	query_apply=t ;;
 	-c)	continue="$2"; resume=f; shift ;;
 	-*)	usage ;;
@@ -41,6 +42,9 @@ esac
 case "$query_apply" in
 t)	touch .dotest/.query_apply
 esac
+case "$keep_subject" in
+-k)	: >.dotest/.keep_subject
+esac
 
 signoff="$1"
 set x .dotest/0*
@@ -52,7 +56,8 @@ do
     f,$i)	resume=t;;
     f,*)	continue;;
     *)
-	    git-mailinfo .dotest/msg .dotest/patch <$i >.dotest/info || exit 1
+	    git-mailinfo $keep_subject \
+		.dotest/msg .dotest/patch <$i >.dotest/info || exit 1
 	    git-stripspace < .dotest/msg > .dotest/msg-clean
 	    ;;
     esac
diff --git a/tools/git-applypatch b/tools/git-applypatch
--- a/tools/git-applypatch
+++ b/tools/git-applypatch
@@ -16,6 +16,7 @@ final=.dotest/final-commit
 ## If this file exists, we ask before applying
 ##
 query_apply=.dotest/.query_apply
+keep_subject=.dotest/.keep_subject
 MSGFILE=$1
 PATCHFILE=$2
 INFO=$3
@@ -30,8 +31,10 @@ export SUBJECT="$(sed -n '/^Subject/ s/S
 if [ -n "$signoff" -a -f "$signoff" ]; then
 	cat $signoff >> $MSGFILE
 fi
+patch_header=
+test -f "$keep_subject" || patch_header='[PATCH] '
 
-(echo "[PATCH] $SUBJECT" ; if [ -s $MSGFILE ]; then echo ; cat $MSGFILE; fi ) > $final
+(echo "$patch_header$SUBJECT" ; if [ -s $MSGFILE ]; then echo ; cat $MSGFILE; fi ) > $final
 
 f=0
 [ -f $query_apply ] || f=1
diff --git a/tools/mailinfo.c b/tools/mailinfo.c
--- a/tools/mailinfo.c
+++ b/tools/mailinfo.c
@@ -9,6 +9,7 @@
 
 static FILE *cmitmsg, *patchfile;
 
+static int keep_subject = 0;
 static char line[1000];
 static char date[1000];
 static char name[1000];
@@ -101,6 +102,8 @@ static void check_line(char *line, int l
 
 static char * cleanup_subject(char *subject)
 {
+	if (keep_subject)
+		return subject;
 	for (;;) {
 		char *p;
 		int len, remove;
@@ -242,8 +245,20 @@ static void usage(void)
 	exit(1);
 }
 
+static const char mailinfo_usage[] =
+"git-mailinfo [-k] msg patch <mail >info";
 int main(int argc, char ** argv)
 {
+	while (1 < argc && argv[1][0] == '-') {
+		if (!strcmp(argv[1], "-k"))
+			keep_subject = 1;
+		else {
+			fprintf(stderr, "usage: %s\n", mailinfo_usage);
+			exit(1);
+		}
+		argc--; argv++;
+	}
+
 	if (argc != 3)
 		usage();
 	cmitmsg = fopen(argv[1], "w");

^ permalink raw reply

* [PATCH] Use LF and allow comments in objects/info/alternates file.
From: Junio C Hamano @ 2005-08-17  5:48 UTC (permalink / raw)
  To: git; +Cc: Linus Torvalds
In-Reply-To: <7vacjhaa7y.fsf@assigned-by-dhcp.cox.net>

Yes, using the same format for the file and the environment variable
was a big mistake.  This uses LF as the path separator, and allows
lines that begin with '#' to be comments.  ':' is no longer a separator
in objects/info/alternates file.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 sha1_file.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

9577e7e3db2299febdc17539478bba38874d4120
diff --git a/sha1_file.c b/sha1_file.c
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -240,14 +240,21 @@ static struct alternate_object_database 
  * SHA1, an extra slash for the first level indirection, and the
  * terminating NUL.
  */
-static void link_alt_odb_entries(const char *alt, const char *ep)
+static void link_alt_odb_entries(const char *alt, const char *ep, int sep)
 {
 	const char *cp, *last;
 	struct alternate_object_database *ent;
 
 	last = alt;
-	do {
-		for (cp = last; cp < ep && *cp != ':'; cp++)
+	while (last < ep) {
+		cp = last;
+		if (cp < ep && *cp == '#') {
+			while (cp < ep && *cp != sep)
+				cp++;
+			last = cp + 1;
+			continue;
+		}
+		for ( ; cp < ep && *cp != sep; cp++)
 			;
 		if (last != cp) {
 			/* 43 = 40-byte + 2 '/' + terminating NUL */
@@ -264,16 +271,16 @@ static void link_alt_odb_entries(const c
 			ent->base[pfxlen] = ent->base[pfxlen + 3] = '/';
 			ent->base[entlen-1] = 0;
 		}
-		while (cp < ep && *cp == ':')
+		while (cp < ep && *cp == sep)
 			cp++;
 		last = cp;
-	} while (cp < ep);
+	}
 }
 
 void prepare_alt_odb(void)
 {
 	char path[PATH_MAX];
-	char *map, *ep;
+	char *map;
 	int fd;
 	struct stat st;
 	char *alt = gitenv(ALTERNATE_DB_ENVIRONMENT) ? : "";
@@ -282,7 +289,7 @@ void prepare_alt_odb(void)
 	if (alt_odb_tail)
 		return;
 	alt_odb_tail = &alt_odb_list;
-	link_alt_odb_entries(alt, alt + strlen(alt));
+	link_alt_odb_entries(alt, alt + strlen(alt), ':');
 
 	fd = open(path, O_RDONLY);
 	if (fd < 0)
@@ -296,10 +303,7 @@ void prepare_alt_odb(void)
 	if (map == MAP_FAILED)
 		return;
 
-	/* Remove the trailing newline */
-	for (ep = map + st.st_size - 1; map < ep && ep[-1] == '\n'; ep--)
-		;
-	link_alt_odb_entries(map, ep);
+	link_alt_odb_entries(map, map + st.st_size, '\n');
 	munmap(map, st.st_size);
 }
 

^ permalink raw reply

* Re: FUNKY tags.
From: Martin Langhoff @ 2005-08-17  5:59 UTC (permalink / raw)
  To: Dave Jones; +Cc: git
In-Reply-To: <20050817024718.GA11734@redhat.com>

On 8/17/05, Dave Jones <davej@redhat.com> wrote:
> In my case, at least the most recent of those cvs tag operations
> was just a 'cvs tag x86info-1_14'. Nothing fancy.  I'm fairly sure
> there was nothing fancy about the earlier instance either.
> So sure in fact, I had to look up that -F flag in the man page to find
> out what it did.

Ok - that reduces the suspects to 
 - a tag applied to only one part of the tree
 - a tag that took longer to apply than fuzztime (large tree, slow cvs
connection?)
 
let me know, and if I find time I may look at the repo. 

martin

^ permalink raw reply

* [PATCH] Also handle CVS branches with a '/' in their name
From: Johannes Schindelin @ 2005-08-17  6:39 UTC (permalink / raw)
  To: Junio C Hamano, git

I track a CVS project which has a branch with a '/' in the branch name.
Since git wants the branch name to be a file name at the same time,
translate that character to a '-'. This should work well, despite the
fact that a division and a difference are completely different :-)

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

 git-cvsimport-script |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

787879e1e16d6cece75dc4744358ba0073e908cc
diff --git a/git-cvsimport-script b/git-cvsimport-script
--- a/git-cvsimport-script
+++ b/git-cvsimport-script
@@ -621,6 +621,7 @@ while(<CVS>) {
 		$state = 4;
 	} elsif($state == 4 and s/^Branch:\s+//) {
 		s/\s+$//;
+		s/\//-/g;
 		$branch = $_;
 		$state = 5;
 	} elsif($state == 5 and s/^Ancestor branch:\s+//) {

^ permalink raw reply

* Re: gitk with hyperspace support
From: Junio C Hamano @ 2005-08-17  6:58 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git
In-Reply-To: <17154.33520.584666.701545@cargo.ozlabs.ibm.com>

Paul Mackerras <paulus@samba.org> writes:

> My reasoning is that it is the local short-range connections which are
> interesting and informative.  The long-range connections aren't really
> visually informative; if you want to know about the long-range
> connections, the parent and child lists in the details pane are much
> more useful.

Correct.

The new output looks a lot less cluttering and I like it very
much, but it is confusing to me on one count.  I clicked one
arrowhead pointing downward, expecting that the pane would jump
scroll to show the counterpart arrowhead, and was dissapointed
that it did not happen.  I could click the "Parent" link at that
point, but then the upward arrow was above and outside the
visible portion of that pane, which broke visual continuity and
I lost track at that point.  I think my being color challenged
exacerbated the resulting confusion; otherwise I could have
probably found the line with the same color as the color of the
downarrow I clicked.

> http://ozlabs.org/~paulus/gitk/gitk.hs

I first thought you rewrote it in Haskell ;-).

^ permalink raw reply

* [PATCH] When copying or renaming, keep the mode, please
From: Johannes Schindelin @ 2005-08-17  7:01 UTC (permalink / raw)
  To: Junio C Hamano, git

Without this patch, git-apply does not retain the mode when renaming or
copying files.

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

 apply.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

8dca30668d7077fa9b9157c3685b3ace8598a514
diff --git a/apply.c b/apply.c
--- a/apply.c
+++ b/apply.c
@@ -1043,8 +1043,12 @@ static int check_patch(struct patch *pat
 			return error("%s: already exists in working directory", new_name);
 		if (errno != ENOENT)
 			return error("%s: %s", new_name, strerror(errno));
-		if (!patch->new_mode)
-			patch->new_mode = S_IFREG | 0644;
+		if (!patch->new_mode) {
+			if (patch->is_new)
+				patch->new_mode = S_IFREG | 0644;
+			else
+				patch->new_mode = patch->old_mode;
+		}
 	}
 
 	if (new_name && old_name) {

^ permalink raw reply

* Re: [PATCH] Also handle CVS branches with a '/' in their name
From: Junio C Hamano @ 2005-08-17  7:02 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0508170839030.27628@wgmdd8.biozentrum.uni-wuerzburg.de>

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> I track a CVS project which has a branch with a '/' in the branch name.
> Since git wants the branch name to be a file name at the same time,
> translate that character to a '-'. This should work well, despite the
> fact that a division and a difference are completely different :-)

My feeling is that there should be nothing to prevent you from
having a non-flat namespace in .git/refs/heads; i.e. we should
allow ".git/refs/heads/foo/bar".  Some of the existing tools may
be forgetting to call either "mkdir -p $(dirname $ref)" if they
are written in shell, or safe_create_leading_directories(ref) in
C, but I consider that is a bug.

^ 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