* [PATCH] git-reset: do not be confused if there is nothing to reset
From: Johannes Schindelin @ 2007-11-03 13:12 UTC (permalink / raw)
To: Björn Steinbrink; +Cc: git, jasampler, gitster
In-Reply-To: <20071103111743.GA29358@atjola.homenet>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 3065 bytes --]
The purpose of the function update_index_from_diff() (which is the
callback function we give do_diff_cache()) is to update those index
entries which differ from the given commit.
Since do_diff_cache() plays games with the in-memory index, this function
discarded the cache and reread it.
Then, back in the function read_from_tree() we wrote the index.
Of course, this broke down when there were no changes and
update_index_from_diff() was not called, and therefore the mangled index
was not discarded.
The solution is to move the index writing into the function
update_index_from_diff().
Noticed by Björn Steinbrink.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
builtin-reset.c | 24 ++++++++++++++++++------
t/t7102-reset.sh | 7 +++++++
2 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/builtin-reset.c b/builtin-reset.c
index e1dc31e..5467e36 100644
--- a/builtin-reset.c
+++ b/builtin-reset.c
@@ -113,10 +113,17 @@ static int update_index_refresh(void)
return run_command_v_opt(argv_update_index, RUN_GIT_CMD);
}
+struct update_cb_data {
+ int index_fd;
+ struct lock_file *lock;
+ int exit_code;
+};
+
static void update_index_from_diff(struct diff_queue_struct *q,
struct diff_options *opt, void *data)
{
int i;
+ struct update_cb_data *cb = data;
/* do_diff_cache() mangled the index */
discard_cache();
@@ -133,29 +140,34 @@ static void update_index_from_diff(struct diff_queue_struct *q,
} else
remove_file_from_cache(one->path);
}
+
+ cb->exit_code = write_cache(cb->index_fd, active_cache, active_nr) ||
+ close(cb->index_fd) ||
+ commit_locked_index(cb->lock);
}
static int read_from_tree(const char *prefix, const char **argv,
unsigned char *tree_sha1)
{
- struct lock_file *lock = xcalloc(1, sizeof(struct lock_file));
- int index_fd;
struct diff_options opt;
+ struct update_cb_data cb;
memset(&opt, 0, sizeof(opt));
diff_tree_setup_paths(get_pathspec(prefix, (const char **)argv), &opt);
opt.output_format = DIFF_FORMAT_CALLBACK;
opt.format_callback = update_index_from_diff;
+ opt.format_callback_data = &cb;
- index_fd = hold_locked_index(lock, 1);
+ cb.lock = xcalloc(1, sizeof(struct lock_file));
+ cb.index_fd = hold_locked_index(cb.lock, 1);
+ cb.exit_code = 0;
read_cache();
if (do_diff_cache(tree_sha1, &opt))
return 1;
diffcore_std(&opt);
diff_flush(&opt);
- return write_cache(index_fd, active_cache, active_nr) ||
- close(index_fd) ||
- commit_locked_index(lock);
+
+ return cb.exit_code;
}
static void prepend_reflog_action(const char *action, char *buf, size_t size)
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index f64b1cb..cea9afb 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -402,4 +402,11 @@ test_expect_success 'test resetting the index at give paths' '
'
+test_expect_success 'resetting an unmodified path is a no-op' '
+ git reset --hard &&
+ git reset -- file1 &&
+ git diff-files --exit-code &&
+ git diff-index --cached --exit-code HEAD
+'
+
test_done
--
1.5.3.5.1505.gd778c
^ permalink raw reply related
* Re: [PATCH] Reuse previous annotation when overwriting a tag
From: Mike Hommey @ 2007-11-03 13:10 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, Junio C Hamano
In-Reply-To: <Pine.LNX.4.64.0711031236160.4362@racer.site>
On Sat, Nov 03, 2007 at 12:36:36PM +0000, Johannes Schindelin wrote:
> Hi,
>
> On Sat, 3 Nov 2007, Mike Hommey wrote:
>
> > 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 ?
>
> editor.c, I'd say.
On which topic is this ?
Mike
^ permalink raw reply
* [PATCH 1/2] Reuse previous annotation when overwriting a tag
From: Mike Hommey @ 2007-11-03 13:08 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
In-Reply-To: <Pine.LNX.4.64.0711031219530.4362@racer.site>
When forcing to overwrite an annotated tag, there are good chances one
wants to keep the old annotation, or modify it, not start from scratch.
This is obviously only triggered for annotated tagging (-a or -s).
Signed-off-by: Mike Hommey <mh@glandium.org>
---
builtin-tag.c | 41 ++++++++++++++++++++++++++++++++++++++---
1 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/builtin-tag.c b/builtin-tag.c
index 66e5a58..e57f57f 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -247,9 +247,40 @@ static int git_tag_config(const char *var, const char *value)
return git_default_config(var, value);
}
+static void write_tag_body(int fd, const unsigned char *sha1)
+{
+ unsigned long size;
+ enum object_type type;
+ char *buf, *sp, *eob;
+ size_t len;
+
+ if (is_null_sha1(sha1))
+ return;
+
+ sp = buf = read_sha1_file(sha1, &type, &size);
+ if (!buf)
+ return;
+ /* skip header */
+ sp = strstr(buf, "\n\n");
+
+ if (!sp || !size || type != OBJ_TAG) {
+ free(buf);
+ return;
+ }
+ sp += 2; /* skip the 2 CRs */
+ eob = strstr(sp, "\n" PGP_SIGNATURE "\n");
+ if (eob)
+ len = eob - sp;
+ else
+ len = buf + size - sp;
+ write_or_die(fd, sp, len);
+
+ free(buf);
+}
+
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)
{
enum object_type type;
char header_buf[1024];
@@ -282,7 +313,11 @@ static void create_tag(const unsigned char *object, const char *tag,
if (fd < 0)
die("could not create file '%s': %s",
path, strerror(errno));
- write_or_die(fd, tag_template, strlen(tag_template));
+
+ if (prev)
+ write_tag_body(fd, prev);
+ else
+ write_or_die(fd, tag_template, strlen(tag_template));
close(fd);
launch_editor(path, buf);
@@ -419,7 +454,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
die("tag '%s' already exists", tag);
if (annotate)
- create_tag(object, tag, &buf, message, sign, object);
+ create_tag(object, tag, &buf, message, sign, prev, object);
lock = lock_any_ref_for_update(ref, prev, 0);
if (!lock)
--
1.5.3.5
^ permalink raw reply related
* [PATCH 2/2] Small code readability improvement in show_reference() in builtin-tag.c
From: Mike Hommey @ 2007-11-03 13:08 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
In-Reply-To: <1194095285-18651-1-git-send-email-mh@glandium.org>
Signed-off-by: Mike Hommey <mh@glandium.org>
---
builtin-tag.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/builtin-tag.c b/builtin-tag.c
index e57f57f..3ed5759 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -84,14 +84,13 @@ static int show_reference(const char *refname, const unsigned char *sha1,
sp = buf = read_sha1_file(sha1, &type, &size);
if (!buf)
return 0;
- if (!size) {
+ /* skip header */
+ sp = strstr(buf, "\n\n");
+
+ if (!sp || !size) {
free(buf);
return 0;
}
- /* skip header */
- while (sp + 1 < buf + size &&
- !(sp[0] == '\n' && sp[1] == '\n'))
- sp++;
/* only take up to "lines" lines, and strip the signature */
for (i = 0, sp += 2;
i < filter->lines && sp < buf + size &&
--
1.5.3.5
^ permalink raw reply related
* Re: [ANNOUNCE] cgit v0.7
From: Lars Hjemli @ 2007-11-03 12:44 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: git list
In-Reply-To: <fcaeb9bf0711030515i24174694w5d4fd9b82ca85868@mail.gmail.com>
On Nov 3, 2007 1:15 PM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
> I wonder why this is not in git's contrib part.
Well, there is at least one technical reason: cgit uses git as a
submodule, so if it got merged into contrib I believe it would require
all git cloners to use git 1.5.2 or newer. It could also be
potentially interesting if/when git-checkout becomes submodule-aware
;-)
--
larsh
^ permalink raw reply
* Re: [PATCH] Reuse previous annotation when overwriting a tag
From: Johannes Schindelin @ 2007-11-03 12:36 UTC (permalink / raw)
To: Mike Hommey; +Cc: git, Junio C Hamano
In-Reply-To: <20071103122707.GA7227@glandium.org>
Hi,
On Sat, 3 Nov 2007, Mike Hommey wrote:
> 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 ?
editor.c, I'd say.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] Make git-blame fail when working tree is needed and we're not in one
From: Mike Hommey @ 2007-11-03 12:30 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
In-Reply-To: <1194092575-7133-3-git-send-email-mh@glandium.org>
Oops, I forgot -n to format-patch. Wasn't there a proposal to have -n
automatically set when outputing several patches ?
Mike
^ permalink raw reply
* 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
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