Git development
 help / color / mirror / Atom feed
* Re: [PATCH] Port git commit to C.
From: Alex Riesen @ 2007-11-08 23:27 UTC (permalink / raw)
  To: Kristian Høgsberg; +Cc: Junio C Hamano, git
In-Reply-To: <1194541140-3062-1-git-send-email-krh@redhat.com>

Kristian Høgsberg, Thu, Nov 08, 2007 17:59:00 +0100:
> This makes git commit a builtin and moves git-commit.sh to
> contrib/examples.  This also removes the git-runstatus
> helper, which was mostly just a git-status.sh implementation detail.

Applied instead of 00c8febf563da on Junio's pu it breaks t1400:

* expecting success: echo TEST >F &&
     git add F &&
         GIT_AUTHOR_DATE="2005-05-26 23:30" \
         GIT_COMMITTER_DATE="2005-05-26 23:30" git-commit -m add -a &&
         h_TEST=$(git rev-parse --verify HEAD)
         echo The other day this did not work. >M &&
         echo And then Bob told me how to fix it. >>M &&
         echo OTHER >F &&
         GIT_AUTHOR_DATE="2005-05-26 23:41" \
         GIT_COMMITTER_DATE="2005-05-26 23:41" git-commit -F M -a &&
         h_OTHER=$(git rev-parse --verify HEAD) &&
         GIT_AUTHOR_DATE="2005-05-26 23:44" \
         GIT_COMMITTER_DATE="2005-05-26 23:44" git-commit --amend &&
         h_FIXED=$(git rev-parse --verify HEAD) &&
         echo Merged initial commit and a later commit. >M &&
         echo $h_TEST >.git/MERGE_HEAD &&
         GIT_AUTHOR_DATE="2005-05-26 23:45" \
         GIT_COMMITTER_DATE="2005-05-26 23:45" git-commit -F M &&
         h_MERGED=$(git rev-parse --verify HEAD)
         rm -f M
Created initial commit 2bc82dd: add
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 F
Created commit d244b72: The other day this did not work.
 1 files changed, 1 insertions(+), 1 deletions(-)
launching editor, log (null)
fatal: * no commit message?  aborting commit.
*   ok 28: creating initial files

* expecting success: diff expect .git/logs/refs/heads/master
3,4d2
< d244b725ca2c5f8aaacd9df2468b890499380862  C O Mitter <committer@example.com> 1117151040 +0000 commit (amend): The other day this did not work.
<   C O Mitter <committer@example.com> 1117151100 +0000 commit (merge): Merged initial commit and a later commit.
* FAIL 29: git-commit logged updates
        diff expect .git/logs/refs/heads/master


Which is not the test actually failed. The failed one is 28, but the
last "rm -f M" killed the error because of missed "&&" before it.

I believe you need something like this to fix the test:

diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index ce045b2..a90824b 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -205,7 +205,7 @@ test_expect_success \
 	 echo $h_TEST >.git/MERGE_HEAD &&
 	 GIT_AUTHOR_DATE="2005-05-26 23:45" \
 	 GIT_COMMITTER_DATE="2005-05-26 23:45" git-commit -F M &&
-	 h_MERGED=$(git rev-parse --verify HEAD)
+	 h_MERGED=$(git rev-parse --verify HEAD) &&
 	 rm -f M'
 
 cat >expect <<EOF

and something like this to refill the strbuf of commit message with
the text read from the amended commit (the failed test was a
"git commit --amend"). The patch is on top of yours "Export
launch_editor() and make it accept ':' as a no-op editor":

diff --git a/builtin-tag.c b/builtin-tag.c
index c3b76da..8ca9ffb 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -42,17 +42,17 @@ void launch_editor(const char *path, struct strbuf *buffer)
 	if (!editor)
 		editor = "vi";
 
-	if (!strcmp(editor, ":"))
-		return;
-
-	memset(&child, 0, sizeof(child));
-	child.argv = args;
-	args[0] = editor;
-	args[1] = path;
-	args[2] = NULL;
-
-	if (run_command(&child))
-		die("There was a problem with the editor %s.", editor);
+	if (strcmp(editor, ":"))
+	{
+		memset(&child, 0, sizeof(child));
+		child.argv = args;
+		args[0] = editor;
+		args[1] = path;
+		args[2] = NULL;
+
+		if (run_command(&child))
+			die("There was a problem with the editor %s.", editor);
+	}
 
 	if (strbuf_read_file(buffer, path, 0) < 0)
 		die("could not read message file '%s': %s",

^ permalink raw reply related

* Re: git rebase --skip
From: Jeff King @ 2007-11-08 23:16 UTC (permalink / raw)
  To: Björn Steinbrink; +Cc: Andreas Ericsson, Mike Hommey, git
In-Reply-To: <20071108104403.GB31187@atjola.homenet>

On Thu, Nov 08, 2007 at 11:44:03AM +0100, Björn Steinbrink wrote:

> > How about if the state to skip was stashed, the patch reapplied and the
> > differences compared. If they were identical, go ahead and force the
> > reset --hard, otherwise abort. That way, --skip will dwim only when
> > it's safe, and all the lost work can be automagically created by
> > just re-applying the patch again?
> 
> I'd prefer the --force option suggested in some other mail. Maybe I'm
> just not manly enough, but messing up a rebase can mean lots of
> duplicated work, so I'm rather happy with no dwim at all. Maybe for the
> real manly users out there, add a rebase.alwaysForce option so they can
> laugh at me for not using that ;-)

