Git development
 help / color / mirror / Atom feed
* gitk-git/Makefile install: mkdir missing
From: Andreas Gruenbacher @ 2009-03-19 13:46 UTC (permalink / raw)
  To: git

I needed this change to get "make install DESTDIR=..." to work here:

diff --git a/gitk-git/Makefile b/gitk-git/Makefile
index e1b6045..3021be0 100644
--- a/gitk-git/Makefile
+++ b/gitk-git/Makefile
@@ -40,6 +40,7 @@ endif
 all:: gitk-wish $(ALL_MSGFILES)
 
 install:: all
+	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
 	$(INSTALL) -m 755 gitk-wish '$(DESTDIR_SQ)$(bindir_SQ)'/gitk
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(msgsdir_SQ)'
 	$(foreach p,$(ALL_MSGFILES), $(INSTALL) -m 644 
$p '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true

Andreas

^ permalink raw reply related

* Re: Gnome chose Git
From: Pat Notz @ 2009-03-19 14:01 UTC (permalink / raw)
  To: Michael J Gruber, Git
In-Reply-To: <49C24D9B.1060301@drmicha.warpmail.net>

On Thu, Mar 19, 2009 at 7:50 AM, Michael J Gruber
<git@drmicha.warpmail.net> wrote:
> Pat Notz venit, vidit, dixit 19.03.2009 14:43:
>> On Thu, Mar 19, 2009 at 7:33 AM, Michael J Gruber
>> <git@drmicha.warpmail.net> wrote:
>>> Teemu Likonen venit, vidit, dixit 19.03.2009 12:23:
>>>> FYI: The Gnome release team just announced that Gnome will migrate from
>>>> Subversion to Git:
>>>>
>>>>     http://thread.gmane.org/gmane.comp.gnome.infrastructure/1134
>>>
>>> Good choice :)
>>>
>>> Interestingly, they seem to go the svn-all-fast-export route.
>>>
>>> Also, they need push tracking for pushing through ssh, which is a common
>>> requirement for many large projects. Do we have something to support
>>> that? git-notes comes to my mind.
>>>
>>> Their current approach is writing to a single log file (receive-hook).
>>> That may support a linear push history best, but looking up who pushed
>>> what, given "what"?
>>>
>>
>> That's also something we do.  Since the post-receive hook gives you
>> the refname and the old and new refs you should have everything you
>> need.  We basically record the user name, UTC timestamp and the ref
>> info.  With a little bit more scripting you should be able to figure
>> everything else out (though post-receive isn't called for local
>> commits).
>>
>
> I know the info is there. It might just make more sense to have it in
> the git repo the way notes are/will be: It's public, it's connected to
> the commits, it's tamper proof (anyone would notice rewrites).
>

Ahh, yes.  We'd like that too.

> Michael
>
> P.S.: Was this intentionally off-list? Just in case I respected it.
>

Oops, sorry about that.  Fixed.

^ permalink raw reply

* [PATCH] Add a fast version of fstat to cygwin port
From: Alex Riesen @ 2009-03-19 14:30 UTC (permalink / raw)
  To: Git Mailing List
  Cc: Junio C Hamano, Dmitry Potapov, Johannes Schindelin,
	Johannes Sixt, Marius Storm-Olsen

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

Besides, the output of the fast stat and lstat is not compatible
with cygwin's fstat with regard to uid, gid and ctime fields.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---

This is not strictly related to the other stat patches. The fstat
code is shamelessly stolen from the mingw port, sorry.

BTW, why do we have to #undef fstat, but not stat/lstat?

 compat/cygwin.c |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 compat/cygwin.h |    2 +
 2 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/compat/cygwin.c b/compat/cygwin.c
index ebac148..e91af4f 100644
--- a/compat/cygwin.c
+++ b/compat/cygwin.c
@@ -15,6 +15,18 @@ static inline void filetime_to_timespec(const
FILETIME *ft, struct timespec *ts)

 #define size_to_blocks(s) (((s)+511)/512)

+/*
+ * Initialize the fields of struct stat which this implementation
+ * considers constant on this platform. See also mingw.c
+ */
+static void dosify_statbuf(struct stat *buf)
+{
+	buf->st_dev = buf->st_rdev = 0; /* not used by Git */
+	buf->st_ino = 0;
+	buf->st_nlink = 1;
+	buf->st_uid = buf->st_gid = 0;
+}
+
 /* do_stat is a common implementation for cygwin_lstat and cygwin_stat.
  *
  * To simplify its logic, in the case of cygwin symlinks, this implementation
@@ -41,11 +53,8 @@ static int do_stat(const char *file_name, struct
stat *buf, stat_fn_t cygstat)
 			return cygstat(file_name, buf);

 		/* fill out the stat structure */
-		buf->st_dev = buf->st_rdev = 0; /* not used by Git */
-		buf->st_ino = 0;
+		dosify_statbuf(buf);
 		buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes);
-		buf->st_nlink = 1;
-		buf->st_uid = buf->st_gid = 0;
 #ifdef __CYGWIN_USE_BIG_TYPES__
 		buf->st_size = ((_off64_t)fdata.nFileSizeHigh << 32) +
 			fdata.nFileSizeLow;
@@ -85,6 +94,41 @@ static int cygwin_stat(const char *path, struct stat *buf)
 	return do_stat(path, buf, stat);
 }

+#undef fstat
+static int cygwin_fstat(int fd, struct stat *buf)
+{
+	HANDLE fh = (HANDLE)_get_osfhandle(fd);
+	BY_HANDLE_FILE_INFORMATION fdata;
+
+	if (fh == INVALID_HANDLE_VALUE) {
+		errno = EBADF;
+		return -1;
+	}
+	/* direct non-file handles to cygwin's fstat() */
+	if (GetFileType(fh) != FILE_TYPE_DISK)
+		return fstat(fd, buf);
+
+	if (!buf) {
+		errno = EINVAL;
+		return -1;
+	}
+	if (GetFileInformationByHandle(fh, &fdata)) {
+		dosify_statbuf(buf);
+		buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes);
+#ifdef __CYGWIN_USE_BIG_TYPES__
+		buf->st_size = ((_off64_t)fdata.nFileSizeHigh << 32) +
+			fdata.nFileSizeLow;
+#else
+		buf->st_size = (off_t)fdata.nFileSizeLow;
+#endif
+		filetime_to_timespec(&fdata.ftLastAccessTime, &buf->st_atim);
+		filetime_to_timespec(&fdata.ftLastWriteTime, &buf->st_mtim);
+		filetime_to_timespec(&fdata.ftCreationTime, &buf->st_ctim);
+		return 0;
+	}
+	errno = EBADF;
+	return -1;
+}

 /*
  * At start up, we are trying to determine whether Win32 API or cygwin stat
@@ -119,9 +163,11 @@ static int init_stat(void)
 		if (!core_filemode && native_stat) {
 			cygwin_stat_fn = cygwin_stat;
 			cygwin_lstat_fn = cygwin_lstat;
+			cygwin_fstat_fn = cygwin_fstat;
 		} else {
 			cygwin_stat_fn = stat;
 			cygwin_lstat_fn = lstat;
+			cygwin_fstat_fn = fstat;
 		}
 		return 0;
 	}
@@ -138,6 +184,12 @@ static int cygwin_lstat_stub(const char
*file_name, struct stat *buf)
 	return (init_stat() ? lstat : *cygwin_lstat_fn)(file_name, buf);
 }

+static int cygwin_fstat_stub(int fd, struct stat *buf)
+{
+	return (init_stat() ? fstat : *cygwin_fstat_fn)(fd, buf);
+}
+
 stat_fn_t cygwin_stat_fn = cygwin_stat_stub;
 stat_fn_t cygwin_lstat_fn = cygwin_lstat_stub;
+int (*cygwin_fstat_fn)(int fd, struct stat *) = cygwin_fstat_stub;

diff --git a/compat/cygwin.h b/compat/cygwin.h
index a3229f5..fd54c82 100644
--- a/compat/cygwin.h
+++ b/compat/cygwin.h
@@ -4,6 +4,8 @@
 typedef int (*stat_fn_t)(const char*, struct stat*);
 extern stat_fn_t cygwin_stat_fn;
 extern stat_fn_t cygwin_lstat_fn;
+extern int (*cygwin_fstat_fn)(int fd, struct stat *);

 #define stat(path, buf) (*cygwin_stat_fn)(path, buf)
 #define lstat(path, buf) (*cygwin_lstat_fn)(path, buf)
+#define fstat(fd, buf) (*cygwin_fstat_fn)(fd, buf)
-- 
1.6.2.142.gaf8db

[-- Attachment #2: 0001-Add-a-fast-version-of-fstat-to-cygwin-port.diff --]
[-- Type: application/octet-stream, Size: 4207 bytes --]

From 47a66bf7f03106e5c48f7002a67a95bbc6959794 Mon Sep 17 00:00:00 2001
From: Alex Riesen <raa.lkml@gmail.com>
Date: Thu, 19 Mar 2009 15:18:00 +0100
Subject: [PATCH] Add a fast version of fstat to cygwin port

Besides, the output of the fast stat and lstat is not compatible
with cygwin's fstat with regard to uid, gid and ctime fields.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
 compat/cygwin.c |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 compat/cygwin.h |    2 +
 2 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/compat/cygwin.c b/compat/cygwin.c
index ebac148..e91af4f 100644
--- a/compat/cygwin.c
+++ b/compat/cygwin.c
@@ -15,6 +15,18 @@ static inline void filetime_to_timespec(const FILETIME *ft, struct timespec *ts)
 
 #define size_to_blocks(s) (((s)+511)/512)
 
+/*
+ * Initialize the fields of struct stat which this implementation
+ * considers constant on this platform. See also mingw.c
+ */
+static void dosify_statbuf(struct stat *buf)
+{
+	buf->st_dev = buf->st_rdev = 0; /* not used by Git */
+	buf->st_ino = 0;
+	buf->st_nlink = 1;
+	buf->st_uid = buf->st_gid = 0;
+}
+
 /* do_stat is a common implementation for cygwin_lstat and cygwin_stat.
  *
  * To simplify its logic, in the case of cygwin symlinks, this implementation
@@ -41,11 +53,8 @@ static int do_stat(const char *file_name, struct stat *buf, stat_fn_t cygstat)
 			return cygstat(file_name, buf);
 
 		/* fill out the stat structure */
