Git development
 help / color / mirror / Atom feed
* Re: git-fetching from a big repository is slow
From: Andy Parkins @ 2006-12-14 16:20 UTC (permalink / raw)
  To: git, hanwen
In-Reply-To: <458171B7.1020702@xs4all.nl>

On Thursday 2006 December 14 15:45, Han-Wen Nienhuys wrote:

> I just noticed that git-fetch now runs git-show-ref --verify on every
> tag it encounters. This seems to slow down fetch over here.

There aren't any tags in this repository :-)

Andy

-- 
Dr Andy Parkins, M Eng (hons), MIEE

^ permalink raw reply

* Re: [PATCH] "master" should be treated no differently from any other branch
From: Andy Parkins @ 2006-12-14 16:25 UTC (permalink / raw)
  To: git
In-Reply-To: <Pine.LNX.4.63.0612141627090.3635@wbgn013.biozentrum.uni-wuerzburg.de>

On Thursday 2006 December 14 15:29, Johannes Schindelin wrote:

> I do not agree. There is usually a principal branch, where you collect the
> topics, and you do want to treat that special. As for the name: better

While there might _usually_ be a principal branch; the special casing is 
_always_ hard coded.

> have a convention here than configurability. You would not want "git" to
> be called "guitar" for some users, just because they happen to like that
> name more, either, right?

You're correct; but we're talking about branch names not program names.  
Making "master" special rather than simply a default means git is dictating 
policy.  It isn't git's place to decide what my branches are called, 
especially as it is git itself that lets me choose freely to begin with.

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIEE

^ permalink raw reply

* Ignoring local changes
From: Pazu @ 2006-12-14 16:26 UTC (permalink / raw)
  To: git

Is there any way to make git completely ignore changes to certain local files? I
know about .gitignore, but that doesn't work when the files I want to ignore
were already added to the repository.

A little more context should help you understand my need. I'm currently tracking
a big subversion repository using git-svn; I do all my develop on local git
branches, and later use git-svn dcommit to push these changes to the svn
repository. 

There are some files in the svn repository (and by extension, on my local
mirrored repository) that are almost always locally modified (eclipse/IDEA
project files or generated artifacts that someone else added to svn), but I
almost never want to commit then. This is a hassle in several situations:

1) git-status always show these files as modified, polluting the output and
making it harder for me to pinpoint the "real" changes.
2) git-rebase refuses to run, since the working copy will always be dirty*
3) since git-svn dcommit uses git-rebase, sometimes it fails for the same reason.

So, is there any way to make git look the other way regarding these files?

* I usually get around this making a local commit with the local modifications,
rebasing, and the using git-reset to revert the last commit.

-- Pazu

^ permalink raw reply

* Re: svn versus git
From: Nguyen Thai Ngoc Duy @ 2006-12-14 16:32 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0612141630240.3635@wbgn013.biozentrum.uni-wuerzburg.de>

Hi,

On 12/14/06, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Two questions arise naturally:
>
> - what do you need it for?

for being user-friendly and consistent. Git porcelain commands seem to
be grouped by function. So it would be natural to have git-ls as a
front-end for both ls-files and ls-tree. I don't really care about
ls-tree but I do about ls-files to examine index.

> - have you seen the patch for git-show today, which would include this
> functionality?

I didn't. From the patch, it seems git-show can show the index via
::file syntax. If so, I'd like withdraw my opinion. '::file' syntax is
not intuitive though. Perhaps you should mention that it can show
index (and how) in the git-show document
-- 

^ permalink raw reply

* Re: git-fetching from a big repository is slow
From: Johannes Schindelin @ 2006-12-14 16:34 UTC (permalink / raw)
  To: Andy Parkins; +Cc: git, hanwen
In-Reply-To: <200612141620.17782.andyparkins@gmail.com>

Hi,

On Thu, 14 Dec 2006, Andy Parkins wrote:

> On Thursday 2006 December 14 15:45, Han-Wen Nienhuys wrote:
> 
> > I just noticed that git-fetch now runs git-show-ref --verify on every
> > tag it encounters. This seems to slow down fetch over here.
> 
> There aren't any tags in this repository :-)

git-show-ref traverses every single _local_ tag when called. This is to 
overcome the problem that tags can be packed now, so a simple file 
existence check is not sufficient.

It would be much faster, probably, if you pack the local refs. IIRC I once 
argued for automatically packing refs (and all refs), but this has not 
been picked up, and I do not really care about it either.

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH] "master" should be treated no differently from any other branch
From: Andy Parkins @ 2006-12-14 16:34 UTC (permalink / raw)
  To: git
In-Reply-To: <200612141625.08485.andyparkins@gmail.com>


> > have a convention here than configurability. You would not want "git" to
> > be called "guitar" for some users, just because they happen to like that
> > name more, either, right?
>
> You're correct; but we're talking about branch names not program names.

And the analogy is flawed.  I don't want git to be called guitar, however I'd 
be very upset if I got
  
 $ mv git guitar
 Error: git is conventionally called guitar


Andy

-- 
Dr Andy Parkins, M Eng (hons), MIEE

^ permalink raw reply

* Re: [PATCH] "master" should be treated no differently from any other branch
From: Johannes Schindelin @ 2006-12-14 16:39 UTC (permalink / raw)
  To: Andy Parkins; +Cc: git
In-Reply-To: <200612141625.08485.andyparkins@gmail.com>

Hi,

On Thu, 14 Dec 2006, Andy Parkins wrote:

> Making "master" special rather than simply a default means git is 
> dictating policy.  It isn't git's place to decide what my branches are 
> called, especially as it is git itself that lets me choose freely to 
> begin with.

Fine. I don't give a flying fly. And if -- by making this and related 
changes -- new users find it even harder to start with Git, I will ignore 
any complaints. I mean, this is yet something new in an almost-everyday 
message that the user has to get used to.

Ciao,
Dscho

^ permalink raw reply

* [RFC/PATCH] Change "refs/" references to symbolic constants
From: Andy Parkins @ 2006-12-14 16:44 UTC (permalink / raw)
  To: git

Changed repeated use of the same constants for the ref paths to be
symbolic constants.  I've defined them in refs.h

  refs/ is now PATH_REFS
  refs/heads/ is now PATH_REFS_HEADS
  refs/tags/ is now PATH_REFS_TAGS
  refs/remotes/ is now PATH_REFS_REMOTES

I've changed all references to them and made constants for the string
lengths as well.  This has clarified the code in some places; for
example:

 - len = strlen(refs[i]) + 11;
 + len = strlen(refs[i]) + STRLEN_PATH_REFS_TAGS + 1;

In this case 11 isn't STRLEN_PATH_REFS_HEADS, as it is in most other
cases, it's TAGS + 1.  With the change to symbolic constants it's much
clearer what is happening.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---

I chose to add the constants to refs.h; unfortunately that meant adding
some #include "refs.h" around the place.

Is that wise?  Would I be better putting the constants in cache.h?