Personally, I don't see the point of a --force option; it turns your work
flow from:

  1. git-rebase --skip
  2. Oops, I guess I have to reset.
  3. git-reset --hard; git-rebase --skip

to:

  1. same as above
  2. same as above
  3. git-rebase --force --skip

I guess it's a little bit easier to explain to new users, but it in no
way eliminates the annoyance of "I expected this to work, and it
didn't, so now I have to think about what happened and enter another
command."

AIUI, Andreas's proposal is not so much DWIM as "do the obvious thing,
but include a safety valve to prevent throwing away work." Is there
actually a case where it would not have the desired effect?

-Peff

^ permalink raw reply

* Re: [NEW REPLACEMENT PATCH] git-checkout: Add a test case for relative paths use.
From: Johannes Schindelin @ 2007-11-08 23:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: David Symonds, git, Andreas Ericsson
In-Reply-To: <7v7iks31lm.fsf@gitster.siamese.dyndns.org>

Hi,

On Thu, 8 Nov 2007, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> >> +	mkdir dir2 &&
> >> +	echo bonjour > dir2/file2 &&
> >> +	git add dir2/file2 &&
> >> +	git commit -m "populate tree"
> >> +
> >> +'
> >
> > Please lose the empty line before the closing quote.  (This applies to all 
> > tests.)
> 
> I personaly find the extra blank lines before and after the
> indented test body easier to read. 

Personally, I don't.  But you are the maintainer.

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH 1/3] Refactor working tree setup
From: Miles Bader @ 2007-11-08 22:41 UTC (permalink / raw)
  To: Mike Hommey; +Cc: git, Junio C Hamano
In-Reply-To: <1194088993-25692-1-git-send-email-mh@glandium.org>

Mike Hommey <mh@glandium.org> writes:
> Create a setup_work_tree() that can be used from any command requiring
> a working tree conditionally.
...
> +void setup_work_tree(void) {
> +	const char *work_tree = get_git_work_tree();

Hi, could you please not use this "function begin brace at EOL" style?

It's inconsistent with the rest of the source, makes the code harder to
read, and confuses Emacs in some cases[1].  Also it's an abomination
unto God, but I imagine it's the first of these reasons that you'll care
about the most... :-)

Thanks,

-Miles


[1] Until quite recently, Emacs c-mode couldn't find the beginning of
such functions (recent versions of c-mode seem OK though).

-- 
The secret to creativity is knowing how to hide your sources.
  --Albert Einstein

^ permalink raw reply

* Re: [PATCH 3/3] git-fetch: avoid local fetching from alternate (again)
From: Shawn O. Pearce @ 2007-11-08 22:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <20071108112254.GN14735@spearce.org>

"Shawn O. Pearce" <spearce@spearce.org> wrote:
> Junio C Hamano <gitster@pobox.com> wrote:
> > "Shawn O. Pearce" <spearce@spearce.org> writes:
> > 
> > > I'm starting to suspect heap corruption again in builtin-fetch.
> > > This patch alters the malloc() calls we are doing and may be shifting
> > > something around just enough in memory to cause a data overwrite or
> > > something and that's why this tag just drops out of the linked list?
> > > But then why does that happen in the test suite but not outside.
> > > Maybe because the test suite is setting environment variables that
> > > I'm not and the impact of those combined with these additional
> > > mallocs is what is breaking it?  *sigh*
> 
> Found it.  This ain't pretty.  Remember, what's failing in the test
> suite is we aren't getting "tag-three-file" automatically followed
> during fetch.  This is an annotated tag referring to a blob.

Here's one possible way of fixing this.  I think what we want is to
include "--not --all" when we run the object listing immediately
after the fetch so we mark *only* those objects we just fetched
and ignore the ones we already had reachable through existing refs.
This makes the walking cost proportional to the size of the fetch
and not the size of the object database.

