Git development
 help / color / mirror / Atom feed
* [PATCH 1/2] am: Add --committer-date-is-author-date option
From: Nanako Shiraishi @ 2009-01-24  1:17 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

From: Junio C Hamano <gitster@pobox.com>
Date: Thu, 22 Jan 2009 16:14:58 -0800

This new option tells 'git-am' to use the timestamp recorded
in the Email message as both author and committer date.

Signed-off-by: しらいしななこ <nanako3@lavabit.com>
---
 git-am.sh     |   13 ++++++++++++-
 t/t4150-am.sh |   20 ++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index e20dd88..e96071d 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -23,6 +23,7 @@ resolvemsg=     override error message when patch failure occurs
 r,resolved      to be used after a patch failure
 skip            skip the current patch
 abort           restore the original branch and abort the patching operation.
+committer-date-is-author-date    lie about committer date
 rebasing        (internal use for git-rebase)"
 
 . git-sh-setup
@@ -133,6 +134,7 @@ dotest="$GIT_DIR/rebase-apply"
 sign= utf8=t keep= skip= interactive= resolved= rebasing= abort=
 resolvemsg= resume=
 git_apply_opt=
+committer_date_is_author_date=
 
 while test $# != 0
 do
@@ -168,6 +170,8 @@ do
 		git_apply_opt="$git_apply_opt $(sq "$1=$2")"; shift ;;
 	-C|-p)
 		git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;;
+	--committer-date-is-author-date)
+		committer_date_is_author_date=t ;;
 	--)
 		shift; break ;;
 	*)
@@ -521,7 +525,14 @@ do
 
 	tree=$(git write-tree) &&
 	parent=$(git rev-parse --verify HEAD) &&
-	commit=$(git commit-tree $tree -p $parent <"$dotest/final-commit") &&
+	commit=$(
+		if test -n "$committer_date_is_author_date"
+		then
+			GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
+			export GIT_COMMITTER_DATE
+		fi &&
+		git commit-tree $tree -p $parent <"$dotest/final-commit"
+	) &&
 	git update-ref -m "$GIT_REFLOG_ACTION: $FIRSTLINE" HEAD $commit $parent ||
 	stop_here $this
 
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 796f795..8d3fb00 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -257,4 +257,24 @@ test_expect_success 'am works from file (absolute path given) in subdirectory' '
 	test -z "$(git diff second)"
 '
 
+test_expect_success 'am --committer-date-is-author-date' '
+	git checkout first &&
+	test_tick &&
+	git am --committer-date-is-author-date patch1 &&
+	git cat-file commit HEAD | sed -e "/^$/q" >head1 &&
+	at=$(sed -ne "/^author /s/.*> //p" head1) &&
+	ct=$(sed -ne "/^committer /s/.*> //p" head1) &&
+	test "$at" = "$ct"
+'
+
+test_expect_success 'am without --committer-date-is-author-date' '
+	git checkout first &&
+	test_tick &&
+	git am patch1 &&
+	git cat-file commit HEAD | sed -e "/^$/q" >head1 &&
+	at=$(sed -ne "/^author /s/.*> //p" head1) &&
+	ct=$(sed -ne "/^committer /s/.*> //p" head1) &&
+	test "$at" != "$ct"
+'
+
 test_done
-- 
1.6.1

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

^ permalink raw reply related

* [PATCH 2/2 (v2)] git-am: Add --ignore-date option
From: Nanako Shiraishi @ 2009-01-24  1:18 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

This new option tells 'git-am' to ignore the date header field
recorded in the format-patch output. The commits will have the
timestamp when they are created instead.

You can work a lot in one day to accumulate many changes, but
apply and push to the public repository only some of them at
the end of the first day. Then next day you can spend all your
working hours reading comics or chatting with your coworkers,
and apply your remaining patches from the previous day using
this option to pretend that you have been working at the end
of the day.

Signed-off-by: しらいしななこ <nanako3@lavabit.com>
---

Added documentation and copied your response about the new
test as a comment.

 Documentation/git-am.txt |   17 ++++++++++++++++-
 git-am.sh                |    8 ++++++++
 t/t4150-am.sh            |   13 +++++++++++++
 3 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index 5cbbe76..c10c91b 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -10,7 +10,8 @@ SYNOPSIS
 --------
 [verse]
 'git am' [--signoff] [--keep] [--utf8 | --no-utf8]
-	 [--3way] [--interactive]
+	 [--3way] [--interactive] [--committer-date-is-author-date]
+	 [--ignore-date]
 	 [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
 	 [<mbox> | <Maildir>...]
 'git am' (--skip | --resolved | --abort)
@@ -71,6 +72,20 @@ default.   You could use `--no-utf8` to override this.
 --interactive::
 	Run interactively.
 
+--committer-date-is-author-date::
+	By default the command records the date from the e-mail
+	message as the commit author date, and uses the time of
+	commit creation as the committer date. This allows the
+	user to lie about the committer date by using the same
+	timestamp as the author date.
+
+--ignore-date::
+	By default the command records the date from the e-mail
+	message as the commit author date, and uses the time of
+	commit creation as the committer date. This allows the
+	user to lie about author timestamp by using the same
+	timestamp as the committer date.
+
 --skip::
 	Skip the current patch.  This is only meaningful when
 	restarting an aborted patch.
diff --git a/git-am.sh b/git-am.sh
index e96071d..f935178 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -24,6 +24,7 @@ r,resolved      to be used after a patch failure
 skip            skip the current patch
 abort           restore the original branch and abort the patching operation.
 committer-date-is-author-date    lie about committer date
+ignore-date     use current timestamp for author date
 rebasing        (internal use for git-rebase)"
 
 . git-sh-setup
@@ -135,6 +136,7 @@ sign= utf8=t keep= skip= interactive= resolved= rebasing= abort=
 resolvemsg= resume=
 git_apply_opt=
 committer_date_is_author_date=
+ignore_date=
 
 while test $# != 0
 do
@@ -172,6 +174,8 @@ do
 		git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;;
 	--committer-date-is-author-date)
 		committer_date_is_author_date=t ;;
+	--ignore-date)
+		ignore_date=t ;;
 	--)
 		shift; break ;;
 	*)