-		buf->st_dev = buf->st_rdev = 0; /* not used by Git */
-		buf->st_ino = 0;
+		dosify_statbuf(buf);
 		buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes);
-		buf->st_nlink = 1;
-		buf->st_uid = buf->st_gid = 0;
 #ifdef __CYGWIN_USE_BIG_TYPES__
 		buf->st_size = ((_off64_t)fdata.nFileSizeHigh << 32) +
 			fdata.nFileSizeLow;
@@ -85,6 +94,41 @@ static int cygwin_stat(const char *path, struct stat *buf)
 	return do_stat(path, buf, stat);
 }
 
+#undef fstat
+static int cygwin_fstat(int fd, struct stat *buf)
+{
+	HANDLE fh = (HANDLE)_get_osfhandle(fd);
+	BY_HANDLE_FILE_INFORMATION fdata;
+
+	if (fh == INVALID_HANDLE_VALUE) {
+		errno = EBADF;
+		return -1;
+	}
+	/* direct non-file handles to cygwin's fstat() */
+	if (GetFileType(fh) != FILE_TYPE_DISK)
+		return fstat(fd, buf);
+
+	if (!buf) {
+		errno = EINVAL;
+		return -1;
+	}
+	if (GetFileInformationByHandle(fh, &fdata)) {
+		dosify_statbuf(buf);
+		buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes);
+#ifdef __CYGWIN_USE_BIG_TYPES__
+		buf->st_size = ((_off64_t)fdata.nFileSizeHigh << 32) +
+			fdata.nFileSizeLow;
+#else
+		buf->st_size = (off_t)fdata.nFileSizeLow;
+#endif
+		filetime_to_timespec(&fdata.ftLastAccessTime, &buf->st_atim);
+		filetime_to_timespec(&fdata.ftLastWriteTime, &buf->st_mtim);
+		filetime_to_timespec(&fdata.ftCreationTime, &buf->st_ctim);
+		return 0;
+	}
+	errno = EBADF;
+	return -1;
+}
 
 /*
  * At start up, we are trying to determine whether Win32 API or cygwin stat
@@ -119,9 +163,11 @@ static int init_stat(void)
 		if (!core_filemode && native_stat) {
 			cygwin_stat_fn = cygwin_stat;
 			cygwin_lstat_fn = cygwin_lstat;
+			cygwin_fstat_fn = cygwin_fstat;
 		} else {
 			cygwin_stat_fn = stat;
 			cygwin_lstat_fn = lstat;
+			cygwin_fstat_fn = fstat;
 		}
 		return 0;
 	}
@@ -138,6 +184,12 @@ static int cygwin_lstat_stub(const char *file_name, struct stat *buf)
 	return (init_stat() ? lstat : *cygwin_lstat_fn)(file_name, buf);
 }
 
+static int cygwin_fstat_stub(int fd, struct stat *buf)
+{
+	return (init_stat() ? fstat : *cygwin_fstat_fn)(fd, buf);
+}
+
 stat_fn_t cygwin_stat_fn = cygwin_stat_stub;
 stat_fn_t cygwin_lstat_fn = cygwin_lstat_stub;
+int (*cygwin_fstat_fn)(int fd, struct stat *) = cygwin_fstat_stub;
 
diff --git a/compat/cygwin.h b/compat/cygwin.h
index a3229f5..fd54c82 100644
--- a/compat/cygwin.h
+++ b/compat/cygwin.h
@@ -4,6 +4,8 @@
 typedef int (*stat_fn_t)(const char*, struct stat*);
 extern stat_fn_t cygwin_stat_fn;
 extern stat_fn_t cygwin_lstat_fn;
+extern int (*cygwin_fstat_fn)(int fd, struct stat *);
 
 #define stat(path, buf) (*cygwin_stat_fn)(path, buf)
 #define lstat(path, buf) (*cygwin_lstat_fn)(path, buf)
+#define fstat(fd, buf) (*cygwin_fstat_fn)(fd, buf)
-- 
1.6.2.142.gaf8db


^ permalink raw reply related

* Re: [PATCH v2] Introduce %<branch> as shortcut to the tracked   branch
From: Michael J Gruber @ 2009-03-19 14:52 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, Petr Baudis, Andreas Gruenbacher, git
In-Reply-To: <alpine.DEB.1.00.0903182343580.10279@pacific.mpi-cbg.de>

Johannes Schindelin venit, vidit, dixit 18.03.2009 23:46:
> Hi,
> 
> On Wed, 18 Mar 2009, Junio C Hamano wrote:
> 
>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>>
>>> Suggested by Pasky.
>>>
>>> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
>>
>> In the longer term who suggested matters much less than why such a 
>> feature is desirable, how it is used, and without it what is impossible 
>> and/or cumbersome.  What's the motivation behind this?
>>
>> You do not have to explain it to me, but you should explain it to the 
>> history that records this commit, and to the users who read doccos.
> 
> And that's not all... Documentation updates and tests for % and %<branch> 
> are missing, too.
> 
> My main motivation to make this patch was to see how fast I could come up 
> with something working that does not hurt my eyes.
> 
> But I do not have time to do more today: My main project as well as Git 
> got accepted into the Google Summer of Code program, so I am even more 
> swamped than usually.
> 
> So... if anybody feels like it, I would be very thankful for a proper 
> commit message, documentation and tests...

Just a quick note that I'm feeling like it... Though it seems this does
not quite work with local branches, i.e. a branch created with

git checkout --track -b tracking tracked

with "tracked" being a local branch. I don't see why on first inspection
of the code (branch.tracking.merge = refs/heads/tracked, so what), but
maybe you will...

Michael

^ permalink raw reply

* Re: [PATCH] Add a fast version of fstat to cygwin port
From: Johannes Sixt @ 2009-03-19 14:54 UTC (permalink / raw)
  To: Alex Riesen
  Cc: Git Mailing List, Junio C Hamano, Dmitry Potapov,
	Johannes Schindelin, Marius Storm-Olsen
In-Reply-To: <81b0412b0903190730s40589291iea9a861ddeedcc0@mail.gmail.com>

Alex Riesen schrieb:
> Besides, the output of the fast stat and lstat is not compatible
> with cygwin's fstat with regard to uid, gid and ctime fields.

Why do you need this? I don't think that fstat() is used in a critical
path. Do you see problems with the incompatible fields?

> This is not strictly related to the other stat patches. The fstat
> code is shamelessly stolen from the mingw port, sorry.

I wouldn't call it "stolen", but "copied". Because if you copy it, it
becomes your responsibility and all copied bugs are yours ;)

> BTW, why do we have to #undef fstat, but not stat/lstat?

Because stat and lstat are #defined with an argument list, but in those
instances where the cygwin version of stat/lstat is meant, they are used
*without* argument list (see cygwin_stat/lstat_stub), and no macro
expansion happens, and therefore we don't need to #undef the macro.

OTOH, do_fstat calls into cygwin's fstat() if the file handle is not a
file and uses an argument list that would cause a macro expansion if it
were not #undef'd:

> +#undef fstat
> +static int cygwin_fstat(int fd, struct stat *buf)
> +{
> +	HANDLE fh = (HANDLE)_get_osfhandle(fd);
> +	BY_HANDLE_FILE_INFORMATION fdata;
> +
> +	if (fh == INVALID_HANDLE_VALUE) {
> +		errno = EBADF;
> +		return -1;
> +	}
> +	/* direct non-file handles to cygwin's fstat() */
> +	if (GetFileType(fh) != FILE_TYPE_DISK)
> +		return fstat(fd, buf);