Unfortunately when you insert "--not" in front of "--all" in the args
array below the test vectors all fail again.  Apparently we already
have the blob that "tag-three-file" refers to so its not something
we walk over during this process and the tag isn't followed.
That happens because the test repository we are fetching into
already has a number of objects through its refs/remotes/origin/*
namespace created by git-clone and the blob is already considered
to be reachable.

I'm not formatting this as a real patch because I'm not yet sure this
is the right way to fix the automatic tag following code.  Or the
right way to abuse the revision walking machinary within git-fetch
to implement such a feature.  Comments would be most appreciated.  :)


--8>--
diff --git a/builtin-fetch.c b/builtin-fetch.c
index 847db73..77f1901 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -8,6 +8,9 @@
 #include "path-list.h"
 #include "remote.h"
 #include "transport.h"
+#include "diff.h"
+#include "list-objects.h"
+#include "revision.h"
 
 static const char fetch_usage[] = "git-fetch [-a | --append] [--upload-pack <upload-pack>] [-f | --force] [--no-tags] [-t | --tags] [-k | --keep] [-u | --update-head-ok] [--depth <depth>] [-v | --verbose] [<repository> <refspec>...]";
 
@@ -335,11 +338,43 @@ static void store_updated_refs(const char *url, struct ref *ref_map)
 	fclose(fp);
 }
 
+static void mark_just_fetched_commit(struct commit *commit)
+{
+}
+
+static void mark_just_fetched_object(struct object_array_entry *p)
+{
+	if (p->item->type == OBJ_BLOB && !has_sha1_file(p->item->sha1))
+		die("missing blob object '%s'", sha1_to_hex(p->item->sha1));
+}
+
 static int fetch_refs(struct transport *transport, struct ref *ref_map)
 {
 	int ret = transport_fetch_refs(transport, ref_map);
-	if (!ret)
+	if (!ret) {
+		const char *args[] = { "rev-list", "--objects", "--all", NULL};
+		struct rev_info revs;
+		struct ref *ref;
+
+		init_revisions(&revs, NULL);
+		setup_revisions(ARRAY_SIZE(args) - 1, args, &revs, NULL);
+		save_commit_buffer = 0;
+		track_object_refs = 0;
+
+		for (ref = ref_map; ref; ref = ref->next) {
+			struct object *o = parse_object(ref->old_sha1);
+			if (o)
+				add_pending_object(&revs, o, "(just-fetched)");
+		}
+
+		prepare_revision_walk(&revs);
+		mark_edges_uninteresting(revs.commits, &revs, NULL);
+		traverse_commit_list(&revs,
+			mark_just_fetched_commit,
+			mark_just_fetched_object);
+
 		store_updated_refs(transport->url, ref_map);
+	}
 	transport_unlock_pack(transport);
 	return ret;
 }
@@ -365,6 +400,7 @@ static struct ref *find_non_local_tags(struct transport *transport,
 	struct ref *ref_map = NULL;
 	struct ref **tail = &ref_map;
 	const struct ref *ref;
+	struct object *obj;
 
 	for_each_ref(add_existing, &existing_refs);
 	for (ref = transport_get_remote_refs(transport); ref; ref = ref->next) {
@@ -389,7 +425,8 @@ static struct ref *find_non_local_tags(struct transport *transport,
 
 		if (!path_list_has_path(&existing_refs, ref_name) &&
 		    !path_list_has_path(&new_refs, ref_name) &&
-		    lookup_object(ref->old_sha1)) {
+		    (obj = lookup_object(ref->old_sha1)) &&
+		    obj->flags & SEEN) {
 			path_list_insert(ref_name, &new_refs);
 
 			rm = alloc_ref(strlen(ref_name) + 1);
diff --git a/list-objects.c b/list-objects.c
index e5c88c2..78bf04c 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -170,4 +170,5 @@ void traverse_commit_list(struct rev_info *revs,
 	}
 	for (i = 0; i < objects.nr; i++)
 		show_object(&objects.objects[i]);
+	free(objects.objects);
 }

-- 
Shawn.

^ permalink raw reply related

* Re: [PATCH 2/3] Fix sed script to work with AIX and BSD sed.
From: Benoit Sigoure @ 2007-11-08 22:15 UTC (permalink / raw)
  To: Ralf Wildenhues; +Cc: git
In-Reply-To: <20071108214824.GH31439@ins.uni-bonn.de>

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

On Nov 8, 2007, at 10:48 PM, Ralf Wildenhues wrote:

> diff --git a/git-bisect.sh b/git-bisect.sh
> index c18bd32..3aac816 100755
> --- a/git-bisect.sh
> +++ b/git-bisect.sh
> @@ -276,7 +276,8 @@ exit_if_skipped_commits () {
>  	if expr "$_tried" : ".*[|].*" > /dev/null ; then
>  		echo "There are only 'skip'ped commit left to test."
>  		echo "The first bad commit could be any of:"
> -		echo "$_tried" | sed -e 's/[|]/\n/g'
> +		echo "$_tried" | sed -e 's/[|]/\

Just out of curiosity, is there any valid reason to use `[' and `]'  
in this RE?  By default sed does not use extended RE (at least none  
of the implementation I know of) so why not just use sed 's/|/...' ?

> +/g'
>  		echo "We cannot bisect more!"
>  		exit 2
>  	fi

-- 
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]

^ permalink raw reply

* Re: [PATCH] hooks--update: fix test for properly set up project description file
From: Junio C Hamano @ 2007-11-08 22:13 UTC (permalink / raw)
  To: Gerrit Pape; +Cc: Andreas Ericsson, git
In-Reply-To: <20071108140200.24902.qmail@f23d7e396b1523.315fe32.mid.smarden.org>

Gerrit Pape <pape@smarden.org> writes:

> The update hook template intends to abort if the project description file
> hasn't been adjusted or is empty.  This patch fixes the check for 'being
> adjusted'.
>
> Signed-off-by: Gerrit Pape <pape@smarden.org>
> ---
>
> On Tue, Nov 06, 2007 at 02:55:55PM +0100, Andreas Ericsson wrote:
>> Gerrit Pape wrote:
>> > # check for no description
>> >-projectdesc=$(sed -e '1p' "$GIT_DIR/description")
>> >-if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit
>> >this
>> >file to name it for gitweb" ]; then
>> >+projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
>>
>> Write this as
>>       projectdesc=$(sed -e 1q "$GIT_DIR/description")
>> instead. It's a little shorter, a little faster and slightly more
>> portable.

I even suspect that the original 'p' is indeed a typo of 'q'.

^ permalink raw reply

* Re: GIT_DIR/--git-dir question
From: Junio C Hamano @ 2007-11-08 22:00 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: git
In-Reply-To: <007c01c8223a$6af2e550$5267a8c0@Jocke>

"Joakim Tjernlund" <joakim.tjernlund@transmode.se> writes:

> I just started to look at having multiple work trees, each working on a separate branch,
> using the same git repo.

I suspect contrib/workdir is what you are looking for not
GIT_DIR.

^ permalink raw reply

* Re: git push mirror mode
From: Junio C Hamano @ 2007-11-08 21:53 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Andy Whitcroft, git
In-Reply-To: <Pine.LNX.4.64.0711081218090.4362@racer.site>

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

> On Thu, 8 Nov 2007, Andy Whitcroft wrote:
>
>> Ok, sometime back Junio sent out a proof-of-concept change to
>> send-pack allowing a mirror mode.
>
> You added/left his sign-off, but did not attribute the patches to him.  

No big deal; I do not think much of my changes remain in the
result.  Mentioning "inspired by" would be nice as courtesy, but
I think this is mostly Andy's work.

As I haven't seen _his_ part of the change before he posted this
updated patch, copying my S-o-b line wasn't necessary either.

^ permalink raw reply

* [PATCH 3/3] Fix sed string regex escaping in module_name.
From: Ralf Wildenhues @ 2007-11-08 21:48 UTC (permalink / raw)
  To: git
In-Reply-To: <20071108214624.GF31439@ins.uni-bonn.de>

When escaping a string to be used as a sed regex, it is important
to only escape active characters.  Escaping other characters is
undefined according to POSIX, and in practice leads to issues with
extensions such as GNU sed's \+.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
---
 git-submodule.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 1c656be..82ac28f 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -74,7 +74,7 @@ resolve_relative_url ()
 module_name()
 {
 	# Do we have "submodule.<something>.path = $1" defined in .gitmodules file?
-	re=$(printf '%s' "$1" | sed -e 's/\([^a-zA-Z0-9_]\)/\\\1/g')
+	re=$(printf '%s' "$1" | sed -e 's/[].[^$\\*]/\\&/g')
 	name=$( GIT_CONFIG=.gitmodules \
 		git config --get-regexp '^submodule\..*\.path$' |
 		sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' )
-- 
1.5.3.5.561.g140d

^ permalink raw reply related

* [PATCH 2/3] Fix sed script to work with AIX and BSD sed.
From: Ralf Wildenhues @ 2007-11-08 21:48 UTC (permalink / raw)
  To: git
In-Reply-To: <20071108214624.GF31439@ins.uni-bonn.de>

\n is not portable in a s/// replacement string, only
in the regex part.  backslash-newline helps.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
---
I'm a bit unsure whether you would prefer to avoid breaking the
indentation with something like
  tr '|' '\n'

OTOH, \n in a tr set is not universally portable either (for example
Solaris /usr/ucb/tr mishandles it, and \012 fails on EBCDIC), but
I'm still on my way of finding out the level of portability you
prefer.  ;-)

Cheers,
Ralf

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

diff --git a/git-bisect.sh b/git-bisect.sh
index c18bd32..3aac816 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -276,7 +276,8 @@ exit_if_skipped_commits () {
 	if expr "$_tried" : ".*[|].*" > /dev/null ; then
 		echo "There are only 'skip'ped commit left to test."
 		echo "The first bad commit could be any of:"
-		echo "$_tried" | sed -e 's/[|]/\n/g'
+		echo "$_tried" | sed -e 's/[|]/\
+/g'
 		echo "We cannot bisect more!"
 		exit 2
 	fi
-- 
1.5.3.5.561.g140d

^ permalink raw reply related

* [PATCH 1/3] Avoid a few unportable, needlessly nested "...`...".
From: Ralf Wildenhues @ 2007-11-08 21:47 UTC (permalink / raw)
  To: git
In-Reply-To: <20071108214624.GF31439@ins.uni-bonn.de>


Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
---
 git-rebase--interactive.sh |    2 +-
 git-request-pull.sh        |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 6d14092..66c80d4 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -392,7 +392,7 @@ do
 	-s|--strategy)
 		case "$#,$1" in
 		*,*=*)
-			STRATEGY="-s `expr "z$1" : 'z-[^=]*=\(.*\)'`" ;;
+			STRATEGY="-s "$(expr "z$1" : 'z-[^=]*=\(.*\)') ;;
 		1,*)
 			usage ;;
 		*)
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 90d969c..068f5e0 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -25,13 +25,13 @@ headrev=`git rev-parse --verify "$head"^0` || exit
 merge_base=`git merge-base $baserev $headrev` ||
 die "fatal: No commits in common between $base and $head"
 
-url="`get_remote_url "$url"`"
-branch=`git peek-remote "$url" \
+url=$(get_remote_url "$url")
+branch=$(git peek-remote "$url" \
 	| sed -n -e "/^$headrev	refs.heads./{
 		s/^.*	refs.heads.//
 		p
 		q
-	}"`
+	}")
 if [ -z "$branch" ]; then
 	echo "warn: No branch of $url is at:" >&2
 	git log --max-count=1 --pretty='format:warn:   %h: %s' $headrev >&2
-- 
1.5.3.5.561.g140d

^ permalink raw reply related

* [PATCH 0/3] some shell portability fixes, v2
From: Ralf Wildenhues @ 2007-11-08 21:46 UTC (permalink / raw)
  To: git

Thanks for all the helpful feedback.  Here's a new series that drops the
$(()) and test -a/-o patches, and otherwise hopefully incorporates all
nits.

Cheers,
Ralf

^ permalink raw reply

* Re: Inconsistencies with git log
From: Alex Riesen @ 2007-11-08 21:23 UTC (permalink / raw)
  To: David Symonds
  Cc: Andreas Ericsson, Brian Gernhardt, Jon Smirl, Johannes Schindelin,
	Git Mailing List
In-Reply-To: <20071108212123.GA4899@steel.home>

Alex Riesen, Thu, Nov 08, 2007 22:21:23 +0100:
> David Symonds, Thu, Nov 08, 2007 14:16:59 +0100:
> > I never suggested path *limited*, only path *relative*. git-status
> > would still show all the same files, but their paths would be relative
> > to your current directory, so there'd be no confusion like you
> > mentioned. This is how Johannes' patch works.
> 
> Relative? Like this?
> 
> $ cd project/foo/bar
> $ git status
> ...
>     M file1.c
>     M file2.c
>     M ../baz/file3.c
>     R ../bax/file4 => file4.c
> 

Oh, I see. Yes. Cool.

^ permalink raw reply

* Re: Inconsistencies with git log
From: Alex Riesen @ 2007-11-08 21:21 UTC (permalink / raw)
  To: David Symonds
  Cc: Andreas Ericsson, Brian Gernhardt, Jon Smirl, Johannes Schindelin,
	Git Mailing List
In-Reply-To: <ee77f5c20711080516n4f207ba3pccc8efffa2a6ad4c@mail.gmail.com>

David Symonds, Thu, Nov 08, 2007 14:16:59 +0100:
> I never suggested path *limited*, only path *relative*. git-status
> would still show all the same files, but their paths would be relative
> to your current directory, so there'd be no confusion like you
> mentioned. This is how Johannes' patch works.

Relative? Like this?

$ cd project/foo/bar
$ git status
...
    M file1.c
    M file2.c
    M ../baz/file3.c
    R ../bax/file4 => file4.c

^ permalink raw reply

* Re: [PATCH] Drop deprecated commands from git(7) and update deprecation notices
From: Junio C Hamano @ 2007-11-08 21:01 UTC (permalink / raw)
  To: Jonas Fonseca; +Cc: Andreas Ericsson, Johannes Schindelin, git
In-Reply-To: <20071108160114.GB20988@diku.dk>

Thanks.

But lost-found is merely deprecated but not removed yet, so I
think it should be kept in the list cmd-list.perl generates.


We may want a mechanism to mark it deprecated in the list as
well, though.  Perhaps ...

---
 Documentation/cmd-list.perl |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 8d21d42..0066064 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -3,7 +3,8 @@
 use File::Compare qw(compare);
 
 sub format_one {
-	my ($out, $name) = @_;
+	my ($out, $nameattr) = @_;
+	my ($name, $attr) = @$nameattr;
 	my ($state, $description);
 	$state = 0;
 	open I, '<', "$name.txt" or die "No such file $name.txt";
@@ -26,8 +27,11 @@ sub format_one {
 		die "No description found in $name.txt";
 	}
 	if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
-		print $out "gitlink:$name\[1\]::\n";
-		print $out "\t$text.\n\n";
+		print $out "gitlink:$name\[1\]::\n\t";
+		if ($attr) {
+			print $out "($attr) ";
+		}
+		print $out "$text.\n\n";
 	}
 	else {
 		die "Description does not match $name: $description";
@@ -39,8 +43,8 @@ while (<DATA>) {
 	next if /^#/;
 
 	chomp;
-	my ($name, $cat) = /^(\S+)\s+(.*)$/;
-	push @{$cmds{$cat}}, $name;
+	my ($name, $cat, $attr) = /^(\S+)\s+(.*?)(?:\s+(.*))?$/;
+	push @{$cmds{$cat}}, [$name, $attr];
 }
 
 for my $cat (qw(ancillaryinterrogators
@@ -126,7 +130,7 @@ git-instaweb                            ancillaryinterrogators
 gitk                                    mainporcelain
 git-local-fetch                         synchingrepositories
 git-log                                 mainporcelain
-git-lost-found                          ancillarymanipulators
+git-lost-found                          ancillarymanipulators	deprecated
 git-ls-files                            plumbinginterrogators
 git-ls-remote                           plumbinginterrogators
 git-ls-tree                             plumbinginterrogators

^ permalink raw reply related

* Re: [NEW REPLACEMENT PATCH] git-checkout: Add a test case for relative paths use.
From: Junio C Hamano @ 2007-11-08 20:48 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: David Symonds, git, Andreas Ericsson
In-Reply-To: <Pine.LNX.4.64.0711081427450.4362@racer.site>

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

>> +	mkdir dir2 &&
>> +	echo bonjour > dir2/file2 &&
>> +	git add dir2/file2 &&
>> +	git commit -m "populate tree"
>> +
>> +'
>
> Please lose the empty line before the closing quote.  (This applies to all 
> tests.)

I personaly find the extra blank lines before and after the
indented test body easier to read.  That is..


	test_expect_sucess 'test description comes here' '

		test command 1 &&
		test command 2 &&
                ...
                test command N

	'

I agree with all other suggestions from your message.

^ permalink raw reply

* [PATCH] nicer display of thin pack completion
From: Nicolas Pitre @ 2007-11-08 20:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

In the same spirit of prettifying Git's output display for mere mortals,
here's a simple extension to the progress API allowing for a final 
message to be provided when terminating a progress line, and use it for
the display of the number of objects needed to complete a thin pack,
saving yet one more line of screen display.

Signed-off-by: Nicolas Pitre <nico@cam.org>
---
diff --git a/index-pack.c b/index-pack.c
index 581a7f5..469a330 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -792,6 +792,7 @@ int main(int argc, char **argv)
 		flush();
 	} else {
 		if (fix_thin_pack) {
+			char msg[48];
 			int nr_unresolved = nr_deltas - nr_resolved_deltas;
 			int nr_objects_initial = nr_objects;
 			if (nr_unresolved <= 0)
@@ -800,12 +801,11 @@ int main(int argc, char **argv)
 					   (nr_objects + nr_unresolved + 1)
 					   * sizeof(*objects));
 			fix_unresolved_deltas(nr_unresolved);
-			stop_progress(&progress);
-			if (verbose)
-				fprintf(stderr, "%d objects were added to complete this thin pack.\n",
-					nr_objects - nr_objects_initial);
+			sprintf(msg, "completed with %d local objects",
+				nr_objects - nr_objects_initial);
+			stop_progress_msg(&progress, msg);
 			fixup_pack_header_footer(output_fd, sha1,
-				curr_pack, nr_objects);
+						 curr_pack, nr_objects);
 		}
 		if (nr_deltas != nr_resolved_deltas)
 			die("pack has %d unresolved deltas",
diff --git a/progress.c b/progress.c
index 0700dcf..4bd650f 100644
--- a/progress.c
+++ b/progress.c
@@ -69,9 +69,9 @@ static void clear_progress_signal(void)
 	progress_update = 0;
 }
 
-static int display(struct progress *progress, unsigned n, int done)
+static int display(struct progress *progress, unsigned n, const char *done)
 {
-	char *eol, *tp;
+	const char *eol, *tp;
 
 	if (progress->delay) {
 		if (!progress_update || --progress->delay)
@@ -90,7 +90,7 @@ static int display(struct progress *progress, unsigned n, int done)
 
 	progress->last_value = n;
 	tp = (progress->throughput) ? progress->throughput->display : "";
-	eol = done ? ", done.   \n" : "   \r";
+	eol = done ? done : "   \r";
 	if (progress->total) {
 		unsigned percent = n * 100 / progress->total;
 		if (percent != progress->last_percent || progress_update) {
@@ -191,13 +191,13 @@ void display_throughput(struct progress *progress, off_t total)
 
 		throughput_string(tp, total, rate);
 		if (progress->last_value != -1 && progress_update)
-			display(progress, progress->last_value, 0);
+			display(progress, progress->last_value, NULL);
 	}
 }
 
 int display_progress(struct progress *progress, unsigned n)
 {
-	return progress ? display(progress, n, 0) : 0;
+	return progress ? display(progress, n, NULL) : 0;
 }
 
 struct progress *start_progress_delay(const char *title, unsigned total,
@@ -227,12 +227,18 @@ struct progress *start_progress(const char *title, unsigned total)
 
 void stop_progress(struct progress **p_progress)
 {
+	stop_progress_msg(p_progress, "done");
+}
+
+void stop_progress_msg(struct progress **p_progress, const char *msg)
+{
 	struct progress *progress = *p_progress;
 	if (!progress)
 		return;
 	*p_progress = NULL;
 	if (progress->last_value != -1) {
 		/* Force the last update */