@@ -526,6 +530,10 @@ do
 	tree=$(git write-tree) &&
 	parent=$(git rev-parse --verify HEAD) &&
 	commit=$(
+		if test -n "$ignore_date"
+		then
+			GIT_AUTHOR_DATE=
+		fi
 		if test -n "$committer_date_is_author_date"
 		then
 			GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 8d3fb00..2ad9048 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -277,4 +277,17 @@ test_expect_success 'am without --committer-date-is-author-date' '
 	test "$at" != "$ct"
 '
 
+# This checks for +0000 because TZ is set to UTC and that should
+# show up when the current time is used. The date in message is set
+# by test_tick that uses -0700 timezone; if this feature does not
+# work, we will see that instead of +0000.
+test_expect_success 'am --ignore-date' '
+	git checkout first &&
+	test_tick &&
+	git am --ignore-date patch1 &&
+	git cat-file commit HEAD | sed -e "/^$/q" >head1 &&
+	at=$(sed -ne "/^author /s/.*> //p" head1) &&
+	echo "$at" | grep "+0000"
+'
+
 test_done
-- 
1.6.1

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

^ permalink raw reply related

* Re: [PATCH v2] Change octal literals to be XEmacs friendly
From: Junio C Hamano @ 2009-01-24  1:31 UTC (permalink / raw)
  To: Vassili Karpov; +Cc: git, Alexandre Julliard
In-Reply-To: <Pine.LNX.4.64.0901240219530.19590@linmac.oyster.ru>

Vassili Karpov <av1474@comtv.ru> writes:

Please don't use "format=flowed"; your patch is whitespace damaged and
does not apply.

> The type-of ?\octal in XEmacs is character while in FSF Emacs it is
> integer. Case expression using this syntax will not work correctly on
> XEmacs. #ooctal syntax on the other hand produces integers everywhere.
>
> Signed-off-by: Vassili Karpov <av1474@comtv.ru>
> ---
>  contrib/emacs/git.el |   30 +++++++++++++++---------------
>  1 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
> index 09e8bae..715580a 100644
> --- a/contrib/emacs/git.el
> +++ b/contrib/emacs/git.el
> @@ -562,29 +562,29 @@ the process output as a string, or nil if the
> git command failed."
>    (let* ((old-type (lsh (or old-perm 0) -9))
>  	 (new-type (lsh (or new-perm 0) -9))
>  	 (str (case new-type
> -		(?\100  ;; file
> +		(#o100  ;; file
>  		 (case old-type
> -		   (?\100 nil)
> -		   (?\120 "   (type change symlink -> file)")
> -		   (?\160 "   (type change subproject -> file)")))
> -		 (?\120  ;; symlink
> +		   (#o100 nil)
> +		   (#o120 "   (type change symlink -> file)")
> +		   (#o160 "   (type change subproject -> file)")))
> +		 (#o120  ;; symlink
>  		  (case old-type
> -		    (?\100 "   (type change file -> symlink)")
> -		    (?\160 "   (type change subproject -> symlink)")
> +		    (#o100 "   (type change file -> symlink)")
> +		    (#o160 "   (type change subproject -> symlink)")
>  		    (t "   (symlink)")))
> -		  (?\160  ;; subproject
> +		  (#o160  ;; subproject
>  		   (case old-type
> -		     (?\100 "   (type change file -> subproject)")
> -		     (?\120 "   (type change symlink -> subproject)")
> +		     (#o100 "   (type change file -> subproject)")
> +		     (#o120 "   (type change symlink -> subproject)")
>  		     (t "   (subproject)")))
> -                  (?\110 nil)  ;; directory (internal, not a real git
> state)
> -		  (?\000  ;; deleted or unknown
> +                  (#o110 nil)  ;; directory (internal, not a real git
> state)
> +		  (#o000  ;; deleted or unknown
>  		   (case old-type
> -		     (?\120 "   (symlink)")
> -		     (?\160 "   (subproject)")))
> +		     (#o120 "   (symlink)")
> +		     (#o160 "   (subproject)")))
>  		  (t (format "   (unknown type %o)" new-type)))))
>      (cond (str (propertize str 'face 'git-status-face))
> -          ((eq new-type ?\110) "/")
> +          ((eq new-type #o110) "/")
>            (t ""))))
>
>  (defun git-rename-as-string (info)
> -- 
> 1.6.0.2.GIT
>
>
>
> -- 
> mailto:av1474@comtv.ru
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: how to force a commit date matching info from a mbox ?
From: Johannes Schindelin @ 2009-01-24  1:43 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, Nanako Shiraishi, git list, Christian MICHON
In-Reply-To: <20090124005225.GA9864@sigill.intra.peff.net>

Hi,

On Fri, 23 Jan 2009, Jeff King wrote:

> On Sat, Jan 24, 2009 at 01:34:41AM +0100, Johannes Schindelin wrote:
> 
> > > So good to know, and I will start generating my patches differently.
> > 
> > Note that your patches will not be found using Pasky's "mail" link in 
> > gitweb, if you do not put the commit subject into the _real_ mail subject.
> > 
> > Dunno if I like that.
> 
> I think that is not a new problem. Quite a few patches are "how about
> this" patches in the middle of a thread, and leave the old subject.
> IMHO, that is a failing of the tool in not tracking common practice, not
> the other way around.

You know exactly what "fixing the tool" would mean.

Ciao,
Dscho

^ permalink raw reply

* Re: [RFC PATCH (GIT-GUI/CORE BUG)] git-gui: Avoid an infinite rescan loop in handle_empty_diff.
From: Keith Cascio @ 2009-01-24  1:46 UTC (permalink / raw)
  To: Alexander Gavrilov; +Cc: git, Shawn O Pearce, Junio C Hamano, Andy Davey, kbro
In-Reply-To: <200901240052.58259.angavrilov@gmail.com>

Teach git-gui to check diff's exit code
in order to know whether a file actually
changed or not.

Signed-off-by: Keith Cascio <keith@cs.ucla.edu>
---
Alexander,
I encountered the same problem and I tried a different way
to prevent it.  Could you please try this alternative patch
and see if it works in your setup?  If so, it might be
a lower-impact solution.  Even if it doesn't solve your
problem, I think it is still an improvement over what
exists and could co-exist with your patch.
                                     -- Keith Cascio

 git-gui/lib/diff.tcl |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
index bbbf15c..94faf95 100644
--- a/git-gui/lib/diff.tcl
+++ b/git-gui/lib/diff.tcl
@@ -276,6 +276,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
 	}
 
 	lappend cmd -p
+	lappend cmd --exit-code
 	lappend cmd --no-color
 	if {$repo_config(gui.diffcontext) >= 1} {
 		lappend cmd "-U$repo_config(gui.diffcontext)"
@@ -310,6 +311,7 @@ proc read_diff {fd cont_info} {
 	global ui_diff diff_active
 	global is_3way_diff is_conflict_diff current_diff_header
 	global current_diff_queue
+	global errorCode
 
 	$ui_diff conf -state normal
 	while {[gets $fd line] >= 0} {
@@ -397,7 +399,9 @@ proc read_diff {fd cont_info} {
 	$ui_diff conf -state disabled
 
 	if {[eof $fd]} {
-		close $fd
+		fconfigure $fd -blocking 1
+		catch { close $fd } err
+		set diff_exit_status $errorCode
 
 		if {$current_diff_queue ne {}} {
 			advance_diff_queue $cont_info
@@ -413,7 +417,7 @@ proc read_diff {fd cont_info} {
 		}
 		ui_ready
 
-		if {[$ui_diff index end] eq {2.0}} {
+		if {$diff_exit_status eq "NONE"} {
 			handle_empty_diff
 		}
 		set callback [lindex $cont_info 1]
-- 
1.6.1

^ permalink raw reply related

* [PATCH v2] Change octal literals to be XEmacs friendly
From: malc @ 2009-01-24  1:52 UTC (permalink / raw)
  To: git


The type-of ?\octal in XEmacs is character while in FSF Emacs it is
integer. Case expression using this syntax will not work correctly on
XEmacs. #ooctal syntax on the other hand produces integers everywhere.

Signed-off-by: Vassili Karpov <av1474@comtv.ru>
---
 contrib/emacs/git.el |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 09e8bae..715580a 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -562,29 +562,29 @@ the process output as a string, or nil if the git command failed."
   (let* ((old-type (lsh (or old-perm 0) -9))
 	 (new-type (lsh (or new-perm 0) -9))
 	 (str (case new-type
-		(?\100  ;; file
+		(#o100  ;; file
 		 (case old-type
-		   (?\100 nil)
-		   (?\120 "   (type change symlink -> file)")
-		   (?\160 "   (type change subproject -> file)")))
-		 (?\120  ;; symlink
+		   (#o100 nil)
+		   (#o120 "   (type change symlink -> file)")
+		   (#o160 "   (type change subproject -> file)")))
+		 (#o120  ;; symlink
 		  (case old-type
-		    (?\100 "   (type change file -> symlink)")
-		    (?\160 "   (type change subproject -> symlink)")
+		    (#o100 "   (type change file -> symlink)")
+		    (#o160 "   (type change subproject -> symlink)")
 		    (t "   (symlink)")))
-		  (?\160  ;; subproject
+		  (#o160  ;; subproject
 		   (case old-type
-		     (?\100 "   (type change file -> subproject)")
-		     (?\120 "   (type change symlink -> subproject)")
+		     (#o100 "   (type change file -> subproject)")
+		     (#o120 "   (type change symlink -> subproject)")
 		     (t "   (subproject)")))
-                  (?\110 nil)  ;; directory (internal, not a real git state)
-		  (?\000  ;; deleted or unknown
+                  (#o110 nil)  ;; directory (internal, not a real git state)
+		  (#o000  ;; deleted or unknown
 		   (case old-type
-		     (?\120 "   (symlink)")
-		     (?\160 "   (subproject)")))
+		     (#o120 "   (symlink)")
+		     (#o160 "   (subproject)")))
 		  (t (format "   (unknown type %o)" new-type)))))
     (cond (str (propertize str 'face 'git-status-face))
-          ((eq new-type ?\110) "/")
+          ((eq new-type #o110) "/")
           (t ""))))
 
 (defun git-rename-as-string (info)
-- 
1.6.0.2.GIT


-- 
mailto:av1474@comtv.ru

^ permalink raw reply related

* Re: [PATCH v2] Change octal literals to be XEmacs friendly
From: Kalle Olavi Niemitalo @ 2009-01-24  1:46 UTC (permalink / raw)
  To: git
In-Reply-To: <Pine.LNX.4.64.0901240219530.19590@linmac.oyster.ru>

Vassili Karpov <av1474@comtv.ru> writes:

> #ooctal syntax on the other hand produces integers everywhere.

GNU Emacs 20.7 doesn't support #o, but neither does it include
the ewoc and log-edit libraries required by the current git.el.

It would be nice to have a comment in git.el saying which
versions of Emacs and XEmacs it is supposed to support, but I
guess people wouldn't bother testing those on every commit.

^ permalink raw reply

* [PATCH] http-push: refactor lock-related headers creation for curl  requests
From: Ray Chuan @ 2009-01-24  2:00 UTC (permalink / raw)
  To: git, Johannes Schindelin

Currently, DAV-related headers (more specifically, headers related to
the lock token, namely, If, Lock-Token, and Timeout) for curl requests
are created and allocated individually, eg a "if_header" variable for
the "If: " header, a "timeout_header" variable for the "Timeout: "
header.

This patch provides a new function ("get_dav_token_headers") that
creates these header, saving methods from allocating memory, and from
issuing a "curl_slist_append" call.

In part, this patch also addresses the fact that commit 753bc91
(Remove the requirement opaquelocktoken uri scheme) did not update
memory allocations for DAV-related headers.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
 http-push.c |   68 +++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/http-push.c b/http-push.c
index cb5bf95..eca4a8e 100644
--- a/http-push.c
+++ b/http-push.c
@@ -177,6 +177,37 @@ struct remote_ls_ctx
 	struct remote_ls_ctx *parent;
 };

+/* get_dav_token_headers options */
+enum dav_header_flag {
+	DAV_HEADER_IF = (1u << 0),
+	DAV_HEADER_LOCK = (1u << 1),
+	DAV_HEADER_TIMEOUT = (1u << 2)
+};
+
+static struct curl_slist *get_dav_token_headers(struct remote_lock
*lock, enum dav_header_flag options) {
+	struct strbuf buf = STRBUF_INIT;
+	struct curl_slist *dav_headers = NULL;
+
+	if(options & DAV_HEADER_IF) {
+		strbuf_addf(&buf, "If: (<%s>)", lock->token);
+		dav_headers = curl_slist_append(dav_headers, buf.buf);
+		strbuf_reset(&buf);
+	}
+	if(options & DAV_HEADER_LOCK) {
+		strbuf_addf(&buf, "Lock-Token: <%s>", lock->token);
+		dav_headers = curl_slist_append(dav_headers, buf.buf);
+		strbuf_reset(&buf);
+	}
+	if(options & DAV_HEADER_TIMEOUT) {
+		strbuf_addf(&buf, "Timeout: Second-%ld", lock->timeout);
+		dav_headers = curl_slist_append(dav_headers, buf.buf);
+		strbuf_reset(&buf);
+	}
+	strbuf_release(&buf);
+
+	return dav_headers;
+}
+
 static void finish_request(struct transfer_request *request);
 static void release_request(struct transfer_request *request);

@@ -588,18 +619,12 @@ static int refresh_lock(struct remote_lock *lock)
 {
 	struct active_request_slot *slot;
 	struct slot_results results;
-	char *if_header;
-	char timeout_header[25];
-	struct curl_slist *dav_headers = NULL;
+	struct curl_slist *dav_headers;
 	int rc = 0;

 	lock->refreshing = 1;

-	if_header = xmalloc(strlen(lock->token) + 25);
-	sprintf(if_header, "If: (<%s>)", lock->token);
-	sprintf(timeout_header, "Timeout: Second-%ld", lock->timeout);
-	dav_headers = curl_slist_append(dav_headers, if_header);
-	dav_headers = curl_slist_append(dav_headers, timeout_header);
+	dav_headers = get_dav_token_headers(lock, DAV_HEADER_IF | DAV_HEADER_TIMEOUT);

 	slot = get_active_slot();
 	slot->results = &results;
@@ -622,7 +647,6 @@ static int refresh_lock(struct remote_lock *lock)

 	lock->refreshing = 0;
 	curl_slist_free_all(dav_headers);
-	free(if_header);

 	return rc;
 }
@@ -1303,14 +1327,10 @@ static int unlock_remote(struct remote_lock *lock)
 	struct active_request_slot *slot;
 	struct slot_results results;
 	struct remote_lock *prev = remote->locks;
-	char *lock_token_header;
-	struct curl_slist *dav_headers = NULL;
+	struct curl_slist *dav_headers;
 	int rc = 0;

-	lock_token_header = xmalloc(strlen(lock->token) + 31);
-	sprintf(lock_token_header, "Lock-Token: <%s>",
-		lock->token);
-	dav_headers = curl_slist_append(dav_headers, lock_token_header);
+	dav_headers = get_dav_token_headers(lock, DAV_HEADER_LOCK);

 	slot = get_active_slot();
 	slot->results = &results;
@@ -1331,7 +1351,6 @@ static int unlock_remote(struct remote_lock *lock)
 	}

 	curl_slist_free_all(dav_headers);
-	free(lock_token_header);

 	if (remote->locks == lock) {
 		remote->locks = lock->next;
@@ -1731,13 +1750,10 @@ static int update_remote(unsigned char *sha1,
struct remote_lock *lock)
 {
 	struct active_request_slot *slot;
 	struct slot_results results;
-	char *if_header;
 	struct buffer out_buffer = { STRBUF_INIT, 0 };
-	struct curl_slist *dav_headers = NULL;
+	struct curl_slist *dav_headers;

-	if_header = xmalloc(strlen(lock->token) + 25);
-	sprintf(if_header, "If: (<%s>)", lock->token);
-	dav_headers = curl_slist_append(dav_headers, if_header);
+	dav_headers = get_dav_token_headers(lock, DAV_HEADER_IF);

 	strbuf_addf(&out_buffer.buf, "%s\n", sha1_to_hex(sha1));

@@ -1756,7 +1772,6 @@ static int update_remote(unsigned char *sha1,
struct remote_lock *lock)
 	if (start_active_slot(slot)) {
 		run_active_slot(slot);
 		strbuf_release(&out_buffer.buf);
-		free(if_header);
 		if (results.curl_result != CURLE_OK) {
 			fprintf(stderr,
 				"PUT error: curl result=%d, HTTP code=%ld\n",
@@ -1766,7 +1781,6 @@ static int update_remote(unsigned char *sha1,
struct remote_lock *lock)
 		}
 	} else {
 		strbuf_release(&out_buffer.buf);
-		free(if_header);
 		fprintf(stderr, "Unable to start PUT request\n");
 		return 0;
 	}
@@ -1948,15 +1962,12 @@ static void update_remote_info_refs(struct
remote_lock *lock)
 	struct buffer buffer = { STRBUF_INIT, 0 };
 	struct active_request_slot *slot;
 	struct slot_results results;
-	char *if_header;
-	struct curl_slist *dav_headers = NULL;
+	struct curl_slist *dav_headers;

 	remote_ls("refs/", (PROCESS_FILES | RECURSIVE),
 		  add_remote_info_ref, &buffer.buf);
 	if (!aborted) {
-		if_header = xmalloc(strlen(lock->token) + 25);
-		sprintf(if_header, "If: (<%s>)", lock->token);
-		dav_headers = curl_slist_append(dav_headers, if_header);
+		dav_headers = get_dav_token_headers(lock, DAV_HEADER_IF);

 		slot = get_active_slot();
 		slot->results = &results;
@@ -1978,7 +1989,6 @@ static void update_remote_info_refs(struct
remote_lock *lock)
 					results.curl_result, results.http_code);
 			}
 		}
-		free(if_header);
 	}
 	strbuf_release(&buffer.buf);
 }
-- 
1.6.0.4

^ permalink raw reply related

* Re: [PATCH v2] Change octal literals to be XEmacs friendly
From: malc @ 2009-01-24  2:01 UTC (permalink / raw)
  To: git
In-Reply-To: <874ozp79y4.fsf@Astalo.kon.iki.fi>

Kalle Olavi Niemitalo <kon@iki.fi> writes:

> Vassili Karpov <av1474@comtv.ru> writes:
>
>> #ooctal syntax on the other hand produces integers everywhere.
>
> GNU Emacs 20.7 doesn't support #o, but neither does it include

Bummer

> the ewoc and log-edit libraries required by the current git.el.

ewoc and log-edit are not part of XEmacs 21.4.20 (the version i am
using), furthermore make-temp-file is not available either, but those
problems, unlike the case/eql/literals issue, can be resolved without
touching git.el (One might argue that case can be fixed with defadvice
or other hackery, but that's a bit too much)

> It would be nice to have a comment in git.el saying which
> versions of Emacs and XEmacs it is supposed to support, but I
> guess people wouldn't bother testing those on every commit.

Well it doesn't "support" XEmacs at all.

-- 
mailto:av1474@comtv.ru

^ permalink raw reply

* Re: how to force a commit date matching info from a mbox ?
From: Jeff King @ 2009-01-24  2:35 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Junio C Hamano, Nanako Shiraishi, git list, Christian MICHON
In-Reply-To: <alpine.DEB.1.00.0901240242270.3586@pacific.mpi-cbg.de>

On Sat, Jan 24, 2009 at 02:43:47AM +0100, Johannes Schindelin wrote:

> > I think that is not a new problem. Quite a few patches are "how about
> > this" patches in the middle of a thread, and leave the old subject.
> > IMHO, that is a failing of the tool in not tracking common practice, not
> > the other way around.
> 
> You know exactly what "fixing the tool" would mean.

Yes, I know. I think Pasky's tool is a clever hack, but I never expected
it to be comprehensive in its results. At the GitTogether, we discussed
some interesting ideas for tracking the mailing list and showing a more
patch-oriented view, but those would be a lot of work, and I am not
volunteering to do it right now.

What I meant by my comment was that I am not too concerned with tweaking
my workflow to help Pasky's tool.

-Peff

^ permalink raw reply

* Re: [RFC PATCH (GIT-GUI/CORE BUG)] git-gui: Avoid an infinite rescan loop in handle_empty_diff.
From: Junio C Hamano @ 2009-01-24  3:29 UTC (permalink / raw)
  To: Alexander Gavrilov; +Cc: git, Shawn O. Pearce, Andy Davey, kbro
In-Reply-To: <200901240052.58259.angavrilov@gmail.com>

Alexander Gavrilov <angavrilov@gmail.com> writes:

>     $ git config core.autocrlf true

This operation, when done in an already populated work tree, invalidates
all the state that is cached in the index, and you would need to adjust
things to the altered reality caused by this operation before doing
anything else.  There are different reasons you would want to flip the
configuration after you have files in your work tree, and depending on the
situation, the correct adjustment would differ.

You may have started a project in this repository, your work tree files
all have CRLF endings that is your platform convention, and after adding
the files to the index (but before making a commit) you may have realized
that you would want to keep your project cross platform, and that may be
the reason you are flipping the configuration.  If that is the case, your
index is already contaminated with CRLF, but your files have the line
ending that is correct (for you).  You would want to remove the index and
"add ." to stage everything again before proceeding, to have the autocrlf
mechanism to correct the line endings in the repository objects.

This would be the best case in one extreme.

On the other hand, you may have cloned a cross platform project from
elsewhere (in other words, your objects and the index have the correct
line ending), the checkout was done without autocrlf and it does not match
the local filesystem convention to use CRLF, and that may be the reason
you are flipping the configuration.  If that is the case, before making
any changes to the work tree files, the right adjustment would be to
remove the index, and "reset --hard" to force a checkout that follows your
autocrlf settings, so that the work tree files are corrected.

This would be the best case in the other end of the extreme.

And there will be different cases in between these extremes.

I think clueful users who flips the configuration from the command line
would know all of the above, know what they want and can tell what the
best course of action would be, but I at the same time wonder if git-gui
should (and if so, can) offer a simple and safe way to help this process
from others.

^ permalink raw reply

* [PATCH] Use time_t for timestamps returned by approxidate() instead of unsigned
From: Tim Henigan @ 2009-01-22 23:07 UTC (permalink / raw)
  To: git; +Cc: gitster, Tim Henigan

Use time_t for timestamps returned by approxidate() instead of unsigned
long.  All references to approxidate were checked as well as references
to OPT_DATE.

Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
---

This is the first patch I have submitted, so please be brutal in your review so that I may learn ;).

This patch is intended to close one of the "Janitor" tasks listed in the GitWiki.  The change from unsigned long to time_t reached further than I originally anticipated as I looked into all the places where timestamps are used.  Please let me know if I should limit the scope of the changes to only the immediate consumers of values returned by approxidate().

There is at least one place in the code (builtin-for-each-ref.c:370) where what looks like a timestamp is compared against ULONG_MAX.  At first glance this sounds like a bad idea, but within the context of that function (grab_date) it appears to be safe.

-Tim

 Documentation/technical/api-parse-options.txt |    4 ++--
 builtin-gc.c                                  |    2 +-
 builtin-prune.c                               |    2 +-
 builtin-reflog.c                              |    4 ++--
 builtin-show-branch.c                         |    2 +-
 cache.h                                       |    2 +-
 date.c                                        |    2 +-
 parse-options.c                               |    2 +-
 reflog-walk.c                                 |    4 ++--
 refs.c                                        |    2 +-
 refs.h                                        |    2 +-
 revision.h                                    |    4 ++--
 sha1_name.c                                   |    2 +-
 test-parse-options.c                          |    2 +-
 14 files changed, 18 insertions(+), 18 deletions(-)
 mode change 100644 => 100755 builtin-gc.c
 mode change 100644 => 100755 builtin-reflog.c
 mode change 100644 => 100755 builtin-show-branch.c
 mode change 100644 => 100755 cache.h
 mode change 100644 => 100755 date.c
 mode change 100644 => 100755 parse-options.c
 mode change 100644 => 100755 reflog-walk.c
 mode change 100644 => 100755 refs.c
 mode change 100644 => 100755 refs.h
 mode change 100644 => 100755 revision.c
 mode change 100644 => 100755 revision.h
 mode change 100644 => 100755 sha1_name.c

diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt
index 539863b..c1dd29d 100644
--- a/Documentation/technical/api-parse-options.txt
+++ b/Documentation/technical/api-parse-options.txt
@@ -125,9 +125,9 @@ There are some macros to easily define options:
 	Introduce an option with integer argument.
 	The integer is put into `int_var`.
 
-`OPT_DATE(short, long, &int_var, description)`::
+`OPT_DATE(short, long, &time_var, description)`::
 	Introduce an option with date argument, see `approxidate()`.
-	The timestamp is put into `int_var`.
+	The timestamp is put into `time_var`.
 
 `OPT_CALLBACK(short, long, &var, arg_str, description, func_ptr)`::
 	Introduce an option with argument.
diff --git a/builtin-gc.c b/builtin-gc.c
old mode 100644
new mode 100755
index a201438..eea891b
--- a/builtin-gc.c
+++ b/builtin-gc.c
@@ -58,7 +58,7 @@ static int gc_config(const char *var, const char *value, void *cb)
 	}
 	if (!strcmp(var, "gc.pruneexpire")) {
 		if (value && strcmp(value, "now")) {
-			unsigned long now = approxidate("now");
+			time_t now = approxidate("now");
 			if (approxidate(value) >= now)
 				return error("Invalid %s: '%s'", var, value);
 		}
diff --git a/builtin-prune.c b/builtin-prune.c
index 545e9c1..a0f1a63 100644
--- a/builtin-prune.c
+++ b/builtin-prune.c
@@ -13,7 +13,7 @@ static const char * const prune_usage[] = {
 };
 static int show_only;
 static int verbose;
-static unsigned long expire;
+static time_t expire;
 
 static int prune_tmp_object(const char *path, const char *filename)
 {
diff --git a/builtin-reflog.c b/builtin-reflog.c
old mode 100644
new mode 100755
index d95f515..bae0c3e
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -361,7 +361,7 @@ static struct reflog_expire_cfg *find_cfg_ent(const char *pattern, size_t len)
 	return ent;
 }
 
-static int parse_expire_cfg_value(const char *var, const char *value, unsigned long *expire)
+static int parse_expire_cfg_value(const char *var, const char *value, time_t *expire)
 {
 	if (!value)
 		return config_error_nonbool(var);
@@ -380,7 +380,7 @@ static int parse_expire_cfg_value(const char *var, const char *value, unsigned l
 static int reflog_expire_config(const char *var, const char *value, void *cb)
 {
 	const char *lastdot = strrchr(var, '.');
-	unsigned long expire;
+	time_t expire;
 	int slot;
 	struct reflog_expire_cfg *ent;
 
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
old mode 100644
new mode 100755
index 306b850..695d553
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -716,7 +716,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
 			base = strtoul(reflog_base, &ep, 10);
 			if (*ep) {
 				/* Ah, that is a date spec... */
-				unsigned long at;
+				time_t at;
 				at = approxidate(reflog_base);
 				read_ref_at(ref, at, -1, sha1, NULL,
 					    NULL, NULL, &base);
diff --git a/cache.h b/cache.h
old mode 100644
new mode 100755
index 8d965b8..397adf1
--- a/cache.h
+++ b/cache.h
@@ -699,7 +699,7 @@ enum date_mode {
 const char *show_date(unsigned long time, int timezone, enum date_mode mode);
 int parse_date(const char *date, char *buf, int bufsize);
 void datestamp(char *buf, int bufsize);
-unsigned long approxidate(const char *);
+time_t approxidate(const char *);
 enum date_mode parse_date_format(const char *format);
 
 #define IDENT_WARN_ON_NO_NAME  1
diff --git a/date.c b/date.c
old mode 100644
new mode 100755
index 950b88f..5971266
--- a/date.c
+++ b/date.c
@@ -841,7 +841,7 @@ static const char *approxidate_digit(const char *date, struct tm *tm, int *num)
 	return end;
 }
 
-unsigned long approxidate(const char *date)
+time_t approxidate(const char *date)
 {
 	int number = 0;
 	struct tm tm, now;
diff --git a/parse-options.c b/parse-options.c
old mode 100644
new mode 100755
index 9eb55cc..0501ee2
--- a/parse-options.c
+++ b/parse-options.c
@@ -480,7 +480,7 @@ int parse_opt_abbrev_cb(const struct option *opt, const char *arg, int unset)
 int parse_opt_approxidate_cb(const struct option *opt, const char *arg,
 			     int unset)
 {
-	*(unsigned long *)(opt->value) = approxidate(arg);
+	*(time_t *)(opt->value) = approxidate(arg);
 	return 0;
 }
 
diff --git a/reflog-walk.c b/reflog-walk.c
old mode 100644
new mode 100755
index f751fdc..73b4932
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -68,7 +68,7 @@ static struct complete_reflogs *read_complete_reflog(const char *ref)
 }
 
 static int get_reflog_recno_by_time(struct complete_reflogs *array,
-	unsigned long timestamp)
+	time_t timestamp)
 {
 	int i;
 	for (i = array->nr - 1; i >= 0; i--)
@@ -139,7 +139,7 @@ void init_reflog_walk(struct reflog_walk_info** info)
 int add_reflog_for_walk(struct reflog_walk_info *info,
 		struct commit *commit, const char *name)
 {
-	unsigned long timestamp = 0;
+	time_t timestamp = 0;
 	int recno = -1;
 	struct string_list_item *item;
 	struct complete_reflogs *reflogs;
diff --git a/refs.c b/refs.c
old mode 100644
new mode 100755
index 33ced65..63327b8
--- a/refs.c
+++ b/refs.c
@@ -1347,7 +1347,7 @@ static char *ref_msg(const char *line, const char *endp)
 	return xmemdupz(line, ep - line);
 }
 
-int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *sha1, char **msg, unsigned long *cutoff_time, int *cutoff_tz, int *cutoff_cnt)
+int read_ref_at(const char *ref, time_t at_time, int cnt, unsigned char *sha1, char **msg, unsigned long *cutoff_time, int *cutoff_tz, int *cutoff_cnt)
 {
 	const char *logfile, *logdata, *logend, *rec, *lastgt, *lastrec;
 	char *tz_c;
diff --git a/refs.h b/refs.h
old mode 100644
new mode 100755
index 06ad260..262728c
--- a/refs.h
+++ b/refs.h
@@ -55,7 +55,7 @@ extern void unlock_ref(struct ref_lock *lock);
 extern int write_ref_sha1(struct ref_lock *lock, const unsigned char *sha1, const char *msg);
 
 /** Reads log for the value of ref during at_time. **/
-extern int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *sha1, char **msg, unsigned long *cutoff_time, int *cutoff_tz, int *cutoff_cnt);
+extern int read_ref_at(const char *ref, time_t at_time, int cnt, unsigned char *sha1, char **msg, unsigned long *cutoff_time, int *cutoff_tz, int *cutoff_cnt);
 
 /* iterate over reflog entries */
 typedef int each_reflog_ent_fn(unsigned char *osha1, unsigned char *nsha1, const char *, unsigned long, int, const char *, void *);
diff --git a/revision.c b/revision.c
old mode 100644
new mode 100755
diff --git a/revision.h b/revision.h
old mode 100644
new mode 100755
index 7cf8487..660607b
--- a/revision.h
+++ b/revision.h
@@ -106,8 +106,8 @@ struct rev_info {
 	/* special limits */
 	int skip_count;
 	int max_count;
-	unsigned long max_age;
-	unsigned long min_age;
+	time_t max_age;
+	time_t min_age;
 
 	/* diff info for patches and for paths limiting */
 	struct diff_options diffopt;
diff --git a/sha1_name.c b/sha1_name.c
old mode 100644
new mode 100755
index 159c2ab..fe915c8
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -339,7 +339,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
 
 	if (reflog_len) {
 		int nth, i;
-		unsigned long at_time;
+		time_t at_time;
 		unsigned long co_time;
 		int co_tz, co_cnt;
 
diff --git a/test-parse-options.c b/test-parse-options.c
index 61d2c39..c8d110d 100644
--- a/test-parse-options.c
+++ b/test-parse-options.c
@@ -3,7 +3,7 @@
 
 static int boolean = 0;
 static int integer = 0;
-static unsigned long timestamp;
+static time_t timestamp;
 static int abbrev = 7;
 static int verbose = 0, dry_run = 0, quiet = 0;
 static char *string = NULL;
-- 
1.6.0.6


>From 22354d185e5c89a5b492898b9b5eba429fed85d3 Mon Sep 17 00:00:00 2001
From: Tim Henigan <tim.henigan@gmail.com>
Date: Thu, 22 Jan 2009 16:08:42 -0500
Subject: [PATCH] Further changes to migrate timestamp vars in the code from type unsigned long to time_t.

Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
---
 builtin-cat-file.c    |    2 +-
 builtin-reflog.c      |   18 +++++++++---------
 builtin-show-branch.c |    2 +-
 date.c                |    4 ++--
 refs.c                |    6 +++---
 refs.h                |    2 +-
 sha1_name.c           |    2 +-
 7 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/builtin-cat-file.c b/builtin-cat-file.c
index 8fad19d..1d7a361 100644
--- a/builtin-cat-file.c
+++ b/builtin-cat-file.c
@@ -42,7 +42,7 @@ static void pprint_tag(const unsigned char *sha1, const char *buf, unsigned long
 					 */
 					const char *sp = tagger;
 					char *ep;
-					unsigned long date;
+					time_t date;
 					long tz;
 					while (sp < cp && *sp != '>')
 						sp++;
diff --git a/builtin-reflog.c b/builtin-reflog.c
index bae0c3e..74284af 100755
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -17,8 +17,8 @@ static const char reflog_expire_usage[] =
 static const char reflog_delete_usage[] =
 "git reflog delete [--verbose] [--dry-run] [--rewrite] [--updateref] <refs>...";
 
-static unsigned long default_reflog_expire;
-static unsigned long default_reflog_expire_unreachable;
+static time_t default_reflog_expire;
+static time_t default_reflog_expire_unreachable;
 
 struct cmd_reflog_expire_cb {
 	struct rev_info revs;
@@ -27,8 +27,8 @@ struct cmd_reflog_expire_cb {
 	int rewrite;
 	int updateref;
 	int verbose;
-	unsigned long expire_total;
-	unsigned long expire_unreachable;
+	time_t expire_total;
+	time_t expire_unreachable;
 	int recno;
 };
 
@@ -210,7 +210,7 @@ static int keep_entry(struct commit **it, unsigned char *sha1)
 }
 
 static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
-		const char *email, unsigned long timestamp, int tz,
+		const char *email, time_t timestamp, int tz,
 		const char *message, void *cb_data)
 {
 	struct expire_reflog_cb *cb = cb_data;
@@ -335,8 +335,8 @@ static int collect_reflog(const char *ref, const unsigned char *sha1, int unused
 
 static struct reflog_expire_cfg {
 	struct reflog_expire_cfg *next;
-	unsigned long expire_total;
-	unsigned long expire_unreachable;
+	time_t expire_total;
+	time_t expire_unreachable;
 	size_t len;
 	char pattern[FLEX_ARRAY];
 } *reflog_expire_cfg, **reflog_expire_cfg_tail;
@@ -462,7 +462,7 @@ static void set_reflog_expiry_param(struct cmd_reflog_expire_cb *cb, int slot, c
 static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
 {
 	struct cmd_reflog_expire_cb cb;
-	unsigned long now = time(NULL);
+	time_t now = time(NULL);
 	int i, status, do_all;
 	int explicit_expiry = 0;
 
@@ -554,7 +554,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
 }
 
 static int count_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
-		const char *email, unsigned long timestamp, int tz,
+		const char *email, time_t timestamp, int tz,
 		const char *message, void *cb_data)
 {
 	struct cmd_reflog_expire_cb *cb = cb_data;
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 695d553..73b3dc0 100755
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -726,7 +726,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
 		for (i = 0; i < reflog; i++) {
 			char *logmsg, *m;
 			const char *msg;
-			unsigned long timestamp;
+			time_t timestamp;
 			int tz;
 
 			if (read_ref_at(ref, 0, base+i, sha1, &logmsg,
diff --git a/date.c b/date.c
index 5971266..d185ea6 100755
--- a/date.c
+++ b/date.c
@@ -84,13 +84,13 @@ static int local_tzoffset(unsigned long time)
 	return offset * eastwest;
 }
 
-const char *show_date(unsigned long time, int tz, enum date_mode mode)
+const char *show_date(time_t time, int tz, enum date_mode mode)
 {
 	struct tm *tm;
 	static char timebuf[200];
 
 	if (mode == DATE_RELATIVE) {
-		unsigned long diff;
+		time_t diff;
 		struct timeval now;
 		gettimeofday(&now, NULL);
 		if (now.tv_sec < time)
diff --git a/refs.c b/refs.c
index 63327b8..159d136 100755
--- a/refs.c
+++ b/refs.c
@@ -1347,13 +1347,13 @@ static char *ref_msg(const char *line, const char *endp)
 	return xmemdupz(line, ep - line);
 }
 
-int read_ref_at(const char *ref, time_t at_time, int cnt, unsigned char *sha1, char **msg, unsigned long *cutoff_time, int *cutoff_tz, int *cutoff_cnt)
+int read_ref_at(const char *ref, time_t at_time, int cnt, unsigned char *sha1, char **msg, time_t *cutoff_time, int *cutoff_tz, int *cutoff_cnt)
 {
 	const char *logfile, *logdata, *logend, *rec, *lastgt, *lastrec;
 	char *tz_c;
 	int logfd, tz, reccnt = 0;
 	struct stat st;
-	unsigned long date;
+	time_t date;
 	unsigned char logged_sha1[20];
 	void *log_mapped;
 	size_t mapsz;
@@ -1467,7 +1467,7 @@ int for_each_reflog_ent(const char *ref, each_reflog_ent_fn fn, void *cb_data)
 	while (fgets(buf, sizeof(buf), logfp)) {
 		unsigned char osha1[20], nsha1[20];
 		char *email_end, *message;
-		unsigned long timestamp;
+		time_t timestamp;
 		int len, tz;
 
 		/* old SP new SP name <email> SP time TAB msg LF */
diff --git a/refs.h b/refs.h
index 262728c..604d5a3 100755
--- a/refs.h
+++ b/refs.h
@@ -55,7 +55,7 @@ extern void unlock_ref(struct ref_lock *lock);
 extern int write_ref_sha1(struct ref_lock *lock, const unsigned char *sha1, const char *msg);
 
 /** Reads log for the value of ref during at_time. **/
-extern int read_ref_at(const char *ref, time_t at_time, int cnt, unsigned char *sha1, char **msg, unsigned long *cutoff_time, int *cutoff_tz, int *cutoff_cnt);
+extern int read_ref_at(const char *ref, time_t at_time, int cnt, unsigned char *sha1, char **msg, time_t *cutoff_time, int *cutoff_tz, int *cutoff_cnt);
 
 /* iterate over reflog entries */
 typedef int each_reflog_ent_fn(unsigned char *osha1, unsigned char *nsha1, const char *, unsigned long, int, const char *, void *);
diff --git a/sha1_name.c b/sha1_name.c
index fe915c8..8a65def 100755
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -340,7 +340,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
 	if (reflog_len) {
 		int nth, i;
 		time_t at_time;
-		unsigned long co_time;
+		time_t co_time;
 		int co_tz, co_cnt;
 
 		/* Is it asking for N-th entry, or approxidate? */
-- 
1.6.0.6


>From 7fb1e3d6390d46433e7ce10841bf11cab3b1d0ff Mon Sep 17 00:00:00 2001
From: Tim Henigan <tim.henigan@gmail.com>
Date: Thu, 22 Jan 2009 17:08:06 -0500
Subject: [PATCH] Final changes to convert unsigned longs to time_t

Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
---
 cache.h       |    2 +-
 date.c        |    8 ++++----
 pretty.c      |    4 ++--
 reflog-walk.c |    2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/cache.h b/cache.h
index 397adf1..a18730c 100755
--- a/cache.h
+++ b/cache.h
@@ -696,7 +696,7 @@ enum date_mode {
 	DATE_RFC2822
 };
 
-const char *show_date(unsigned long time, int timezone, enum date_mode mode);
+const char *show_date(time_t time, int timezone, enum date_mode mode);
 int parse_date(const char *date, char *buf, int bufsize);
 void datestamp(char *buf, int bufsize);
 time_t approxidate(const char *);
diff --git a/date.c b/date.c
index d185ea6..59b4426 100755
--- a/date.c
+++ b/date.c
@@ -37,7 +37,7 @@ static const char *weekday_names[] = {
 	"Sundays", "Mondays", "Tuesdays", "Wednesdays", "Thursdays", "Fridays", "Saturdays"
 };
 
-static time_t gm_time_t(unsigned long time, int tz)
+static time_t gm_time_t(time_t time, int tz)
 {
 	int minutes;
 
@@ -52,7 +52,7 @@ static time_t gm_time_t(unsigned long time, int tz)
  * thing, which means that tz -0100 is passed in as the integer -100,
  * even though it means "sixty minutes off"
  */
-static struct tm *time_to_tm(unsigned long time, int tz)
+static struct tm *time_to_tm(time_t time, int tz)
 {
 	time_t t = gm_time_t(time, tz);
 	return gmtime(&t);
@@ -62,7 +62,7 @@ static struct tm *time_to_tm(unsigned long time, int tz)
  * What value of "tz" was in effect back then at "time" in the
  * local timezone?
  */
-static int local_tzoffset(unsigned long time)
+static int local_tzoffset(time_t time)
 {
 	time_t t, t_local;
 	struct tm tm;
@@ -632,7 +632,7 @@ void datestamp(char *buf, int bufsize)
 	date_string(now, offset, buf, bufsize);
 }
 
-static void update_tm(struct tm *tm, unsigned long sec)
+static void update_tm(struct tm *tm, time_t sec)
 {
 	time_t n = mktime(tm) - sec;
 	localtime_r(&n, tm);
diff --git a/pretty.c b/pretty.c
index cc460b5..6ab3222 100644
--- a/pretty.c
+++ b/pretty.c
@@ -126,7 +126,7 @@ void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb,
 {
 	char *date;
 	int namelen;
-	unsigned long time;
+	time_t time;
 	int tz;
 	const char *filler = "    ";
 
@@ -330,7 +330,7 @@ static size_t format_person_part(struct strbuf *sb, char part,
 	/* currently all placeholders have same length */
 	const int placeholder_len = 2;
 	int start, end, tz = 0;
-	unsigned long date = 0;
+	time_t date = 0;
 	char *ep;
 
 	/* advance 'end' to point to email start delimiter */
diff --git a/reflog-walk.c b/reflog-walk.c
index 73b4932..1bc9675 100755
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -11,7 +11,7 @@ struct complete_reflogs {
 	struct reflog_info {
 		unsigned char osha1[20], nsha1[20];
 		char *email;
-		unsigned long timestamp;
+		time_t timestamp;
 		int tz;
 		char *message;
 	} *items;
-- 
1.6.0.6

^ permalink raw reply related

* Re: [PATCH] http-push: refactor lock-related headers creation for curl  requests
From: Johannes Schindelin @ 2009-01-24  4:11 UTC (permalink / raw)
  To: Ray Chuan; +Cc: git
In-Reply-To: <be6fef0d0901231800t6943b01dwbca976d5e9f3397@mail.gmail.com>

Hi,

On Sat, 24 Jan 2009, Ray Chuan wrote:

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

Make that an Acked-by:

> +	if(options & DAV_HEADER_IF) {
> +		strbuf_addf(&buf, "If: (<%s>)", lock->token);
> +		dav_headers = curl_slist_append(dav_headers, buf.buf);
> +		strbuf_reset(&buf);

BTW in case anyone is puzzled (like I was): curl_slist_append() takes a 
"char *" as second parameter, but does not take custody of the buffer; 
instead, it strdup()s it.  See
http://cool.haxx.se/cvs.cgi/curl/lib/sendf.c?rev=1.155&content-type=text/vnd.viewcvs-markup
for details.

BTNW this should be mentioned in the commit message, too, to spare other 
people the puzzlement.

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH v2] Change octal literals to be XEmacs friendly
From: Junio C Hamano @ 2009-01-24  5:16 UTC (permalink / raw)
  To: malc; +Cc: git
In-Reply-To: <878wp1mphq.fsf@linmac.oyster.ru>

malc@pulsesoft.com writes:

> Kalle Olavi Niemitalo <kon@iki.fi> writes:
>
>> Vassili Karpov <av1474@comtv.ru> writes:
>>
>>> #ooctal syntax on the other hand produces integers everywhere.
>>
>> GNU Emacs 20.7 doesn't support #o, but neither does it include
>
> Bummer

To be portable you could certainly spell them in decimal integers, no?

^ permalink raw reply

* Re: [PATCH] http-push: refactor lock-related headers creation for curl  requests
From: Junio C Hamano @ 2009-01-24  5:18 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Ray Chuan, git
In-Reply-To: <alpine.DEB.1.00.0901240507070.13232@racer>

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

> Hi,
>
> On Sat, 24 Jan 2009, Ray Chuan wrote:
>
>> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> Make that an Acked-by:
>
>> +	if(options & DAV_HEADER_IF) {
>> +		strbuf_addf(&buf, "If: (<%s>)", lock->token);
>> +		dav_headers = curl_slist_append(dav_headers, buf.buf);
>> +		strbuf_reset(&buf);
>
> BTW in case anyone is puzzled (like I was): curl_slist_append() takes a 
> "char *" as second parameter, but does not take custody of the buffer; 
> instead, it strdup()s it.  See
> http://cool.haxx.se/cvs.cgi/curl/lib/sendf.c?rev=1.155&content-type=text/vnd.viewcvs-markup
> for details.
>
> BTNW this should be mentioned in the commit message, too, to spare other 
> people the puzzlement.

Yeah, but your advice is too late --- I already lost a few minutes solving
my puzzlement with manpages.

Thanks, both.

^ permalink raw reply

* Re: [PATCH] Use time_t for timestamps returned by approxidate() instead of unsigned
From: Markus Heidelberg @ 2009-01-24  5:22 UTC (permalink / raw)
  To: Tim Henigan; +Cc: git, gitster
In-Reply-To: <1232665622-5110-1-git-send-email-tim.henigan@gmail.com>

Tim Henigan, 23.01.2009:
> Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
> ---
>  mode change 100644 => 100755 builtin-gc.c
>  mode change 100644 => 100755 builtin-reflog.c
>  mode change 100644 => 100755 builtin-show-branch.c
>  mode change 100644 => 100755 cache.h
>  mode change 100644 => 100755 date.c
>  mode change 100644 => 100755 parse-options.c
>  mode change 100644 => 100755 reflog-walk.c
>  mode change 100644 => 100755 refs.c
>  mode change 100644 => 100755 refs.h
>  mode change 100644 => 100755 revision.c
>  mode change 100644 => 100755 revision.h
>  mode change 100644 => 100755 sha1_name.c

Oops

^ permalink raw reply

* Re: [PATCH] Use time_t for timestamps returned by approxidate() instead of unsigned
From: Johannes Schindelin @ 2009-01-24  6:27 UTC (permalink / raw)
  To: Tim Henigan; +Cc: git, gitster
In-Reply-To: <1232665622-5110-1-git-send-email-tim.henigan@gmail.com>

Hi,

On Thu, 22 Jan 2009, Tim Henigan wrote:

> Use time_t for timestamps returned by approxidate() instead of unsigned 
> long.  All references to approxidate were checked as well as references 
> to OPT_DATE.

Hmm.  I vaguely remember Linus mentioning recently that unsigned long is 
the appropriate data type for the Unix Epoch...

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH (GIT-GUI BUG)] git-gui: Fix post-commit status with subject in non-locale encoding.
From: Robin Rosenberg @ 2009-01-24  6:37 UTC (permalink / raw)
  To: Alexander Gavrilov; +Cc: git, Shawn O. Pearce
In-Reply-To: <200901240018.13457.angavrilov@gmail.com>

fredag 23 januari 2009 22:18:13 skrev Alexander Gavrilov:
> As pointed out in msysgit bug #181, when a non-locale encoding
> is used for commits, post-commit status messages display the
> subject incorrectly. It happens because the file handle is
> not properly configured before the subject is read back.
> 
> This patch fixes it by factoring out the code that is
> used to setup the output handle into a separate function,
> and calling it from the reading code.

Ack. Works fine now.

Thanks.

-- robin

^ permalink raw reply

* Re: [PATCH 1/2] user-manual: Simplify the user configuration.
From: Felipe Contreras @ 2009-01-24  8:21 UTC (permalink / raw)
  To: Hannu Koivisto; +Cc: Junio C Hamano, git, Johannes Schindelin
In-Reply-To: <83wscndv57.fsf@kalahari.s2.org>

On Thu, Jan 22, 2009 at 8:59 PM, Hannu Koivisto <azure@iki.fi> wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> On Thu, Jan 22, 2009 at 6:17 PM, Hannu Koivisto <azure@iki.fi> wrote:
>>> Felipe Contreras <felipe.contreras@gmail.com> writes:
>>>
>>>> This brings back my previous question: where is the home directory in
>>>> a Windows system?
>>>
>>> It's where %HOMEDRIVE%%HOMEPATH% points to.
>>
>> I thought it was something like that. Do we want something like that
>> in the manual, or should we assume Windows users know that?
>
> I should have added that Unix programs (i.e. Cygwin programs and
> even some native ports) probably use %HOME% which may be different
> from %HOMEDRIVE%%HOMEPATH%.  I recall that if you haven't
> explicitly set up HOME in Windows environment, Cygwin sets it up
> magically from passwd or falls back to %HOMEDRIVE%%HOMEPATH%.  I
> have no idea if msysgit respects %HOME% if it is set or always uses
> %HOMEDRIVE%%HOMEPATH% or something completely different (user
> profile, most likely).
>
> It certainly may be that "home directory" is a foreign concept to
> some Windows users.  Some might know it as a user profile or a
> personal folder (just guessing, I'm pretty isolated from less
> experienced Windows users), even though user profile is a separate
> concept from "home directory" (note that there is %USERPROFILE%
> which by default is the same as %HOMEDRIVE%%HOMEPATH% at least in
> XP).
>
> In any case, what Cygwin git does should be expected by Cygwin
> users.  If msysgit wanted to be a really native Windows application
> and store the configuration where Microsoft thinks it should be
> stored, it probably shouldn't store the config under "home
> directory" to begin with (I'm guessing that's what it does) but
> under %USERPROFILE\Application Data\Git (...FILE\Local
> Settings\... in case non-roaming storage is wanted).  And in that
> case the manual might be misleading for msysgit users.  See
> e.g. <http://msdn.microsoft.com/en-us/library/ms995853.aspx>.

Isn't that enough argument to stop assuming the user knows where is
the "home directory"?

-- 
Felipe Contreras

^ permalink raw reply

* Re: [RFC/PATCH v3 3/3] archive.c: add basic support for submodules
From: Lars Hjemli @ 2009-01-24  8:44 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Junio C Hamano, René Scharfe
In-Reply-To: <alpine.DEB.1.00.0901232054360.21467@intel-tinevez-2-302>

On Fri, Jan 23, 2009 at 20:57, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
>
> On Fri, 23 Jan 2009, Lars Hjemli wrote:
>>
>> That's too bad, I hoped on some feedback from you on the part of the
>> commit message which you didn't quote:
>
> Well, you ignored my comments,

I might have misunderstood your comments, but I certainly didn't
ignore them. I actually tried to come up with a solution that would
solve your concerns about which submodules to include in the archive
(which is why I hoped for some feedback on that proposal).


> so what do you expect me to do?  Be happy?
>
> There are two issues there:
>
> - presence of a specific commit object being present in the repository
>  does not necessarily mean that it is reachable by any ref, and therefore
>  can mean that the tree/blob objects are not reachable, because it could
>  be an interrupted fetch;

This part I agree with.


>  in all of Git, we try to assume that only
>  reachable objects are valid objects.

I don't think this is true (most git commands accepts their arguments
as valid objects without verifying if they are reachable from a ref).
Do you feel it is necessary to perform a reachability check of the
gitlink'd commit before traversing into a submodule tree?


> - presence of a specific commit in the supermodule is a _lousy_ indicator
>  that the user wants to include that submodule in the archive.

This is the issue I tried to address with my
`--submodules=[a|c|r][g:<name>]` proposal in the commit message for
this patch. I hoped you would find it interesting, given your comments
in http://thread.gmane.org/gmane.comp.version-control.git/106167/focus=106235
(i.e. my 'a' flag would match your 'look-in-superprojects-odb', while
the 'c', 'r' and 'g' options would address your issues about how to
select the correct set of submodules).

--
larsh

^ permalink raw reply

* read-only working copies using links
From: Chad Dombrova @ 2009-01-24  9:17 UTC (permalink / raw)
  To: git

hi all,

there's a major feature for working with large binaries that has not  
yet been addressed by git:  the ability to check out a file as a  
symbolic/hard link to a blob in the repository, instead of duplicating  
the file into the working copy.

imagine a scenario where one user is putting large binary files into a  
git repo on a networked server.  100 other users on the server need  
read-only access to this repo.  they clone the repo using --shared or  
--local, which saves disk space for the object files, but each of  
these 100 working copies also creates copies of all the binary files  
at the HEAD revision. it would be 100x as efficient in both disk space  
and checkout speeds if, in place of these files, symbolic or hard  
links were made to the blob files in .git/objects.

the crux of the issue is that the blob objects would have to be stored  
as exact copies of the original files.  it would seem there are two  
things that currently prevent this from happening.  1) blobs are  
stored with compression and 2) they include a small header.   
compression can be disabled by setting core.loosecompression to 0, so  
that seems like less of an issue.  as for the header, wouldn't it be  
possible to store it separately?  in other words, store two files per  
blob directory, a small stub file with the header info and the  
unaltered file data.

what are the caveats to a system like this?  has anyone looked into  
this before?

-chad

p.s.
i tried submitting a post through nabble a few days and it said that  
it was still pending, so i thought i'd try submitting directly to the  
mailing list.  sorry, if i end up double-posting

^ permalink raw reply

* Re: http fixes, was Re: [PATCH] Allow cloning an empty repository
From: Sverre Rabbelier @ 2009-01-24  9:39 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Mike Hommey, git
In-Reply-To: <alpine.DEB.1.00.0901240125190.3586@pacific.mpi-cbg.de>

On Sat, Jan 24, 2009 at 01:26, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> On Fri, 23 Jan 2009, Mike Hommey wrote:
>> As I said when posting my patch batch, I don't have much time nor
>> motivation to work on this series. But let's make a deal: if someone
>> writes a good enough http test suite, I'll polish the http code.
>
> I already said in my replied to your patch that I will add the http test
> suite if you fix your patches.

I think Mike meant that he wants a working test suite before
continuing work on it? As in, what's the point in working on something
if you don't have a working test-suite to test your solution against
;).

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* Re: read-only working copies using links
From: Sverre Rabbelier @ 2009-01-24 11:02 UTC (permalink / raw)
  To: Chad Dombrova, Tim 'Mithro' Ansell; +Cc: git
In-Reply-To: <3EE64C92-CB4C-47BD-9C48-E369AED4B82F@gmail.com>

Heya,

On Sat, Jan 24, 2009 at 10:17, Chad Dombrova <chadrik@gmail.com> wrote:
> the crux of the issue is that the blob objects would have to be stored as
> exact copies of the original files.  it would seem there are two things that
> currently prevent this from happening.  1) blobs are stored with compression
> and 2) they include a small header.  compression can be disabled by setting
> core.loosecompression to 0, so that seems like less of an issue.  as for the
> header, wouldn't it be possible to store it separately?  in other words,
> store two files per blob directory, a small stub file with the header info
> and the unaltered file data.

I think Tim Ansell (cced) was talking about this at the gittogether
(storing the metadata seperately), as it would benefit sparse/narrow
checkout, another advantage supporting his case?

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* Re: [PATCH 1/2] handle color.ui at a central place
From: Markus Heidelberg @ 2009-01-24 11:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, René Scharfe, git
In-Reply-To: <7vmydi4kiz.fsf@gitster.siamese.dyndns.org>

Junio C Hamano, 23.01.2009:
> Markus Heidelberg <markus.heidelberg@web.de> writes:
> 
> > Jeff King, 22.01.2009:
> > ...
> >> > ...
> >> > That would probably be better.
> >> 
> >> Do you want to work on it, or should it go into the "yeah, right, one
> >> day" section of my todo list?
> >
> > Yes, feel free to enlarge your todo list :)
> > There are some other things that I want to work on before, so better
> > don't count on me for this. But maybe I'll come up to it, before your
> > todo list pointer reaches this item, who knows.
> 
> Whatever.
> 
> I merged and pushed out these two patches but they seem to break
> format-patch big time if you have ui.color set to auto.
> 
> I will be reverting them out of 'next'.  Grumble.

Damn, sorry for this.

I looked at the code and found this in git_format_config():

	if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) {
		return 0;

Which of course didn't handle color.ui, but that wasn't necessary before
the central color.ui handling from my patch.

So with the following diff it works:

-	if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) {
+	if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")
+				       || !strcmp(var, "color.ui")) {

Compared to f3aafa4 (Disable color detection during format-patch,
2006-07-09) and a159ca0 (Allow subcommand.color and color.subcommand
color configuration, 2006-12-13), which introduced !strcmp(var,
"diff.color") resp. !strcmp(var, "color.diff") at this place.

Or with this, which however would be a similar thing to what I tried to
remove from the code.

        git_config(git_format_config, NULL);
+       diff_use_color_default = 0;

format-patch is perhaps the only place where the commit has broken
things, because I didn't find other places, where color config options
were set, but not the corresponding variables. So it seems as if only
format-patch needed code like this to turn off the colors.

Markus

^ permalink raw reply

* Re: [PATCH 1/2] user-manual: Simplify the user configuration.
From: Johannes Schindelin @ 2009-01-24 13:42 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: Hannu Koivisto, Junio C Hamano, git
In-Reply-To: <94a0d4530901240021u65adeff8pb6995ef707bc1f68@mail.gmail.com>

Hi,

On Sat, 24 Jan 2009, Felipe Contreras wrote:

> On Thu, Jan 22, 2009 at 8:59 PM, Hannu Koivisto <azure@iki.fi> wrote:
> > Felipe Contreras <felipe.contreras@gmail.com> writes:
> >
> >> On Thu, Jan 22, 2009 at 6:17 PM, Hannu Koivisto <azure@iki.fi> wrote:
> >>> Felipe Contreras <felipe.contreras@gmail.com> writes:
> >>>
> >>>> This brings back my previous question: where is the home directory in
> >>>> a Windows system?
> >>>
> >>> It's where %HOMEDRIVE%%HOMEPATH% points to.
> >>
> >> I thought it was something like that. Do we want something like that
> >> in the manual, or should we assume Windows users know that?
> >
> > I should have added that Unix programs (i.e. Cygwin programs and
> > even some native ports) probably use %HOME% which may be different
> > from %HOMEDRIVE%%HOMEPATH%.  I recall that if you haven't
> > explicitly set up HOME in Windows environment, Cygwin sets it up
> > magically from passwd or falls back to %HOMEDRIVE%%HOMEPATH%.  I
> > have no idea if msysgit respects %HOME% if it is set or always uses
> > %HOMEDRIVE%%HOMEPATH% or something completely different (user
> > profile, most likely).
> >
> > It certainly may be that "home directory" is a foreign concept to
> > some Windows users.  Some might know it as a user profile or a
> > personal folder (just guessing, I'm pretty isolated from less
> > experienced Windows users), even though user profile is a separate
> > concept from "home directory" (note that there is %USERPROFILE%
> > which by default is the same as %HOMEDRIVE%%HOMEPATH% at least in
> > XP).
> >
> > In any case, what Cygwin git does should be expected by Cygwin
> > users.  If msysgit wanted to be a really native Windows application
> > and store the configuration where Microsoft thinks it should be
> > stored, it probably shouldn't store the config under "home
> > directory" to begin with (I'm guessing that's what it does) but
> > under %USERPROFILE\Application Data\Git (...FILE\Local
> > Settings\... in case non-roaming storage is wanted).  And in that
> > case the manual might be misleading for msysgit users.  See
> > e.g. <http://msdn.microsoft.com/en-us/library/ms995853.aspx>.
> 
> Isn't that enough argument to stop assuming the user knows where is
> the "home directory"?

Why does it appear as if we always have to bend over for Windows?  That is 
really frustrating.

In any case, the only thing the user would need to know the location of 
$HOME for is for .gitconfig.  And for Windows users I suggest using the 
dialog in git gui (for the variables that are editable there), which 
should cover most of what the user needs.  For everything else, they 
should use "git config".

Because if you really start with explaining where the home can be on 
Windows, you would also have to cover why "%USERPROFILE%" does not work in 
Git bash.  And before you know what is happening, you have a big ass 
Windows chapter in the user manual that revolves around anything except 
Git.

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