We never do that for stat/lstat.

-- Hannes

^ permalink raw reply

* Re: t5505-remote fails on Windows
From: Jay Soffian @ 2009-03-19 15:00 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Johannes Schindelin, Jeff King, Johannes Sixt, Git Mailing List
In-Reply-To: <7vhc1pai84.fsf@gitster.siamese.dyndns.org>

On Thu, Mar 19, 2009 at 7:02 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Do we really want an API for that?  Calling qsort() directly should be
>> obvious enough, no?
>
> I think so.  If it were done like this (notice the lack of double
> indirection in the cmp_fn signature):
>
>    typedef int string_list_item_cmp_fn(const struct string_list_item *, const struct string_list_item *);
>
>    void sort_string_list_with_fn(struct string_list *list, string_list_item_cmp_fn *);
>
> it would have made more sense, though.

Oh, wow, sorry, I didn't even realize Jeff had just added that
function. Somehow I missed that part of his patch.

j.

^ permalink raw reply

* git am from scratch
From: Andreas Gruenbacher @ 2009-03-19 15:09 UTC (permalink / raw)
  To: git

Hello,

lates git (e986ceb0): there is a bug in git am when trying to recreate the 
entire history of a repository:

	$ git format-patch --stdout rcs-history \
		| ( rm -rf fOo && mkdir fOo && cd fOo && git init && git am )
	Initialized empty Git repository in /home/agruen/git/patch/foo/.git/
	fatal: HEAD: not a valid SHA1
	fatal: bad revision 'HEAD'

When the first commit is added by hand instead, git am will import the rest of 
the mbox without problems. This is annoying because it's at least not 
immediately obvious how to recreate the initial commit with all the metadata.

Is this easily fixed?

Thanks,
Andreas

^ permalink raw reply

* [PATCH 1/2] change remote to repo in order to resolve conflicts
From: Amos King @ 2009-03-19 15:12 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Changed remote in push_http.c to repo so it won't be
confused with how remote is used else where in the
system.

Signed-off-by: Amos King <amos.l.king@gmail.com>
---
 http-push.c |  154 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 77 insertions(+), 77 deletions(-)

diff --git a/http-push.c b/http-push.c
index 48e5f38..9ac2664 100644
--- a/http-push.c
+++ b/http-push.c
@@ -97,7 +97,7 @@ struct repo
 	struct remote_lock *locks;
 };

-static struct repo *remote;
+static struct repo *repo;

 enum transfer_state {
 	NEED_FETCH,
@@ -324,7 +324,7 @@ static void start_fetch_loose(struct
transfer_request *request)

 	git_SHA1_Init(&request->c);

-	url = get_remote_object_url(remote->url, hex, 0);
+	url = get_remote_object_url(repo->url, hex, 0);
 	request->url = xstrdup(url);

 	/* If a previous temp file is present, process what was already
@@ -389,7 +389,7 @@ static void start_fetch_loose(struct
transfer_request *request)
 	request->state = RUN_FETCH_LOOSE;
 	if (!start_active_slot(slot)) {
 		fprintf(stderr, "Unable to start GET request\n");
-		remote->can_update_info_refs = 0;
+		repo->can_update_info_refs = 0;
 		release_request(request);
 	}
 }
@@ -399,7 +399,7 @@ static void start_mkcol(struct transfer_request *request)
 	char *hex = sha1_to_hex(request->obj->sha1);
 	struct active_request_slot *slot;

-	request->url = get_remote_object_url(remote->url, hex, 1);
+	request->url = get_remote_object_url(repo->url, hex, 1);

 	slot = get_active_slot();
 	slot->callback_func = process_response;
@@ -434,10 +434,10 @@ static void start_fetch_packed(struct
transfer_request *request)
 	struct transfer_request *check_request = request_queue_head;
 	struct active_request_slot *slot;

-	target = find_sha1_pack(request->obj->sha1, remote->packs);
+	target = find_sha1_pack(request->obj->sha1, repo->packs);
 	if (!target) {
 		fprintf(stderr, "Unable to fetch %s, will not be able to update
server info refs\n", sha1_to_hex(request->obj->sha1));
-		remote->can_update_info_refs = 0;
+		repo->can_update_info_refs = 0;
 		release_request(request);
 		return;
 	}
@@ -450,9 +450,9 @@ static void start_fetch_packed(struct
transfer_request *request)
 	snprintf(request->tmpfile, sizeof(request->tmpfile),
 		 "%s.temp", filename);

-	url = xmalloc(strlen(remote->url) + 64);
+	url = xmalloc(strlen(repo->url) + 64);
 	sprintf(url, "%sobjects/pack/pack-%s.pack",
-		remote->url, sha1_to_hex(target->sha1));
+		repo->url, sha1_to_hex(target->sha1));

 	/* Make sure there isn't another open request for this pack */
 	while (check_request) {
@@ -469,7 +469,7 @@ static void start_fetch_packed(struct
transfer_request *request)
 	if (!packfile) {
 		fprintf(stderr, "Unable to open local file %s for pack",
 			request->tmpfile);
-		remote->can_update_info_refs = 0;
+		repo->can_update_info_refs = 0;
 		free(url);
 		return;
 	}
@@ -505,7 +505,7 @@ static void start_fetch_packed(struct
transfer_request *request)
 	request->state = RUN_FETCH_PACKED;
 	if (!start_active_slot(slot)) {
 		fprintf(stderr, "Unable to start GET request\n");
-		remote->can_update_info_refs = 0;
+		repo->can_update_info_refs = 0;
 		release_request(request);
 	}
 }
@@ -554,10 +554,10 @@ static void start_put(struct transfer_request *request)
 	request->buffer.buf.len = stream.total_out;

 	strbuf_addstr(&buf, "Destination: ");
-	append_remote_object_url(&buf, remote->url, hex, 0);
+	append_remote_object_url(&buf, repo->url, hex, 0);
 	request->dest = strbuf_detach(&buf, NULL);

-	append_remote_object_url(&buf, remote->url, hex, 0);
+	append_remote_object_url(&buf, repo->url, hex, 0);
 	strbuf_add(&buf, request->lock->tmpfile_suffix, 41);
 	request->url = strbuf_detach(&buf, NULL);

@@ -648,7 +648,7 @@ static int refresh_lock(struct remote_lock *lock)

 static void check_locks(void)
 {
-	struct remote_lock *lock = remote->locks;
+	struct remote_lock *lock = repo->locks;
 	time_t current_time = time(NULL);
 	int time_remaining;

@@ -788,7 +788,7 @@ static void finish_request(struct transfer_request *request)
 		if (request->curl_result != CURLE_OK) {
 			fprintf(stderr, "Unable to get pack file %s\n%s",
 				request->url, curl_errorstr);
-			remote->can_update_info_refs = 0;
+			repo->can_update_info_refs = 0;
 		} else {
 			off_t pack_size = ftell(request->local_stream);

@@ -798,7 +798,7 @@ static void finish_request(struct transfer_request *request)
 					       request->filename)) {
 				target = (struct packed_git *)request->userData;
 				target->pack_size = pack_size;
-				lst = &remote->packs;
+				lst = &repo->packs;
 				while (*lst != target)
 					lst = &((*lst)->next);
 				*lst = (*lst)->next;
@@ -806,7 +806,7 @@ static void finish_request(struct transfer_request *request)
 				if (!verify_pack(target))
 					install_packed_git(target);
 				else
-					remote->can_update_info_refs = 0;
+					repo->can_update_info_refs = 0;
 			}
 		}
 		release_request(request);
