* Re: [PATCH] Reuse previous annotation when overwriting a tag
From: Mike Hommey @ 2007-11-03 12:27 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:
> 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.
By the way, I think it would be much better if this function was made
more generic and would not write, but return an strbuf containing the
object body. It could also be used by e.g. git-commit --amend.
What would be the best suited place for such a function ?
Mike
^ permalink raw reply
* why the 'g' prefix on the SHA1 in git-describe output?
From: Jim Meyering @ 2007-11-03 12:25 UTC (permalink / raw)
To: git list
Hello,
Can anyone tell me what motivated adding the 'g' prefix on the SHA1 in
git-describe output? Is there some version-parsing/comparing tool that
misbehaves on a component like the SHA1 that would otherwise start with a
digit but contain non-numeric bytes, too?
Why do I ask? Because I'm using a bastardized version of GIT-VERSION-GEN
in coreutils' build-aux/git-version-gen, and removed the 'g' to shorten
the string by a byte. If there's a good reason (i.e., other than vanity :-)
for the 'g', I'll propose comments for GIT-VERSION-GEN, so others
don't do what I've done.
Jim
^ permalink raw reply
* Re: [PATCH] Reuse previous annotation when overwriting a tag
From: Johannes Schindelin @ 2007-11-03 12:23 UTC (permalink / raw)
To: Mike Hommey; +Cc: git, Junio C Hamano
In-Reply-To: <20071103121002.GA4295@glandium.org>
Hi,
On Sat, 3 Nov 2007, Mike Hommey wrote:
> 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 ?
Typo. I meant the parens, and my fingers typed parents. D'oh.
> (...)
> > 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.
I agree for the "\n\n"; this was my mistake (IOW it should be fixed both
in show_reference() as well as in your code).
But for the signature, show_reference() _has_ to go line by line, because
the user is allowed to specify a maximal line count. This does not apply
for your function.
> (...)
> > 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 ;)
Hehe. This is what I really like about git's mailing list: it is a place
where you learn something new every day.
Ciao,
Dscho
^ permalink raw reply
* [PATCH] Make git-blame fail when working tree is needed and we're not in one
From: Mike Hommey @ 2007-11-03 12:22 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
In-Reply-To: <1194092575-7133-2-git-send-email-mh@glandium.org>
Signed-off-by: Mike Hommey <mh@glandium.org>
---
builtin-blame.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/builtin-blame.c b/builtin-blame.c
index 141287e..500ae77 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -2338,6 +2338,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
* do not default to HEAD, but use the working tree
* or "--contents".
*/
+ setup_work_tree();
sb.final = fake_working_tree_commit(path, contents_from);
add_pending_object(&revs, &(sb.final->object), ":");
}
--
1.5.3.5
^ permalink raw reply related
* [PATCH] Allow 'git blame rev path' to work on bare repository
From: Mike Hommey @ 2007-11-03 12:22 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
In-Reply-To: <1194092575-7133-1-git-send-email-mh@glandium.org>
While 'git blame rev -- path' works, 'git blame rev path' didn't.
Signed-off-by: Mike Hommey <mh@glandium.org>
---
builtin-blame.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/builtin-blame.c b/builtin-blame.c
index aedc294..141287e 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -2294,10 +2294,6 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
}
else if (i != argc - 1)
usage(blame_usage); /* garbage at end */
-
- if (!has_path_in_work_tree(path))
- die("cannot stat path %s: %s",
- path, strerror(errno));
}
}
--
1.5.3.5
^ permalink raw reply related
* [PATCH] Delay pager setup in git blame
From: Mike Hommey @ 2007-11-03 12:22 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
This avoids to launch the pager when git blame fails for any reason.
Signed-off-by: Mike Hommey <mh@glandium.org>
---
builtin-blame.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin-blame.c b/builtin-blame.c
index 8432b82..aedc294 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -2215,9 +2215,6 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
argv[unk++] = arg;
}
- if (!incremental)
- setup_pager();
-
if (!blame_move_score)
blame_move_score = BLAME_DEFAULT_MOVE_SCORE;
if (!blame_copy_score)
@@ -2411,6 +2408,9 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
read_mailmap(&mailmap, ".mailmap", NULL);
+ if (!incremental)
+ setup_pager();
+
assign_blame(&sb, &revs, opt);
if (incremental)
--
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 12:16 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: git
In-Reply-To: <fcaeb9bf0711030457se2f5f5bpd9aa463e878cd621@mail.gmail.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1940 bytes --]
Hi,
On Sat, 3 Nov 2007, Nguyen Thai Ngoc Duy wrote:
> On 11/3/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> > 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().
>
> Because setup_git_directory() does not? From what I see,
> setup_git_directory() calls setup_git_directory_gently() then check
> for inside_work_tree variable almost immediately
> (check_repository_format() does not seem to ask
> is_inside_work_tree()).
Ah, I see the problem.
>From your commit message I assumed that you fixed the wrong spot... Which
you did not. It would have helped me if the message had read:
When both GIT_DIR and GIT_WORK_TREE are set, and
setup_git_directory_gently() changes the current working
directory accordingly, it should also set inside_work_tree = 1.
Your fix is the proper one, but it not only fixes setup_git_directory(),
but all callers of setup_git_directory_gently().
Thanks,
Dscho
^ 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
* 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: [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: 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 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: [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: 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] 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: [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 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
* [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] 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 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
* [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 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
* 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
* 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
* [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
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox