Git development
 help / color / mirror / Atom feed
* [PATCH (resend) 1/3] http.c: free preq when aborting
From: Tay Ray Chuan @ 2009-08-10 15:55 UTC (permalink / raw)
  To: git, gitster; +Cc: Jeff Lasslett
In-Reply-To: <be6fef0d0908100847h7e9b53a2ofdf318e9958be3b2@mail.gmail.com>

Free preq in new_http_pack_request when aborting. preq was allocated
before jumping to the 'abort' label so this is safe.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
 http.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/http.c b/http.c
index a2720d5..cfe32f5 100644
--- a/http.c
+++ b/http.c
@@ -1059,6 +1059,7 @@ struct http_pack_request *new_http_pack_request(

 abort:
 	free(filename);
+	free(preq);
 	return NULL;
 }

--
1.6.3.1

^ permalink raw reply related

* Re: [EGIT PATCH] Provide a more JavaBeans-style 'getName' accessor for the id Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
From: Shawn O. Pearce @ 2009-08-10 15:52 UTC (permalink / raw)
  To: Alex Blewitt; +Cc: robin.rosenberg, git
In-Reply-To: <1241909854-11498-1-git-send-email-alex.blewitt@gmail.com>

Alex Blewitt <alex.blewitt@gmail.com> wrote:
> ---
>  .../src/org/spearce/jgit/lib/AnyObjectId.java      |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
> index acb3cb5..015042a 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
> @@ -448,6 +448,12 @@ public final String name() {
>  	}
>  
>  	/**
> +	 * @return string form of the SHA-1, in lower case hexadecimal.
> +	 */
> +	public final String getName() {
> +		return name();
> +	}

Obviously you didn't compile test this in JGit:

./org/spearce/jgit/revwalk/RevTag.java:206: getName() in
org.spearce.jgit.revwalk.RevTag cannot override getName() in
org.spearce.jgit.lib.AnyObjectId; overridden method is final

:-(

-- 
Shawn.

^ permalink raw reply

* [PATCH 1/3] http.c: free preq when aborting
From: Tay Ray Chuan @ 2009-08-10 15:51 UTC (permalink / raw)
  To: git; +Cc: Jeff Lasslett

Free preq in new_http_pack_request when aborting. preq was allocated
before jumping to the 'abort' label so this is safe.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
 http.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/http.c b/http.c
index a2720d5..cfe32f5 100644
--- a/http.c
+++ b/http.c
@@ -1059,6 +1059,7 @@ struct http_pack_request *new_http_pack_request(

 abort:
 	free(filename);
+	free(preq);
 	return NULL;
 }

--
1.6.3.1

^ permalink raw reply related

* Re: [PATCH] Check return value of ftruncate call in http.c. Remove  possible mem leak
From: Tay Ray Chuan @ 2009-08-10 15:47 UTC (permalink / raw)
  To: Jeff Lasslett; +Cc: git, gitster
In-Reply-To: <1249911747-28490-1-git-send-email-jeff.lasslett@gmail.com>

Hi,

On Mon, Aug 10, 2009 at 9:42 PM, Jeff Lasslett<jeff.lasslett@gmail.com> wrote:
> @@ -1216,10 +1220,12 @@ struct http_object_request *new_http_object_request(const char *base_url,
>                                 CURLOPT_HTTPHEADER, range_header);
>        }
>
> +       free(url);
>        return freq;
>
> -       free(url);

Freeing after the return didn't make sense. Thanks for spotting this.

On a side note, you could simply do away with the 'url' variable,
since you're going to pass freq->url to curl_setopt.

-- 
Cheers,
Ray Chuan

^ permalink raw reply

* Re: [PATCH] git gui: remove warning when deleting correctly merged remote branch
From: Shawn O. Pearce @ 2009-08-10 15:47 UTC (permalink / raw)
  To: Heiko Voigt; +Cc: git
In-Reply-To: <20090615211956.GB8065@macbook.lan>

Heiko Voigt <hvoigt@hvoigt.net> wrote:
> If the user wants to delete a remote branch and selects the correct
> "merged into" we should not warn that "Recovering deleted branches is
> difficult". For local branches we do the same already.
> 
> Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
> ---
>  git-gui/lib/remote_branch_delete.tcl |   16 +++++++++-------
>  1 files changed, 9 insertions(+), 7 deletions(-)

Thanks, applied.
 
-- 
Shawn.

^ permalink raw reply

* Re: git-gui translation pushed
From: Shawn O. Pearce @ 2009-08-10 15:44 UTC (permalink / raw)
  To: Jimmy Angelakos; +Cc: git
In-Reply-To: <1245870671.5526.14.camel@blob>

Jimmy Angelakos <vyruss@hellug.gr> wrote:
> I have pushed a Greek translation for git-gui on repo.or.cz's
> git-gui-i18n (mob branch).

Thanks, I have cherry-picked this through to master.  The charset
was set wrong in the files, it was "CHARSET", which isn't a valid
charset.  I modified to UTF-8 before applying.  I suspect something
is up with your PO editor.

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH] Limited git-gui to displaying 5000 new files
From: Shawn O. Pearce @ 2009-08-10 15:38 UTC (permalink / raw)
  To: Dan Zwell; +Cc: Git Mailing List, raa.lkml
In-Reply-To: <4A4A77A6.1020905@lawrence.edu>

Dan Zwell <dzwell@gmail.com> wrote:
> When there is a large number of new or modified files,
> "display_all_files" takes a long time, and git-gui appears to
> hang. Limit the display to 5000 files, by default. This number
> is configurable as gui.maxfilesdisplayed.
>
> Show a warning if the list of files is truncated.

