Git development
 help / color / mirror / Atom feed
* Re: [PATCH 5/5] Migrate git-am.sh to use git-rev-parse --parseopt
From: Alex Riesen @ 2007-11-03  9:55 UTC (permalink / raw)
  To: Pierre Habouzit; +Cc: gitster, torvalds, git
In-Reply-To: <1194043193-29601-6-git-send-email-madcoder@debian.org>

Pierre Habouzit, Fri, Nov 02, 2007 23:39:52 +0100:
> diff --git a/git-am.sh b/git-am.sh
> index 2514d07..e5ed6a7 100755
> --- a/git-am.sh
> +++ b/git-am.sh
...
> -	usage ;;
> -	*)
> -	break ;;
> +		-i|--interactive)
> +			interactive=t ;;
> +		-b|--binary)
> +			binary=t ;;

Did you really have to change the indentation?

^ permalink raw reply

* [PATCH] Add missing inside_work_tree setting in setup_git_directory_gently
From: Nguyễn Thái Ngọc Duy @ 2007-11-03 10:03 UTC (permalink / raw)
  To: git

Without this, work_tree handling code in setup_git_directory
will be activated. If you stay in root work tree (no prefix),
it does not harm. It does if you work from a subdirectory though.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Turns out my patch on NEED_WORK_TREE is fixing a wrong place.

 setup.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/setup.c b/setup.c
index 145eca5..6f8f769 100644
--- a/setup.c
+++ b/setup.c
@@ -240,6 +240,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
 			if (chdir(work_tree_env) < 0)
 				die ("Could not chdir to %s", work_tree_env);
 			strcat(buffer, "/");