I'm tempted to add a constant for "objects/" as well, to complete the set.
Would there be any objections?

 builtin-branch.c        |   24 ++++++++++++------------
 builtin-fmt-merge-msg.c |    5 +++--
 builtin-init-db.c       |   15 ++++++++-------
 builtin-name-rev.c      |   10 +++++-----
 builtin-pack-refs.c     |    2 +-
 builtin-push.c          |    8 ++++----
 builtin-show-branch.c   |   28 ++++++++++++++--------------
 builtin-show-ref.c      |    4 ++--
 connect.c               |   18 +++++++++---------
 describe.c              |    2 +-
 fetch-pack.c            |    4 ++--
 fsck-objects.c          |    2 +-
 http-fetch.c            |    5 +++--
 http-push.c             |    4 ++--
 local-fetch.c           |    3 ++-
 path.c                  |    5 +++--
 receive-pack.c          |    4 ++--
 refs.c                  |   16 ++++++++--------
 refs.h                  |   15 +++++++++++++++
 setup.c                 |    5 +++--
 sha1_name.c             |   10 +++++-----
 wt-status.c             |    3 ++-
 22 files changed, 107 insertions(+), 85 deletions(-)

diff --git a/builtin-branch.c b/builtin-branch.c
index 560309c..1f4b6f0 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -105,7 +105,7 @@ static void delete_branches(int argc, const char **argv, 
int force)
 		if (!strcmp(head, argv[i]))
 			die("Cannot delete the branch you are currently on.");
 
-		name = xstrdup(mkpath("refs/heads/%s", argv[i]));
+		name = xstrdup(mkpath(PATH_REFS_HEADS "%s", argv[i]));
 		if (!resolve_ref(name, sha1, 1, NULL))
 			die("Branch '%s' not found.", argv[i]);
 