> @@ -1713,7 +1717,18 @@ proc display_all_files {} {
> 	set file_lists($ui_index) [list]
> 	set file_lists($ui_workdir) [list]
>
> -	foreach path [lsort [array names file_states]] {
> +	set to_display [lsort [array names file_states]]
> +	set display_limit $default_config(gui.maxfilesdisplayed)

This should use [get_config gui.maxfilesdisplayed] so that the
user can actually set this property in a configuration file and
have git-gui honor it.  Reading from $default_config means you are
only looking at the hardcoded value you set in git-gui.sh.

> +	if {[llength $to_display] > $display_limit} {
> +		if {![info exists files_warning] || !$files_warning} {

Wouldn't it be easier to just set files_warning to 0 at the start
of the script, so that you don't need to do this info exists test?

> +			set warning "Displaying only $display_limit of "
> +			append warning "[llength $to_display] files."
> +			info_popup [mc $warning]

This needs to be in the translated strings.

-- 
Shawn.

^ permalink raw reply

* Re: [RFC/PATCH RESEND v2] git-gui: display summary when showing diff of a submodule
From: Shawn O. Pearce @ 2009-08-10 15:33 UTC (permalink / raw)
  To: Jens Lehmann; +Cc: git, gitster, Heiko Voigt
In-Reply-To: <4A65FBAF.9020603@web.de>

Jens Lehmann <Jens.Lehmann@web.de> wrote:
> As it is hard to say what changed in a submodule by looking at the hashes,
> let's show the colored submodule summary instead.
> 
> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
> ---
> 
> I got only one response two weeks ago, so here is a resend.

Thanks for the resend, got lost in my inbox.  Applied.
 
-- 
Shawn.

^ permalink raw reply

* Re: Droppable Git Gui in Mac OS X
From: Shawn O. Pearce @ 2009-08-10 15:26 UTC (permalink / raw)
  To: Tobia Conforto; +Cc: git
In-Reply-To: <loom.20090807T090458-788@post.gmane.org>

Tobia Conforto <tobia.conforto@gmail.com> wrote:
> I noticed that Git Gui cannot be launched on an existing repository by
> simply dragging the repository folder onto Git Gui's icon in the dock,
> but this is a standard UI feature in OS X.
> 
> Here is a fix "Git Gui.app" (which MacPorts installs in
> /opt/local/share/git-gui/lib) to enable this feature.

Interesting.

Two comments:

1) Commit message?  What should we record in the project history
   for this change?

2) Signed-off-by line?  Please see git.git's SUBMITTING_PATCHES
   file for details of what this means, and why it is necessary:

   http://repo.or.cz/w/alt-git.git?a=blob;f=Documentation/SubmittingPatches;hb=HEAD

 
> --- Git Gui.app/Contents/Info.plist
> +++ Git Gui.app/Contents/Info.plist
> @@ -24,5 +24,16 @@
>  	<string>GITg</string>
>  	<key>CFBundleVersion</key>
>  	<string>0.12.0</string>
> +	<key>CFBundleDocumentTypes</key>
> +	<array>
> +		<dict>
> +			<key>CFBundleTypeOSTypes</key>
> +			<array>
> +				<string>fold</string>
> +			</array>
> +			<key>CFBundleTypeRole</key>
> +			<string>Viewer</string>
> +		</dict>
> +	</array>
>  </dict>
>  </plist>
> --- Git Gui.app/Contents/Resources/Scripts/AppMain.tcl
> +++ Git Gui.app/Contents/Resources/Scripts/AppMain.tcl
> @@ -19,4 +19,9 @@
> 
>  unset gitexecdir gitguilib
>  set argv [lrange $argv 1 end]
> -source $AppMain_source
> +
> +proc ::tk::mac::OpenDocument {args} {
> +	cd [lindex $args 0]
> +}
> +
> +after 1 { source $AppMain_source }
> 
> 
> --
> 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

-- 
Shawn.

^ permalink raw reply

* Re: [JGIT] Request For Help/Directions
From: Shawn O. Pearce @ 2009-08-10 15:23 UTC (permalink / raw)
  To: Douglas Campos; +Cc: Git Mailing List
In-Reply-To: <ed88cb980907312015q5eb89bf3k73b6664c4f3cbcfd@mail.gmail.com>

Douglas Campos <douglas@theros.info> wrote:
> I'm interested in helping with the implementation, can someone gimme
> little directions?
> 
> I was thinking on implement "git checkout <file>" functionality.
> 
> Any tips?
> 
> PS: I'm reading the testcases & code to find directions, but got
> struck at some deprecated types (GitIndex -> DirCache).

Sorry for the late reply, things tend to get lost in my inbox.

GitIndex vs. DirCache... that's an ugly issue at the momement in the
code base.  I really want to move to DirCache because it tends to
be quicker at reading and writing the index out, plus it honors the
'TREE' extension, at least some of the time.  But its API is said
to be harder to work with, and I can't disagree with that, using the
DirCacheBuilder vs. DirCacheEditor to make updates is horribly ugly.

FWIW, DirCacheBuilder is really meant to be used inside of a
TreeWalk, alongside other iterators, like a FileTreeIterator.

In theory, you should be able to create a 3 way TreeWalk between:

 1) DirCacheBuilderIterator
 2) FileTreeIterator
 3) CanonicalTreeParser

where 1 represents the current state of the .git/index file,
2 represents the current state of the working directory, and 3
represents the tree you are performing the checkout from.

IIRC you could attach a TreeFilter.ANY_DIFF to this TreeWalk and
only have it stop where there are differences between the 3 trees.
Though with a FileTreeIterator ANY_DIFF is probably a bad idea,
as the SHA-1 isn't readily available in a FileTreeIterator and
that is one of the things ANY_DIFF relies upon.  Instead you'd
need to write your own TreeFilter to check stat data between 1-2,
and SHA-1 data between 2-3.

At a difference point, you then need to apply the basic 3-way merge
logic to determine if you should checkout the file in 3 to 1 and 2,
or if you should abort because the file in 2 (the working tree)
differs and needs to be merged.

A really good reason for using the TreeWalk is it has a subclass
called NameConflictTreeWalk that knows how to heal around
directory/file conflicts (aka D/F conflicts) and reports both D/F
paths under a single entry, so that the merge alogrithm can attempt
to deal with D->F or F->D type changes.

But a good chunk of this is pie-in-the-sky.  I've built these APIs
with this in mind... but haven't gotten as far as actually putting
the implementation into practice.

-- 
Shawn.

^ permalink raw reply

* [RFC PATCH v2 4/4] read-tree: add --no-sparse to turn off sparse hook
From: Nguyễn Thái Ngọc Duy @ 2009-08-10 15:19 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <1249917562-5931-4-git-send-email-pclouds@gmail.com>


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin-read-tree.c         |    4 +++-
 t/t1009-read-tree-sparse.sh |    6 ++++++
 unpack-trees.c              |    6 ++++--
 unpack-trees.h              |    1 +
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index 9c2d634..4c1061e 100644
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
@@ -31,7 +31,7 @@ static int list_tree(unsigned char *sha1)
 }
 
 static const char * const read_tree_usage[] = {
-	"git read-tree [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u [--exclude-per-directory=<gitignore>] | -i]]  [--index-output=<file>] <tree-ish1> [<tree-ish2> [<tree-ish3>]]",
+	"git read-tree [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u [--exclude-per-directory=<gitignore>] | -i]] [--no-sparse] [--index-output=<file>] <tree-ish1> [<tree-ish2> [<tree-ish3>]]",
 	NULL
 };
 
@@ -98,6 +98,8 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
 		  PARSE_OPT_NONEG, exclude_per_directory_cb },
 		OPT_SET_INT('i', NULL, &opts.index_only,
 			    "don't check the working tree after merging", 1),
+		OPT_SET_INT(0, "no-sparse", &opts.no_sparse_hook,
+			    "do not run sparse hook", 1),
 		OPT_END()
 	};
 
diff --git a/t/t1009-read-tree-sparse.sh b/t/t1009-read-tree-sparse.sh
index b613a89..18115b1 100755
--- a/t/t1009-read-tree-sparse.sh
+++ b/t/t1009-read-tree-sparse.sh
@@ -39,4 +39,10 @@ test_expect_success 're-add one' '
 	test -f one
 '
 
+test_expect_success 'read-tree --no-sparse' '
+	make_hook "git update-index --assume-unchanged one"
+	git read-tree -u -m --no-sparse HEAD &&
+	test -f one
+'
+
 test_done
diff --git a/unpack-trees.c b/unpack-trees.c
index f407bf5..d087112 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -530,8 +530,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
 	if (o->trivial_merges_only && o->nontrivial_merge)
 		return unpack_failed(o, "Merge requires file-level merging");
 
-	if (run_sparse_hook(o))
-		return unpack_failed(o, NULL);
+	if (!o->no_sparse_hook) {
+		if (run_sparse_hook(o))
+			return unpack_failed(o, NULL);
+	}
 
 	o->src_index = NULL;
 	ret = check_updates(o) ? (-2) : 0;