+			inside_work_tree = 1;
 			return retval;
 		}
 		if (nongit_ok) {
-- 
1.5.3.rc4.3.gab089

^ permalink raw reply related

* [PATCH] Don't require working tree for git-rm
From: Mike Hommey @ 2007-11-03 10:08 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

This allows to do git rm --cached -r directory, instead of
git ls-files -z directory | git update-index --remove -z --stdin.
This can be particularly useful for git-filter-branch users.

Signed-off-by: Mike Hommey <mh@glandium.org>
---
 git.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git.c b/git.c
index 4e10581..01dcb6a 100644
--- a/git.c
+++ b/git.c
@@ -345,7 +345,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "rev-list", cmd_rev_list, RUN_SETUP },
 		{ "rev-parse", cmd_rev_parse, RUN_SETUP },
 		{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
-		{ "rm", cmd_rm, RUN_SETUP | NEED_WORK_TREE },
+		{ "rm", cmd_rm, RUN_SETUP },
 		{ "runstatus", cmd_runstatus, RUN_SETUP | NEED_WORK_TREE },
 		{ "shortlog", cmd_shortlog, RUN_SETUP | USE_PAGER },
 		{ "show-branch", cmd_show_branch, RUN_SETUP },
-- 
1.5.3.5

^ permalink raw reply related

* Re: StGIT fails to clean patch series, and to go to a patch
From: Catalin Marinas @ 2007-11-03 10:32 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <200711031045.21506.jnareb@gmail.com>

On 03/11/2007, Jakub Narebski <jnareb@gmail.com> wrote:
> I have patch series with empty patch in the middle of the stack.
> After trying to stg-clean (and failing) stack looks like below:

Does 'stg delete gitweb-Update-INSTALL-file' work?

> 1164:[gitweb/web!git]$ stg goto gitweb-Use-config-more
> Checking for changes in the working directory ... done
> Traceback (most recent call last):

Does a simple 'stg push' work? I suspect there is something wrong with
the gitweb-Update-INSTALL-file patch but not sure why or how it could
get to this inconsistent state?

It's worth checking the values of 'stg id
gitweb-Update-INSTALL-file//top' and //bottom and whether they are
commit ids or something else.

-- 
Catalin

^ permalink raw reply

* Re: [StGit RFC] A more structured way of calling git
From: Catalin Marinas @ 2007-11-03 10:56 UTC (permalink / raw)
  To: Karl Hasselström; +Cc: David Kågedal, Git Mailing List, Yann Dirson
In-Reply-To: <20071026192418.GA19774@diana.vm.bytemark.co.uk>

On 26/10/2007, Karl Hasselström <kha@treskal.com> wrote:
> I wanted to build an StGit command that coalesced adjacent patches to
> a single patch. Because the end result tree would still be the same,
> this should be doable without ever involving HEAD, the index, or the
> worktree.

Wouldn't HEAD need to be modified since the commit log changes
slightly, even though the tree is the same. Or am I misunderstanding
this?

> StGit's existing infrastructure for manipulating patches
> didn't lend itself to doing this kind of thing, though: it's not
> modular enough. So I started to design a replacement low-level
> interface to git, and things got slightly out of hand ... and I ended
> up with a much bigger refactoring than I'd planned.

Thanks for this. I'll need a bit of time to read it all and give
feedback. In general, I welcome this refactoring.

I'll go through the whole e-mail in the next days and get back to you.

-- 
Catalin

^ permalink raw reply

* Re: git-svn questions: how to clone/init non-standard layout branches/tags?
From: Benoit SIGOURE @ 2007-11-03 10:56 UTC (permalink / raw)
  To: Luke Lu; +Cc: git
In-Reply-To: <756D5EE2-FB2C-48DB-8242-14E154E34A9C@vicaya.com>

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

On Nov 3, 2007, at 9:19 AM, Luke Lu wrote:

> There are a few svn repositories that use non-standard layout like  
> this:
>
> <path_to_project>/trunk
> <path_to_project>/production
> <path_to_project>/some_branch
>
> production and some_branch are indeed branched from trunk.
>
> 1. How do you init/clone svn repositories like that?

I seem to remember that you can pass more than one `-b' option to git- 
svn clone, so I'd basically do (untested):
git svn clone <url> -T trunk -b production -b some_branch

> 2. Is there a way to add a new svn branch like that (say production  
> or some_branch) to an existing git-svn repository that has trunk  
> cloned?

I don't know, but that'd be great indeed.

-- 
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

* [ANNOUNCE] cgit v0.7
From: Lars Hjemli @ 2007-11-03 11:08 UTC (permalink / raw)
  To: git list

cgit v0.7 (a fast webinterface for git) is now available at

     git://hjemli.net/pub/git/cgit

This release includes better search capabilities, better diff,
filtered and sorted branch/tag lists on the summary page, a simple way
to switch between branches and finally a much needed restructuring of
the user interface. There is even a brand new logo, and a number of
bugfixes.

The latest version can be seen in action on http://hjemli.net/git/
(disclaimer: I'm not a web/user interface designer, and should not be
held responsible for any eyeball-related damages).

Big thanks to everyone who submitted patches and feedback!

---
Sortlog since v0.6


Chris Pickel (3):
      Makefile: add support for DESTDIR
      Make cgit honor CACHE_ROOT as defined in Makefile
      Improve the sample cgitrc file

Lars Hjemli (47):
      Makefile: add missing references to DESTDIR
      cgit v0.6.1
      Revert "Makefile: add missing references to DESTDIR"
      Revert part of "Makefile: add support for DESTDIR"
      cgit v0.6.2
      ui-tree: specify parameter position for all htmlf formats
      ui-tree: show last line of blob
      Add cgit.conf to .gitignore, remove *~
      Remove a few compiler warnings
      Use trim_end() to remove trailing slashes
      Upgrade to GIT 1.5.3.2
      cgit v0.6.3
      Add support for a renamelimit option in cgitrc
      Add prefix parameter to cgit_diff_tree()
      Add prefix parameter to cgit_print_diff()
      ui-commit.c: link to diff instead of tree from diffstat
      css: remove the annoying tr:hover rule for diffstat
      gen-version.sh: don't sed the output from git describe
      ui-diff: add links to pre- and postversion of blobs
      cgit.css: make diff headers more visible
      Use git-1.5.3.3
      Skip unknown header fields when parsing tags and commits
      Add functions and types for ref lists
      Use reflist to print branch info
      Use reflist to print tag info
      Sort tags by age
      Add support for config param summary-tags
      Move logic for age comparision from cmp_tag_age into cmp_age()
      Add support for config param summary-branches
      Add descriptions of summary-branches and summary-tags to cgitrc
      Make cgit_print_branches()/cgit_print_tags() external
      Add support for refs view
      Add links to the new refs page from summary page
      Cleanup code introduced by the filter-refs topic
      cgit_parse_commit(): Add missing call to xstrdup()
      Add html_option() function
      Teach log search about --grep, --author and --committer
      Make print_branch() handle refs not pointing at commits
      Teach cgit_object_link() about tag objects
      Add config param 'index-info'
      Change the cgit layout
      Add search parameters to cgit_log_link
      Fix search form action/hidden fields
      Don't include current path in menu links
      Don't include current SHA1 in 'log' menu-item
      Use GIT-1.5.3.5
      CGIT 0.7

Michael Krelin (2):
      fixed typo in cgitrc
      correct typo in CSS

Shunichi Fuji (1):
      Fix typo in css

^ permalink raw reply

* [PATCH] Make struct commands[] const to save a couple bytes
From: Nguyễn Thái Ngọc Duy @ 2007-11-03 11:13 UTC (permalink / raw)
  To: git


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 .data got reduced by 960 bytes. Not much, but anyway ;)

 git.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/git.c b/git.c
index 4e10581..d0a2042 100644
--- a/git.c
+++ b/git.c
@@ -238,7 +238,7 @@ struct cmd_struct {
 	int option;
 };
 
-static int run_command(struct cmd_struct *p, int argc, const char **argv)
+static int run_command(const struct cmd_struct *p, int argc, const char **argv)
 {
 	int status;
 	struct stat st;
@@ -283,7 +283,7 @@ static int run_command(struct cmd_struct *p, int argc, const char **argv)
 static void handle_internal_command(int argc, const char **argv)
 {
 	const char *cmd = argv[0];
-	static struct cmd_struct commands[] = {
+	static const struct cmd_struct commands[] = {
 		{ "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
 		{ "annotate", cmd_annotate, RUN_SETUP },
 		{ "apply", cmd_apply },
@@ -375,7 +375,7 @@ static void handle_internal_command(int argc, const char **argv)
 	}
 
 	for (i = 0; i < ARRAY_SIZE(commands); i++) {
-		struct cmd_struct *p = commands+i;
+		const struct cmd_struct *p = commands+i;
 		if (strcmp(p->cmd, cmd))
 			continue;
 		exit(run_command(p, argc, argv));
-- 
1.5.3.rc4.3.gab089

^ permalink raw reply related

* git-svn, tracking branches
From: Pascal Obry @ 2007-11-03 11:16 UTC (permalink / raw)
  To: git list


Hi there,

I have "git svn init" a repository to work only on the trunk for the
Subversion repository. I'd like now to work on a branch. I've been able
to do that by editing .git/config, no problem.

My question, is there a better way than hand editing this file ? I've
tried "git remote" but it seems to work only for git repo and there is
no "git svn remote"... Any idea ?

Thanks,
Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

^ permalink raw reply

* git reset -- path weirdness
From: Björn Steinbrink @ 2007-11-03 11:17 UTC (permalink / raw)
  To: Johannes.Schindelin; +Cc: git, jasampler, gitster

Hi,

I noticed some weirdness with git reset when a path is given. Basically
it seems to cycle the file through 3 states: unstaged, unmerged,
deleted(!) which is IMHO weird at best. A bisection showed that the
behaviour was introduced with the shell -> conversion of git-reset.

Extra annoyance is caused by the fact that "git status" tells you to add
the file when it is in the unmerged state, but that doesn't do anything.

Log of "git reset" switching through the states:

doener@atjola:git (master) $ git status
# On branch master
nothing to commit (working directory clean)

doener@atjola:git (master) $ git reset -- builtin-reset.c
builtin-reset.c: needs merge

doener@atjola:git (master) $ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#
#       unmerged:   builtin-reset.c
#
no changes added to commit (use "git add" and/or "git commit -a")

doener@atjola:git (master) $ git reset -- builtin-reset.c

doener@atjola:git (master) $ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       deleted:    builtin-reset.c
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       builtin-reset.c

doener@atjola:git (master) $ git reset -- builtin-reset.c

doener@atjola:git (master) $ git status
# On branch master
nothing to commit (working directory clean)


Thanks,
Björn

^ permalink raw reply

* [PATCH 2/3] Use setup_work_tree() in builtin-ls-files.c
From: Mike Hommey @ 2007-11-03 11:23 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano
In-Reply-To: <1194088993-25692-1-git-send-email-mh@glandium.org>


Signed-off-by: Mike Hommey <mh@glandium.org>
---
 builtin-ls-files.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index b70da18..e0b856f 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -525,11 +525,8 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
 		break;
 	}
 
-	if (require_work_tree && !is_inside_work_tree()) {
-		const char *work_tree = get_git_work_tree();
-		if (!work_tree || chdir(work_tree))
-			die("This operation must be run in a work tree");
-	}
+	if (require_work_tree && !is_inside_work_tree())
+		setup_work_tree();
 
 	pathspec = get_pathspec(prefix, argv + i);
 
-- 
1.5.3.5

^ permalink raw reply related

* [PATCH 3/3] Don't always require working tree for git-rm
From: Mike Hommey @ 2007-11-03 11:23 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano
In-Reply-To: <1194088993-25692-2-git-send-email-mh@glandium.org>

This allows to do git rm --cached -r directory, instead of
git ls-files -z directory | git update-index --remove -z --stdin.
This can be particularly useful for git-filter-branch users.

Signed-off-by: Mike Hommey <mh@glandium.org>
---

This replaces the patch from
http://article.gmane.org/gmane.comp.version-control.git/63227

 builtin-rm.c |    3 +++
 git.c        |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/builtin-rm.c b/builtin-rm.c
index bca2bd9..a3d25e6 100644
--- a/builtin-rm.c
+++ b/builtin-rm.c
@@ -155,6 +155,9 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 	if (!argc)
 		usage_with_options(builtin_rm_usage, builtin_rm_options);
 
+	if (!index_only)
+		setup_work_tree();
+
 	pathspec = get_pathspec(prefix, argv);
 	seen = NULL;
 	for (i = 0; pathspec[i] ; i++)
diff --git a/git.c b/git.c
index eb31c93..4a250f7 100644
--- a/git.c
+++ b/git.c
@@ -340,7 +340,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "rev-list", cmd_rev_list, RUN_SETUP },
 		{ "rev-parse", cmd_rev_parse, RUN_SETUP },
 		{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
-		{ "rm", cmd_rm, RUN_SETUP | NEED_WORK_TREE },
+		{ "rm", cmd_rm, RUN_SETUP },
 		{ "runstatus", cmd_runstatus, RUN_SETUP | NEED_WORK_TREE },
 		{ "shortlog", cmd_shortlog, RUN_SETUP | USE_PAGER },
 		{ "show-branch", cmd_show_branch, RUN_SETUP },
-- 
1.5.3.5

^ permalink raw reply related

* [PATCH 1/3] Refactor working tree setup
From: Mike Hommey @ 2007-11-03 11:23 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Create a setup_work_tree() that can be used from any command requiring
a working tree conditionally.

Signed-off-by: Mike Hommey <mh@glandium.org>
---

This kind of implements what Dscho suggested in
http://article.gmane.org/gmane.comp.version-control.git/62487

 cache.h |    1 +
 git.c   |   11 +++--------
 setup.c |    9 +++++++++
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/cache.h b/cache.h
index bfffa05..497b9f9 100644
--- a/cache.h
+++ b/cache.h
@@ -222,6 +222,7 @@ extern const char *get_git_work_tree(void);
 #define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"
 
 extern const char **get_pathspec(const char *prefix, const char **pathspec);
+extern void setup_work_tree(void);
 extern const char *setup_git_directory_gently(int *);
 extern const char *setup_git_directory(void);
 extern const char *prefix_path(const char *prefix, int len, const char *path);
diff --git a/git.c b/git.c
index 4e10581..eb31c93 100644
--- a/git.c
+++ b/git.c
@@ -249,14 +249,9 @@ static int run_command(struct cmd_struct *p, int argc, const char **argv)
 		prefix = setup_git_directory();
 	if (p->option & USE_PAGER)
 		setup_pager();
-	if (p->option & NEED_WORK_TREE) {
-		const char *work_tree = get_git_work_tree();
-		const char *git_dir = get_git_dir();
-		if (!is_absolute_path(git_dir))
-			set_git_dir(make_absolute_path(git_dir));
-		if (!work_tree || chdir(work_tree))
-			die("%s must be run in a work tree", p->cmd);
-	}
+	if (p->option & NEED_WORK_TREE)
+		setup_work_tree();
+
 	trace_argv_printf(argv, argc, "trace: built-in: git");
 
 	status = p->fn(argc, argv, prefix);
diff --git a/setup.c b/setup.c
index 145eca5..df006d9 100644
--- a/setup.c
+++ b/setup.c
@@ -206,6 +206,15 @@ static const char *set_work_tree(const char *dir)
 	return NULL;
 }
 
+void setup_work_tree(void) {
+	const char *work_tree = get_git_work_tree();
+	const char *git_dir = get_git_dir();
+	if (!is_absolute_path(git_dir))
+		set_git_dir(make_absolute_path(git_dir));
+	if (!work_tree || chdir(work_tree))
+		die("This operation must be run in a work tree");
+}
+
 /*
  * We cannot decide in this function whether we are in the work tree or
  * not, since the config can only be read _after_ this function was called.
-- 
1.5.3.5

^ permalink raw reply related

* Re: [PATCH] Add missing inside_work_tree setting in setup_git_directory_gently
From: Johannes Schindelin @ 2007-11-03 11:38 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <20071103100323.GA25305@laptop>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 918 bytes --]

Hi,

On Sat, 3 Nov 2007, Nguyễn Thái Ngọc Duy wrote:

> Without this, work_tree handling code in setup_git_directory
> will be activated. If you stay in root work tree (no prefix),
> it does not harm. It does if you work from a subdirectory though.
> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  Turns out my patch on NEED_WORK_TREE is fixing a wrong place.
> 
>  setup.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/setup.c b/setup.c
> index 145eca5..6f8f769 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -240,6 +240,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
>  			if (chdir(work_tree_env) < 0)
>  				die ("Could not chdir to %s", work_tree_env);
>  			strcat(buffer, "/");
> +			inside_work_tree = 1;

I really have to wonder why this is needed, as it should be deduced 
(correctly!) when you ask is_inside_work_tree().

Ciao,
Dscho

^ permalink raw reply

* [PATCH] git-cvsimport: really convert underscores in branch names to dots with -u
From: Gerrit Pape @ 2007-11-03 11:55 UTC (permalink / raw)
  To: git, Junio C Hamano

The documentation states for the -u option that underscores in tag and
branch names are converted to dots, but this was actually implemented
for the tag names only.

Kurt Roeckx reported this through
 http://bugs.debian.org/446495

Signed-off-by: Gerrit Pape <pape@smarden.org>
---
 git-cvsimport.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 2954fb8..e4bc2b5 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -818,6 +818,7 @@ while (<CVS>) {
 		$state = 4;
 	} elsif ($state == 4 and s/^Branch:\s+//) {
 		s/\s+$//;
+		tr/_/\./ if ( $opt_u );
 		s/[\/]/$opt_s/g;
 		$branch = $_;
 		$state = 5;
-- 
1.5.3.5

^ permalink raw reply related

* Re: [PATCH 5/5] Migrate git-am.sh to use git-rev-parse --parseopt
From: Pierre Habouzit @ 2007-11-03 11:54 UTC (permalink / raw)
  To: Alex Riesen; +Cc: gitster, torvalds, git
In-Reply-To: <20071103095556.GB2853@steel.home>

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

On Sat, Nov 03, 2007 at 09:55:56AM +0000, Alex Riesen wrote:
> Pierre Habouzit, Fri, Nov 02, 2007 23:39:52 +0100:
> > diff --git a/git-am.sh b/git-am.sh
> > index 2514d07..e5ed6a7 100755
> > --- a/git-am.sh
> > +++ b/git-am.sh
> ....
> > -	usage ;;
> > -	*)
> > -	break ;;
> > +		-i|--interactive)
> > +			interactive=t ;;
> > +		-b|--binary)
> > +			binary=t ;;
> 
> Did you really have to change the indentation?

  Well, I'm unsure what the standard is for git, I gladly use any
indentation, I don't really care. I assumed that it wasn't indented
before becauuse instead of -i|--interactive you had:

  -i|--in|--int|....|--interactive which took a lot of space, as it
seemed to me that the case ".." in foo) esac construction in git had the
cases indented in most places. But I may be wrong.

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] Reuse previous annotation when overwriting a tag
From: Johannes Schindelin @ 2007-11-03 11:54 UTC (permalink / raw)
  To: Mike Hommey; +Cc: git, Junio C Hamano
In-Reply-To: <1194082273-19486-1-git-send-email-mh@glandium.org>

Hi,

On Sat, 3 Nov 2007, Mike Hommey wrote:

> diff --git a/builtin-tag.c b/builtin-tag.c
> index 66e5a58..cfd8017 100644
> --- a/builtin-tag.c
> +++ b/builtin-tag.c
> @@ -247,9 +247,42 @@ static int git_tag_config(const char *var, const char *value)
>  	return git_default_config(var, value);
>  }
>  
> +static void write_annotation(int fd, const unsigned char *sha1)

Technically, it is the "body".

> +{
> +	int i;
> +	unsigned long size;
> +	enum object_type type;
> +	char *buf, *sp, *eol;
> +	size_t len;
> +
> +	sp = buf = read_sha1_file(sha1, &type, &size);
> +	if (!buf)
> +		return;
> +	if (!size || (type != OBJ_TAG)) {

Please lose the extra parents.

> +		free(buf);
> +		return;
> +	}
> +	/* skip header */
> +	while (sp + 1 < buf + size &&
> +			!(sp[0] == '\n' && sp[1] == '\n'))
> +		sp++;

This can be done much easier with 'sp = strstr(buf, "\n\n");'.  You can 
even do that before the previous if(), to free() && return if there is no 
body.

> +	/* strip the signature */
> +	for (i = 0, sp += 2; sp < buf + size &&
> +			prefixcmp(sp, PGP_SIGNATURE "\n");
> +			i++) {
> +		eol = memchr(sp, '\n', size - (sp - buf));
> +		len = eol ? eol - sp : size - (sp - buf);
> +		write_or_die(fd, sp, len + 1);
> +		if (!eol)
> +			break;
> +		sp = eol + 1;
> +	}
> +	free(buf);

This can be done much easier with 'eob = strstr(sp, "\n" PGP_SIGNATURE 
"\n");'.

> +}
> +
>  static void create_tag(const unsigned char *object, const char *tag,
>  		       struct strbuf *buf, int message, int sign,
> -			   unsigned char *result)
> +			unsigned char *prev, unsigned char *result)

This changes indentation.

> @@ -282,6 +315,10 @@ static void create_tag(const unsigned char *object, const char *tag,
>  		if (fd < 0)
>  			die("could not create file '%s': %s",
>  						path, strerror(errno));
> +
> +		if (prev)
> +			write_annotation(fd, prev);
> +
>  		write_or_die(fd, tag_template, strlen(tag_template));

Isn't an "else" missing before the write_or_die() here?

> @@ -308,7 +345,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
>  {
>  	struct strbuf buf;
>  	unsigned char object[20], prev[20];
> -	int annotate = 0, sign = 0, force = 0, lines = 0, message = 0;
> +	int annotate = 0, sign = 0, force = 0, lines = 0,
> +	    message = 0, existed = 0;
>  	char ref[PATH_MAX];
>  	const char *object_ref, *tag;
>  	int i;
> @@ -417,9 +455,12 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
>  		hashclr(prev);
>  	else if (!force)
>  		die("tag '%s' already exists", tag);
> +	else
> +		existed = 1;
>  
>  	if (annotate)
> -		create_tag(object, tag, &buf, message, sign, object);
> +		create_tag(object, tag, &buf, message, sign,
> +			   existed ? prev : NULL, object);

Why not teach write_annotations() (or write_tag_body() like I would prefer 
it to be called) to grok a null_sha1?  It's not like we care for 
performance here, but rather for readability and ease of use.

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH] Don't require working tree for git-rm
From: Johannes Schindelin @ 2007-11-03 11:56 UTC (permalink / raw)
  To: Mike Hommey; +Cc: git, Junio C Hamano
In-Reply-To: <1194084521-12962-1-git-send-email-mh@glandium.org>

Hi,

On Sat, 3 Nov 2007, Mike Hommey wrote:

> This allows to do git rm --cached -r directory, instead of
> git ls-files -z directory | git update-index --remove -z --stdin.
> This can be particularly useful for git-filter-branch users.
> 
> Signed-off-by: Mike Hommey <mh@glandium.org>
> ---
>  git.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/git.c b/git.c
> index 4e10581..01dcb6a 100644
> --- a/git.c
> +++ b/git.c
> @@ -345,7 +345,7 @@ static void handle_internal_command(int argc, const char **argv)
>  		{ "rev-list", cmd_rev_list, RUN_SETUP },
>  		{ "rev-parse", cmd_rev_parse, RUN_SETUP },
>  		{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
> -		{ "rm", cmd_rm, RUN_SETUP | NEED_WORK_TREE },
> +		{ "rm", cmd_rm, RUN_SETUP },

Just removing this is wrong!

You have to test for a working tree if "--cached" was _not_ given.  

Ciao,
Dscho

^ permalink raw reply

* Re: git reset -- path weirdness
From: Johannes Schindelin @ 2007-11-03 12:03 UTC (permalink / raw)
  To: Björn Steinbrink; +Cc: git, jasampler, gitster
In-Reply-To: <20071103111743.GA29358@atjola.homenet>

Hi,

On Sat, 3 Nov 2007, Bj?rn Steinbrink wrote:

> I noticed some weirdness with git reset when a path is given. Basically 
> it seems to cycle the file through 3 states: unstaged, unmerged, 
> deleted(!) which is IMHO weird at best. A bisection showed that the 
> behaviour was introduced with the shell -> conversion of git-reset.

Indeed.  I'm on it.

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH 5/5] Migrate git-am.sh to use git-rev-parse --parseopt
From: Pierre Habouzit @ 2007-11-03 12:05 UTC (permalink / raw)
  To: Alex Riesen, gitster, torvalds, git
In-Reply-To: <20071103115445.GA13417@artemis.corp>

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

On Sat, Nov 03, 2007 at 11:54:45AM +0000, Pierre Habouzit wrote:
> On Sat, Nov 03, 2007 at 09:55:56AM +0000, Alex Riesen wrote:
> > Pierre Habouzit, Fri, Nov 02, 2007 23:39:52 +0100:
> > > diff --git a/git-am.sh b/git-am.sh
> > > index 2514d07..e5ed6a7 100755
> > > --- a/git-am.sh
> > > +++ b/git-am.sh
> > ....
> > > -	usage ;;
> > > -	*)
> > > -	break ;;
> > > +		-i|--interactive)
> > > +			interactive=t ;;
> > > +		-b|--binary)
> > > +			binary=t ;;
> > 
> > Did you really have to change the indentation?
> 
>   Well, I'm unsure what the standard is for git, I gladly use any
> indentation, I don't really care. I assumed that it wasn't indented
> before becauuse instead of -i|--interactive you had:
> 
>   -i|--in|--int|....|--interactive which took a lot of space, as it
> seemed to me that the case ".." in foo) esac construction in git had the
> cases indented in most places. But I may be wrong.

  Okay seems I was wrong, sorry then, that wasn't done on purpose at
all.


-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

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

Hi,

On Sat, 3 Nov 2007, Mike Hommey wrote:

> Create a setup_work_tree() that can be used from any command requiring a 
> working tree conditionally.

All three patches look fine to me.

Ciao,
Dscho

^ permalink raw reply

* Re: That new progress meter
From: Pierre Habouzit @ 2007-11-03 12:09 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Nicolas Pitre, git
In-Reply-To: <Pine.LNX.4.64.0711021836000.4362@racer.site>

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

On Fri, Nov 02, 2007 at 06:36:35PM +0000, Johannes Schindelin wrote:
> Hi Nico,
> 
> that new progress meter sure is amazing and useful!

  I do agree. There seems to be some glitches though, here is how my
output looks after a git fetch I just did on git.git:

    remote: Generating pack...
    remote: Done counting 310 objects.
    remote: Deltifying 310 objects...           | Here we have a glitch |
    remote:  100% (310/310) done                 `-------vvvv----------'
    remote: Total 310 (delta 160), reused 178 (delta 112)iB/s
    Receiving objects: 100% (310/310), 379.98 KiB | 136 KiB/s, done.
    Resolving deltas: 100% (160/160), done.
    * refs/remotes/origin/html: fast forward to branch 'html' of git://git.kernel.org/pub/scm/git/git
      old..new: 1c70883..7ae0ab2
    * refs/remotes/origin/maint: fast forward to branch 'maint' of git://git.kernel.org/pub/scm/git/git
      old..new: 136e631..f45e867
    * refs/remotes/origin/man: fast forward to branch 'man' of git://git.kernel.org/pub/scm/git/git
      old..new: 9850e2e..44dd7e0
    * refs/remotes/origin/master: fast forward to branch 'master' of git://git.kernel.org/pub/scm/git/git
      old..new: 3e4bb08..e3d6d56
    * refs/remotes/origin/next: fast forward to branch 'next' of git://git.kernel.org/pub/scm/git/git
      old..new: a93d0b0..536f64a
    * refs/remotes/origin/pu: forcing update to non-fast forward branch 'pu' of git://git.kernel.org/pub/scm/git/git
      old...new: eb57be8...bf1284a

FWIW, maybe instead using spaces to erase lines we could use minimal
vt100 codes[0] like:

Erase End of Line       <ESC>[K
    Erases from the current cursor position to the end of the current line. 
Erase Start of Line     <ESC>[1K
    Erases from the current cursor position to the start of the current line. 
Erase Line              <ESC>[2K
    Erases the entire current line.

  [0] http://www.termsys.demon.co.uk/vtansi.htm

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] Reuse previous annotation when overwriting a tag
From: Mike Hommey @ 2007-11-03 12:10 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Junio C Hamano
In-Reply-To: <Pine.LNX.4.64.0711031148460.4362@racer.site>

On Sat, Nov 03, 2007 at 11:54:38AM +0000, Johannes Schindelin wrote:
> > +{
> > +	int i;
> > +	unsigned long size;
> > +	enum object_type type;
> > +	char *buf, *sp, *eol;
> > +	size_t len;
> > +
> > +	sp = buf = read_sha1_file(sha1, &type, &size);
> > +	if (!buf)
> > +		return;
> > +	if (!size || (type != OBJ_TAG)) {
> 
> Please lose the extra parents.

What do you mean ?

(...)
> This can be done much easier with 'sp = strstr(buf, "\n\n");'.  You can 
> even do that before the previous if(), to free() && return if there is no 
> body.
(...)
> This can be done much easier with 'eob = strstr(sp, "\n" PGP_SIGNATURE 
> "\n");'.

I must say I just stole most of it in show_reference() in the same file.

> > +}
> > +
> >  static void create_tag(const unsigned char *object, const char *tag,
> >  		       struct strbuf *buf, int message, int sign,
> > -			   unsigned char *result)
> > +			unsigned char *prev, unsigned char *result)
> 
> This changes indentation.

I'll fix this.

> > @@ -282,6 +315,10 @@ static void create_tag(const unsigned char *object, const char *tag,
> >  		if (fd < 0)
> >  			die("could not create file '%s': %s",
> >  						path, strerror(errno));
> > +
> > +		if (prev)
> > +			write_annotation(fd, prev);
> > +
> >  		write_or_die(fd, tag_template, strlen(tag_template));
> 
> Isn't an "else" missing before the write_or_die() here?

You're obviously right.

(...)
> Why not teach write_annotations() (or write_tag_body() like I would prefer 
> it to be called) to grok a null_sha1?  It's not like we care for 
> performance here, but rather for readability and ease of use.

I would have if I had looked up for is_null_sha1() earlier ;)

Cheers,

Mike

^ permalink raw reply

* Re: [PATCH] Don't require working tree for git-rm
From: Mike Hommey @ 2007-11-03 12:11 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Junio C Hamano
In-Reply-To: <Pine.LNX.4.64.0711031155070.4362@racer.site>

On Sat, Nov 03, 2007 at 11:56:17AM +0000, Johannes Schindelin wrote:
> Hi,
> 
> On Sat, 3 Nov 2007, Mike Hommey wrote:
> 
> > This allows to do git rm --cached -r directory, instead of
> > git ls-files -z directory | git update-index --remove -z --stdin.
> > This can be particularly useful for git-filter-branch users.
> > 
> > Signed-off-by: Mike Hommey <mh@glandium.org>
> > ---
> >  git.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/git.c b/git.c
> > index 4e10581..01dcb6a 100644
> > --- a/git.c
> > +++ b/git.c
> > @@ -345,7 +345,7 @@ static void handle_internal_command(int argc, const char **argv)
> >  		{ "rev-list", cmd_rev_list, RUN_SETUP },
> >  		{ "rev-parse", cmd_rev_parse, RUN_SETUP },
> >  		{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
> > -		{ "rm", cmd_rm, RUN_SETUP | NEED_WORK_TREE },
> > +		{ "rm", cmd_rm, RUN_SETUP },
> 
> Just removing this is wrong!
> 
> You have to test for a working tree if "--cached" was _not_ given.  

See the other patch I sent a bit later.

Mike

^ permalink raw reply

* Re: [ANNOUNCE] cgit v0.7
From: Nguyen Thai Ngoc Duy @ 2007-11-03 12:15 UTC (permalink / raw)
  To: Lars Hjemli; +Cc: git list
In-Reply-To: <8c5c35580711030408n658eb11fk19d554f0fa3b17@mail.gmail.com>

I wonder why this is not in git's contrib part. It requires git source
code to build and does not seem to require additional dependencies.
It's smaller than gitweb and does not need perl... MinGW porting guys
may even have a look at it while porting git (and I'm thinking about
porting busybox httpd so that it could run out of the box on Windows
;) ).

Any reasons?

On 11/3/07, Lars Hjemli <hjemli@gmail.com> wrote:
> cgit v0.7 (a fast webinterface for git) is now available at
>
>      git://hjemli.net/pub/git/cgit
>
> This release includes better search capabilities, better diff,
> filtered and sorted branch/tag lists on the summary page, a simple way
> to switch between branches and finally a much needed restructuring of
> the user interface. There is even a brand new logo, and a number of
> bugfixes.
>
> The latest version can be seen in action on http://hjemli.net/git/
> (disclaimer: I'm not a web/user interface designer, and should not be
> held responsible for any eyeball-related damages).
>
> Big thanks to everyone who submitted patches and feedback!
>
> ---
> Sortlog since v0.6
>
>
> Chris Pickel (3):
>       Makefile: add support for DESTDIR
>       Make cgit honor CACHE_ROOT as defined in Makefile
>       Improve the sample cgitrc file
>
> Lars Hjemli (47):
>       Makefile: add missing references to DESTDIR
>       cgit v0.6.1
>       Revert "Makefile: add missing references to DESTDIR"
>       Revert part of "Makefile: add support for DESTDIR"
>       cgit v0.6.2
>       ui-tree: specify parameter position for all htmlf formats
>       ui-tree: show last line of blob
>       Add cgit.conf to .gitignore, remove *~
>       Remove a few compiler warnings
>       Use trim_end() to remove trailing slashes
>       Upgrade to GIT 1.5.3.2
>       cgit v0.6.3
>       Add support for a renamelimit option in cgitrc
>       Add prefix parameter to cgit_diff_tree()
>       Add prefix parameter to cgit_print_diff()
>       ui-commit.c: link to diff instead of tree from diffstat
>       css: remove the annoying tr:hover rule for diffstat
>       gen-version.sh: don't sed the output from git describe
>       ui-diff: add links to pre- and postversion of blobs
>       cgit.css: make diff headers more visible
>       Use git-1.5.3.3
>       Skip unknown header fields when parsing tags and commits
>       Add functions and types for ref lists
>       Use reflist to print branch info
>       Use reflist to print tag info
>       Sort tags by age
>       Add support for config param summary-tags
>       Move logic for age comparision from cmp_tag_age into cmp_age()
>       Add support for config param summary-branches
>       Add descriptions of summary-branches and summary-tags to cgitrc
>       Make cgit_print_branches()/cgit_print_tags() external
>       Add support for refs view
>       Add links to the new refs page from summary page
>       Cleanup code introduced by the filter-refs topic
>       cgit_parse_commit(): Add missing call to xstrdup()
>       Add html_option() function
>       Teach log search about --grep, --author and --committer
>       Make print_branch() handle refs not pointing at commits
>       Teach cgit_object_link() about tag objects
>       Add config param 'index-info'
>       Change the cgit layout
>       Add search parameters to cgit_log_link
>       Fix search form action/hidden fields
>       Don't include current path in menu links
>       Don't include current SHA1 in 'log' menu-item
>       Use GIT-1.5.3.5
>       CGIT 0.7
>
> Michael Krelin (2):
>       fixed typo in cgitrc
>       correct typo in CSS
>
> Shunichi Fuji (1):
>       Fix typo in css
> -
> 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
>


-- 
Duy

^ 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