@@ -161,15 +161,15 @@ static int append_ref(const char *refname, const 
unsigned char *sha1, int flags,
 	int len;
 
 	/* Detect kind */
-	if (!strncmp(refname, "refs/heads/", 11)) {
+	if (!strncmp(refname, PATH_REFS_HEADS, STRLEN_PATH_REFS_HEADS)) {
 		kind = REF_LOCAL_BRANCH;
-		refname += 11;
-	} else if (!strncmp(refname, "refs/remotes/", 13)) {
+		refname += STRLEN_PATH_REFS_HEADS;
+	} else if (!strncmp(refname, PATH_REFS_REMOTES, STRLEN_PATH_REFS_REMOTES)) {
 		kind = REF_REMOTE_BRANCH;
-		refname += 13;
-	} else if (!strncmp(refname, "refs/tags/", 10)) {
+		refname += STRLEN_PATH_REFS_REMOTES;
+	} else if (!strncmp(refname, PATH_REFS_TAGS, STRLEN_PATH_REFS_TAGS)) {
 		kind = REF_TAG;
-		refname += 10;
+		refname += STRLEN_PATH_REFS_TAGS;
 	}
 
 	/* Don't add types the caller doesn't want */
@@ -290,7 +290,7 @@ static void create_branch(const char *name, const char 
*start,
 	unsigned char sha1[20];
 	char ref[PATH_MAX], msg[PATH_MAX + 20];
 
-	snprintf(ref, sizeof ref, "refs/heads/%s", name);
+	snprintf(ref, sizeof ref, PATH_REFS_HEADS "%s", name);
 	if (check_ref_format(ref))
 		die("'%s' is not a valid branch name.", name);
 
@@ -324,13 +324,13 @@ static void rename_branch(const char *oldname, const 
char *newname, int force)
 	char oldref[PATH_MAX], newref[PATH_MAX], logmsg[PATH_MAX*2 + 100];
 	unsigned char sha1[20];
 
-	if (snprintf(oldref, sizeof(oldref), "refs/heads/%s", oldname) > 
sizeof(oldref))
+	if (snprintf(oldref, sizeof(oldref), PATH_REFS_HEADS "%s", oldname) > 
sizeof(oldref))
 		die("Old branchname too long");
 
 	if (check_ref_format(oldref))
 		die("Invalid branch name: %s", oldref);
 
-	if (snprintf(newref, sizeof(newref), "refs/heads/%s", newname) > 
sizeof(newref))
+	if (snprintf(newref, sizeof(newref), PATH_REFS_HEADS "%s", newname) > 
sizeof(newref))
 		die("New branchname too long");
 
 	if (check_ref_format(newref))
@@ -430,8 +430,8 @@ int cmd_branch(int argc, const char **argv, const char 
*prefix)
 	head = xstrdup(resolve_ref("HEAD", head_sha1, 0, NULL));
 	if (!head)
 		die("Failed to resolve HEAD as a valid ref.");
-	if (strncmp(head, "refs/heads/", 11))
-		die("HEAD not found below refs/heads!");
+	if (strncmp(head, PATH_REFS_HEADS, STRLEN_PATH_REFS_HEADS))
+		die("HEAD not found below " PATH_REFS_HEADS "!");
 	head += 11;
 
 	if (delete)
diff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c
index 87d3d63..d0615b5 100644
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
@@ -4,6 +4,7 @@
 #include "diff.h"
 #include "revision.h"
 #include "tag.h"
+#include "refs.h"
 
 static const char *fmt_merge_msg_usage =
 	"git-fmt-merge-msg [--summary] [--no-summary] [--file <file>]";
@@ -280,8 +281,8 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const 
char *prefix)
 	current_branch = resolve_ref("HEAD", head_sha1, 1, NULL);
 	if (!current_branch)
 		die("No current branch");
-	if (!strncmp(current_branch, "refs/heads/", 11))
-		current_branch += 11;
+	if (!strncmp(current_branch, PATH_REFS_HEADS, STRLEN_PATH_REFS_HEADS))
+		current_branch += STRLEN_PATH_REFS_HEADS;
 
 	while (fgets(line, sizeof(line), in)) {
 		i++;
diff --git a/builtin-init-db.c b/builtin-init-db.c
index 235a0ee..df343ea 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -5,6 +5,7 @@
  */
 #include "cache.h"
 #include "builtin.h"
+#include "refs.h"
 
 #ifndef DEFAULT_GIT_TEMPLATE_DIR
 #define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates/"
@@ -182,11 +183,11 @@ static void create_default_files(const char *git_dir, 
const char *template_path)
 	/*
 	 * Create .git/refs/{heads,tags}
 	 */
-	strcpy(path + len, "refs");
+	strcpy(path + len, PATH_REFS);
 	safe_create_dir(path, 1);
-	strcpy(path + len, "refs/heads");
+	strcpy(path + len, PATH_REFS_HEADS);
 	safe_create_dir(path, 1);
-	strcpy(path + len, "refs/tags");
+	strcpy(path + len, PATH_REFS_TAGS);
 	safe_create_dir(path, 1);
 
 	/* First copy the templates -- we might have the default
@@ -205,11 +206,11 @@ static void create_default_files(const char *git_dir, 
const char *template_path)
 	if (shared_repository) {
 		path[len] = 0;
 		adjust_shared_perm(path);
-		strcpy(path + len, "refs");
+		strcpy(path + len, PATH_REFS);
 		adjust_shared_perm(path);
-		strcpy(path + len, "refs/heads");
+		strcpy(path + len, PATH_REFS_HEADS);
 		adjust_shared_perm(path);
-		strcpy(path + len, "refs/tags");
+		strcpy(path + len, PATH_REFS_TAGS);
 		adjust_shared_perm(path);
 	}
 
@@ -219,7 +220,7 @@ static void create_default_files(const char *git_dir, 
const char *template_path)
 	 */
 	strcpy(path + len, "HEAD");
 	if (read_ref("HEAD", sha1) < 0) {
-		if (create_symref("HEAD", "refs/heads/master") < 0)
+		if (create_symref("HEAD", PATH_REFS_HEADS "master") < 0)
 			exit(1);
 	}
 
diff --git a/builtin-name-rev.c b/builtin-name-rev.c
index 618aa31..ef66b1f 100644
--- a/builtin-name-rev.c
+++ b/builtin-name-rev.c
@@ -81,7 +81,7 @@ static int name_ref(const char *path, const unsigned char 
*sha1, int flags, void
 	int tags_only = *(int*)cb_data;
 	int deref = 0;
 
-	if (tags_only && strncmp(path, "refs/tags/", 10))
+	if (tags_only && strncmp(path, PATH_REFS_TAGS, STRLEN_PATH_REFS_TAGS))
 		return 0;
 
 	while (o && o->type == OBJ_TAG) {
@@ -94,10 +94,10 @@ static int name_ref(const char *path, const unsigned char 
*sha1, int flags, void
 	if (o && o->type == OBJ_COMMIT) {
 		struct commit *commit = (struct commit *)o;
 
-		if (!strncmp(path, "refs/heads/", 11))
-			path = path + 11;
-		else if (!strncmp(path, "refs/", 5))
-			path = path + 5;
+		if (!strncmp(path, PATH_REFS_HEADS, STRLEN_PATH_REFS_HEADS))
+			path = path + STRLEN_PATH_REFS_HEADS;
+		else if (!strncmp(path, PATH_REFS, STRLEN_PATH_REFS))
+			path = path + STRLEN_PATH_REFS;
 
 		name_rev(commit, xstrdup(path), 0, 0, deref);
 	}
diff --git a/builtin-pack-refs.c b/builtin-pack-refs.c
index 8dc5b9e..c15f629 100644
--- a/builtin-pack-refs.c
+++ b/builtin-pack-refs.c
@@ -36,7 +36,7 @@ static int handle_one_ref(const char *path, const unsigned 
char *sha1,
 	/* Do not pack the symbolic refs */
 	if ((flags & REF_ISSYMREF))
 		return 0;
-	is_tag_ref = !strncmp(path, "refs/tags/", 10);
+	is_tag_ref = !strncmp(path, PATH_REFS_TAGS, STRLEN_PATH_REFS_TAGS);
 	if (!cb->all && !is_tag_ref)
 		return 0;
 
diff --git a/builtin-push.c b/builtin-push.c
index b7412e8..de3eb46 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -30,9 +30,9 @@ static void add_refspec(const char *ref)
 static int expand_one_ref(const char *ref, const unsigned char *sha1, int 
flag, void *cb_data)
 {
 	/* Ignore the "refs/" at the beginning of the refname */
-	ref += 5;
+	ref += STRLEN_PATH_REFS;
 
-	if (!strncmp(ref, "tags/", 5))
+	if (!strncmp(ref, PATH_TAGS, STRLEN_PATH_TAGS))
 		add_refspec(xstrdup(ref));
 	return 0;
 }
@@ -68,9 +68,9 @@ static void set_refspecs(const char **refs, int nr)
 					if (nr <= ++i)
 						die("tag <tag> shorthand without <tag>");
 					if (pass) {
-						len = strlen(refs[i]) + 11;
+						len = strlen(refs[i]) + STRLEN_PATH_REFS_TAGS + 1;
 						tag = xmalloc(len);
-						strcpy(tag, "refs/tags/");
+						strcpy(tag, PATH_REFS_TAGS);
 						strcat(tag, refs[i]);
 						refspec[cnt] = tag;
 					}
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index fb1a400..d598d2d 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -372,22 +372,22 @@ static int append_ref(const char *refname, const 
unsigned char *sha1, int flag,
 static int append_head_ref(const char *refname, const unsigned char *sha1, 
int flag, void *cb_data)
 {
 	unsigned char tmp[20];
-	int ofs = 11;
-	if (strncmp(refname, "refs/heads/", ofs))
+	int ofs = STRLEN_PATH_REFS_HEADS;
+	if (strncmp(refname, PATH_REFS_HEADS, ofs))
 		return 0;
 	/* If both heads/foo and tags/foo exists, get_sha1 would
 	 * get confused.
 	 */
 	if (get_sha1(refname + ofs, tmp) || hashcmp(tmp, sha1))
-		ofs = 5;
+		ofs = STRLEN_PATH_REFS;
 	return append_ref(refname + ofs, sha1, flag, cb_data);
 }
 
 static int append_tag_ref(const char *refname, const unsigned char *sha1, int 
flag, void *cb_data)
 {
-	if (strncmp(refname, "refs/tags/", 10))
+	if (strncmp(refname, PATH_REFS_TAGS, STRLEN_PATH_REFS_TAGS))
 		return 0;
-	return append_ref(refname + 5, sha1, flag, cb_data);
+	return append_ref(refname + STRLEN_PATH_REFS, sha1, flag, cb_data);
 }
 
 static const char *match_ref_pattern = NULL;
@@ -416,9 +416,9 @@ static int append_matching_ref(const char *refname, const 
unsigned char *sha1, i
 		return 0;
 	if (fnmatch(match_ref_pattern, tail, 0))
 		return 0;
-	if (!strncmp("refs/heads/", refname, 11))
+	if (!strncmp(PATH_REFS_HEADS, refname, STRLEN_PATH_REFS_HEADS))
 		return append_head_ref(refname, sha1, flag, cb_data);
-	if (!strncmp("refs/tags/", refname, 10))
+	if (!strncmp(PATH_REFS_TAGS, refname, STRLEN_PATH_REFS_TAGS))
 		return append_tag_ref(refname, sha1, flag, cb_data);
 	return append_ref(refname, sha1, flag, cb_data);
 }
@@ -443,12 +443,12 @@ static int rev_is_head(char *head, int headlen, char 
*name,
 	if ((!head[0]) ||
 	    (head_sha1 && sha1 && hashcmp(head_sha1, sha1)))
 		return 0;
-	if (!strncmp(head, "refs/heads/", 11))
-		head += 11;
-	if (!strncmp(name, "refs/heads/", 11))
-		name += 11;
-	else if (!strncmp(name, "heads/", 6))
-		name += 6;
+	if (!strncmp(head, PATH_REFS_HEADS, STRLEN_PATH_REFS_HEADS))
+		head += STRLEN_PATH_REFS_HEADS;
+	if (!strncmp(name, PATH_REFS_HEADS, STRLEN_PATH_REFS_HEADS))
+		name += STRLEN_PATH_REFS_HEADS;
+	else if (!strncmp(name, PATH_HEADS, STRLEN_PATH_HEADS))
+		name += STRLEN_PATH_HEADS;
 	return !strcmp(head, name);
 }
 
@@ -659,7 +659,7 @@ int cmd_show_branch(int ac, const char **av, const char 
*prefix)
 				has_head++;
 		}
 		if (!has_head) {
-			int pfxlen = strlen("refs/heads/");
+			int pfxlen = STRLEN_PATH_REFS_HEADS;
 			append_one_rev(head + pfxlen);
 		}
 	}
diff --git a/builtin-show-ref.c b/builtin-show-ref.c
index 0739798..29ec05c 100644
--- a/builtin-show-ref.c
+++ b/builtin-show-ref.c
@@ -18,8 +18,8 @@ static int show_ref(const char *refname, const unsigned char 
*sha1, int flag, vo
 	if (tags_only || heads_only) {
 		int match;
 
-		match = heads_only && !strncmp(refname, "refs/heads/", 11);
-		match |= tags_only && !strncmp(refname, "refs/tags/", 10);
+		match = heads_only && !strncmp(refname, PATH_REFS_HEADS, 
STRLEN_PATH_REFS_HEADS);
+		match |= tags_only && !strncmp(refname, PATH_REFS_TAGS, 
STRLEN_PATH_REFS_TAGS);
 		if (!match)
 			return 0;
 	}
diff --git a/connect.c b/connect.c
index f7edba8..49bfa37 100644
--- a/connect.c
+++ b/connect.c
@@ -17,23 +17,23 @@ static int check_ref(const char *name, int len, unsigned 
int flags)
 	if (!flags)
 		return 1;
 
-	if (len < 5 || memcmp(name, "refs/", 5))
+	if (len < STRLEN_PATH_REFS || memcmp(name, PATH_REFS, STRLEN_PATH_REFS))
 		return 0;
 
 	/* Skip the "refs/" part */
-	name += 5;
-	len -= 5;
+	name += STRLEN_PATH_REFS;
+	len -= STRLEN_PATH_REFS;
 
 	/* REF_NORMAL means that we don't want the magic fake tag refs */
 	if ((flags & REF_NORMAL) && check_ref_format(name) < 0)
 		return 0;
 
 	/* REF_HEADS means that we want regular branch heads */
-	if ((flags & REF_HEADS) && !memcmp(name, "heads/", 6))
+	if ((flags & REF_HEADS) && !memcmp(name, PATH_HEADS, STRLEN_PATH_HEADS))
 		return 1;
 
 	/* REF_TAGS means that we want tags */
-	if ((flags & REF_TAGS) && !memcmp(name, "tags/", 5))
+	if ((flags & REF_TAGS) && !memcmp(name, PATH_TAGS, STRLEN_PATH_TAGS))
 		return 1;
 
 	/* All type bits clear means that we are ok with anything */
@@ -202,8 +202,8 @@ static int count_refspec_match(const char *pattern,
 		 */
 		if (namelen != patlen &&
 		    patlen != namelen - 5 &&
-		    strncmp(name, "refs/heads/", 11) &&
-		    strncmp(name, "refs/tags/", 10)) {
+		    strncmp(name, PATH_REFS_HEADS, STRLEN_PATH_REFS_HEADS) &&
+		    strncmp(name, PATH_REFS_TAGS, STRLEN_PATH_REFS_TAGS)) {
 			/* We want to catch the case where only weak
 			 * matches are found and there are multiple
 			 * matches, and where more than one strong
@@ -290,7 +290,7 @@ static int match_explicit_refs(struct ref *src, struct ref 
*dst,
 		case 1:
 			break;
 		case 0:
-			if (!memcmp(rs[i].dst, "refs/", 5)) {
+			if (!memcmp(rs[i].dst, PATH_REFS, STRLEN_PATH_REFS)) {
 				int len = strlen(rs[i].dst) + 1;
 				matched_dst = xcalloc(1, sizeof(*dst) + len);
 				memcpy(matched_dst->name, rs[i].dst, len);
@@ -311,7 +311,7 @@ static int match_explicit_refs(struct ref *src, struct ref 
*dst,
 				errs = 1;
 				error("dst refspec %s does not match any "
 				      "existing ref on the remote and does "
-				      "not start with refs/.", rs[i].dst);
+				      "not start with " PATH_REFS ".", rs[i].dst);
 			}
 			break;
 		default:
diff --git a/describe.c b/describe.c
index f4029ee..e3b0baa 100644
--- a/describe.c
+++ b/describe.c
@@ -66,7 +66,7 @@ static int get_name(const char *path, const unsigned char 
*sha1, int flag, void
 	 * If --tags, then any tags are used.
 	 * Otherwise only annotated tags are used.
 	 */
-	if (!strncmp(path, "refs/tags/", 10)) {
+	if (!strncmp(path, PATH_REFS_TAGS, STRLEN_PATH_REFS_TAGS)) {
 		if (object->type == OBJ_TAG)
 			prio = 2;
 		else
diff --git a/fetch-pack.c b/fetch-pack.c
index 743eab7..e67b2fe 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -307,8 +307,8 @@ static void filter_refs(struct ref **refs, int nr_match, 
char **match)
 
 	for (ref = *refs; ref; ref = next) {
 		next = ref->next;
-		if (!memcmp(ref->name, "refs/", 5) &&
-		    check_ref_format(ref->name + 5))
+		if (!memcmp(ref->name, PATH_REFS, STRLEN_PATH_REFS) &&
+		    check_ref_format(ref->name + STRLEN_PATH_REFS))
 			; /* trash */
 		else if (fetch_all) {
 			*newtail = ref;
diff --git a/fsck-objects.c b/fsck-objects.c
index 46b628c..f9b1218 100644
--- a/fsck-objects.c
+++ b/fsck-objects.c
@@ -463,7 +463,7 @@ static int fsck_head_link(void)
 
 	if (!head_points_at || !(flag & REF_ISSYMREF))
 		return error("HEAD is not a symbolic ref");
-	if (strncmp(head_points_at, "refs/heads/", 11))
+	if (strncmp(head_points_at, PATH_REFS_HEADS, STRLEN_PATH_REFS_HEADS))
 		return error("HEAD points to something strange (%s)",
 			     head_points_at);
 	if (is_null_sha1(sha1))
diff --git a/http-fetch.c b/http-fetch.c
index 396552d..2c02690 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -3,6 +3,7 @@
 #include "pack.h"
 #include "fetch.h"
 #include "http.h"
+#include "refs.h"
 
 #define PREV_BUF_SIZE 4096
 #define RANGE_HEADER_SIZE 30
@@ -943,8 +944,8 @@ static char *quote_ref_url(const char *base, const char 
*ref)
 			len += 2; /* extra two hex plus replacement % */
 	qref = xmalloc(len);
 	memcpy(qref, base, baselen);
-	memcpy(qref + baselen, "refs/", 5);
-	for (cp = ref, dp = qref + baselen + 5; (ch = *cp) != 0; cp++) {
+	memcpy(qref + baselen, PATH_REFS, STRLEN_PATH_REFS);
+	for (cp = ref, dp = qref + baselen + STRLEN_PATH_REFS; (ch = *cp) != 0; 
cp++) {
 		if (needs_quote(ch)) {
 			*dp++ = '%';
 			*dp++ = hex((ch >> 4) & 0xF);
diff --git a/http-push.c b/http-push.c
index ecefdfd..6f17acf 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1919,7 +1919,7 @@ static void get_local_heads(void)
 static void get_dav_remote_heads(void)
 {
 	remote_tail = &remote_refs;
-	remote_ls("refs/", (PROCESS_FILES | PROCESS_DIRS | RECURSIVE), 
process_ls_ref, NULL);
+	remote_ls(PATH_REFS, (PROCESS_FILES | PROCESS_DIRS | RECURSIVE), 
process_ls_ref, NULL);
 }
 
 static int is_zero_sha1(const unsigned char *sha1)
@@ -2063,7 +2063,7 @@ static void update_remote_info_refs(struct remote_lock 
*lock)
 	buffer.buffer = xcalloc(1, 4096);
 	buffer.size = 4096;
 	buffer.posn = 0;
-	remote_ls("refs/", (PROCESS_FILES | RECURSIVE),
+	remote_ls(PATH_REFS, (PROCESS_FILES | RECURSIVE),
 		  add_remote_info_ref, &buffer);
 	if (!aborted) {
 		if_header = xmalloc(strlen(lock->token) + 25);
diff --git a/local-fetch.c b/local-fetch.c
index 7b6875c..99c5cb2 100644
--- a/local-fetch.c
+++ b/local-fetch.c
@@ -4,6 +4,7 @@
 #include "cache.h"
 #include "commit.h"
 #include "fetch.h"
+#include "refs.h"
 
 static int use_link;
 static int use_symlink;
@@ -174,7 +175,7 @@ int fetch_ref(char *ref, unsigned char *sha1)
 	int ifd;
 
 	if (ref_name_start < 0) {
-		sprintf(filename, "%s/refs/", path);
+		sprintf(filename, "%s/" PATH_REFS, path);
 		ref_name_start = strlen(filename);
 	}
 	strcpy(filename + ref_name_start, ref);
diff --git a/path.c b/path.c
index d2c076d..10be22c 100644
--- a/path.c
+++ b/path.c
@@ -11,6 +11,7 @@
  * which is what it's designed for.
  */
 #include "cache.h"
+#include "refs.h"
 #include <pwd.h>
 
 static char bad_path[] = "/bad-path/";
@@ -103,7 +104,7 @@ int validate_symref(const char *path)
 	/* Make sure it is a "refs/.." symlink */
 	if (S_ISLNK(st.st_mode)) {
 		len = readlink(path, buffer, sizeof(buffer)-1);
-		if (len >= 5 && !memcmp("refs/", buffer, 5))
+		if (len >= 5 && !memcmp(PATH_REFS, buffer, STRLEN_PATH_REFS))
 			return 0;
 		return -1;
 	}
@@ -126,7 +127,7 @@ int validate_symref(const char *path)
 	len -= 4;
 	while (len && isspace(*buf))
 		buf++, len--;
-	if (len >= 5 && !memcmp("refs/", buf, 5))
+	if (len >= STRLEN_PATH_REFS && !memcmp(PATH_REFS, buf, STRLEN_PATH_REFS))
 		return 0;
 	return -1;
 }
diff --git a/receive-pack.c b/receive-pack.c
index e76d9ae..0d22120 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -105,7 +105,7 @@ static int update(struct command *cmd)
 	struct ref_lock *lock;
 
 	cmd->error_string = NULL;
-	if (!strncmp(name, "refs/", 5) && check_ref_format(name + 5)) {
+	if (!strncmp(name, PATH_REFS, STRLEN_PATH_REFS) && check_ref_format(name + 
STRLEN_PATH_REFS)) {
 		cmd->error_string = "funny refname";
 		return error("refusing to create funny ref '%s' locally",
 			     name);
@@ -121,7 +121,7 @@ static int update(struct command *cmd)
 	}
 	if (deny_non_fast_forwards && !is_null_sha1(new_sha1) &&
 	    !is_null_sha1(old_sha1) &&
-	    !strncmp(name, "refs/heads/", 11)) {
+	    !strncmp(name, PATH_REFS_HEADS, STRLEN_PATH_REFS_HEADS)) {
 		struct commit *old_commit, *new_commit;
 		struct commit_list *bases, *ent;
 
diff --git a/refs.c b/refs.c
index a02957c..6fb81a7 100644
--- a/refs.c
+++ b/refs.c
@@ -263,7 +263,7 @@ const char *resolve_ref(const char *ref, unsigned char 
*sha1, int reading, int *
 		/* Follow "normalized" - ie "refs/.." symlinks by hand */
 		if (S_ISLNK(st.st_mode)) {
 			len = readlink(path, buffer, sizeof(buffer)-1);
-			if (len >= 5 && !memcmp("refs/", buffer, 5)) {
+			if (len >= STRLEN_PATH_REFS && !memcmp(PATH_REFS, buffer, 
STRLEN_PATH_REFS)) {
 				buffer[len] = 0;
 				strcpy(ref_buffer, buffer);
 				ref = ref_buffer;
@@ -458,22 +458,22 @@ int head_ref(each_ref_fn fn, void *cb_data)
 
 int for_each_ref(each_ref_fn fn, void *cb_data)
 {
-	return do_for_each_ref("refs/", fn, 0, cb_data);
+	return do_for_each_ref(PATH_REFS, fn, 0, cb_data);
 }
 
 int for_each_tag_ref(each_ref_fn fn, void *cb_data)
 {
-	return do_for_each_ref("refs/tags/", fn, 10, cb_data);
+	return do_for_each_ref(PATH_REFS_TAGS, fn, STRLEN_PATH_REFS_TAGS, cb_data);
 }
 
 int for_each_branch_ref(each_ref_fn fn, void *cb_data)
 {
-	return do_for_each_ref("refs/heads/", fn, 11, cb_data);
+	return do_for_each_ref(PATH_REFS_HEADS, fn, STRLEN_PATH_REFS_HEADS, 
cb_data);
 }
 
 int for_each_remote_ref(each_ref_fn fn, void *cb_data)
 {
-	return do_for_each_ref("refs/remotes/", fn, 13, cb_data);
+	return do_for_each_ref(PATH_REFS_REMOTES, fn, STRLEN_PATH_REFS_REMOTES, 
cb_data);
 }
 
 /* NEEDSWORK: This is only used by ssh-upload and it should go; the
@@ -485,7 +485,7 @@ int get_ref_sha1(const char *ref, unsigned char *sha1)
 {
 	if (check_ref_format(ref))
 		return -1;
-	return read_ref(mkpath("refs/%s", ref), sha1);
+	return read_ref(mkpath(PATH_REFS "%s", ref), sha1);
 }
 
 /*
@@ -702,7 +702,7 @@ struct ref_lock *lock_ref_sha1(const char *ref, const 
unsigned char *old_sha1)
 	char refpath[PATH_MAX];
 	if (check_ref_format(ref))
 		return NULL;
-	strcpy(refpath, mkpath("refs/%s", ref));
+	strcpy(refpath, mkpath(PATH_REFS "%s", ref));
 	return lock_ref_sha1_basic(refpath, old_sha1, NULL);
 }
 
@@ -917,7 +917,7 @@ static int log_ref_write(struct ref_lock *lock,
 	const char *committer;
 
 	if (log_all_ref_updates &&
-	    !strncmp(lock->ref_name, "refs/heads/", 11)) {
+	    !strncmp(lock->ref_name, PATH_REFS_HEADS, STRLEN_PATH_REFS_HEADS)) {
 		if (safe_create_leading_directories(lock->log_file) < 0)
 			return error("unable to create directory for %s",
 				lock->log_file);
diff --git a/refs.h b/refs.h
index 51aab1e..cd7c428 100644
--- a/refs.h
+++ b/refs.h
@@ -13,6 +13,21 @@ struct ref_lock {
 #define REF_ISSYMREF 01
 #define REF_ISPACKED 02
 
+#define PATH_REFS                "refs/"
+#define STRLEN_PATH_REFS         5
+#define PATH_HEADS               "heads/"
+#define STRLEN_PATH_HEADS        6
+#define PATH_TAGS                "tags/"
+#define STRLEN_PATH_TAGS         5
+#define PATH_REMOTES             "remotes/"
+#define STRLEN_PATH_REMOTES      8
+#define PATH_REFS_HEADS          PATH_REFS PATH_HEADS
+#define STRLEN_PATH_REFS_HEADS   (STRLEN_PATH_REFS+STRLEN_PATH_HEADS)
+#define PATH_REFS_TAGS           PATH_REFS PATH_TAGS
+#define STRLEN_PATH_REFS_TAGS    (STRLEN_PATH_REFS+STRLEN_PATH_TAGS)
+#define PATH_REFS_REMOTES        PATH_REFS PATH_REMOTES
+#define STRLEN_PATH_REFS_REMOTES (STRLEN_PATH_REFS+STRLEN_PATH_REMOTES)
+
 /*
  * Calls the specified function for each ref file until it returns nonzero,
  * and returns the value
diff --git a/setup.c b/setup.c
index 2afdba4..ea2c4b7 100644
--- a/setup.c
+++ b/setup.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "refs.h"
 
 const char *prefix_path(const char *prefix, int len, const char *path)
 {
@@ -142,7 +143,7 @@ const char **get_pathspec(const char *prefix, const char 
**pathspec)
  */
 static int is_toplevel_directory(void)
 {
-	if (access(".git/refs/", X_OK) ||
+	if (access(".git/" PATH_REFS, X_OK) ||
 	    access(getenv(DB_ENVIRONMENT) ?
 		   getenv(DB_ENVIRONMENT) : ".git/objects/", X_OK) ||
 	    validate_symref(".git/HEAD"))
@@ -167,7 +168,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
 			die("'$%s' too big", GIT_DIR_ENVIRONMENT);
 		memcpy(path, getenv(GIT_DIR_ENVIRONMENT), len);
 		
-		strcpy(path + len, "/refs");
+		strcpy(path + len, PATH_REFS);
 		if (access(path, X_OK))
 			goto bad_dir_environ;
 		strcpy(path + len, "/HEAD");
diff --git a/sha1_name.c b/sha1_name.c
index 6d7cd78..b81c7fc 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -239,11 +239,11 @@ static int get_sha1_basic(const char *str, int len, 
unsigned char *sha1)
 {
 	static const char *fmt[] = {
 		"%.*s",
-		"refs/%.*s",
-		"refs/tags/%.*s",
-		"refs/heads/%.*s",
-		"refs/remotes/%.*s",
-		"refs/remotes/%.*s/HEAD",
+		PATH_REFS "%.*s",
+		PATH_REFS_TAGS "%.*s",
+		PATH_REFS_HEADS "%.*s",
+		PATH_REFS_REMOTES "%.*s",
+		PATH_REFS_REMOTES "%.*s/HEAD",
 		NULL
 	};
 	static const char *warning = "warning: refname '%.*s' is ambiguous.\n";
diff --git a/wt-status.c b/wt-status.c
index 6e9414d..bac8634 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -7,6 +7,7 @@
 #include "diff.h"
 #include "revision.h"
 #include "diffcore.h"
+#include "refs.h"
 
 int wt_status_use_color = 0;
 static char wt_status_colors[][COLOR_MAXLEN] = {
@@ -271,7 +272,7 @@ static void wt_status_print_verbose(struct wt_status *s)
 
 void wt_status_print(struct wt_status *s)
 {
-	if (s->branch && strcmp(s->branch, "refs/heads/master"))
+	if (s->branch && strcmp(s->branch, PATH_REFS_HEADS "master"))
 		color_printf_ln(color(WT_STATUS_HEADER),
 			"# On branch %s", s->branch);
 
-- 
1.4.4.1.g3ece-dirty

^ permalink raw reply related

* Re: Ignoring local changes
From: Andreas Ericsson @ 2006-12-14 16:44 UTC (permalink / raw)
  To: Pazu; +Cc: git
In-Reply-To: <loom.20061214T171948-279@post.gmane.org>

Pazu wrote:
> Is there any way to make git completely ignore changes to certain local files? I
> know about .gitignore, but that doesn't work when the files I want to ignore
> were already added to the repository.
> 

Yes it does. Just add the file to .gitignore and it won't be noticed
anymore.

Correction: I just tested this, and while git-add won't touch the file, 
git-update-index will, and git-status still shows it as modified.

This feels like a bug to me.

> A little more context should help you understand my need. I'm currently tracking
> a big subversion repository using git-svn; I do all my develop on local git
> branches, and later use git-svn dcommit to push these changes to the svn
> repository. 
> 
> There are some files in the svn repository (and by extension, on my local
> mirrored repository) that are almost always locally modified (eclipse/IDEA
> project files or generated artifacts that someone else added to svn), but I
> almost never want to commit then. This is a hassle in several situations:
> 
> 1) git-status always show these files as modified, polluting the output and
> making it harder for me to pinpoint the "real" changes.
> 2) git-rebase refuses to run, since the working copy will always be dirty*
> 3) since git-svn dcommit uses git-rebase, sometimes it fails for the same reason.
> 
> So, is there any way to make git look the other way regarding these files?
> 

man git-ls-files, search for .git/info/exclude and see if that works for 
you.

On a side-note, it would be neat if it was possible to set 
--exclude-per-directory as a config option. It would save an awful lot 
of hassle for imported repositories. Even more so if 
git-{cvs,svn,p4}import and the lot set it up automagically.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se

^ permalink raw reply

* Re: Ignoring local changes
From: Pazu @ 2006-12-14 16:55 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: git
In-Reply-To: <45817F8A.3050701@op5.se>

2006/12/14, Andreas Ericsson <ae@op5.se>:

> Correction: I just tested this, and while git-add won't touch the file,
> git-update-index will, and git-status still shows it as modified.

Yes, and that's exactly my problems. There are a number of
modified/removed files in my working copy that were previously added
to the repository, and git-status shows them as modified/removed, even
when they're listed in .gitignore or .git/info/exclude

> This feels like a bug to me.

Dunno, sounds like this is by design. I acknowledge that my situation
is unusual, and most often, you'll want to always track a file once
it's been added to the repository.


^ permalink raw reply

* Re: svn versus git
From: Johannes Schindelin @ 2006-12-14 16:55 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git
In-Reply-To: <fcaeb9bf0612140832v1c80bf7dgd61897111292d31@mail.gmail.com>

Hi,

On Thu, 14 Dec 2006, Nguyen Thai Ngoc Duy wrote:

> On 12/14/06, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > Two questions arise naturally:
> > 
> > - what do you need it for?
> 
> for being user-friendly and consistent.

Okay, I only thought you had a use case, which could have been possibly 
better served by other commands.

> > - have you seen the patch for git-show today, which would include this
> > functionality?
> 
> I didn't. From the patch, it seems git-show can show the index via
> ::file syntax. If so, I'd like withdraw my opinion. '::file' syntax is
> not intuitive though. Perhaps you should mention that it can show
> index (and how) in the git-show document

Well, you can reference blobs that way, but not trees.

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH] Update git-diff documentation
From: Nicolas Pitre @ 2006-12-14 17:02 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.63.0612140957590.3635@wbgn013.biozentrum.uni-wuerzburg.de>

On Thu, 14 Dec 2006, Johannes Schindelin wrote:

> Hi,
> 
> On Thu, 14 Dec 2006, Junio C Hamano wrote:
> 
> > -Show changes between two trees, a tree and the working tree, a
> > -tree and the index file, or the index file and the working tree.
> > -The combination of what is compared with what is determined by
> > -the number of trees given to the command.
> > +This command shows changes between four combinations of states.
> 
> I think the old explanation, while longer, is clearer.

It might not if you don't know what a "tree" is in git speak.  The 
notion of what a tree refers to is slowly introduced afterwards which I 
think is better than delivering everything in a dense four lines right 
up front.



^ permalink raw reply

* Re: What's in git.git (stable)
From: Nicolas Pitre @ 2006-12-14 17:06 UTC (permalink / raw)
  To: Shawn Pearce; +Cc: Andy Parkins, git
In-Reply-To: <20061214093637.GC1747@spearce.org>

On Thu, 14 Dec 2006, Shawn Pearce wrote:

> But I'm not sure that git-add should output anything.  Last I checked
> the 'mv' command in Linux doesn't say "Move 5 files" when I move 5
> files into a directory.  Likewise I don't think that knowing that
> 6781 files were added is useful, what if it should have really been
> 6782 files?  I'm unlikely to know, care, or realize it.

git-add -v does output added files already.



^ permalink raw reply

* Re: svn versus git
From: Nguyen Thai Ngoc Duy @ 2006-12-14 17:10 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0612141754420.3635@wbgn013.biozentrum.uni-wuerzburg.de>

Hi,

On 12/14/06, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > > - have you seen the patch for git-show today, which would include this
> > > functionality?
> >
> > I didn't. From the patch, it seems git-show can show the index via
> > ::file syntax. If so, I'd like withdraw my opinion. '::file' syntax is
> > not intuitive though. Perhaps you should mention that it can show
> > index (and how) in the git-show document
>
> Well, you can reference blobs that way, but not trees.

Oh, yeah. Isn't this a good oppotunity to add --index option to git-show?
git-show --index will show the index. git-show --index file will show
the file content. This makes git-show a little unconsistent though as
it may or may not require argument <object>.

Another option is treat '::' alone specially -- call git-ls-files.
-- 

^ permalink raw reply

* Re: What's in git.git (stable)
From: Nicolas Pitre @ 2006-12-14 17:23 UTC (permalink / raw)
  To: Andy Parkins; +Cc: git
In-Reply-To: <200612141021.12637.andyparkins@gmail.com>

On Thu, 14 Dec 2006, Andy Parkins wrote:

> > Besides, The fact that revert _adds_ to history is a nice way to
> > document that you reverted that change. And you can even explain in the
> > commit message, why you did it.
> 
> I'm not disputing that the /operation/ is useful, I'm arguing that it is 
> incorrectly named.

Well, people are used to say they've "reverted" a change.  Although the 
command might appear slightly misnamed wrt its operation, it still does 
what most people are expecting from such a name.



^ permalink raw reply

* Re: What's in git.git (stable)
From: Nicolas Pitre @ 2006-12-14 17:47 UTC (permalink / raw)
  To: Shawn Pearce; +Cc: Andy Parkins, git
In-Reply-To: <20061214114546.GI1747@spearce.org>

On Thu, 14 Dec 2006, Shawn Pearce wrote:

> Andy Parkins <andyparkins@gmail.com> wrote:
> > How's this then:
> > 
> > $ git commit
> > $ git commit
> > $ git commit
> > $ git reset HEAD^^^
> > 
> > "AGGGHHHHHH!  I meant HEAD^^"
> > 
> > At this point I start running "git-prune -n | grep commit" and some liberal 
> > use of git-show to try and find the hash of the object so I can do
> 
> At this point I usually try to politely suggest that users do:
> 
>   git repo-config --global core.logAllRefUpdates true
> 

And this is where I politely say that this option should be true by 
default for everybody.

I don't recall why it isn't so yet.



^ permalink raw reply

* Re: What's in git.git (stable)
From: Nicolas Pitre @ 2006-12-14 18:06 UTC (permalink / raw)
  To: Shawn Pearce; +Cc: Carl Worth, Andy Parkins, git
In-Reply-To: <20061214120518.GL1747@spearce.org>

On Thu, 14 Dec 2006, Shawn Pearce wrote:

> But the problem raised is that there are many types of repositories,
> and not all should always have reflogs enabled, and its hard to
> tell which one should and which shouldn't by default, and its even
> worse to force it into a user's ~/.gitconfig as then repositories
> which should not have reflogs are getting them anyway.

Thank you for reminding me the reasons why.

However I'd argue that the lack of reflog data is much much worse than 
needlessly having it.

It is therefore much saner to disable it in the config and remove the 
unwanted reflog files than being sorry because it wasn't enabled when 
you would have needed it.

>  * Normal working repository (wants reflogs);
>  * Bare private (backup) repository (wants reflogs);
>  * Bare shared repository (probably doesn't want reflogs);
>  * Import generated repository (probably doesn't want reflogs);

And what would be the actual problem if reflog was enabled (i.e. was not 
explicitly disabled if enabled by default) in those last two cases?

> Find a way to make git-init-db know the difference magically and 
> you'll probably see a patch emerge quickly afterwards.  But right now 
> I don't think anyone really has a great solution to the problem.

I'd say screw that.  The solution should really be this patch:

diff --git a/environment.c b/environment.c
index 84d870c..98275b2 100644
--- a/environment.c
+++ b/environment.c
@@ -15,7 +15,7 @@ int use_legacy_headers = 1;
 int trust_executable_bit = 1;
 int assume_unchanged;
 int prefer_symlink_refs;
-int log_all_ref_updates;
+int log_all_ref_updates = 1;
 int warn_ambiguous_refs = 1;
 int repository_format_version;
 char git_commit_encoding[MAX_ENCODING_LENGTH] = "utf-8";

> I know Junio wrote something on this not too long ago (and it was a
> good writeup too) but I can never find threads in gmane's archives,
> so I'm just going to leave that to someone else...

Well I must have missed it.

But unless there is real harm to have reflog enabled even when you don't 
need it I really think the default should be set to enabled.



^ permalink raw reply related

* Re: [PATCH] "master" should be treated no differently from any other branch
From: John W. Linville @ 2006-12-14 17:42 UTC (permalink / raw)
  To: Andy Parkins; +Cc: git
In-Reply-To: <200612141519.44294.andyparkins@gmail.com>

On Thu, Dec 14, 2006 at 03:19:44PM +0000, Andy Parkins wrote:
> This patch makes all merge log messages of the form:
> 
>   Merge branch XXXX into YYYY
> 
> Regardless of whether YYYY is master or not.
> 
> "master" shouldn't get special treatment; making different log messages
> based on the name of the branch is bad form.  What if a user likes
> "my/master" or "my/head" as their master branch?

Why not drop the "into YYYY" part for everyone else?  I don't find
it useful at all, and is just confusing if I merge to a temporary
branch and then pull that into master later.

John
-- 
John W. Linville

^ permalink raw reply

* Re: git-fetching from a big repository is slow
From: Nicolas Pitre @ 2006-12-14 18:14 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: Andy Parkins, git
In-Reply-To: <4581573E.40803@op5.se>

On Thu, 14 Dec 2006, Andreas Ericsson wrote:

> Andy Parkins wrote:
> > Hello,
> > 
> > I've got a big repository.  I've got two computers.  One has the repository
> > up-to-date (164M after repack); one is behind (30M ish).
> > 
> > I used git-fetch to try and update; and the sync took HOURS.  I zipped the
> > .git directory and transferred that and it took about 15 minutes to
> > transfer.
> > 
> > Am I doing something wrong?  The git-fetch was done with a git+ssh:// URL.
> > The zip transfer with scp (so ssh shouldn't be a factor).
> > 
> 
> This seems to happen if your repository consists of many large binary files,
> especially many large binary files of several versions that do not deltify
> well against each other. Perhaps it's worth adding gzip compression detecion
> to git? I imagine more people than me are tracking gzipped/bzip2'ed content
> that pretty much never deltifies well against anything else.

If your remote repository is fully packed in a single pack that should 
not have any impact on the transfer latency since no attempt to 
redeltify objects against each other is attempted by default when those 
objects are in the same pack.



^ permalink raw reply

* Re: [PATCH] "master" should be treated no differently from any other branch
From: Nicolas Pitre @ 2006-12-14 18:22 UTC (permalink / raw)
  To: Han-Wen Nienhuys; +Cc: git
In-Reply-To: <4581721B.4050102@xs4all.nl>

On Thu, 14 Dec 2006, Han-Wen Nienhuys wrote:

> Johannes Schindelin escreveu:
> > Hi,
> > 
> > On Thu, 14 Dec 2006, Andy Parkins wrote:
> > 
> >> "master" shouldn't get special treatment; making different log messages 
> >> based on the name of the branch is bad form.  What if a user likes 
> >> "my/master" or "my/head" as their master branch?
> > 
> > I do not agree. There is usually a principal branch, where you collect the 
> > topics, and you do want to treat that special. As for the name: better 
> > have a convention here than configurability. You would not want "git" to 
> > be called "guitar" for some users, just because they happen to like that 
> > name more, either, right?
> 
> Disagree: I have two principal branches, master and stable/2.10.  I don't see
> why the latter should get different commit messages.

I also agree to disagree.  "master" is maybe the default branch, but it 
is not so special to deserve a different message than any other branch.



^ permalink raw reply

* Re: [PATCH] "master" should be treated no differently from any other branch
From: Robin Rosenberg @ 2006-12-14 18:35 UTC (permalink / raw)
  To: John W. Linville; +Cc: Andy Parkins, git
In-Reply-To: <20061214174251.GA16819@tuxdriver.com>

torsdag 14 december 2006 18:42 skrev John W. Linville:
> On Thu, Dec 14, 2006 at 03:19:44PM +0000, Andy Parkins wrote:
> > This patch makes all merge log messages of the form:
> >
> >   Merge branch XXXX into YYYY
> >
> > Regardless of whether YYYY is master or not.
> >
> > "master" shouldn't get special treatment; making different log messages
> > based on the name of the branch is bad form.  What if a user likes
> > "my/master" or "my/head" as their master branch?
>
> Why not drop the "into YYYY" part for everyone else?  I don't find
> it useful at all, and is just confusing if I merge to a temporary
> branch and then pull that into master later.

Or just drop both the from, into and repo names.. A commit may come from a 
certain repo, buy you would never know since it may have been pulled there 
rather than committed, so the merge message is misleading and if the merge 
was a fast forward you wouldn't see a merge message at all.

To make everybody happy, the .git/config could contain a template that states 
the project policy on merge commits.

Obviously the person executing the merge is free to amend the merge message, 
insertering synthetic commits or whatever he/she sees fit.


^ permalink raw reply

* [PATCH] git-clone documentation
From: Quy Tonthat @ 2006-12-14 14:17 UTC (permalink / raw)
  To: git

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

When --use-separate-remote is used on git-clone, the remote
heads are saved under $GIT_DIR/refs/remotes/origin/, not
"$GIT_DIR/remotes/origin/"

Quy


[-- Attachment #2: git.diff --]
[-- Type: text/x-patch, Size: 523 bytes --]

diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 985043f..bfddb21 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -100,7 +100,7 @@ OPTIONS
 	defined default, typically `/usr/share/git-core/templates`.
 
 --use-separate-remote::
-	Save remotes heads under `$GIT_DIR/remotes/origin/` instead
+	Save remotes heads under `$GIT_DIR/refs/remotes/origin/` instead
 	of `$GIT_DIR/refs/heads/`.  Only the local master branch is
 	saved in the latter. This is the default.
 

^ permalink raw reply related

* Re: [RFC/PATCH] runstatus: restructure visual appearance
From: Jon Loeliger @ 2006-12-13 16:12 UTC (permalink / raw)
  To: Lars Hjemli; +Cc: Junio C Hamano, Git List
In-Reply-To: <8c5c35580612130127y1b094dbbq34c06376704b0506@mail.gmail.com>

On Wed, 2006-12-13 at 03:27, Lars Hjemli wrote:

> >If we are designing a new format to make git-status output more
> >compact and easier to understand, I think it should also attempt
> >to address this [mode-change] problem as well.
> 
> Excellent point, I'll use it as an excuse to refine and resend the patch.

If you are so inclined, you might google on list for a
patch I submitted down this line last year sometime?

jdl


^ permalink raw reply

* Re: svn versus git
From: Arkadiusz Miskiewicz @ 2006-12-14 19:00 UTC (permalink / raw)
  To: Andy Parkins; +Cc: git
In-Reply-To: <200612132200.41420.andyparkins@gmail.com>

On Wednesday 13 December 2006 23:00, Andy Parkins wrote:
> Hello,
>
> With all the discussion about user interface difficulties, I started to
> write a comparison with subversion document.  (I was assuming that people
> find subversion easy).  As much as I love git, I was expecting to find that
> it's hard to use interface would have subversion as the clear winner.  I
> was hoping that would then give guidance as to what could be fixed in git.
>
> I was surprised, therefore, to find that in each case I was finding that
> git was the winner.

subversion is a winner when it comes to options handling (especially --help) 
and better (error) messages. That's one of reason why people find it easy.

ps. I'm blind or there is no documentation about what utilities are needed to 
get git fully working? (like sed, coreutils, grep, rcs package (merge tool 
afaik needed)...). 

-- 
Arkadiusz Miśkiewicz        PLD/Linux Team

^ permalink raw reply

* Re: git-fetching from a big repository is slow
From: Geert Bosch @ 2006-12-14 19:05 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: Johannes Schindelin, Andy Parkins, git
In-Reply-To: <4581685D.1070407@op5.se>


On Dec 14, 2006, at 10:06, Andreas Ericsson wrote:

> It wouldn't work for this particular case though. In our  
> distribution repository we have ~300 bzip2 compressed tarballs with  
> an average size of 3MiB. 240 of those are between 2.5 and 4 MiB, so  
> they don't drastically differ, but neither do they delta well.
>
> One option would be to add some sort of config option to skip  
> attempting deltas of files with a certain suffix. That way we could  
> just tell it to ignore *.gz,*.tgz,*.bz2 and everything would work  
> just as it does today, but a lot faster.

Such special magic based on filenames is always a bad idea. Tomorrow  
somebody
comes with .zip files (oh, and of course .ZIP), then it's .jpg's other
compressed content. In the end git will be doing lots of magic and  
still perform
badly on unknown compressed content.

There is a very simple way of detecting compressed files: just look  
at the
size of the compressed blob and compare against the size of the  
expanded blob.
If the compressed blob has a non-trivial size which is close to the  
expanded
size, assume the file is not interesting as source or target for deltas.

Example:
    if (compressed_size > expanded_size / 4 * 3 + 1024) {
      /* don't try to deltify if blob doesn't compress well */
      return ...;
    }


^ 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