+		char buf[strlen(msg) + 5];
 		struct throughput *tp = progress->throughput;
 		if (tp) {
 			unsigned int rate = !tp->avg_misecs ? 0 :
@@ -240,7 +246,8 @@ void stop_progress(struct progress **p_progress)
 			throughput_string(tp, tp->curr_total, rate);
 		}
 		progress_update = 1;
-		display(progress, progress->last_value, 1);
+		sprintf(buf, ", %s.\n", msg);
+		display(progress, progress->last_value, buf);
 	}
 	clear_progress_signal();
 	free(progress->throughput);
diff --git a/progress.h b/progress.h
index 3912969..611e4c4 100644
--- a/progress.h
+++ b/progress.h
@@ -9,5 +9,6 @@ struct progress *start_progress(const char *title, unsigned total);
 struct progress *start_progress_delay(const char *title, unsigned total,
 				       unsigned percent_treshold, unsigned delay);
 void stop_progress(struct progress **progress);
+void stop_progress_msg(struct progress **progress, const char *msg);
 
 #endif

^ permalink raw reply related

* Re: What's cooking in git.git (topics)
From: Steffen Prohaska @ 2007-11-08 20:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vir4d40sw.fsf@gitster.siamese.dyndns.org>


On Nov 8, 2007, at 9:08 AM, Junio C Hamano wrote:

> * sp/push-refspec (Sun Oct 28 18:46:20 2007 +0100) 5 commits
>  - push: teach push to pass --verbose option to transport layer
>  - push: use same rules as git-rev-parse to resolve refspecs
>  - add ref_abbrev_matches_full_with_rev_parse_rules() comparing
>    abbrev with full ref name
>  - rename ref_matches_abbrev() to
>    ref_abbrev_matches_full_with_fetch_rules()
>  - push: support pushing HEAD to real branch name
>
> Really need to look at this series to merge to 'next'.  Sorry.

Take your time. There is a slight chance that I'll unify
ref_abbrev_matches_full_with_rev_parse_rules() and  
ref_abbrev_matches_full_with_fetch_rules() over the weekend.

	Steffen

^ permalink raw reply

* Re: [PATCH 4/3] t3700: avoid racy git situation
From: Junio C Hamano @ 2007-11-08 20:42 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Johannes Sixt, git, krh
In-Reply-To: <Pine.LNX.4.64.0711081511440.4362@racer.site>

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

> The problem is that the index has the same timestamp as the file "foo".
>
> Therefore, git cannot tell if "foo" is up-to-date in the index, since it 
> could have been modified (and indeed is) just a fraction of a second later 
> than the index was last updated.
>
> And since diff-index, as called from the test script, does not generate a 
> diff, but really only determines if the index information suggests that 
> the files are up-to-date, there is not really much you can do.
>
> This is our good old friend, the racy git problem.