@@ -889,7 +889,7 @@ static int add_send_request(struct object *obj,
struct remote_lock *lock)
 		get_remote_object_list(obj->sha1[0]);
 	if (obj->flags & (REMOTE | PUSHING))
 		return 0;
-	target = find_sha1_pack(obj->sha1, remote->packs);
+	target = find_sha1_pack(obj->sha1, repo->packs);
 	if (target) {
 		obj->flags |= REMOTE;
 		return 0;
@@ -930,8 +930,8 @@ static int fetch_index(unsigned char *sha1)
 	struct slot_results results;

 	/* Don't use the index if the pack isn't there */
-	url = xmalloc(strlen(remote->url) + 64);
-	sprintf(url, "%sobjects/pack/pack-%s.pack", remote->url, hex);
+	url = xmalloc(strlen(repo->url) + 64);
+	sprintf(url, "%sobjects/pack/pack-%s.pack", repo->url, hex);
 	slot = get_active_slot();
 	slot->results = &results;
 	curl_easy_setopt(slot->curl, CURLOPT_URL, url);
@@ -956,7 +956,7 @@ static int fetch_index(unsigned char *sha1)
 	if (push_verbosely)
 		fprintf(stderr, "Getting index for pack %s\n", hex);

-	sprintf(url, "%sobjects/pack/pack-%s.idx", remote->url, hex);
+	sprintf(url, "%sobjects/pack/pack-%s.idx", repo->url, hex);

 	filename = sha1_pack_index_name(sha1);
 	snprintf(tmpfile, sizeof(tmpfile), "%s.temp", filename);
@@ -1018,8 +1018,8 @@ static int setup_index(unsigned char *sha1)
 		return -1;

 	new_pack = parse_pack_index(sha1);
-	new_pack->next = remote->packs;
-	remote->packs = new_pack;
+	new_pack->next = repo->packs;
+	repo->packs = new_pack;
 	return 0;
 }

@@ -1037,8 +1037,8 @@ static int fetch_indices(void)
 	if (push_verbosely)
 		fprintf(stderr, "Getting pack list\n");

-	url = xmalloc(strlen(remote->url) + 20);
-	sprintf(url, "%sobjects/info/packs", remote->url);
+	url = xmalloc(strlen(repo->url) + 20);
+	sprintf(url, "%sobjects/info/packs", repo->url);

 	slot = get_active_slot();
 	slot->results = &results;
@@ -1223,11 +1223,11 @@ static struct remote_lock *lock_remote(const
char *path, long timeout)
 	struct curl_slist *dav_headers = NULL;
 	struct xml_ctx ctx;

-	url = xmalloc(strlen(remote->url) + strlen(path) + 1);
-	sprintf(url, "%s%s", remote->url, path);
+	url = xmalloc(strlen(repo->url) + strlen(path) + 1);
+	sprintf(url, "%s%s", repo->url, path);

 	/* Make sure leading directories exist for the remote ref */
-	ep = strchr(url + strlen(remote->url) + 1, '/');
+	ep = strchr(url + strlen(repo->url) + 1, '/');
 	while (ep) {
 		char saved_character = ep[1];
 		ep[1] = '\0';
@@ -1319,8 +1319,8 @@ static struct remote_lock *lock_remote(const
char *path, long timeout)
 	} else {
 		lock->url = url;
 		lock->start_time = time(NULL);
-		lock->next = remote->locks;
-		remote->locks = lock;
+		lock->next = repo->locks;
+		repo->locks = lock;
 	}

 	return lock;
@@ -1330,7 +1330,7 @@ static int unlock_remote(struct remote_lock *lock)
 {
 	struct active_request_slot *slot;
 	struct slot_results results;
-	struct remote_lock *prev = remote->locks;
+	struct remote_lock *prev = repo->locks;
 	struct curl_slist *dav_headers;
 	int rc = 0;

@@ -1356,8 +1356,8 @@ static int unlock_remote(struct remote_lock *lock)

 	curl_slist_free_all(dav_headers);

-	if (remote->locks == lock) {
-		remote->locks = lock->next;
+	if (repo->locks == lock) {
+		repo->locks = lock->next;
 	} else {
 		while (prev && prev->next != lock)
 			prev = prev->next;
@@ -1375,9 +1375,9 @@ static int unlock_remote(struct remote_lock *lock)

 static void remove_locks(void)
 {
-	struct remote_lock *lock = remote->locks;
+	struct remote_lock *lock = repo->locks;

-	fprintf(stderr, "Removing remote locks...\n");
+	fprintf(stderr, "Removing repo locks...\n");
 	while (lock) {
 		unlock_remote(lock);
 		lock = lock->next;
@@ -1457,7 +1457,7 @@ static void handle_remote_ls_ctx(struct xml_ctx
*ctx, int tag_closed)
 				}
 			}
 			if (path) {
-				path += remote->path_len;
+				path += repo->path_len;
 				ls->dentry_name = xstrdup(path);
 			}
 		} else if (!strcmp(ctx->name, DAV_PROPFIND_COLLECTION)) {
@@ -1480,7 +1480,7 @@ static void remote_ls(const char *path, int flags,
 		      void (*userFunc)(struct remote_ls_ctx *ls),
 		      void *userData)
 {
-	char *url = xmalloc(strlen(remote->url) + strlen(path) + 1);
+	char *url = xmalloc(strlen(repo->url) + strlen(path) + 1);
 	struct active_request_slot *slot;
 	struct slot_results results;
 	struct strbuf in_buffer = STRBUF_INIT;
@@ -1496,7 +1496,7 @@ static void remote_ls(const char *path, int flags,
 	ls.userData = userData;
 	ls.userFunc = userFunc;

-	sprintf(url, "%s%s", remote->url, path);
+	sprintf(url, "%s%s", repo->url, path);

 	strbuf_addf(&out_buffer.buf, PROPFIND_ALL_REQUEST);

@@ -1574,7 +1574,7 @@ static int locking_available(void)
 	struct xml_ctx ctx;
 	int lock_flags = 0;

-	strbuf_addf(&out_buffer.buf, PROPFIND_SUPPORTEDLOCK_REQUEST, remote->url);
+	strbuf_addf(&out_buffer.buf, PROPFIND_SUPPORTEDLOCK_REQUEST, repo->url);

 	dav_headers = curl_slist_append(dav_headers, "Depth: 0");
 	dav_headers = curl_slist_append(dav_headers, "Content-Type: text/xml");
@@ -1586,7 +1586,7 @@ static int locking_available(void)
 	curl_easy_setopt(slot->curl, CURLOPT_READFUNCTION, fread_buffer);
 	curl_easy_setopt(slot->curl, CURLOPT_FILE, &in_buffer);
 	curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
-	curl_easy_setopt(slot->curl, CURLOPT_URL, remote->url);
+	curl_easy_setopt(slot->curl, CURLOPT_URL, repo->url);
 	curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 1);
 	curl_easy_setopt(slot->curl, CURLOPT_CUSTOMREQUEST, DAV_PROPFIND);
 	curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, dav_headers);
@@ -1617,15 +1617,15 @@ static int locking_available(void)
 			XML_ParserFree(parser);
 			if (!lock_flags)
 				error("Error: no DAV locking support on %s",
-				      remote->url);
+				      repo->url);

 		} else {
 			error("Cannot access URL %s, return code %d",
-			      remote->url, results.curl_result);
+			      repo->url, results.curl_result);
 			lock_flags = 0;
 		}
 	} else {
-		error("Unable to start PROPFIND request on %s", remote->url);
+		error("Unable to start PROPFIND request on %s", repo->url);
 	}

 	strbuf_release(&out_buffer.buf);
@@ -1801,10 +1801,10 @@ static void one_remote_ref(char *refname)

 	ref = alloc_ref(refname);

