Git development
 help / color / mirror / Atom feed
* [PATCH 1/2] gitweb: add '/' to the end of filename in page title for trees
From: Jakub Narebski @ 2006-06-20  6:17 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski
In-Reply-To: <11507842053885-git-send-email-jnareb@gmail.com>

---

 gitweb/gitweb.cgi |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

d17c119d32ae4c5dd50976ea6a255d2bcbe480ed
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 1e1a044..42f3296 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -263,6 +263,9 @@ sub git_header_html {
 			$title .= "/$action";
 			if (defined $file_name) {
 				$title .= " - $file_name";
+				if ($action eq "tree" && $file_name !~ m|/$|) {
+					$title .= "/";
+				}
 			}
 		}
 	}
-- 
1.3.0

^ permalink raw reply related

* [PATCH] Fix: Support for the standard mime.types map in gitweb
From: Jakub Narebski @ 2006-06-20  6:19 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski

Temporary fix: commented out offending line in mimetype_guess.

---

 gitweb/gitweb.cgi |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

718a3b4c1e56c0330fa2c7ced2e66be5b095b541
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 11cc71f..1b254df 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -1524,7 +1524,7 @@ sub mimetype_guess {
 
 	if ($mimetypes_file) {
 		my $file = $mimetypes_file;
-		$file =~ m#^/# or $file = "$projectroot/$path/$file";
+		#$file =~ m#^/# or $file = "$projectroot/$path/$file";
 		$mime = mimetype_guess_file($filename, $file);
 	}
 	$mime ||= mimetype_guess_file($filename, '/etc/mime.types');
-- 
1.3.0

^ permalink raw reply related

* Re: [PATCH 1/2] gitweb: add '/' to the end of filename in page title for trees
From: Jakub Narebski @ 2006-06-20  6:22 UTC (permalink / raw)
  To: git
In-Reply-To: <1150784206793-git-send-email-jnareb@gmail.com>

This should of course be [PATCH 2/2]. I'm sorry for mistake.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* wrong check condition in patch-delta.c?
From: Nguyễn Thái Ngọc Duy @ 2006-06-20  6:32 UTC (permalink / raw)
  To: git

Hi,
While inspecting patch-delta.c, I encounter this:
                       if (cp_off + cp_size < cp_size ||
                           cp_off + cp_size > src_size ||
                           cp_size > size)
                               goto bad;
"cp_off + cp_size < cp_size" doesn't make sense to me. Is it on purpose?

^ permalink raw reply

* Re: wrong check condition in patch-delta.c?
From: Marco Roeland @ 2006-06-20  7:21 UTC (permalink / raw)
  To: Nguy???n Thái Ng???c Duy; +Cc: git
In-Reply-To: <fcaeb9bf0606192332j5b2ee4b9ycf2c63c7b1820204@mail.gmail.com>

On Tuesday June 20th 2006 Nguy???n Thái Ng???c Duy wrote:

> While inspecting patch-delta.c, I encounter this:
>                       if (cp_off + cp_size < cp_size ||
>                           cp_off + cp_size > src_size ||
>                           cp_size > size)
>                               goto bad;
> "cp_off + cp_size < cp_size" doesn't make sense to me. Is it on purpose?

It protects against possible overflow. Adding fixed length integers is
"wraparound" after all and discards the "carry" bit.
-- 
Marco Roeland

^ permalink raw reply

* [PATCH] repo-config: Fix late-night bug
From: Johannes Schindelin @ 2006-06-20  7:45 UTC (permalink / raw)
  To: git, junkio


This bug was hidden by the "future-proofing" of the test. Sigh.

When neither GIT_CONFIG nor GIT_CONFIG_LOCAL is set, do not use NULL,
but $GIT_DIR/config. Instead of using $GIT_DIR/config when only
GIT_CONFIG_LOCAL is set. Sorry.

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

	This time, "only" repo-config was affected, _not_ all users of
	the config file.

 repo-config.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/repo-config.c b/repo-config.c
index 03f108f..ab8f1af 100644
--- a/repo-config.c
+++ b/repo-config.c
@@ -74,8 +74,6 @@ static int get_value(const char* key_, c
 		const char *home = getenv("HOME");
 		local = getenv("GIT_CONFIG_LOCAL");
 		if (!local)
-			local = repo_config;
-		else
 			local = repo_config = strdup(git_path("config"));
 		if (home)
 			global = strdup(mkpath("%s/.gitconfig", home));
-- 
1.4.0.g59268-dirty

^ permalink raw reply related

* [PATCH] git_config: access() returns 0 on success, not > 0
From: Johannes Schindelin @ 2006-06-20  7:51 UTC (permalink / raw)
  To: git, junkio


Another late-night bug. Sorry again.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 config.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/config.c b/config.c
index d064f42..3e077d4 100644
--- a/config.c
+++ b/config.c
@@ -335,7 +335,7 @@ int git_config(config_fn_t fn)
 
 	if (home) {
 		char *user_config = strdup(mkpath("%s/.gitconfig", home));
-		if (access(user_config, R_OK) > 0)
+		if (!access(user_config, R_OK))
 			ret = git_config_from_file(fn, user_config);
 		free(user_config);
 	}
-- 
1.4.0.g59268-dirty

^ permalink raw reply related

* Apologies for the 2 late-night bugs
From: Johannes Schindelin @ 2006-06-20  7:54 UTC (permalink / raw)
  To: git

Hi,

with the recent patches to introduce $HOME/.gitconfig, I also introduced 
two bugs. They were not due to lacking of testing, but rather due to 
testing with an accidentally set GIT_CONFIG. And now I *know* why I did 
not want that thing in the first place. And I decided not to become a 
pilot, ever.

Ciao,
Dscho

^ permalink raw reply

* [PATCH/RFC] gitweb: Add title attribute with unshortened value for table cells
From: Jakub Narebski @ 2006-06-20  8:12 UTC (permalink / raw)
  To: git

This allows to see full, unshortened value on mouseover using 'title'
attribute for <td> element. For now it means only author name and
project owner name.

Ugly solution using $cgi->start_td({-title => VALUE})

Doesn't work well with values outside us-ascii, but that might be
considered web browser bug (misfeature), not a bug in gitweb.

---
The idea is to have full value available on mouseover, be it commit title, 
author of the commit, project owner, tag name/title or project description.
For now only author name and project owner name are implemented, and
implementation is ugly and results is not perfect.


 gitweb/gitweb.cgi |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

b72280ac4649d54375732de771f7d92c7d350258
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 1b254df..9a09b20 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -887,7 +887,7 @@ sub git_project_list {
 		$alternate ^= 1;
 		print "<td>" . $cgi->a({-href => "$my_uri?" . esc_param("p=$pr->{'path'};a=summary"), -class => "list"}, esc_html($pr->{'path'})) . "</td>\n" .
 		      "<td>$pr->{'descr'}</td>\n" .
-		      "<td><i>" . chop_str($pr->{'owner'}, 15) . "</i></td>\n";
+		      $cgi->start_td({-title => $pr->{'owner'}}) . chop_str($pr->{'owner'}, 15) . "</i></td>\n";
 		my $colored_age;
 		if ($pr->{'commit'}{'age'} < 60*60*2) {
 			$colored_age = "<span style =\"color: #009900;\"><b><i>$pr->{'commit'}{'age_string'}</i></b></span>";
@@ -1057,7 +1057,7 @@ sub git_summary {
 				$ref = " <span class=\"tag\">" . esc_html($refs->{$commit}) . "</span>";
 			}
 			print "<td><i>$co{'age_string'}</i></td>\n" .
-			      "<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
+			      $cgi->start_td({-title => $co{'author_name'}}) . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
 			      "<td>";
 			if (length($co{'title_short'}) < length($co{'title'})) {
 				print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"},
@@ -2306,7 +2306,7 @@ sub git_history {
 			}
 			$alternate ^= 1;
 			print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
-			      "<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 3)) . "</i></td>\n" .
+			      $cgi->start_td({-title => $co{'author_name'}}) . esc_html(chop_str($co{'author_name'}, 15, 3)) . "</i></td>\n" .
 			      "<td>" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list"}, "<b>" .
 			      esc_html(chop_str($co{'title'}, 50)) . "$ref</b>") . "</td>\n" .
 			      "<td class=\"link\">" .
@@ -2396,7 +2396,7 @@ sub git_search {
 			}
 			$alternate ^= 1;
 			print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
-			      "<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
+			      $cgi->start_td({-title => $co{'author_name'}}) . esc_html(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
 			      "<td>" .
 			      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$co{'id'}"), -class => "list"}, "<b>" . esc_html(chop_str($co{'title'}, 50)) . "</b><br/>");
 			my $comment = $co{'comment'};
@@ -2449,7 +2449,7 @@ sub git_search {
 					}
 					$alternate ^= 1;
 					print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
-					      "<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
+					      $cgi->start_td({-title => $co{'author_name'}}) . esc_html(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
 					      "<td>" .
 					      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$co{'id'}"), -class => "list"}, "<b>" .
 					      esc_html(chop_str($co{'title'}, 50)) . "</b><br/>");
@@ -2537,7 +2537,7 @@ sub git_shortlog {
 		}
 		$alternate ^= 1;
 		print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
-		      "<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
+		      $cgi->start_td({-title => $co{'author_name'}}) . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
 		      "<td>";
 		if (length($co{'title_short'}) < length($co{'title'})) {
 			print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"},
-- 
1.3.0

^ permalink raw reply related

* Re: [PATCH] Fix git to be (more) ANSI C99 compliant.
From: Rene Scharfe @ 2006-06-20  8:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Florian Forster, git, Linus Torvalds
In-Reply-To: <7vac8860z9.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano schrieb:
> BTW, I think we would probably want to have this patch on top of
> Rene's patch.  In all instances, the variable "buf" is of type
> "const char *" and the existing casts do not make sense to me.
> 
> 
> diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
> index 5c8a5f0..39a61b6 100644

Your patch reverts builtin-tar-tree.c to the version which is
currently both in master and next, which I think is a good
change.  However, could it be avoided at merge time?

OT: I found the blobs 5c8a5f0 and 39a61b6 by guessing (they are
builtin-tar-tree.c in pu and master, respectively).  OK, that
was easy.  But is there a way to reversely look up an object
without guessing, i.e. find out which commit(s) introduced a
certain blob?

Thanks,
René

^ permalink raw reply

* Re: git 1.4.0 usability problem
From: Jeff Garzik @ 2006-06-20  8:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7v4pyhdel5.fsf@assigned-by-dhcp.cox.net>

Here's a real world example of the 1.4.0 change breaking a merge:

("netdev-2.6" == local clone of kernel.org/...jgarzik/netdev-2.6.git)
[jgarzik@pretzel netdev-2.6]$ git branch
   ALL
   e100-sbit
* master
   upstream
   upstream-linus

[jgarzik@pretzel netdev-2.6]$ git pull /spare/repo/linux-2.6
Generating pack...
Done counting 3427 objects.
Result has 2510 objects.
Deltifying 2510 objects.
  100% (2510/2510) done
Unpacking 2510 objects
Total 2510, written 2510 (delta 2024), reused 0 (delta 0)
  100% (2510/2510) done
Updating from 427abfa28afedffadfca9dd8b067eb6d36bac53f to 
25f42b6af09e34c3f92107b36b5aa6edc2fdba2f
fatal: Untracked working tree file 'drivers/net/myri10ge/Makefile' would 
be overwritten by merge.

EXPLANATION:

* drivers/net/myri10ge/Makefile exists in latest Linus kernel tree, 
stored locally in /spare/repo/linux-2.6.
* drivers/net/myri10ge/Makefile exists in netdev-2.6#upstream and 
netdev-2.6#upstream-linus branches.
* drivers/net/myri10ge/Makefile does not exist in current branch, 
netdev-2.6#master.

^ permalink raw reply

* Re: [PATCH] Fix git to be (more) ANSI C99 compliant.
From: Junio C Hamano @ 2006-06-20  8:58 UTC (permalink / raw)
  To: Rene Scharfe; +Cc: git
In-Reply-To: <4497AED4.5060505@lsrfire.ath.cx>

Rene Scharfe <rene.scharfe@lsrfire.ath.cx> writes:

> Junio C Hamano schrieb:
>> BTW, I think we would probably want to have this patch on top of
>> Rene's patch.  In all instances, the variable "buf" is of type
>> "const char *" and the existing casts do not make sense to me.
>> 
>> diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
>> index 5c8a5f0..39a61b6 100644
>
> Your patch reverts builtin-tar-tree.c to the version which is
> currently both in master and next, which I think is a good
> change.  However, could it be avoided at merge time?

Sorry for attributing those "casts [that] do not make sense to
me" to you -- it is not your code but part of Florian's patch.

I think applying the patch in question on top of Florian's 11172e
would be the most sensible, since that is currently the tip of ff/c99
topic branch whose early parts have been merged to "next" and
the tip to "pu".  When Linus feels as sympathetic as I do, we
can pull the rest of ff/c99 branch to "next" and then eventually
to "master" and the patch will be merged together without
introducing the nonsense casts.

Another possibility is to amend the tip of ff/c99 topic branch,
since it is not merged to "next" yet.  I promised not to rewind
"master" nor "next", but never made promises not to rewind "pu",
so it is a fair game.  I think it is simpler and cleaner, so
that will be what I will do.

> OT: I found the blobs 5c8a5f0 and 39a61b6 by guessing (they are
> builtin-tar-tree.c in pu and master, respectively).  OK, that
> was easy.  But is there a way to reversely look up an object
> without guessing, i.e. find out which commit(s) introduced a
> certain blob?

You could do something like this (totally untested).

Going from the above "diff --git" index line you have object
name abbreviations and pathnames as clues.  To take advantage of
it, you could use "git rev-list pu -- builtin-tar-tree.c"
instead of unlimited list.

$ git rev-list pu |
  git diff-tree -r --stdin --pretty |
  perl -e '
	my @lines = ();
        sub flush_em {
        	my @found = ();
                my @comment = ();
		for my $l (@lines) {
                	if ($l !~ /^:/) {
				push @comment, $l;
				next;
			}
                        for (@ARGV) {
                        	if ($l =~ / $_/) {
                                	push @found, $l;
					last;
				}
                        }
                }
		if (@found) {
			print join("", @comment, @found);
                }
                @lines = ();
	}
        while (<STDIN>) {
        	if (/^commit [0-9a-f]{40}$/) { flush_em(); }
                push @lines, $_;
	}
        flush_em();
  ' 39a61b6 5c8a5f0

^ permalink raw reply

* Re: [PATCH/RFC] gitweb: Add title attribute with unshortened value for table cells
From: Junio C Hamano @ 2006-06-20  9:15 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <200606201012.31684.jnareb@gmail.com>

Jakub Narebski <jnareb@gmail.com> writes:

> Doesn't work well with values outside us-ascii, but that might be
> considered web browser bug (misfeature), not a bug in gitweb.

That's sad.

Are you sure about it?

What does start_td({-title=>"blah"}) produce? <td title="blah">?
If so, is http://members.cox.net/junkio/t.html close to what you
are trying to achieve here?

>  		      "<td>$pr->{'descr'}</td>\n" .
> -		      "<td><i>" . chop_str($pr->{'owner'}, 15) . "</i></td>\n";
> +		      $cgi->start_td({-title => $pr->{'owner'}}) . chop_str($pr->{'owner'}, 15) . "</i></td>\n";

Where did the opening <i> go?  Not that I care about italics,
since I think this should all be done with stylesheet, but I do
care about unbalanced pairs.

BTW, I haven't nailed down the procedure to update the
kernel.org gitweb installations (I suspect the burden is on me
since Kay orphaned gitweb onto me).

I wonder if there is somebody who is willing to run gitweb from
the "next" branch on some public site, so that I can be
reasonably confident before breaking one of the most important
infrastructure of the kernel development?  Volunteers?

^ permalink raw reply

* Re: git 1.4.0 usability problem
From: Ryan Anderson @ 2006-06-20  9:16 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Junio C Hamano, git
In-Reply-To: <4497B39E.2050205@garzik.org>

On Tue, Jun 20, 2006 at 04:36:46AM -0400, Jeff Garzik wrote:
> Here's a real world example of the 1.4.0 change breaking a merge:
> 
> ("netdev-2.6" == local clone of kernel.org/...jgarzik/netdev-2.6.git)
> [jgarzik@pretzel netdev-2.6]$ git branch
>   ALL
>   e100-sbit
> * master
>   upstream
>   upstream-linus
> 
> [jgarzik@pretzel netdev-2.6]$ git pull /spare/repo/linux-2.6
> Generating pack...
> Done counting 3427 objects.
> Result has 2510 objects.
> Deltifying 2510 objects.
>  100% (2510/2510) done
> Unpacking 2510 objects
> Total 2510, written 2510 (delta 2024), reused 0 (delta 0)
>  100% (2510/2510) done
> Updating from 427abfa28afedffadfca9dd8b067eb6d36bac53f to 
> 25f42b6af09e34c3f92107b36b5aa6edc2fdba2f
> fatal: Untracked working tree file 'drivers/net/myri10ge/Makefile' would 
> be overwritten by merge.
> 
> EXPLANATION:
> 
> * drivers/net/myri10ge/Makefile exists in latest Linus kernel tree, 
> stored locally in /spare/repo/linux-2.6.
> * drivers/net/myri10ge/Makefile exists in netdev-2.6#upstream and 
> netdev-2.6#upstream-linus branches.
> * drivers/net/myri10ge/Makefile does not exist in current branch, 
> netdev-2.6#master.

If that is the case, how did it get into the directory, then?

I suspect the history we're missing is this:

git checkout upstream
...
git checkout -f master

If you have a clean tree, there's not really a reason to use -f.  It
actively hurts you by confusing git as to what state your directory is
in. (If you don't have a clean tree, well, using -f will orphan new
files that Git knows about, and overwrite the changes on ones it does,
so it's still rather inconsistent, and probably not at all what you
intend.)

Instead of using "git checkout -f" to abandon any WIP, try something
like this:

	git branch throw-away HEAD
	git checkout throw-away
	git commit -a -m "throw away"
	git checkout $1
	git branch -D throw-away


i.e:
$ sed -i -e 's/PHONY/YNOHP/g' Makefile
$ git branch throw-away HEAD
$ git checkout throw-away
$ git diff |diffstat
 Makefile |   60 ++++++++++++++++++++++++++++++------------------------------
$ git commit -a -m "throw-away"
$ git checkout master
$ git branch -d throw-away
The branch 'throw-away' is not a strict subset of your current HEAD.
If you are sure you want to delete it, run 'git branch -D throw-away'.
$ git branch -D throw-away
Deleted branch throw-away.
$ git diff | diffstat
0 files changed
$ git branch throw-away HEAD
$ cp Makefile Makefile-ryan
$ git add Makefile-ryan 
$ git checkout throw-away
$ git diff | diffstat
 0 files changed
$ git status
# On branch refs/heads/throw-away
#
# Updated but not checked in:
#   (will commit)
#
#	new file: Makefile-ryan
#
$ git commit -a -m "throw-away"
$ git checkout master
$ git status
nothing to commit

Note that using plain "checkout" should be noticeably faster, too.





-- 

Ryan Anderson
  sometimes Pug Majere

^ permalink raw reply

* Re: git 1.4.0 usability problem
From: Junio C Hamano @ 2006-06-20  9:35 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: git
In-Reply-To: <4497B39E.2050205@garzik.org>

Jeff Garzik <jeff@garzik.org> writes:

> Here's a real world example of the 1.4.0 change breaking a merge:
>
> ("netdev-2.6" == local clone of kernel.org/...jgarzik/netdev-2.6.git)
> [jgarzik@pretzel netdev-2.6]$ git branch
>   ALL
>   e100-sbit
> * master
>   upstream
>   upstream-linus
>
> [jgarzik@pretzel netdev-2.6]$ git pull /spare/repo/linux-2.6
> ...
> Updating from 427abfa28afedffadfca9dd8b067eb6d36bac53f to
> 25f42b6af09e34c3f92107b36b5aa6edc2fdba2f
> fatal: Untracked working tree file 'drivers/net/myri10ge/Makefile'
> would be overwritten by merge.
>
> EXPLANATION:
>
> * drivers/net/myri10ge/Makefile exists in latest Linus kernel tree,
> stored locally in /spare/repo/linux-2.6.
> * drivers/net/myri10ge/Makefile exists in netdev-2.6#upstream and
> netdev-2.6#upstream-linus branches.
> * drivers/net/myri10ge/Makefile does not exist in current branch,
> netdev-2.6#master.

Requesting one more bit of explanation.

When you did this pull, you were on your "master" branch.  Whose
HEAD does not have the myri10ge/Makefile in its tree.  And you
did not have that path in the index either (otherwise it would
not have said "untracked working tree file").  Did you have that
file in your working tree?  And if so how/why?

If you did something like this before ending up in your "master"
branch, I think you would have such a file:

	$ git branch ;# you were in upstream-linus branch
          ALL
          e100-sbit
          master
          upstream
        * upstream-linus
        $ git diff      ;# and were up-to-date -- no output nor
        $ git diff HEAD ;# local changes
        $ git checkout -f master ;# but you switched to master with -f

With "checkout -f", your local changes to files that appear in
the "master" branch will be overwritten, but the files that are
supposed to disappear because you are switching out of the
current branch (e.g. myri10ge/Makefile) are left behind.

It probably would make sense to change "checkout -f" so that it
removes such files from your working tree to support this
particular usage.  We kept saying "with -f local dirty state
will be gone", but "checkout -f" does not do as thorough job as
"reset --hard".  Changing "checkout -f next-branch" to do the
moral equivalent of "reset --hard HEAD && checkout next-branch"
would solve this problem, and I do not think changing it that
way would not have any negative impact.

I suspect this patch would do exactly that...

diff --git a/git-checkout.sh b/git-checkout.sh
index 564117f..193f6c5 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -137,7 +137,7 @@ # what we already had
 
 if [ "$force" ]
 then
-    git-read-tree --reset $new &&
+    git-read-tree --reset -u $new &&
 	git-checkout-index -q -f -u -a
 else
     git-update-index --refresh >/dev/null

^ permalink raw reply related

* Re: [PATCH/RFC] gitweb: Add title attribute with unshortened value for table cells
From: Timo Hirvonen @ 2006-06-20  9:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: jnareb, git
In-Reply-To: <7vd5d4chmg.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> wrote:

> I wonder if there is somebody who is willing to run gitweb from
> the "next" branch on some public site, so that I can be
> reasonably confident before breaking one of the most important
> infrastructure of the kernel development?  Volunteers?

I can help.

http://onion.dynserv.net/git/gitweb.cgi

Note: http://onion.dynserv.net/git/ (index.cgi) is an old version.

Global symbol "$path" requires explicit package name at
/var/www/localhost/htdocs/git/gitweb.cgi line 1521.
Execution of /var/www/localhost/htdocs/git/gitweb.cgi aborted due to
compilation errors.

The line is:

$file =~ m#^/# or $file = "$projectroot/$path/$file";

$path seems to be undefined.  I don't understand perl very well so I
can't fix it.

-- 
http://onion.dynserv.net/~timo/

^ permalink raw reply

* Re: [PATCH/RFC] gitweb: Add title attribute with unshortened value for table cells
From: Jakub Narebski @ 2006-06-20  9:48 UTC (permalink / raw)
  To: git
In-Reply-To: <7vd5d4chmg.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:

> Jakub Narebski <jnareb@gmail.com> writes:
> 
>> Doesn't work well with values outside us-ascii, but that might be
>> considered web browser bug (misfeature), not a bug in gitweb.
> 
> That's sad.
> 
> Are you sure about it?

Now I see I was wrong.

> What does start_td({-title=>"blah"}) produce? <td title="blah">?
> If so, is http://members.cox.net/junkio/t.html close to what you
> are trying to achieve here?

Yes, that is what I tried to achieve. Using CGI to set attributes
was to quote characters which cannot be in double quited attribute values,
i.e. change '"' to '&#34;' or '&quot;'. I don't know what start_td did with
\"o character (Perl v5.8.6, CGI::VERSION=3.05).

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* [PATCH] checkout -f: do not leave untracked working tree files.
From: Junio C Hamano @ 2006-06-20  9:50 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: git, Ryan Anderson
In-Reply-To: <7vr71kb257.fsf@assigned-by-dhcp.cox.net>

Earlier we did not consider untracked working tree files
"precious", but we have always considered them fair game to
clobber.  These days, branch switching by read-tree is more
careful and tries to protect untracked working tree files.  This
caused the following workflow to stop working:

	git checkout one-branch-with-file-F
	git checkout -f another-without-file-F
	git pull . one-branch-with-file-F

Because the second checkout leaves F from the previous state as
untracked file in the working tree, the merge would fail, trying
to protect F from being clobbered.

This changes "git checkout -f" to remove working tree files that
are known to git in the switched-from state but do not exist in
the switched-to state, borrowing the same logic from "reset --hard".

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

 * I am going to bed without trying this out since it is very
   late tonight.  Might be in "pu" or "next" tomorrow depending
   on my mood.  If this works out for Jeff, I can simply drop
   the "core.oktoclobber = ask" patch from my topics -- although
   I kind of liked that one ;-).

 git-checkout.sh |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/git-checkout.sh b/git-checkout.sh
index 564117f..77c2593 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -137,8 +137,7 @@ # what we already had
 
 if [ "$force" ]
 then
-    git-read-tree --reset $new &&
-	git-checkout-index -q -f -u -a
+    git-read-tree --reset -u $new
 else
     git-update-index --refresh >/dev/null
     merge_error=$(git-read-tree -m -u $old $new 2>&1) || (
-- 
1.4.0.g59268

^ permalink raw reply related

* Re: [PATCH/RFC] gitweb: Add title attribute with unshortened value for table cells
From: Jakub Narebski @ 2006-06-20  9:59 UTC (permalink / raw)
  To: git
In-Reply-To: <20060620124606.4e3e226c.tihirvon@gmail.com>

Timo Hirvonen wrote:

> http://onion.dynserv.net/git/gitweb.cgi
> 
> Global symbol "$path" requires explicit package name at
> /var/www/localhost/htdocs/git/gitweb.cgi line 1521.
> Execution of /var/www/localhost/htdocs/git/gitweb.cgi aborted due to
> compilation errors.
> 
> The line is:
> 
> $file =~ m#^/# or $file = "$projectroot/$path/$file";
> 
> $path seems to be undefined.  I don't understand perl very well so I
> can't fix it.

Temporary fix is in:
 
  "[PATCH] Fix: Support for the standard mime.types map in gitweb"
  (Message-Id: <11507843541678-git-send-email-jnareb@gmail.com>)
    http://permalink.gmane.org/gmane.comp.version-control.git/22172

BTW. I have _my_ version at 
  http://front.fuw.edu.pl/cgi-bin/jnareb/gitweb.cgi

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: [PATCH/RFC] gitweb: Add title attribute with unshortened value for table cells
From: Timo Hirvonen @ 2006-06-20 10:57 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <e78gun$65s$1@sea.gmane.org>

Jakub Narebski <jnareb@gmail.com> wrote:

> Timo Hirvonen wrote:
> 
> > http://onion.dynserv.net/git/gitweb.cgi
> > 
> > Global symbol "$path" requires explicit package name at
> > /var/www/localhost/htdocs/git/gitweb.cgi line 1521.
> > Execution of /var/www/localhost/htdocs/git/gitweb.cgi aborted due to
> > compilation errors.
> > 
> > The line is:
> > 
> > $file =~ m#^/# or $file = "$projectroot/$path/$file";
> > 
> > $path seems to be undefined.  I don't understand perl very well so I
> > can't fix it.
> 
> Temporary fix is in:
>  
>   "[PATCH] Fix: Support for the standard mime.types map in gitweb"
>   (Message-Id: <11507843541678-git-send-email-jnareb@gmail.com>)
>     http://permalink.gmane.org/gmane.comp.version-control.git/22172

Seems to work now.  I also enabled blame and it works too. But I noticed
that the search is sometimes broken.  If you click a "blob" link and
then try to search something gitweb will complain:

    403 Forbidden - Unknown commit object. 

"h" parameter is blob, not commit. Shouldn't the h parameter be set to
HEAD always when searching?  Searching starts at h so the search results
vary:

http://onion.dynserv.net/git/gitweb.cgi?p=cmus.git&a=search&h=HEAD&s=pickaxe%3Atheme

http://onion.dynserv.net/git/gitweb.cgi?p=cmus.git&a=search&h=fd2d983d51858e25cc71b14b59c787e1683ba7c5&s=pickaxe%3Atheme

-- 
http://onion.dynserv.net/~timo/

^ permalink raw reply

* Re: [PATCH] checkout -f: do not leave untracked working tree files.
From: Santi Béjar @ 2006-06-20 11:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff Garzik, git, Ryan Anderson
In-Reply-To: <7vfyi0b1gv.fsf_-_@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> writes:

> Earlier we did not consider untracked working tree files
> "precious", but we have always considered them fair game to
> clobber.  These days, branch switching by read-tree is more
> careful and tries to protect untracked working tree files.  This
> caused the following workflow to stop working:
>
> 	git checkout one-branch-with-file-F
> 	git checkout -f another-without-file-F
> 	git pull . one-branch-with-file-F
>
> Because the second checkout leaves F from the previous state as
> untracked file in the working tree, the merge would fail, trying
> to protect F from being clobbered.
>
> This changes "git checkout -f" to remove working tree files that
> are known to git in the switched-from state but do not exist in
> the switched-to state, borrowing the same logic from "reset --hard".
>

I agree with this patch (without testing).

Another thing to take into account is that, for this particular
case/sequence, the untracked file-F is exactly the same as the one from
the pull, so you are not overwritting that file and it could succeed.

    Santi

^ permalink raw reply

* Re: [PATCH] checkout -f: do not leave untracked working tree files.
From: Junio C Hamano @ 2006-06-20 11:18 UTC (permalink / raw)
  To: Santi Béjar; +Cc: git
In-Reply-To: <8764iw5bvl.fsf@gmail.com>

Santi Béjar <sbejar@gmail.com> writes:

> Another thing to take into account is that, for this particular
> case/sequence, the untracked file-F is exactly the same as the one from
> the pull, so you are not overwritting that file and it could succeed.

Yes and no.  The untracked file is not even known to git when
pull is happening (that is the definition of "untracked").  Yes,
we could see if the contents happen to match and choose to
overwrite, but I think it is often more likely that the contents
do not match that it is not worth it (I have not examined what
it would involve to add that check yet, so it might turn out to
be a cheap check but I doubt it).

^ permalink raw reply

* Re: [PATCH] checkout -f: do not leave untracked working tree files.
From: Alexander Litvinov @ 2006-06-20 11:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Santi Béjar, git
In-Reply-To: <7vfyi09isf.fsf@assigned-by-dhcp.cox.net>

Good news. I have a habbit to switch branches using two commands:

git checkout -f second-branch
git clean -d -q

Now this will work with single command. Thanks.

^ permalink raw reply

* Re: [PATCH] checkout -f: do not leave untracked working tree files.
From: Junio C Hamano @ 2006-06-20 11:51 UTC (permalink / raw)
  To: Alexander Litvinov; +Cc: Santi Béjar, git
In-Reply-To: <200606201827.50808.lan@academsoft.ru>

Alexander Litvinov <lan@academsoft.ru> writes:

> Good news. I have a habbit to switch branches using two commands:
>
> git checkout -f second-branch
> git clean -d -q
>
> Now this will work with single command. Thanks.

"will" meaning "you suspect" or "you tried and confirmed"?

^ permalink raw reply

* Re: [PATCH] checkout -f: do not leave untracked working tree files.
From: Alexander Litvinov @ 2006-06-20 12:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vveqw82qd.fsf@assigned-by-dhcp.cox.net>

> "will" meaning "you suspect" or "you tried and confirmed"?
:-) I suspect.

Lets test. Your pu branch (5af05efbeaa06005596129fb111a739a87f8a883) really 
works. I have cvs repo and use git for daily work. I have head and 2 branches 
from cvs and store CVS/* files in git too. Usualy this operation pruduce a 
lot of CVS/Tag files:

git checkout -f cvs-v52 (this is one of by cvs's branch)
cvs -q up -dP (nothing have been updated)
git checkout -f master (this is a dev branch from cvs head)
git status

pu branch nuke them when use git checkout -f !

^ 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