diff --git a/unpack-trees.h b/unpack-trees.h
index ad21823..81eb2ef 100644
--- a/unpack-trees.h
+++ b/unpack-trees.h
@@ -30,6 +30,7 @@ struct unpack_trees_options {
 		     skip_unmerged,
 		     initial_checkout,
 		     diff_index_cached,
+		     no_sparse_hook,
 		     gently;
 	const char *prefix;
 	int pos;
-- 
1.6.3.GIT

^ permalink raw reply related

* [RFC PATCH v2 3/4] unpack_trees(): add support for sparse checkout
From: Nguyễn Thái Ngọc Duy @ 2009-08-10 15:19 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <1249917562-5931-3-git-send-email-pclouds@gmail.com>

This patch teaches unpack_trees() to checkout/remove entries on
working directories appropriately when sparse checkout area is
changed. Hook "sparse" is needed to help determine which entry will be
checked out, which will not be.

When the hook is run, it is prepared with a pseudo index. The hook then
can use "git update-index --[no-]assume-unchanged" to manipulate the index.
It should not do anything else on the index. Assume unchanged information
from the index will be used to shape working directory.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 cache.h                     |    3 +
 t/t1009-read-tree-sparse.sh |   42 ++++++++++++
 unpack-trees.c              |  152 +++++++++++++++++++++++++++++++++++++++++--
 unpack-trees.h              |    2 +
 4 files changed, 193 insertions(+), 6 deletions(-)
 create mode 100755 t/t1009-read-tree-sparse.sh

diff --git a/cache.h b/cache.h
index 1a2a3c9..dfad54a 100644
--- a/cache.h
+++ b/cache.h
@@ -177,6 +177,9 @@ struct cache_entry {
 #define CE_HASHED    (0x100000)
 #define CE_UNHASHED  (0x200000)
 
+/* Only remove in work directory, not index */
+#define CE_WT_REMOVE (0x400000)
+
 /*
  * Extended on-disk flags
  */
diff --git a/t/t1009-read-tree-sparse.sh b/t/t1009-read-tree-sparse.sh
new file mode 100755
index 0000000..b613a89
--- /dev/null
+++ b/t/t1009-read-tree-sparse.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+test_description='sparse hook tests'
+
+. ./test-lib.sh
+
+make_hook() {
+	echo "#!/bin/sh" > .git/hooks/sparse &&
+	echo "$1" >> .git/hooks/sparse &&
+	chmod u+x .git/hooks/sparse
+}
+
+test_expect_success setup '
+	echo one > one &&
+	echo two > two &&
+	git add one two &&
+	git commit -m onetwo &&
+	echo three > three &&
+	git add three &&
+	git commit -m three
+'
+
+mkdir .git/hooks
+
+test_expect_success 'failed hook' '
+	make_hook "exit 1" &&
+	test_must_fail git read-tree -u -m HEAD
+'
+
+test_expect_success 'remove one' '
+	make_hook "git update-index --assume-unchanged one"
+	git read-tree -u -m HEAD &&
+	test ! -f one
+'
+
+test_expect_success 're-add one' '
+	make_hook "git update-index --no-assume-unchanged one" &&
+	git read-tree -u -m HEAD &&
+	test -f one
+'
+
+test_done
diff --git a/unpack-trees.c b/unpack-trees.c
index 720f7a1..f407bf5 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -8,6 +8,7 @@
 #include "progress.h"
 #include "refs.h"
 #include "attr.h"
+#include "run-command.h"
 
 /*
  * Error messages expected by scripts out of plumbing commands such as
@@ -32,6 +33,12 @@ static struct unpack_trees_error_msgs unpack_plumbing_errors = {
 
 	/* bind_overlap */
 	"Entry '%s' overlaps with '%s'.  Cannot bind.",
+
+	/* sparse_not_uptodate_file */
+	"Entry '%s' not uptodate. Cannot update sparse checkout.",
+
+	/* would_lose_orphaned */
+	"Orphaned working tree file '%s' would be %s by sparse checkout update.",
 };
 
 #define ERRORMSG(o,fld) \
@@ -78,7 +85,7 @@ static int check_updates(struct unpack_trees_options *o)
 	if (o->update && o->verbose_update) {
 		for (total = cnt = 0; cnt < index->cache_nr; cnt++) {
 			struct cache_entry *ce = index->cache[cnt];
-			if (ce->ce_flags & (CE_UPDATE | CE_REMOVE))
+			if (ce->ce_flags & (CE_UPDATE | CE_REMOVE | CE_WT_REMOVE))
 				total++;
 		}
 
@@ -92,6 +99,13 @@ static int check_updates(struct unpack_trees_options *o)
 	for (i = 0; i < index->cache_nr; i++) {
 		struct cache_entry *ce = index->cache[i];
 
+		if (ce->ce_flags & CE_WT_REMOVE) {
+			display_progress(progress, ++cnt);
+			if (o->update)
+				unlink_entry(ce);
+			continue;
+		}
+
 		if (ce->ce_flags & CE_REMOVE) {
 			display_progress(progress, ++cnt);
 			if (o->update)
@@ -118,6 +132,106 @@ static int check_updates(struct unpack_trees_options *o)
 	return errs != 0;
 }
 
+static int verify_uptodate_sparse(struct cache_entry *ce, struct unpack_trees_options *o);
+static int verify_absent_sparse(struct cache_entry *ce, const char *action, struct unpack_trees_options *o);
+static int run_sparse_hook(struct unpack_trees_options *o)
+{
+	struct index_state *index = &o->result;
+	struct index_state sparse_index = *index;
+	struct cache_entry *ce, *sparse_ce;
+	char sparse_index_file[PATH_MAX];
+	char sparse_index_env[PATH_MAX];
+	const char *argv[2], *env[2];
+	struct child_process cp;
+	int fd, i, j;
+
+	if (access(git_path("hooks/sparse"), X_OK) < 0)
+		return 0;
+
+	strcpy(sparse_index_file, git_path("sparse"));
+	fd = open(sparse_index_file, O_WRONLY | O_CREAT, 0600);
+	if (fd < 0) {
+		error("Unable to open %s for writing", sparse_index_file);
+		return -1;
+	}
+	/* FIXME: write_index may change something */
+	if (write_index(&sparse_index, fd)) {
+		error("Unable to write index to %s", sparse_index_file);
+		close(fd);
+		return -1;
+	}
+	close(fd);
+
+	memset(&cp, 0, sizeof(cp));
+	argv[0] = git_path("hooks/sparse");
+	argv[1] = NULL;
+	cp.argv = argv;
+	cp.no_stdin = 1;
+	cp.stdout_to_stderr = 1;
+	snprintf(sparse_index_env, sizeof(sparse_index_env), "GIT_INDEX_FILE=%s", sparse_index_file);
+	env[0] = sparse_index_env;
+	env[1] = NULL;
+	cp.env = env;
+	if (run_command(&cp)) {
+		error("Failed to run hook 'sparse'");
+		unlink(sparse_index_file);
+		return -1;
+	}
+
+	discard_index(&sparse_index);
+	read_index_from(&sparse_index, sparse_index_file);
+	unlink(sparse_index_file);
+
+	ce = index->cache[0];
+	sparse_ce = sparse_index.cache[0];
+	for (i = j = 0; i < index->cache_nr; i++, ce++) {
+		int was_checkout = !(ce->ce_flags & CE_VALID);
+
+		if (ce_stage(ce))
+			continue;
+
+		/*
+		 * We only care about files getting into the checkout area
+		 * If merge strategies want to remove some, go ahead
+		 */
+		if (ce->ce_flags & CE_REMOVE)
+			continue;
+
+		while (j < sparse_index.cache_nr &&
+		       cache_name_compare(sparse_ce->name, sparse_ce->ce_flags, ce->name, ce->ce_flags) < 0) {
+			sparse_ce++;
+			j++;
+		}
+		if (j < sparse_index.cache_nr &&
+		    !cache_name_compare(sparse_ce->name, sparse_ce->ce_flags, ce->name, ce->ce_flags))
+			ce->ce_flags = (ce->ce_flags & ~CE_VALID) | (sparse_ce->ce_flags & CE_VALID);
+
+		/* Update worktree, add/remove entries if needed */
+
+		if (was_checkout && ce->ce_flags & CE_VALID) {
+			/*
+			 * If CE_UPDATE is set, verify_uptodate() must be called already
+			 * also stat info may have lost after merged_entry() so calling
+			 * verify_uptodate() again may fail
+			 */
+			if (!(ce->ce_flags & CE_UPDATE) && verify_uptodate_sparse(ce, o))
+				return -1;
+			ce->ce_flags |= CE_WT_REMOVE;
+		}
+		if (!was_checkout && !(ce->ce_flags & CE_VALID)) {
+			if (verify_absent_sparse(ce, "overwritten", o))
+				return -1;
+			ce->ce_flags |= CE_UPDATE;
+		}
+
+		/* merge strategies may set CE_UPDATE outside checkout area */
+		if (ce->ce_flags & CE_VALID)
+			ce->ce_flags &= ~CE_UPDATE;
+
+	}
+	return 0;
+}
+
 static inline int call_unpack_fn(struct cache_entry **src, struct unpack_trees_options *o)
 {
 	int ret = o->fn(src, o);
@@ -416,6 +530,9 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
 	if (o->trivial_merges_only && o->nontrivial_merge)
 		return unpack_failed(o, "Merge requires file-level merging");
 
+	if (run_sparse_hook(o))
+		return unpack_failed(o, NULL);
+
 	o->src_index = NULL;
 	ret = check_updates(o) ? (-2) : 0;
 	if (o->dst_index)
@@ -445,8 +562,9 @@ static int same(struct cache_entry *a, struct cache_entry *b)
  * When a CE gets turned into an unmerged entry, we
  * want it to be up-to-date
  */
-static int verify_uptodate(struct cache_entry *ce,
-		struct unpack_trees_options *o)
+static int verify_uptodate_generic(struct cache_entry *ce,
+				   struct unpack_trees_options *o,
+				   const char *error_msg)
 {
 	struct stat st;
 
@@ -471,7 +589,18 @@ static int verify_uptodate(struct cache_entry *ce,
 	if (errno == ENOENT)
 		return 0;
 	return o->gently ? -1 :
-		error(ERRORMSG(o, not_uptodate_file), ce->name);
+		error(error_msg, ce->name);
+}
+
+static int verify_uptodate(struct cache_entry *ce,
+			   struct unpack_trees_options *o)
+{
+	return verify_uptodate_generic(ce, o, ERRORMSG(o, not_uptodate_file));
+}
+static int verify_uptodate_sparse(struct cache_entry *ce,
+				  struct unpack_trees_options *o)
+{
+	return verify_uptodate_generic(ce, o, ERRORMSG(o, sparse_not_uptodate_file));
 }
 
 static void invalidate_ce_path(struct cache_entry *ce, struct unpack_trees_options *o)
@@ -579,8 +708,9 @@ static int icase_exists(struct unpack_trees_options *o, struct cache_entry *dst,
  * We do not want to remove or overwrite a working tree file that
  * is not tracked, unless it is ignored.
  */
-static int verify_absent(struct cache_entry *ce, const char *action,
-			 struct unpack_trees_options *o)
+static int verify_absent_generic(struct cache_entry *ce, const char *action,
+				 struct unpack_trees_options *o,
+				 const char *error_msg)
 {
 	struct stat st;
 
@@ -660,6 +790,16 @@ static int verify_absent(struct cache_entry *ce, const char *action,
 	}
 	return 0;
 }
+static int verify_absent(struct cache_entry *ce, const char *action,
+			 struct unpack_trees_options *o)
+{
+	return verify_absent_generic(ce, action, o, ERRORMSG(o, would_lose_untracked));
+}
+static int verify_absent_sparse(struct cache_entry *ce, const char *action,
+			 struct unpack_trees_options *o)
+{
+	return verify_absent_generic(ce, action, o, ERRORMSG(o, would_lose_orphaned));
+}
 
 static int merged_entry(struct cache_entry *merge, struct cache_entry *old,
 		struct unpack_trees_options *o)
diff --git a/unpack-trees.h b/unpack-trees.h
index d19df44..ad21823 100644
--- a/unpack-trees.h
+++ b/unpack-trees.h
@@ -14,6 +14,8 @@ struct unpack_trees_error_msgs {
 	const char *not_uptodate_dir;
 	const char *would_lose_untracked;
 	const char *bind_overlap;
+	const char *sparse_not_uptodate_file;
+	const char *would_lose_orphaned;
 };
 
 struct unpack_trees_options {
-- 
1.6.3.GIT

^ permalink raw reply related

* [RFC PATCH v2 2/4] gitignore: read from index if .gitignore is assume-unchanged
From: Nguyễn Thái Ngọc Duy @ 2009-08-10 15:19 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <1249917562-5931-2-git-send-email-pclouds@gmail.com>

In sparse checkout mode (aka CE_VALID or assume-unchanged) some files
may be missing from working directory. If some of those files are
.gitignore, it will affect how git excludes files.

Because those files are by definition "assume unchanged" we can
instead read them from index. This adds index as a prerequisite for
directory listing. At the moment directory listing is used by "git
clean", "git add", "git ls-files" and "git status"/"git commit" and
unpack_trees()-related commands.  These commands have been
checked/modified to populate index before doing directory listing.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/technical/api-directory-listing.txt |    3 +
 builtin-clean.c                                   |    5 +-
 builtin-ls-files.c                                |    4 +-
 dir.c                                             |   70 ++++++++++++++-------
 t/t3001-ls-files-others-exclude.sh                |   20 ++++++
 t/t7300-clean.sh                                  |   19 ++++++
 6 files changed, 96 insertions(+), 25 deletions(-)

diff --git a/Documentation/technical/api-directory-listing.txt b/Documentation/technical/api-directory-listing.txt
index 5bbd18f..7d0e282 100644
--- a/Documentation/technical/api-directory-listing.txt
+++ b/Documentation/technical/api-directory-listing.txt
@@ -58,6 +58,9 @@ The result of the enumeration is left in these fields::
 Calling sequence
 ----------------
 
+* Ensure the_index is populated as it may have CE_VALID entries that
+  affect directory listing.
+
 * Prepare `struct dir_struct dir` and clear it with `memset(&dir, 0,
   sizeof(dir))`.
 
diff --git a/builtin-clean.c b/builtin-clean.c
index 2d8c735..d917472 100644
--- a/builtin-clean.c
+++ b/builtin-clean.c
@@ -71,8 +71,11 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 
 	dir.flags |= DIR_SHOW_OTHER_DIRECTORIES;
 
-	if (!ignored)
+	if (!ignored) {
+		if (read_cache() < 0)
+			die("index file corrupt");
 		setup_standard_excludes(&dir);
+	}
 
 	pathspec = get_pathspec(prefix, argv);
 	read_cache();
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index f473220..d1a23c4 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -481,6 +481,9 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
 		prefix_offset = strlen(prefix);
 	git_config(git_default_config, NULL);
 
+	if (read_cache() < 0)
+		die("index file corrupt");
+
 	argc = parse_options(argc, argv, prefix, builtin_ls_files_options,
 			ls_files_usage, 0);
 	if (show_tag || show_valid_bit) {
@@ -508,7 +511,6 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
 	pathspec = get_pathspec(prefix, argv);
 
 	/* be nice with submodule paths ending in a slash */
-	read_cache();
 	if (pathspec)
 		strip_trailing_slash_from_submodules();
 
diff --git a/dir.c b/dir.c
index e05b850..e55344f 100644
--- a/dir.c
+++ b/dir.c
@@ -200,11 +200,36 @@ void add_exclude(const char *string, const char *base,
 	which->excludes[which->nr++] = x;
 }
 
+static void *read_index_data(const char *path, size_t *size)
+{
+	int pos, len;
+	unsigned long sz;
+	enum object_type type;
+	void *data;
+	struct index_state *istate = &the_index;
+
+	len = strlen(path);
+	pos = index_name_pos(istate, path, len);
+	if (pos < 0)
+		return NULL;
+	/* only applies to CE_VALID entries */
+	if (!(istate->cache[pos]->ce_flags & CE_VALID))
+		return NULL;
+	data = read_sha1_file(istate->cache[pos]->sha1, &type, &sz);
+	if (!data || type != OBJ_BLOB) {
+		free(data);
+		return NULL;
+	}
+	*size = xsize_t(sz);
+	return data;
+}
+
 static int add_excludes_from_file_1(const char *fname,
 				    const char *base,
 				    int baselen,
 				    char **buf_p,
-				    struct exclude_list *which)
+				    struct exclude_list *which,
+				    int check_index)
 {
 	struct stat st;
 	int fd, i;
@@ -212,27 +237,31 @@ static int add_excludes_from_file_1(const char *fname,
 	char *buf, *entry;
 
 	fd = open(fname, O_RDONLY);
-	if (fd < 0 || fstat(fd, &st) < 0)
-		goto err;
-	size = xsize_t(st.st_size);
-	if (size == 0) {
-		close(fd);
-		return 0;
+	if (fd < 0 || fstat(fd, &st) < 0) {
+		if (0 <= fd)
+			close(fd);
+		if (!check_index || (buf = read_index_data(fname, &size)) == NULL)
+			return -1;
 	}
-	buf = xmalloc(size+1);
-	if (read_in_full(fd, buf, size) != size)
-	{
-		free(buf);
-		goto err;
+	else {
+		size = xsize_t(st.st_size);
+		if (size == 0) {
+			close(fd);
+			return 0;
+		}
+		buf = xmalloc(size);
+		if (read_in_full(fd, buf, size) != size) {
+			close(fd);
+			return -1;
+		}
+		close(fd);
 	}
-	close(fd);
 
 	if (buf_p)
 		*buf_p = buf;
-	buf[size++] = '\n';
 	entry = buf;
-	for (i = 0; i < size; i++) {
-		if (buf[i] == '\n') {
+	for (i = 0; i <= size; i++) {
+		if (i == size || buf[i] == '\n') {
 			if (entry != buf + i && entry[0] != '#') {
 				buf[i - (i && buf[i-1] == '\r')] = 0;
 				add_exclude(entry, base, baselen, which);
@@ -241,17 +270,12 @@ static int add_excludes_from_file_1(const char *fname,
 		}
 	}
 	return 0;
-
- err:
-	if (0 <= fd)
-		close(fd);
-	return -1;
 }
 
 void add_excludes_from_file(struct dir_struct *dir, const char *fname)
 {
 	if (add_excludes_from_file_1(fname, "", 0, NULL,
-				     &dir->exclude_list[EXC_FILE]) < 0)
+				     &dir->exclude_list[EXC_FILE], 0) < 0)
 		die("cannot use %s as an exclude file", fname);
 }
 
@@ -302,7 +326,7 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)
 		strcpy(dir->basebuf + stk->baselen, dir->exclude_per_dir);
 		add_excludes_from_file_1(dir->basebuf,
 					 dir->basebuf, stk->baselen,
-					 &stk->filebuf, el);
+					 &stk->filebuf, el, 1);
 		dir->exclude_stack = stk;
 		current = stk->baselen;
 	}
diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh
index c65bca8..88b69bc 100755
--- a/t/t3001-ls-files-others-exclude.sh
+++ b/t/t3001-ls-files-others-exclude.sh
@@ -85,6 +85,26 @@ test_expect_success \
        >output &&
      test_cmp expect output'
 
+test_expect_success 'setup sparse gitignore' '
+	git add .gitignore one/.gitignore one/two/.gitignore &&
+	git update-index --assume-unchanged .gitignore one/.gitignore one/two/.gitignore &&
+	rm .gitignore one/.gitignore one/two/.gitignore
+'
+
+test_expect_success \
+    'git ls-files --others with various exclude options.' \
+    'git ls-files --others \
+       --exclude=\*.6 \
+       --exclude-per-directory=.gitignore \
+       --exclude-from=.git/ignore \
+       >output &&
+     test_cmp expect output'
+
+test_expect_success 'restore gitignore' '
+	git checkout .gitignore one/.gitignore one/two/.gitignore &&
+	rm .git/index
+'
+
 cat > excludes-file <<\EOF
 *.[1-8]
 e*
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index 929d5d4..4886d5f 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -22,6 +22,25 @@ test_expect_success 'setup' '
 
 '
 
+test_expect_success 'git clean with assume-unchanged .gitignore' '
+	git update-index --assume-unchanged .gitignore &&
+	rm .gitignore &&
+	mkdir -p build docs &&
+	touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
+	git clean &&
+	test -f Makefile &&
+	test -f README &&
+	test -f src/part1.c &&
+	test -f src/part2.c &&
+	test ! -f a.out &&
+	test ! -f src/part3.c &&
+	test -f docs/manual.txt &&
+	test -f obj.o &&
+	test -f build/lib.so &&
+	git update-index --no-assume-unchanged .gitignore &&
+	git checkout .gitignore
+'
+
 test_expect_success 'git clean' '
 
 	mkdir -p build docs &&
-- 
1.6.3.GIT

^ permalink raw reply related

* [RFC PATCH v2 1/4] Prevent diff machinery from examining assume-unchanged entries on worktree
From: Nguyễn Thái Ngọc Duy @ 2009-08-10 15:19 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <1249917562-5931-1-git-send-email-pclouds@gmail.com>


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 diff-lib.c                       |    5 +++--
 t/t4039-diff-assume-unchanged.sh |   31 +++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100755 t/t4039-diff-assume-unchanged.sh

diff --git a/diff-lib.c b/diff-lib.c
index b7813af..f5787f6 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -159,7 +159,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
 				continue;
 		}
 
-		if (ce_uptodate(ce))
+		if (ce_uptodate(ce) || (ce->ce_flags & CE_VALID))
 			continue;
 
 		changed = check_removed(ce, &st);
@@ -337,6 +337,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
 	struct rev_info *revs = o->unpack_data;
 	int match_missing, cached;
 
+	/* if the entry is not checked out, don't examine work tree */
+	cached = o->index_only || (idx && (idx->ce_flags & CE_VALID));
 	/*
 	 * Backward compatibility wart - "diff-index -m" does
 	 * not mean "do not ignore merges", but "match_missing".
@@ -344,7 +346,6 @@ static void do_oneway_diff(struct unpack_trees_options *o,
 	 * But with the revision flag parsing, that's found in
 	 * "!revs->ignore_merges".
 	 */
-	cached = o->index_only;
 	match_missing = !revs->ignore_merges;
 
 	if (cached && idx && ce_stage(idx)) {
diff --git a/t/t4039-diff-assume-unchanged.sh b/t/t4039-diff-assume-unchanged.sh
new file mode 100755
index 0000000..d0e46a7
--- /dev/null
+++ b/t/t4039-diff-assume-unchanged.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+test_description='diff with assume-unchanged entries'
+
+. ./test-lib.sh
+
+# external diff has been tested in t4020-diff-external.sh
+
+test_expect_success 'setup' '
+	echo zero > zero &&
+	git add zero &&
+	git commit -m zero &&
+	echo one > one &&
+	echo two > two &&
+	git add one two &&
+	git commit -m onetwo &&
+	git update-index --assume-unchanged one &&
+	echo borked >> one &&
+	test "$(git ls-files -v one)" = "h one"
+'
+
+test_expect_success 'diff-index does not examine assume-unchanged entries' '
+	git diff-index HEAD^ -- one | grep -q 5626abf0f72e58d7a153368ba57db4c673c0e171 
+'
+
+# TODO ced_uptodate()
+test_expect_success 'diff-files does not examine assume-unchanged entries' '
+	/usr/bin/git diff-files -- one
+'
+
+test_done
-- 
1.6.3.GIT

^ permalink raw reply related

* [RFC PATCH v2 0/4] Sparse checkout
From: Nguyễn Thái Ngọc Duy @ 2009-08-10 15:19 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Another RFC, which is more usable than the last series I sent out.
Compared to the last one, a few more patches have gone the way of
Dodo; 'git shape-workdir' has become a hook and should be easier
to write too. All you need is a few
"git update-index --[no-]assume-unchanged" in .git/hooks/sparse.

Nguyễn Thái Ngọc Duy (4):
  Prevent diff machinery from examining assume-unchanged entries on
    worktree
  gitignore: read from index if .gitignore is assume-unchanged
  unpack_trees(): add support for sparse checkout
  read-tree: add --no-sparse to turn off sparse hook

 Documentation/technical/api-directory-listing.txt |    3 +
 builtin-clean.c                                   |    5 +-
 builtin-ls-files.c                                |    4 +-
 builtin-read-tree.c                               |    4 +-
 cache.h                                           |    3 +
 diff-lib.c                                        |    5 +-
 dir.c                                             |   70 +++++++---
 t/t1009-read-tree-sparse.sh                       |   48 +++++++
 t/t3001-ls-files-others-exclude.sh                |   20 +++
 t/t4039-diff-assume-unchanged.sh                  |   31 ++++
 t/t7300-clean.sh                                  |   19 +++
 unpack-trees.c                                    |  154 ++++++++++++++++++++-
 unpack-trees.h                                    |    3 +
 13 files changed, 335 insertions(+), 34 deletions(-)
 create mode 100755 t/t1009-read-tree-sparse.sh
 create mode 100755 t/t4039-diff-assume-unchanged.sh

^ permalink raw reply

* Re: Using both JGit and C Git
From: Shawn O. Pearce @ 2009-08-10 15:12 UTC (permalink / raw)
  To: Semen Vadishev; +Cc: git
In-Reply-To: <4A7726E1.2020501@gmail.com>

Semen Vadishev <Semen.Vadishev@gmail.com> wrote:
> I'm working on git client written in Java. Now the application uses both
> implementations but our team is interested in switching to JGit
> completely some day. We consider that for the first version all
> read-only operations should be implemented with JGit and read-write
> functionality should use exec calls to git executable. We would keep
> that approach until we have even the smallest suspect that pure Java
> implementation could corrupt repository somehow. Also we have a number
> of read-write operations implemented with JGit and we will use them
> internally to collect more experience and to see if any problems will
> appear.
> 
> Does anyone here already have any experience with using both JGit and C
> Git together. Is there any kind of test suites which allow to check
> JGit's behavior on different platforms comparing with native git. Is
> there any known issues/workarounds? Any feedback is much appreciated.
> 
> I've noticed that such a question was raised here, but the answers are
> probably out of date now.

There are some tests in the JGit test suite that validate JGit
against C Git output to ensure the data is the same.  For example
we have created certain content with C Git, checked a copy of the
pack file into the JGit repository, then create the same content
in JGit and validate that the data is the same.  But this sort of
test is difficult because of potential unimportant variations in
the zlib library.  The compressed output can safely differ, when
running the output through the inflate method the original content
is still restored.  So we tend not to rely on it that much.


I can say that JGit completely powers Gerrit Code Review[1], and
that Gerrit Code Review is in use at many different sites as a
production server, relied upon by thousands for their daily work.
As a case in point, Gerrit Code Review powers the Android Open
Source Project... and also the Android related teams for many device
manufacturers who are building devices running that operating system.
It also powers the servers used by the Google developers who work
on Android.

Gerrit Code Review completely runs the server side portion of Git,
both the git-upload-pack and git-receive-pack, in a pure Java SSHD.
Its the only interface the teams have to their repository... and
it does it quite nicely.  The users don't know the difference,
it just works.

So, in my humble opinion, as a server technology, JGit is quite
stable and works well.  It doesn't perform as well as C Git does,
especially under high user loads, but we aren't serving volume here
as a public read-only mirror, we are supporting a smaller group.


[1] http://code.google.com/p/gerrit/

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH] gitweb: squelch harmless variable scoping errors
From: Jakub Narebski @ 2009-08-10 15:05 UTC (permalink / raw)
  To: Mark A Rada; +Cc: git, Randal L. Schwartz, Junio C Hamano
In-Reply-To: <F203660D-5123-475D-8288-F398EA670002@mailservices.uwaterloo.ca>

On Sat, 8 Aug 2009, Mark A Rada wrote:

> I fiddled around a bit and this solution seems to work, but is a bit  
> odd, as the method is declared obsolete in the Perl documentation
> (v5.8.8). 
> 
> What do you think?

Below there is alternate solution (from asking on #perl channel on
FreeNode).

> --->8---
> This will use the 'vars' method of declaring global variables instead
> of the 'our' method.
> 
> Though 'vars' has been obsoleted, it has the advantage of pre-declaring
> global symbols; this ensures that those symbols will be available to
> routines loaded later, whereas 'our' does not seem to do this.
> 
> The result is that when using mod_perl you will no longer get any
> warnings printed to your error_log.
> 
> Signed-off-by: Mark Rada <marada@uwaterloo.ca>
> ---
> gitweb/gitweb.perl |    8 +++++---
> 1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 37120a3..0544aa2 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -57,12 +57,14 @@ if ($path_info) {
> our $GIT = "++GIT_BINDIR++/git";
> 
> # absolute fs-path which will be prepended to the project path
> -#our $projectroot = "/pub/scm";
> -our $projectroot = "++GITWEB_PROJECTROOT++";
> +use vars qw($projectroot);
> +#$projectroot = "/pub/scm";
> +$projectroot = "++GITWEB_PROJECTROOT++";
> 
> # fs traversing limit for getting project list
> # the number is relative to the projectroot
> -our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
> +use vars qw($project_maxdepth);
> +$project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
> 
> # target of the home link on top of all pages
> our $home_link = $my_uri || "/";
> -- 
> 1.6.4

Alternate solution could be (please test that it works as intended),
which is a bit simpler, and do not use obsolete 'use vars' pragma,
which is not BLOCK-scoped like other pragmas like 'use strict'.

diff --git i/gitweb/gitweb.perl w/gitweb/gitweb.perl
index ab0cad2..c0fa53c 100755
--- i/gitweb/gitweb.perl
+++ w/gitweb/gitweb.perl
@@ -2308,6 +2305,7 @@ sub git_get_projects_list {
 			follow_skip => 2, # ignore duplicates
 			dangling_symlinks => 0, # ignore dangling symlinks, silently
 			wanted => sub {
+				our ($project_maxdepth, $projectroot);
 				# skip project-list toplevel, if we get it.
 				return if (m!^[/.]$!);
 				# only directories can be git repositories



-- 
Jakub Narebski

Git User's Survey 2009:
http://tinyurl.com/GitSurvey2009

^ permalink raw reply related

* Re: A tiny documentation patch
From: Thomas Rast @ 2009-08-10 14:59 UTC (permalink / raw)
  To: Štěpán Němec; +Cc: git
In-Reply-To: <20090810144419.GB24183@headley>

Štěpán Němec wrote:
> here's the patch.

Please read Documentation/SubmittingPatches.  In particular, you
should send your patch inline (git-send-email can help) and add a
Signed-off-by.

> I noticed a few typos in the git-remote manpage
[...]
> diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
[...]
> -In mirror mode, enabled with `\--mirror`, the refs will not be stored
> +In mirror mode, enabled with `--mirror`, the refs will not be stored
[...]
> -mode, furthermore, `git push` will always behave as if `\--mirror`
> +mode, furthermore, `git push` will always behave as if `--mirror`

While I'm not sure how far back you'd have to go to find an asciidoc
that does need this escaping, it's definitely *not* a typo.  In some
instances, -- turns into em dashes.

If you are seeing stray backslashes in the output (I don't), I suspect
you are either running asciidoc 8.x but forgot to set ASCIIDOC8, or
8.4.1+ and are missing the patch 71c020c (Disable asciidoc 8.4.1+
semantics for `{plus}` and friends, 2009-07-25).

> -With `--dry-run` option, report what branches will be pruned, but do no
> +With `--dry-run` option, report what branches will be pruned, but do not
>  actually prune them.

Ok.

>  remotes.<group>.  If a named group is not specified on the command line,
> -the configuration parameter remotes.default will get used; if
> +the configuration parameter remotes.default will be used; if

Ok.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

^ permalink raw reply

* Re: Gitweb giving me some warnings in Apache's error_log
From: Jakub Narebski @ 2009-08-10 14:57 UTC (permalink / raw)
  To: Mark Rada; +Cc: git
In-Reply-To: <88f4c4ee0908071056g5d9da83ft77d56ec2e5e84bac@mail.gmail.com>

On Fri, 7 Aug 2009, Mark Rada wrote:
> On Fri, Aug 7, 2009 at 10:14 AM, Jakub Narebski<jnareb@gmail.com> wrote:
>> Mark A Rada <markrada26@gmail.com> writes:
>>
>>> It doesn't seem to cause any other problems, but I don't know if it is
>>> significant or not.
>>>
>>> [Fri Aug  7 08:51:13 2009] gitweb.cgi: Variable "$project_maxdepth"
>>> may be unavailable at /var/www/private/gitweb/cgi-bin/gitweb.cgi line
>>> 2296.
>>> [Fri Aug  7 08:51:13 2009] gitweb.cgi: Variable "$projectroot" may be
>>> unavailable at /var/www/private/gitweb/cgi-bin/gitweb.cgi line 2304.
>>>
>>>
>>> Apache 2.2.12/ mod_perl 2.04/ perl 5.8.8
>>
>> From perldiag(1) manpage:
>>
>>  Variable "%s" may be unavailable
>>
>>    (W closure) An inner (nested) anonymous subroutine is inside a
>>    named subroutine, and outside that is another subroutine; and the
>>    anonymous (innermost) subroutine is referencing a lexical variable
>>    defined in the outermost subroutine.
[...]

>> The warning is about 'wanted' anonymous subroutine passed to
>> File::Find::find.  The "middle" subroutine is git_get_projects_list,
>> and the "outermost" is mod_perl / ModPerl::Registry request loop.
>>
>> We can't make git_get_projects_list anonymous, but anonymous
>> subroutine is not called or referenced outside git_get_projects_list,
>> nor it is called or referenced outside mod_perl request/event loop.
>>
>> This warning is harmless... but I do not know how to silence it.

> Let me double check my understanding.
> 
> The warnings will not occur if Gitweb is run as a regular CGI script
> because then it won't be nested inside a call from ModPerl::Registry?

Yes, it is true that this happens only when running gitweb as mod_perl
legacy script using ModPerl::Registry.  Otherwise it would be caught
when running t/t9500-gitweb-standalone-no-errors.sh test.

> 
> Will it also not complain if I provided my own $projects_list in the
> first place?

Yes, it would not, because the code is run only when $projects_list is
a directory to search for git repositories.  If $projects_list is
a file you wouldn't get this warning (and it might be slightly faster,
if less flexible, as you would need to regenerate this file when adding
or removing, or renaming, or changing owner of repositories).

-- 
Jakub Narebski
Poland

^ permalink raw reply

* Re: [JGIT PATCH 1/1] Generate javadoc when making jgit. Also, package docs into a zip for distribution.
From: Shawn O. Pearce @ 2009-08-10 14:56 UTC (permalink / raw)
  To: Nicholas Campbell; +Cc: git, Robin Rosenberg
In-Reply-To: <76596580908092132h1aab0c22qb364914ce9e827b2@mail.gmail.com>

Nicholas Campbell <nicholas.j.campbell@gmail.com> wrote:
> Runs through defined "PLUGINS" and creates Javadoc. Assumes src is a subdir.
> 
> Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
> ---
>  make_jgit.sh |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)

Thanks.  This didn't apply cleanly to tip of tree, so I hand merged
it in, but then modified it a bit.  This is what I actually applied:
 
--8<--
From: Nicholas Campbell <nicholas.j.campbell@gmail.com>
Subject: [PATCH] Generate javadoc during ./make_jgit.sh

Package docs into a zip for distribution.  Runs through defined
"PLUGINS" and creates Javadoc. Assumes src is a subdir.

Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
[sp: cleaned up docs/ directory after build; removed docs/ from zip]
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .gitignore   |    1 +
 make_jgit.sh |   13 ++++++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/.gitignore b/.gitignore
index baf2766..5219cbc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 /jgit
 /jgit.jar
 /jgit_src.zip
+/jgit_docs.zip
diff --git a/make_jgit.sh b/make_jgit.sh
index baaa3af..9608b70 100755
--- a/make_jgit.sh
+++ b/make_jgit.sh
@@ -3,6 +3,7 @@
 O_CLI=jgit
 O_JAR=jgit.jar
 O_SRC=jgit_src.zip
+O_DOC=jgit_docs.zip
 
 PLUGINS="
 	org.spearce.jgit
@@ -39,6 +40,7 @@ cleanup_bin() {
 	do
 		rm -rf $p/bin2
 	done
+	rm -rf docs
 }
 
 die() {
@@ -49,7 +51,7 @@ die() {
 }
 
 cleanup_bin
-rm -f $O_CLI $O_JAR $O_SRC
+rm -f $O_CLI $O_JAR $O_SRC $O_DOC
 
 VN=`git describe --abbrev=4 HEAD 2>/dev/null`
 git update-index -q --refresh
@@ -118,4 +120,13 @@ chmod 555 $O_CLI+ &&
 mv $O_CLI+ $O_CLI &&
 echo "Created $O_CLI." || die "Build failed."
 
+echo "Building Javadocs ..."
+for p in $PLUGINS; do
+	javadoc -sourcepath "$p/src/" -d "docs/$p/" \
+	`find "$p/src" -name "*.java"`
+done
+
+(cd docs && jar cf "../$O_DOC" .)
+echo "Created $O_DOC."
+
 cleanup_bin
-- 
1.6.4.70.g9c084

-- 
Shawn.

^ permalink raw reply related

* A tiny documentation patch
From: Štěpán Němec @ 2009-08-10 14:44 UTC (permalink / raw)
  To: git

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

 Hello,

I noticed a few typos in the git-remote manpage, so I fixed the txt
source file and here's the patch.

 Best regards and thank you for Git!

Štěpán Němec

[-- Attachment #2: 0001-Fix-typos-in-git-remote.txt.patch --]
[-- Type: text/x-diff, Size: 1985 bytes --]

>From 65ae3e5cdb241aaaed96a7aeecffb6d305d0b07c Mon Sep 17 00:00:00 2001
From: =?utf-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= <stepnem@gmail.com>
Date: Mon, 10 Aug 2009 16:29:08 +0200
Subject: [PATCH] Fix typos in git-remote.txt

---
 Documentation/git-remote.txt |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index 9e2b4ea..0964cee 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -56,10 +56,10 @@ multiple branches without grabbing all branches.
 With `-m <master>` option, `$GIT_DIR/remotes/<name>/HEAD` is set
 up to point at remote's `<master>` branch. See also the set-head command.
 +
-In mirror mode, enabled with `\--mirror`, the refs will not be stored
+In mirror mode, enabled with `--mirror`, the refs will not be stored
 in the 'refs/remotes/' namespace, but in 'refs/heads/'.  This option
 only makes sense in bare repositories.  If a remote uses mirror
-mode, furthermore, `git push` will always behave as if `\--mirror`
+mode, furthermore, `git push` will always behave as if `--mirror`
 was passed.
 
 'rename'::
@@ -114,14 +114,14 @@ These stale branches have already been removed from the remote repository
 referenced by <name>, but are still locally available in
 "remotes/<name>".
 +
-With `--dry-run` option, report what branches will be pruned, but do no
+With `--dry-run` option, report what branches will be pruned, but do not
 actually prune them.
 
 'update'::
 
 Fetch updates for a named set of remotes in the repository as defined by
 remotes.<group>.  If a named group is not specified on the command line,
-the configuration parameter remotes.default will get used; if
+the configuration parameter remotes.default will be used; if
 remotes.default is not defined, all remotes which do not have the
 configuration parameter remote.<name>.skipDefaultUpdate set to true will
 be updated.  (See linkgit:git-config[1]).
-- 
1.6.3.3


^ permalink raw reply related

* give a hint/solution for "It looks like git-am is in progress. Cannot  rebase."
From: Lucian Adrian Grijincu @ 2009-08-10 14:34 UTC (permalink / raw)
  To: git

Hi,

I ran git-am instead of git-apply on my repo. The git-am complained
about the input data, I completely ignored it because I never use
git-am (except on typos + tab-completions like today).

Later, after a few commits I wanted to rebase (interactively) my tree
to merge a few commits.
  $ git rebase -i HEAD~4
  It looks like git-am is in progress. Cannot rebase.

Ok, the message is nice, it tells me it can't do something, but I'm
stupid enough not to know how to proceed.
I see that this message is the same in HEAD (master and next).

It would be nice if git would output one or two hints. For example:
* run "git cancel-a-git-am-in-progress" to cancel a git-am in progress
* run "git commit-the-git-am-in-progress" to commit the git-am in progress

Of course, the commands need to be replaced with some valid git
commands, but I don't know which those commands are :)

The message is generated in git-rebase.sh by this code:
  test -f "$GIT_DIR"/rebase-apply/applying &&
  die 'It looks like git-am is in progress. Cannot rebase.'

For now I think I'll `rm -rf .git/rebase-apply` (and hopefully not
break anything).

-- 
 .
..: Lucian

^ permalink raw reply

* Re: [msysGit] Using VC build git
From: Johannes Schindelin @ 2009-08-10 14:29 UTC (permalink / raw)
  To: Frank Li; +Cc: git, msysGit
In-Reply-To: <alpine.DEB.1.00.0908101606220.8324@intel-tinevez-2-302>

Hi,

On Mon, 10 Aug 2009, Johannes Schindelin wrote:

> Please, we have _high_ standards in git.git, and I really do not want to 
> have to take anything to Junio that does not fulfill that standard.

To elaborate:  if I see something like this in the --stat:

 contrib/vcbuild/include/zlib.h        | 1357 +++++++++++++++++++++++++++++++++
 contrib/vcbuild/lib/zlib.lib          |  Bin 0 -> 104148 bytes

... I know already that there is no way this can make it into git.git.  
There just is not.

Also, if the first commit says nothing else than "Rebase to v1.6.4", it 
is pretty obvious to me that I will not sign off on that (and I just guess 
that is the very reason you did not sign off on that, either).

Further, putting anything into contrib/ that really belongs into contrib/ 
is not cutting it, either.

And I am pretty astonished that mingw.[ch] is touched, as VC is definitely 
not MinGW32.

Changing 1000+ lines of libgit.vcproj in almost every commit is also 
something I really do not look upon favorably.

Finally, if _no single_ commit message says _anything_ about the reasons 
why you had to change code outside of vcbuild/, I am only puzzled.

Now, I want to give you a pretty clear idea what has to be done if this is 
going into 4msysgit.git, ever, because you obviously spent a lot of time 
on it, and other people want it, too:

- changing "open" to "_open" in mingw.c is a no-no-no.  If you need to use 
  "_open" in VC, then define "open" in the compile flags for mingw.c, but 
  leave code that is not written for VC alone.

- introducing trailing whitespace is usually a sign of not caring enough 
  about clean and neat code.  So just don't do it.

- making link() fail on MinGW32 just to be able to compile it with VC is 
  outright rude against all people who use a free and open compiler 
  instead of a closed one.

- changing an "_snprintf" to "_vsnprintf" in vcbuild/porting.c without 
  anything else is a clear and loud sign that the code before was broken, 
  and that you fix a faulty patch in a later patch.  This is not how we do 
  things in git.git.  We fix the proper patch before the patch series is 
  accepted into mainline.

- violating the coding style -- even if it is in your VC-specific part -- 
  is not an option.  You need to fix the coding style.

- violating the coding style in files that are not VC-specific is not an 
  option at all.  You really need to fix it.

- changing the default editor from "vi" to "notepad2" will break almost 
  every existing Git user's setup.  That is just inexcusable.

Note: these comments are _just for the last_ of your 5 patches.

Just a brief comment on the 4th patch, because I really do not want to 
spend more time on this round of patches: spelling the opendir() function 
as "open dir" function in the commit message is misleading, to say the 
least, and moving code that was added in a previous patch in the same 
patch series just shows that it was a mistake to begin with.  Besides, 
don't move anything into mingw.c if MinGW32 does not need it.

Hth,
Dscho

^ permalink raw reply

* Re: Failing a test on OpenServer 6 t5100-mailinfo.sh
From: Boyd Lynn Gerber @ 2009-08-10 14:29 UTC (permalink / raw)
  To: Brandon Casey; +Cc: Git List
In-Reply-To: <9NpKOKLSn88JzY2TZHUJ89wA2DmHDCazUmQpdWGi9Wi25O90kUipEg@cipher.nrlssc.navy.mil>

On Mon, 10 Aug 2009, Brandon Casey wrote:
> Boyd Lynn Gerber wrote:
>> With a config.mak.autogen that is fixed for OpenServer 6.
>> I now have three tests that fail.
>>
>> The first is because of the OS does not allow perl to do somethings.
>>
>> The second is a new problem.
>
> Probably your system is missing support for some character encodings.
>
>> *** t5100-mailinfo.sh ***
...
>> * FAIL 12: mailinfo 0011
>
> This uses charset ISO8859-15.
...
>> * FAIL 16: mailinfo rfc2047/0001
>
> ISO8859-2
>
>> * FAIL 19: mailinfo rfc2047/0004
>
> ISO8859-8
>
>> * FAIL 26: mailinfo rfc2047/0011
>
> ISO8859-2
>
> You can just skip these tests if you don't want to install the missing 
> encoding support.

Thanks,

-- 
Boyd Gerber <gerberb@zenez.com> 801 849-0213
ZENEZ	1042 East Fort Union #135, Midvale Utah  84047

^ permalink raw reply

* Re: Failing a test on OpenServer 6 t5100-mailinfo.sh
From: Brandon Casey @ 2009-08-10 14:25 UTC (permalink / raw)
  To: Boyd Lynn Gerber; +Cc: Git List
In-Reply-To: <alpine.LNX.2.00.0908081014560.13290@suse104.zenez.com>

Boyd Lynn Gerber wrote:
> Hello,
> 
> With a config.mak.autogen that is fixed for OpenServer 6.
> 
> I now have three tests that fail.
> 
> The first is because of the OS does not allow perl to do somethings.
> 
> The second is a new problem.

Probably your system is missing support for some character encodings.

> *** t5100-mailinfo.sh ***
> *   ok 1: split sample box
> *   ok 2: mailinfo 0001
> *   ok 3: mailinfo 0002
> *   ok 4: mailinfo 0003
> *   ok 5: mailinfo 0004
> *   ok 6: mailinfo 0005
> *   ok 7: mailinfo 0006
> *   ok 8: mailinfo 0007
> *   ok 9: mailinfo 0008
> *   ok 10: mailinfo 0009
> *   ok 11: mailinfo 0010
> * FAIL 12: mailinfo 0011

This uses charset ISO8859-15.

> 
>                         git mailinfo -u msg$mail patch$mail <$mail
>> info$mail &&
>                         echo msg &&
>                         test_cmp "$TEST_DIRECTORY"/t5100/msg$mail
> msg$mail &&
>                         echo patch &&
>                         test_cmp "$TEST_DIRECTORY"/t5100/patch$mail
> patch$mail &&
>                         echo info &&
>                         test_cmp "$TEST_DIRECTORY"/t5100/info$mail
> info$mail
> 
> *   ok 13: mailinfo 0012
> *   ok 14: mailinfo 0013
> *   ok 15: split box with rfc2047 samples
> * FAIL 16: mailinfo rfc2047/0001

ISO8859-2

> *   ok 17: mailinfo rfc2047/0002
> *   ok 18: mailinfo rfc2047/0003
> * FAIL 19: mailinfo rfc2047/0004

ISO8859-8

> *   ok 20: mailinfo rfc2047/0005
> *   ok 21: mailinfo rfc2047/0006
> *   ok 22: mailinfo rfc2047/0007
> *   ok 23: mailinfo rfc2047/0008
> *   ok 24: mailinfo rfc2047/0009
> *   ok 25: mailinfo rfc2047/0010
> * FAIL 26: mailinfo rfc2047/0011

ISO8859-2

You can just skip these tests if you don't want to install the missing
encoding support.

-brandon

^ 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