-	if (http_fetch_ref(remote->url, ref) != 0) {
+	if (http_fetch_ref(repo->url, ref) != 0) {
 		fprintf(stderr,
 			"Unable to fetch ref %s from %s\n",
-			refname, remote->url);
+			refname, repo->url);
 		free(ref);
 		return;
 	}
@@ -1813,7 +1813,7 @@ static void one_remote_ref(char *refname)
 	 * Fetch a copy of the object if it doesn't exist locally - it
 	 * may be required for updating server info later.
 	 */
-	if (remote->can_update_info_refs && !has_sha1_file(ref->old_sha1)) {
+	if (repo->can_update_info_refs && !has_sha1_file(ref->old_sha1)) {
 		obj = lookup_unknown_object(ref->old_sha1);
 		if (obj) {
 			fprintf(stderr,	"  fetch %s for %s\n",
@@ -1853,10 +1853,10 @@ static void add_remote_info_ref(struct
remote_ls_ctx *ls)

 	ref = alloc_ref(ls->dentry_name);

-	if (http_fetch_ref(remote->url, ref) != 0) {
+	if (http_fetch_ref(repo->url, ref) != 0) {
 		fprintf(stderr,
 			"Unable to fetch ref %s from %s\n",
-			ls->dentry_name, remote->url);
+			ls->dentry_name, repo->url);
 		aborted = 1;
 		free(ref);
 		return;
@@ -1931,12 +1931,12 @@ static void update_remote_info_refs(struct
remote_lock *lock)

 static int remote_exists(const char *path)
 {
-	char *url = xmalloc(strlen(remote->url) + strlen(path) + 1);
+	char *url = xmalloc(strlen(repo->url) + strlen(path) + 1);
 	struct active_request_slot *slot;
 	struct slot_results results;
 	int ret = -1;

-	sprintf(url, "%s%s", remote->url, path);
+	sprintf(url, "%s%s", repo->url, path);

 	slot = get_active_slot();
 	slot->results = &results;
@@ -1966,8 +1966,8 @@ static void fetch_symref(const char *path, char
**symref, unsigned char *sha1)
 	struct active_request_slot *slot;
 	struct slot_results results;

-	url = xmalloc(strlen(remote->url) + strlen(path) + 1);
-	sprintf(url, "%s%s", remote->url, path);
+	url = xmalloc(strlen(repo->url) + strlen(path) + 1);
+	sprintf(url, "%s%s", repo->url, path);

 	slot = get_active_slot();
 	slot->results = &results;
@@ -2082,7 +2082,7 @@ static int delete_remote_branch(char *pattern, int force)
 				     "of your current HEAD.\n"
 				     "If you are sure you want to delete it,"
 				     " run:\n\t'git http-push -D %s %s'",
-				     remote_ref->name, remote->url, pattern);
+				     remote_ref->name, repo->url, pattern);
 		}
 	}

@@ -2090,8 +2090,8 @@ static int delete_remote_branch(char *pattern, int force)
 	fprintf(stderr, "Removing remote branch '%s'\n", remote_ref->name);
 	if (dry_run)
 		return 0;
-	url = xmalloc(strlen(remote->url) + strlen(remote_ref->name) + 1);
-	sprintf(url, "%s%s", remote->url, remote_ref->name);
+	url = xmalloc(strlen(repo->url) + strlen(remote_ref->name) + 1);
+	sprintf(url, "%s%s", repo->url, remote_ref->name);
 	slot = get_active_slot();
 	slot->results = &results;
 	curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
@@ -2134,7 +2134,7 @@ int main(int argc, char **argv)

 	setup_git_directory();

-	remote = xcalloc(sizeof(*remote), 1);
+	repo = xcalloc(sizeof(*repo), 1);

 	argv++;
 	for (i = 1; i < argc; i++, argv++) {
@@ -2167,14 +2167,14 @@ int main(int argc, char **argv)
 				continue;
 			}
 		}
-		if (!remote->url) {
+		if (!repo->url) {
 			char *path = strstr(arg, "//");
-			remote->url = arg;
-			remote->path_len = strlen(arg);
+			repo->url = arg;
+			repo->path_len = strlen(arg);
 			if (path) {
-				remote->path = strchr(path+2, '/');
-				if (remote->path)
-					remote->path_len = strlen(remote->path);
+				repo->path = strchr(path+2, '/');
+				if (repo->path)
+					repo->path_len = strlen(repo->path);
 			}
 			continue;
 		}
@@ -2187,7 +2187,7 @@ int main(int argc, char **argv)
 	die("git-push is not available for http/https repository when not
compiled with USE_CURL_MULTI");
 #endif

-	if (!remote->url)
+	if (!repo->url)
 		usage(http_push_usage);

 	if (delete_branch && nr_refspec != 1)
@@ -2199,13 +2199,13 @@ int main(int argc, char **argv)

 	no_pragma_header = curl_slist_append(no_pragma_header, "Pragma:");

-	if (remote->url && remote->url[strlen(remote->url)-1] != '/') {
-		rewritten_url = xmalloc(strlen(remote->url)+2);
-		strcpy(rewritten_url, remote->url);
+	if (repo->url && repo->url[strlen(repo->url)-1] != '/') {
+		rewritten_url = xmalloc(strlen(repo->url)+2);
+		strcpy(rewritten_url, repo->url);
 		strcat(rewritten_url, "/");
-		remote->path = rewritten_url + (remote->path - remote->url);
-		remote->path_len++;
-		remote->url = rewritten_url;
+		repo->path = rewritten_url + (repo->path - repo->url);
+		repo->path_len++;
+		repo->url = rewritten_url;
 	}

 	/* Verify DAV compliance/lock support */
@@ -2217,20 +2217,20 @@ int main(int argc, char **argv)
 	sigchain_push_common(remove_locks_on_signal);

 	/* Check whether the remote has server info files */
-	remote->can_update_info_refs = 0;
-	remote->has_info_refs = remote_exists("info/refs");
-	remote->has_info_packs = remote_exists("objects/info/packs");
-	if (remote->has_info_refs) {
+	repo->can_update_info_refs = 0;
+	repo->has_info_refs = remote_exists("info/refs");
+	repo->has_info_packs = remote_exists("objects/info/packs");
+	if (repo->has_info_refs) {
 		info_ref_lock = lock_remote("info/refs", LOCK_TIME);
 		if (info_ref_lock)
-			remote->can_update_info_refs = 1;
+			repo->can_update_info_refs = 1;
 		else {
 			fprintf(stderr, "Error: cannot lock existing info/refs\n");
 			rc = 1;
 			goto cleanup;
 		}
 	}
-	if (remote->has_info_packs)
+	if (repo->has_info_packs)
 		fetch_indices();

 	/* Get a list of all local and remote heads to validate refspecs */
@@ -2388,8 +2388,8 @@ int main(int argc, char **argv)
 	}

 	/* Update remote server info if appropriate */
-	if (remote->has_info_refs && new_refs) {
-		if (info_ref_lock && remote->can_update_info_refs) {
+	if (repo->has_info_refs && new_refs) {
+		if (info_ref_lock && repo->can_update_info_refs) {
 			fprintf(stderr, "Updating remote server info\n");
 			if (!dry_run)
 				update_remote_info_refs(info_ref_lock);
@@ -2402,7 +2402,7 @@ int main(int argc, char **argv)
 	free(rewritten_url);
 	if (info_ref_lock)
 		unlock_remote(info_ref_lock);
-	free(remote);
+	free(repo);

 	curl_slist_free_all(no_pragma_header);

-- 
1.6.2.GIT

^ permalink raw reply related

* [PATCH 2/2] Allow http authentication via prompt for http push.
From: Amos King @ 2009-03-19 15:12 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Schindelin

There is now a faux remote created in order to
be passed to http_init.

Signed-off-by: Amos King <amos.l.king@gmail.com>
---
 http-push.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/http-push.c b/http-push.c
index 9ac2664..468d5af 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2195,7 +2195,16 @@ int main(int argc, char **argv)

 	memset(remote_dir_exists, -1, 256);

-	http_init(NULL);
+	/*
+	 * This is a faked remote so that http_init can
+	 * get the correct data for builidng out athorization.
+	 */
+	struct remote *remote;
+	remote = xcalloc(sizeof(*remote), 1);
+	ALLOC_GROW(remote->url, remote->url_nr + 1, remote->url_alloc);
+	remote->url[remote->url_nr++] = repo->url;
+
+	http_init(remote);

 	no_pragma_header = curl_slist_append(no_pragma_header, "Pragma:");

-- 
1.6.2.GIT

^ permalink raw reply related

* Re: [PATCH] Add a fast version of fstat to cygwin port
From: Alex Riesen @ 2009-03-19 15:14 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Git Mailing List, Junio C Hamano, Dmitry Potapov,
	Johannes Schindelin, Marius Storm-Olsen
In-Reply-To: <49C25CAE.6000003@viscovery.net>

2009/3/19 Johannes Sixt <j.sixt@viscovery.net>:
> Alex Riesen schrieb:
>> BTW, why do we have to #undef fstat, but not stat/lstat?
>
> Because stat and lstat are #defined with an argument list, but in those
> instances where the cygwin version of stat/lstat is meant, they are used
> *without* argument list (see cygwin_stat/lstat_stub), and no macro
> expansion happens, and therefore we don't need to #undef the macro.
>
> OTOH, do_fstat calls into cygwin's fstat() if the file handle is not a
> file and uses an argument list that would cause a macro expansion if it
> were not #undef'd:
>
...
>> +     /* direct non-file handles to cygwin's fstat() */
>> +     if (GetFileType(fh) != FILE_TYPE_DISK)
>> +             return fstat(fd, buf);
>
> We never do that for stat/lstat.

I see. Not immediately obvious :)
Thanks!

^ permalink raw reply

* Re: Gnome chose Git
From: Shawn O. Pearce @ 2009-03-19 15:16 UTC (permalink / raw)
  To: Pat Notz; +Cc: Michael J Gruber, Git
In-Reply-To: <1cd1989b0903190701uac4602dl1d2c3cace45a9938@mail.gmail.com>

Pat Notz <patnotz@gmail.com> wrote:
> On Thu, Mar 19, 2009 at 7:50 AM, Michael J Gruber
> <git@drmicha.warpmail.net> wrote:
> > Pat Notz venit, vidit, dixit 19.03.2009 14:43:
> >> On Thu, Mar 19, 2009 at 7:33 AM, Michael J Gruber
> >> <git@drmicha.warpmail.net> wrote:
> >>>
> >>> Also, they need push tracking for pushing through ssh, which is a common
> >>> requirement for many large projects. Do we have something to support
> >>> that? git-notes comes to my mind.
> >>>
> >>> Their current approach is writing to a single log file (receive-hook).
> >>> That may support a linear push history best, but looking up who pushed
> >>> what, given "what"?
> >>
> >> That's also something we do. ?Since the post-receive hook gives you
> >> the refname and the old and new refs you should have everything you
> >> need. ?We basically record the user name, UTC timestamp and the ref
> >> info. ?With a little bit more scripting you should be able to figure
> >> everything else out (though post-receive isn't called for local
> >> commits).

Why are people reinventing the reflog, and core.logallrefupdates ?

> > I know the info is there. It might just make more sense to have it in
> > the git repo the way notes are/will be: It's public, it's connected to
> > the commits, it's tamper proof (anyone would notice rewrites).
> 
> Ahh, yes.  We'd like that too.

Eclipse is also talking about Git, and has a similar problem.

Anytime you start talking about "who put what" though, you get into a
"where, and why does it matter?"

Imagine you are Eclipse Foundation or GNOME, you need to know which
authorized developer put the code on your servers.

But imagine you are an ISV like Oracle or IBM and you consume
code from the upstream project (Eclipse), put it on your servers,
add some "extra sauce", and distribute the result in some form.
Who put what on the Eclipse server isn't relevant, but what employee
your clone to use 3.4.1 instead of 3.4.0 matters a whole lot more.
For the most part, you just trust the upstream to do their own
IP tracking and diligence, as they have the contributor license
agreements, and you don't.

Its a thorny problem.  We've talked about trying to add some sort
of GnuPG signature into a push stream (for example) to allow the
server to store a record of who-did-what-when and later distribute
that back.

  http://thread.gmane.org/gmane.comp.version-control.git/71849

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH v2] Introduce %<branch> as shortcut to the tracked   branch
From: Michael J Gruber @ 2009-03-19 15:17 UTC (permalink / raw)
  Cc: Johannes Schindelin, Junio C Hamano, Petr Baudis,
	Andreas Gruenbacher, git
In-Reply-To: <49C25C4A.2010202@drmicha.warpmail.net>

Michael J Gruber venit, vidit, dixit 19.03.2009 15:52:
> Johannes Schindelin venit, vidit, dixit 18.03.2009 23:46:
>> Hi,
>>
>> On Wed, 18 Mar 2009, Junio C Hamano wrote:
>>
>>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>>>
>>>> Suggested by Pasky.
>>>>
>>>> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
>>>
>>> In the longer term who suggested matters much less than why such a 
>>> feature is desirable, how it is used, and without it what is impossible 
>>> and/or cumbersome.  What's the motivation behind this?
>>>
>>> You do not have to explain it to me, but you should explain it to the 
>>> history that records this commit, and to the users who read doccos.
>>
>> And that's not all... Documentation updates and tests for % and %<branch> 
>> are missing, too.
>>
>> My main motivation to make this patch was to see how fast I could come up 
>> with something working that does not hurt my eyes.
>>
>> But I do not have time to do more today: My main project as well as Git 
>> got accepted into the Google Summer of Code program, so I am even more 
>> swamped than usually.
>>
>> So... if anybody feels like it, I would be very thankful for a proper 
>> commit message, documentation and tests...
> 
> Just a quick note that I'm feeling like it... Though it seems this does
> not quite work with local branches, i.e. a branch created with
> 
> git checkout --track -b tracking tracked
> 
> with "tracked" being a local branch. I don't see why on first inspection
> of the code (branch.tracking.merge = refs/heads/tracked, so what), but
> maybe you will...

So, for a local branch, branch_get() returns a branch without merge info
even though it's in the config (the remote is "." here). "git branch
--track" is specifically meant for (branching off a ) local branch,
because it's the default for remote branches anyway. Right? Does not
look right.

Michael

^ permalink raw reply

* [PATCH v3 2/3] document --force-rebase
From: Michele Ballabio @ 2009-03-19 15:28 UTC (permalink / raw)
  To: srabbelier, gitster; +Cc: git
In-Reply-To: <fabb9a1e0903190401k1127dc8ev7704c8a7bd381c99@mail.gmail.com>

Words by Junio.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
---

On Thursday 19 March 2009, Sverre Rabbelier wrote:
> Awesome, thanks! Perhaps you could, for extra brownie points, add a
> line to the --whitespace=fix documentation that it implies
> --force-rebase?

You're right, I resent 3/3 for the same reason.

 Documentation/git-rebase.txt |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 57bd333..7ffeec8 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -258,10 +258,19 @@ OPTIONS
 	context exist they all must match.  By default no context is
 	ever ignored.
 
+-f::
+--force-rebase::
+	Force the rebase even if the current branch is a descendant
+	of the commit you are rebasing onto.  Normally the command will
+	exit with the message "Current branch is up to date" in such a
+	situation.
+
 --whitespace=<option>::
 	This flag is passed to the 'git-apply' program
 	(see linkgit:git-apply[1]) that applies the patch.
 	Incompatible with the --interactive option.
+	If the option `fix` (or its equivalent `strip`) is used, it implies
+	--force-rebase.
 
 -i::
 --interactive::
-- 
1.6.2.22.gc2ac

^ permalink raw reply related

* [PATCH v3 3/3] rebase: add options passed to git-am
From: Michele Ballabio @ 2009-03-19 15:28 UTC (permalink / raw)
  To: srabbelier, gitster; +Cc: git
In-Reply-To: <fabb9a1e0903190401k1127dc8ev7704c8a7bd381c99@mail.gmail.com>

Add the options --committer-date-is-author-date and --ignore-date
to git-rebase. They were introduced in commit a79ec62d0 for git-am.
These options imply --force-rebase.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
---
 Documentation/git-rebase.txt |    6 ++++++
 git-rebase.sh                |    4 ++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 7ffeec8..592ec76 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -272,6 +272,12 @@ OPTIONS
 	If the flag `fix` (or its equivalent `strip`) is used, it implies
 	--force-rebase.
 
+--committer-date-is-author-date::
+--ignore-date::
+	These flags are passed to 'git-am' to easily change the dates
+	of the rebased commits (see linkgit:git-am[1]).
+	Both imply --force-rebase.
+
 -i::
 --interactive::
 	Make a list of the commits which are about to be rebased.  Let the
diff --git a/git-rebase.sh b/git-rebase.sh
index e38d68a..b83fd3f 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -309,6 +309,10 @@ do
 			;;
 		esac
 		;;
+	--committer-date-is-author-date|--ignore-date)
+		git_am_opt="$git_am_opt $1"
+		force_rebase=t
+		;;
 	-C*)
 		git_am_opt="$git_am_opt $1"
 		;;
-- 
1.6.2.22.gc2ac

^ permalink raw reply related

* Re: [PATCH 2/2] Make Git respect changes to .gitattributes during checkout.
From: Kristian Amlie @ 2009-03-19 15:42 UTC (permalink / raw)
  To: ext Junio C Hamano; +Cc: git@vger.kernel.org
In-Reply-To: <7vprgkg2kx.fsf@gitster.siamese.dyndns.org>

ext Junio C Hamano wrote:
> In a well structured git program, we always read from the work tree and
> the index (to see if there is something changed---you need to be able to
> apply convert_to_git when you do this), internally compute what should
> happen (e.g. decide that the new result needs to be checked out for a
> path), and then write it out (you apply convert_to_working_tree while you
> do this).  So how about doing something like the attached patch?
> 
> The patch allows the caller to tell the usual "read from the working tree,
> if not use the version from the index as the fallback" logic to be swapped
> around, and take the index version.  It may or may not pass your new tests
> (I haven't even compile tested it), but I think the damage is minimized
> compared to your version.

You're right, that's a much cleaner approach. The patch is really good
as far as I can see. It fixes both my test cases (including the one I
wasn't able to fix), and there are no additional failures when running
the autotests. Do you have second thoughts about it, or is it good
enough to apply?

If it is, I'll move the test case into t0021-conversion.sh like you said
and give you a new patch for that.

> It is great that you are trying to fix this issue for the most obvious
> "switching between two branches while not having a local change" case, but
> frankly, I do not think this is solvable in more general cases, and that
> is why it was kept "known to be broken, not worth fixing" state.
> 
> For example, you may notice that, after making a clean checkout, one path
> has a wrong attribute assigned to it, and may try to correct it.  But how?
> 
>  $ edit .gitattributes ;# mark foo.dat as binary
>  $ rm foo.dat
>  $ git checkout foo.dat ;# make sure the new settings is correct???

As far as I can see, this works without any modifications to the patch.
Is that maybe because git_attr_set_direction() is not called if you use
that form of checkout?

--
Kristian

^ permalink raw reply

* Re: [PATCH JGIT] Method invokes inefficient Number constructor; use static valueOf instead
From: Shawn O. Pearce @ 2009-03-19 15:49 UTC (permalink / raw)
  To: Yann Simon; +Cc: Robin Rosenberg, git
In-Reply-To: <49C20D13.2050908@gmail.com>

Yann Simon <yann.simon.fr@gmail.com> wrote:
> From FindBugs:
> Using new Integer(int) is guaranteed to always result in a new object
> whereas Integer.valueOf(int) allows caching of values to be done by the
> compiler, class library, or JVM. Using of cached values avoids object
> allocation and the code will be faster.

Ah, yes.

> Values between -128 and 127 are guaranteed to have corresponding cached
> instances [...]
...
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
> index e0e4855..04ef59d 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
> @@ -383,7 +383,7 @@ private void resolveDeltas(final ProgressMonitor progress)
>  	private void resolveDeltas(final PackedObjectInfo oe) throws IOException {
>  		final int oldCRC = oe.getCRC();
>  		if (baseById.containsKey(oe)
> -				|| baseByPos.containsKey(new Long(oe.getOffset())))
> +				|| baseByPos.containsKey(Long.valueOf(oe.getOffset())))

Why I box with new Long() over Long.valueOf():

 The standard only requires -128..127 to be cached.  A JRE can
 cache value outside of this range if it chooses, but long has a
 huge range, its unlikely to cache much beyond this required region.

 Most pack files are in the 10 MB...100+ MB range.  Most objects
 take more than 100 bytes in a pack, even compressed delta encoded.
 Thus any object after the first is going to have its offset outside
 of the cached range.

 In other words, why waste the CPU cycles on the "cached range
 bounds check" when I'm always going to fail and allocate.  I might
 as well just allocate

 These sections of code are rather performance critical for the
 indexing phase of a pack receive, on either side of a connection.
 I need to shave even more instructions out of the critical paths,
 as its not fast enough as-is.  Using new Long() is quicker than
 using Long.valueOf(), so new Long() it is.

> @@ -448,7 +448,7 @@ private void resolveDeltas(final long pos, final int oldCRC, int type,
>  	private void resolveChildDeltas(final long pos, int type, byte[] data,
>  			PackedObjectInfo oe) throws IOException {
>  		final ArrayList<UnresolvedDelta> a = baseById.remove(oe);
> -		final ArrayList<UnresolvedDelta> b = baseByPos.remove(new Long(pos));
> +		final ArrayList<UnresolvedDelta> b = baseByPos.remove(Long.valueOf(pos));
>  		int ai = 0, bi = 0;
>  		if (a != null && b != null) {
>  			while (ai < a.size() && bi < b.size()) {
> @@ -679,7 +679,7 @@ private void indexOneObject() throws IOException {
>  				ofs <<= 7;
>  				ofs += (c & 127);
>  			}
> -			final Long base = new Long(pos - ofs);
> +			final Long base = Long.valueOf(pos - ofs);
>  			ArrayList<UnresolvedDelta> r = baseByPos.get(base);

See above for why these two hunks allocate rather than use valueOf()
or even the implicit compiler produced auto-boxing (which uses
valueOf).

But your first hunk (which I snipped) is fine to apply.

-- 
Shawn.

^ permalink raw reply

* Re: Gnome chose Git
From: Pat Notz @ 2009-03-19 15:50 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Michael J Gruber, Git
In-Reply-To: <20090319151610.GO23521@spearce.org>

On Thu, Mar 19, 2009 at 9:16 AM, Shawn O. Pearce <spearce@spearce.org> wrote:
>
> Why are people reinventing the reflog, and core.logallrefupdates ?
>

Hmmm, lack of awareness of core.logallrefupdates in my case.  Thanks
for the pointer.

~ Pat

^ permalink raw reply

* Re: [PATCH JGIT] Method invokes inefficient new String(String) constructor
From: Shawn O. Pearce @ 2009-03-19 16:01 UTC (permalink / raw)
  To: Yann Simon; +Cc: Robin Rosenberg, git
In-Reply-To: <49C20D4E.5020203@gmail.com>

Yann Simon <yann.simon.fr@gmail.com> wrote:
> From FindBugs:
> Using the java.lang.String(String) constructor wastes memory because
> the object so constructed will be functionally indistinguishable from
> the String passed as a parameter. Just use the argument String directly.
> 
> Signed-off-by: Yann Simon <yann.simon.fr@gmail.com>
> ---
>  .../src/org/spearce/jgit/lib/RefDatabase.java      |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
> index 87f26bf..49da538 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
> @@ -447,7 +447,7 @@ private synchronized void refreshPackedRefs() {
>  
>  					final int sp = p.indexOf(' ');
>  					final ObjectId id = ObjectId.fromString(p.substring(0, sp));
> -					final String name = new String(p.substring(sp + 1));
> +					final String name = p.substring(sp + 1);
>  					last = new Ref(Ref.Storage.PACKED, name, name, id);
>  					newPackedRefs.put(last.getName(), last);

I had a specific reason for forcing a new String object here.

The line in question, p, is from the packed-refs file and
contains the entire SHA-1 in hex form at the beginning of it.
We've converted that into binary as an ObjectId, it uses 1/4 the
space of the string portion.

The Ref object, its ObjectId, and its name string, are going to be
cached in a Map, probably long-term.  We're better off shedding the
80 bytes of memory used to hold the hex SHA-1 then risk substring()
deciding its "faster" to reuse the char[] then to make a copy of it.

-- 
Shawn.

^ permalink raw reply

* Special weekend price
From: Lazarus Morrison @ 2009-03-19 16:41 UTC (permalink / raw)
  To: git

Feel more powerful as a man! http://srhj.agojvoxnam.net/

^ permalink raw reply

* Re: git am from scratch
From: Eric Raible @ 2009-03-19 16:16 UTC (permalink / raw)
  To: git
In-Reply-To: <200903191609.24812.agruen@suse.de>

Andreas Gruenbacher <agruen <at> suse.de> writes:

> When the first commit is added by hand instead, git am will import the rest 

Or:
git init && git commit --allow-empty -m'initial'

^ permalink raw reply

* Re: Gnome chose Git
From: Andreas Ericsson @ 2009-03-19 16:29 UTC (permalink / raw)
  To: Mike Ralphson; +Cc: Teemu Likonen, git
In-Reply-To: <e2b179460903190433l3619e09aj47490a6e3b10d42d@mail.gmail.com>

Mike Ralphson wrote:
> 2009/3/19 Teemu Likonen <tlikonen@iki.fi>:
>> FYI: The Gnome release team just announced that Gnome will migrate from
>> Subversion to Git:
>>
>>    http://thread.gmane.org/gmane.comp.gnome.infrastructure/1134
> 
> There does seem to be a typo in the release though.
> 
> "We realize that git is not perfect, and that the transition will
> require significant and important changes to many GNOME processes."
> 
> s/ not//
> 
> There, fixed that.
> 
> Seriously, they should be advocating a c) there, contributing
> improvements back to git (and whichever svn migration tool they used)
> for the benefit of all, which I'm sure we'll see.
> 

Kristian Högsberg played a rather significant part in the migration
process. Since he's an old git contributor, he'll almost certainly
see to it that improvements are made available to core git.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

^ permalink raw reply

* Re: [PATCH JGIT] Method invokes inefficient new String(String)  constructor
From: Yann Simon @ 2009-03-19 16:44 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Robin Rosenberg, git
In-Reply-To: <20090319160102.GQ23521@spearce.org>

2009/3/19 Shawn O. Pearce <spearce@spearce.org>:
> The line in question, p, is from the packed-refs file and
> contains the entire SHA-1 in hex form at the beginning of it.
> We've converted that into binary as an ObjectId, it uses 1/4 the
> space of the string portion.
>
> The Ref object, its ObjectId, and its name string, are going to be
> cached in a Map, probably long-term.  We're better off shedding the
> 80 bytes of memory used to hold the hex SHA-1 then risk substring()
> deciding its "faster" to reuse the char[] then to make a copy of it.

Thany you for the explanation.
I learn something, and my tests confirm it.
The p.substring(...) can keep the entire array of char by only
updating the intern offset value.
new String(p.subtring(...)) make sure that the variable contains only
the final chars.

Yann

^ permalink raw reply

* fatal: bad object HEAD
From: Rostislav Svoboda @ 2009-03-19 16:55 UTC (permalink / raw)
  To: git

Hi people, I have a BIG trouble:

$ git fsck
error: refs/heads/branch_1 does not point to a valid object!
error: refs/heads/branch_2 does not point to a valid object!
error: refs/heads/branch_3 does not point to a valid object!
error: refs/heads/master does not point to a valid object!
(and quite many missing and dangling blobs)

I use msysGit 1.6.1-preview20081227 and I did:
$ git checkout master
$ git gui

here I got again and again that stupid error message
'file fname.ext has been modified but no changes detected' so I did
$ git add fname.ext
$ git branch branch_1    (here I did a mistake. I wanted to do 'git
checkout branch_1' )

And now is _everything_ seems to be lost... uaaaa :( What can I do now?
Any would be REALLY appreciated

Bost

^ permalink raw reply

* Re: [RFC] Colorization of log --graph
From: Allan Caffee @ 2009-03-19 16:59 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <alpine.DEB.1.00.0903181228420.10279@pacific.mpi-cbg.de>

Hello and thanks for the speedy reply!

On Wed, Mar 18, 2009 at 7:44 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Wed, 18 Mar 2009, Allan Caffee wrote:
>
> > I know that _some_ people arn't particularly fond of colors, but I was
> > wondering how difficult it would be to colorize the edges on the --graph
> > drawn by the log command?  It can be a little tricky trying to follow
> > them with a relatively complex history.  I was thinking something like
> > gitk already does.
>
> That's a good idea!  (And it is mentioned as a TODO in graph.c...)

That's me, always thinking outside the box.  ;-)

> > Is anybody else interested in seeing this?
>
> Count me in.  Are you interested in implementing this?

I'll give it a go.  Been a while since I've done anything of substance
in pure C so it should be a nice refresher.  :)

> If so:
>
> - you need to #include "color.h" in graph.c
>
> - you need to insert a color identifier into struct column (there is an
>  XXX comment at the correct location)

By color identifier I assume you mean the ANSI escape sequence, right?
I didn't see a type for representing colors in color.{c,h} other than
the int it seems to use internally.

> - you need to find a way to determine colors for the branches

Okay, so if we were to make this similiar to how gitk works it would involve:
If the previous commit was a merge:
	for (i = 0; i < graph->num_columns; i++)
		graph->columns[i]->color = get_next_column_color();
else
	get_current_column_color();

I was thinking of storing the current color by adding a
default_column_color attribute to git_graph that serves as an index into
column_colors.  column_colors being the array of available colors.

> - you need to put the handling into the function
>  graph_output_pre_commit_line() in graph.c (and probably
>  graph_output_commit_char(), graph_output_post_merge_line(),
>  graph_output_collapsing_line(), graph_padding_line(), and
>  graph_output_padding_line(), too)
>
> - it would make sense IMHO to introduce a new function that takes a
>  pointer to an strbuf, a pointer to a struct column and a char (or maybe
>  a string) that adds the appropriately colorized char (or string) to the
>  strbuf

That makes sense.  Then we can just update the functions you mentioned
above to use this.

> - use the global variable diff_use_color to determine if the output should
>  be colorized at all

The function for adding a column to an strbuf would offer a convenient
place to put the condition.

> - probably you need to make an array of available colors or some such
>  (which might be good to put into color.[ch])

This would be the color_codes array I mentioned but it seems like it
might belong in graph.c.  There's something similiar in diff.c and it
seems like this is more related to graphing then to colors in general.
Although I do think it makes sense to #define some of the more common
ANSI codes there so that they don't have to be duplicated.  grep shows 6
occurrences of '\033[31m', the code for red foreground.

I'll begin working on a patch.  Comments/questions?

~Allan

^ permalink raw reply

* Re: [PATCH 2/2] Allow http authentication via prompt for http push.
From: Johannes Schindelin @ 2009-03-19 16:59 UTC (permalink / raw)
  To: Amos King; +Cc: git, Junio C Hamano
In-Reply-To: <d8c371a80903190812w59febbd3qc6bc3d70ce85f76e@mail.gmail.com>

Hi,

On Thu, 19 Mar 2009, Amos King wrote:

> There is now a faux remote created in order to
> be passed to http_init.
> 
> Signed-off-by: Amos King <amos.l.king@gmail.com>
> ---
>  http-push.c |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/http-push.c b/http-push.c
> index 9ac2664..468d5af 100644
> --- a/http-push.c
> +++ b/http-push.c
> @@ -2195,7 +2195,16 @@ int main(int argc, char **argv)
> 
>  	memset(remote_dir_exists, -1, 256);
> 
> -	http_init(NULL);
> +	/*
> +	 * This is a faked remote so that http_init can
> +	 * get the correct data for builidng out athorization.
> +	 */

You might want to pass this through aspell ;-)  Altough it will not 
suggest 'out ->our', I guess...

> +	struct remote *remote;
> +	remote = xcalloc(sizeof(*remote), 1);
> +	ALLOC_GROW(remote->url, remote->url_nr + 1, remote->url_alloc);
> +	remote->url[remote->url_nr++] = repo->url;
> +
> +	http_init(remote);

Would 'fake' not be a more appropriate name than 'remote'?

That would also make the patch 1/2 rather unnecessary (I also have to 
admit that I do not find 'repo' a better name, as we have a repository 
both locally and remotely, and this _is_ the remote repository, not the 
local one).

Ciao,
Dscho

^ 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