That sounds very wrong.

What happened to the ce_smudge_racily_clean_entry() call that is
done from write_index()?

> NOTE: other scms do not have this problem, mostly because they are too 
> slow to trigger it.

I recall racy-hg mentioned on their development list twice, a
few months apart, and CVS has the "delay the return from a
commit to the next full second" or something to work around
problems in the timestamp recorded in CVS/Entries.

^ permalink raw reply

* [PATCH] git-cvsimport: fix handling of user name when it is not set in CVSROOT
From: Gordon Hopper @ 2007-11-08 20:15 UTC (permalink / raw)
  To: git; +Cc: gitster

The cvs programs do not default to "anonymous" as the user name, but use the
currently logged in user.  This patch more closely matches the cvs behavior.

Signed-off-by: Gordon Hopper <g.hopper@computer.org>
---
 git-cvsimport.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index e4bc2b5..efa6a0c 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -223,7 +223,8 @@ sub conn {
 			}
 		}

-		$user="anonymous" unless defined $user;
+		# if username is not explicit in CVSROOT, then use current user, as cvs would
+		$user=(getlogin() || $ENV{'LOGNAME'} || $ENV{'USER'} ||
"anonymous") unless $user;
 		my $rr2 = "-";
 		unless ($port) {
 			$rr2 = ":pserver:$user\@$serv:$repo";
-- 
1.5.3.5

^ permalink raw reply related

* Re: git rebase --skip
From: Mike Hommey @ 2007-11-08 19:22 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: Björn Steinbrink, Jeff King, git
In-Reply-To: <20071108191601.GA22353@glandium.org>

On Thu, Nov 08, 2007 at 08:16:01PM +0100, Mike Hommey wrote:
> On Thu, Nov 08, 2007 at 01:43:05PM -0500, Daniel Barkalow wrote:
> > > git commit
> > > git rebase --skip
> > 
> > I guess that works, and nothing else presently does. But I don't think 
> > that's at all intuitive as the correct thing to do (plus it feels too easy 
> > to get into losing your commit message). Maybe we should have a "git 
> > rebase --amend", which does the obvious thing (acts like --continue, but 
> > lets you edit the message). It's not like you just did something totally 
> > different; the commit is still the replacement for D, it's just less the 
> > same.
> 
> Maybe some commands such as commit should fail or at least emit warning
> when used during a rebase ?

Or, in the present case, doing the same as what "edit" would do in a
git-rebase --interactive could be enough.

Mike

^ permalink raw reply

* Re: git rebase --skip
From: Mike Hommey @ 2007-11-08 19:16 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: Björn Steinbrink, Jeff King, git
In-Reply-To: <Pine.LNX.4.64.0711081332550.29952@iabervon.org>

On Thu, Nov 08, 2007 at 01:43:05PM -0500, Daniel Barkalow wrote:
> > git commit
> > git rebase --skip
> 
> I guess that works, and nothing else presently does. But I don't think 
> that's at all intuitive as the correct thing to do (plus it feels too easy 
> to get into losing your commit message). Maybe we should have a "git 
> rebase --amend", which does the obvious thing (acts like --continue, but 
> lets you edit the message). It's not like you just did something totally 
> different; the commit is still the replacement for D, it's just less the 
> same.

Maybe some commands such as commit should fail or at least emit warning
when used during a rebase ?

Mike

^ permalink raw reply

* GIT_DIR/--git-dir question
From: Joakim Tjernlund @ 2007-11-08 19:06 UTC (permalink / raw)
  To: git

I just started to look at having multiple work trees, each working on a separate branch,
using the same git repo.

GIT_DIR/--git-dir seems to be what I am looking for but I wonder if there
is a way to store the value of GIT_DIR/--git-dir in the working tree
somehow?

  Jocke

^ permalink raw reply

* [PATCH] git-send-email: Change the prompt for the subject of the initial message.
From: Benoit Sigoure @ 2007-11-08 18:56 UTC (permalink / raw)
  To: git; +Cc: gitster, Benoit Sigoure

I never understood what this prompt was asking for until I read the actual
source code.  I think this wording is much more understandable.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
---
 git-send-email.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index f4b8f96..f9bd2e5 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -352,7 +352,7 @@ sub expand_aliases {
 
 if (!defined $initial_subject && $compose) {
 	do {
-		$_ = $term->readline("What subject should the emails start with? ",
+		$_ = $term->readline("What subject should the initial email start with? ",
 			$initial_subject);
 	} while (!defined $_);
 	$initial_subject = $_;
-- 
1.5.3.4.398.g859b

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox