* [PATCH v2 4/4] git-add --all: documentation
From: Junio C Hamano @ 2008-07-20 6:09 UTC (permalink / raw)
To: git
In-Reply-To: <1216534144-23826-3-git-send-email-gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Documentation/git-add.txt | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index 3558905..2b6d6c8 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -9,7 +9,7 @@ SYNOPSIS
--------
[verse]
'git add' [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]
- [--update | -u] [--refresh] [--ignore-errors] [--]
+ [--all | [--update | -u]] [--refresh] [--ignore-errors] [--]
<filepattern>...
DESCRIPTION
@@ -86,6 +86,12 @@ OPTIONS
command line. If no paths are specified, all tracked files in the
current directory and its subdirectories are updated.
+-A::
+--all::
+ Update files that git already knows about (same as '\--update')
+ and add all untracked files that are not ignored by '.gitignore'
+ mechanism.
+
--refresh::
Don't add the file(s), but only refresh their stat()
information in the index.
--
1.5.6.4.570.g052e6
^ permalink raw reply related
* [PATCH v2 3/4] git-add --all: tests
From: Junio C Hamano @ 2008-07-20 6:09 UTC (permalink / raw)
To: git
In-Reply-To: <1216534144-23826-2-git-send-email-gitster@pobox.com>
And here is a small test script that makes sure that:
- both modified and new files are included,
- removed file is noticed, and
- no ignored file is included.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* This option has to be a superset of -u, so it must also notice removed
files. v2 adds that to the test.
t/t2202-add-addremove.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
create mode 100755 t/t2202-add-addremove.sh
diff --git a/t/t2202-add-addremove.sh b/t/t2202-add-addremove.sh
new file mode 100755
index 0000000..6a81510
--- /dev/null
+++ b/t/t2202-add-addremove.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+test_description='git add --all'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ (
+ echo .gitignore
+ echo will-remove
+ ) >expect &&
+ (
+ echo actual
+ echo expect
+ echo ignored
+ ) >.gitignore &&
+ >will-remove &&
+ git add --all &&
+ test_tick &&
+ git commit -m initial &&
+ git ls-files >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'git add --all' '
+ (
+ echo .gitignore
+ echo not-ignored
+ echo "M .gitignore"
+ echo "A not-ignored"
+ echo "D will-remove"
+ ) >expect &&
+ >ignored &&
+ >not-ignored &&
+ echo modification >>.gitignore &&
+ rm -f will-remove &&
+ git add --all &&
+ git update-index --refresh &&
+ git ls-files >actual &&
+ git diff-index --name-status --cached HEAD >>actual &&
+ test_cmp expect actual
+'
+
+test_done
--
1.5.6.4.570.g052e6
^ permalink raw reply related
* [PATCH v2 2/4] git-add --all: add all files
From: Junio C Hamano @ 2008-07-20 6:09 UTC (permalink / raw)
To: git
In-Reply-To: <1216534144-23826-1-git-send-email-gitster@pobox.com>
People sometimes find that "git add -u && git add ." are 13 keystrokes too
many. This reduces it by nine.
The support of this has been very low priority for me personally, because
I almost never do "git add ." in a directory with already tracked files,
and in a new directory, there is no point saying "git add -u".
However, for two types of people (that are very different from me), this
mode of operation may make sense and there is no reason to leave it
unsupported. That is:
(1) If you are extremely well disciplined and keep perfect .gitignore, it
always is safe to say "git add ."; or
(2) If you are extremely undisciplined and do not even know what files
you created, and you do not very much care what goes in your history,
it does not matter if "git add ." included everything.
So there it is, although I suspect I will not use it myself, ever.
It will be too much of a change that is against the expectation of the
existing users to allow "git commit -a" to include untracked files, and
it would be inconsistent if we named this new option "-a", so the short
option is "-A". We _might_ want to later add "git commit -A" but that is
a separate topic.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* This option is different from what "commit -a" does, so it must be
named differently. v2 patch uses -A as the short option.
builtin-add.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/builtin-add.c b/builtin-add.c
index 9b2ee8c..6f5672a 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -190,7 +190,7 @@ static const char ignore_error[] =
"The following paths are ignored by one of your .gitignore files:\n";
static int verbose = 0, show_only = 0, ignored_too = 0, refresh_only = 0;
-static int ignore_add_errors;
+static int ignore_add_errors, addremove;
static struct option builtin_add_options[] = {
OPT__DRY_RUN(&show_only),
@@ -200,6 +200,7 @@ static struct option builtin_add_options[] = {
OPT_BOOLEAN('p', "patch", &patch_interactive, "interactive patching"),
OPT_BOOLEAN('f', "force", &ignored_too, "allow adding otherwise ignored files"),
OPT_BOOLEAN('u', "update", &take_worktree_changes, "update tracked files"),
+ OPT_BOOLEAN('A', "all", &addremove, "add all, noticing removal of tracked files"),
OPT_BOOLEAN( 0 , "refresh", &refresh_only, "don't add, only refresh the index"),
OPT_BOOLEAN( 0 , "ignore-errors", &ignore_add_errors, "just skip files which cannot be added because of errors"),
OPT_END(),
@@ -254,6 +255,14 @@ int cmd_add(int argc, const char **argv, const char *prefix)
git_config(add_config, NULL);
+ if (addremove && take_worktree_changes)
+ die("-A and -u are mutually incompatible");
+ if (addremove && !argc) {
+ static const char *here[2] = { ".", NULL };
+ argc = 1;
+ argv = here;
+ }
+
add_new_files = !take_worktree_changes && !refresh_only;
require_pathspec = !take_worktree_changes;
@@ -286,7 +295,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
goto finish;
}
- if (take_worktree_changes)
+ if (take_worktree_changes || addremove)
exit_status |= add_files_to_cache(prefix, pathspec, flags);
if (add_new_files)
--
1.5.6.4.570.g052e6
^ permalink raw reply related
* [PATCH v2 1/4] builtin-add.c: restructure the code for maintainability
From: Junio C Hamano @ 2008-07-20 6:09 UTC (permalink / raw)
To: git
The implementation of "git add" has four major codepaths that are mutually
exclusive:
- if "--interactive" or "--patch" is given, spawn "git add--interactive"
and exit without doing anything else. Otherwise things are handled
internally in this C code;
- if "--update" is given, update the modified files and exit without
doing anything else;
- if "--refresh" is given, do refresh and exit without doing anything
else;
- otherwise, find the paths that match pathspecs and stage their
contents.
It led to an unholy mess in the code structure; each of the latter three
codepaths has a separate call to read_cache(), even though they are all
about "read the current index, update it and write it back", and logically
they should read the index once _anyway_.
This cleans up the latter three cases by introducing a pair of helper
variables:
- "add_new_files" is set if we need to scan the working tree for paths
that match the pathspec. This variable is false for "--update" and
"--refresh", because they only work on already tracked files.
- "require_pathspec" is set if the user must give at least one pathspec.
"--update" does not need it but all the other cases do.
This is in preparation for introducing a new option "--all", that does the
equivalent of "git add -u && git add ." (aka "addremove").
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-add.c | 75 ++++++++++++++++++++++++++++++++------------------------
1 files changed, 43 insertions(+), 32 deletions(-)
diff --git a/builtin-add.c b/builtin-add.c
index bf13aa3..9b2ee8c 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -140,8 +140,6 @@ static void refresh(int verbose, const char **pathspec)
for (specs = 0; pathspec[specs]; specs++)
/* nothing */;
seen = xcalloc(specs, 1);
- if (read_cache() < 0)
- die("index file corrupt");
refresh_index(&the_index, verbose ? 0 : REFRESH_QUIET, pathspec, seen);
for (i = 0; i < specs; i++) {
if (!seen[i])
@@ -216,13 +214,36 @@ static int add_config(const char *var, const char *value, void *cb)
return git_default_config(var, value, cb);
}
+static int add_files(struct dir_struct *dir, int flags)
+{
+ int i, exit_status = 0;
+
+ if (dir->ignored_nr) {
+ fprintf(stderr, ignore_error);
+ for (i = 0; i < dir->ignored_nr; i++)
+ fprintf(stderr, "%s\n", dir->ignored[i]->name);
+ fprintf(stderr, "Use -f if you really want to add them.\n");
+ die("no files added");
+ }
+
+ for (i = 0; i < dir->nr; i++)
+ if (add_file_to_cache(dir->entries[i]->name, flags)) {
+ if (!ignore_add_errors)
+ die("adding files failed");
+ exit_status = 1;
+ }
+ return exit_status;
+}
+
int cmd_add(int argc, const char **argv, const char *prefix)
{
int exit_status = 0;
- int i, newfd;
+ int newfd;
const char **pathspec;
struct dir_struct dir;
int flags;
+ int add_new_files;
+ int require_pathspec;
argc = parse_options(argc, argv, builtin_add_options,
builtin_add_usage, 0);
@@ -233,53 +254,43 @@ int cmd_add(int argc, const char **argv, const char *prefix)
git_config(add_config, NULL);
+ add_new_files = !take_worktree_changes && !refresh_only;
+ require_pathspec = !take_worktree_changes;
+
newfd = hold_locked_index(&lock_file, 1);
flags = ((verbose ? ADD_CACHE_VERBOSE : 0) |
(show_only ? ADD_CACHE_PRETEND : 0) |
(ignore_add_errors ? ADD_CACHE_IGNORE_ERRORS : 0));
- if (take_worktree_changes) {
- const char **pathspec;
- if (read_cache() < 0)
- die("index file corrupt");
- pathspec = get_pathspec(prefix, argv);
- exit_status = add_files_to_cache(prefix, pathspec, flags);
- goto finish;
- }
-
- if (argc == 0) {
+ if (require_pathspec && argc == 0) {
fprintf(stderr, "Nothing specified, nothing added.\n");
fprintf(stderr, "Maybe you wanted to say 'git add .'?\n");
return 0;
}
pathspec = get_pathspec(prefix, argv);
- if (refresh_only) {
- refresh(verbose, pathspec);
- goto finish;
- }
-
- fill_directory(&dir, pathspec, ignored_too);
+ /*
+ * If we are adding new files, we need to scan the working
+ * tree to find the ones that match pathspecs; this needs
+ * to be done before we read the index.
+ */
+ if (add_new_files)
+ fill_directory(&dir, pathspec, ignored_too);
if (read_cache() < 0)
die("index file corrupt");
- if (dir.ignored_nr) {
- fprintf(stderr, ignore_error);
- for (i = 0; i < dir.ignored_nr; i++) {
- fprintf(stderr, "%s\n", dir.ignored[i]->name);
- }
- fprintf(stderr, "Use -f if you really want to add them.\n");
- die("no files added");
+ if (refresh_only) {
+ refresh(verbose, pathspec);
+ goto finish;
}
- for (i = 0; i < dir.nr; i++)
- if (add_file_to_cache(dir.entries[i]->name, flags)) {
- if (!ignore_add_errors)
- die("adding files failed");
- exit_status = 1;
- }
+ if (take_worktree_changes)
+ exit_status |= add_files_to_cache(prefix, pathspec, flags);
+
+ if (add_new_files)
+ exit_status |= add_files(&dir, flags);
finish:
if (active_cache_changed) {
--
1.5.6.4.570.g052e6
^ permalink raw reply related
* Re: [PATCH 2/2] git-add -a: add all files
From: Tarmigan @ 2008-07-20 4:28 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Michael J Gruber, Jay Soffian
In-Reply-To: <905315640807192120k45b8c0e3k5b341e77c466dde@mail.gmail.com>
On Sat, Jul 19, 2008 at 9:20 PM, Tarmigan <tarmigan+git@gmail.com> wrote:
> On Sat, Jul 19, 2008 at 8:29 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> People sometimes find that "git add -u && git add ." are 13 keystrokes too
>> many.
>
> It's too bad that 'commit -a' and 'add -a' will have different
> meanings. Are add and commit considered porcelain enough that their
> short options could be changed? Probably not, but it would be nice to
> align 'commit -a' and 'add -a' or maybe 'commit -u' and 'add -u'. I
> can just hear people whining about inconsistent flags between
> subcommands with this change.
>
>> The support of this has been very low priority for me personally, because
>> I almost never do "git add ." in an already populated directory, and if a
>> directory is not already populated, there is no point saying "git add -u"
>> at the same time.
>
> Your reasoning for not using it (which is probably the case for most
> people), combined with the inconsistent short options makes me dislike
> the short option a little bit, but I like the long --add option.
I meant --all instead of --add obviously.
>
> Thanks,
> Tarmigan
>
^ permalink raw reply
* Re: [PATCH 2/2] git-add -a: add all files
From: Tarmigan @ 2008-07-20 4:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Michael J Gruber, Jay Soffian
In-Reply-To: <7vk5fhgrm6.fsf_-_@gitster.siamese.dyndns.org>
On Sat, Jul 19, 2008 at 8:29 PM, Junio C Hamano <gitster@pobox.com> wrote:
> People sometimes find that "git add -u && git add ." are 13 keystrokes too
> many.
It's too bad that 'commit -a' and 'add -a' will have different
meanings. Are add and commit considered porcelain enough that their
short options could be changed? Probably not, but it would be nice to
align 'commit -a' and 'add -a' or maybe 'commit -u' and 'add -u'. I
can just hear people whining about inconsistent flags between
subcommands with this change.
> The support of this has been very low priority for me personally, because
> I almost never do "git add ." in an already populated directory, and if a
> directory is not already populated, there is no point saying "git add -u"
> at the same time.
Your reasoning for not using it (which is probably the case for most
people), combined with the inconsistent short options makes me dislike
the short option a little bit, but I like the long --add option.
Thanks,
Tarmigan
^ permalink raw reply
* [PATCH 3/2] git-add -a: tests
From: Junio C Hamano @ 2008-07-20 3:32 UTC (permalink / raw)
To: git; +Cc: Michael J Gruber, Jay Soffian
In-Reply-To: <7vk5fhgrm6.fsf_-_@gitster.siamese.dyndns.org>
And here is a small test script that makes sure that:
- both modified and new files are included, and
- no ignored files are included.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
t/t2202-add-addremove.sh | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/t/t2202-add-addremove.sh b/t/t2202-add-addremove.sh
new file mode 100755
index 0000000..7bf8eda
--- /dev/null
+++ b/t/t2202-add-addremove.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+test_description='git add -a'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ echo .gitignore >expect &&
+ (
+ echo actual
+ echo expect
+ echo ignored
+ ) >.gitignore &&
+ git add -a &&
+ test_tick &&
+ git commit -m initial &&
+ git ls-files >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'git add -a' '
+ (
+ echo .gitignore
+ echo not-ignored
+ echo "M .gitignore"
+ echo "A not-ignored"
+ ) >expect &&
+ >ignored &&
+ >not-ignored &&
+ echo modification >>.gitignore &&
+ git add -a &&
+ git update-index --refresh &&
+ git ls-files >actual &&
+ git diff-index --name-status --cached HEAD >>actual &&
+ test_cmp expect actual
+'
+
+test_done
^ permalink raw reply related
* [PATCH 2/2] git-add -a: add all files
From: Junio C Hamano @ 2008-07-20 3:29 UTC (permalink / raw)
To: git; +Cc: Michael J Gruber, Jay Soffian
In-Reply-To: <7vsku5grpr.fsf@gitster.siamese.dyndns.org>
People sometimes find that "git add -u && git add ." are 13 keystrokes too
many.
The support of this has been very low priority for me personally, because
I almost never do "git add ." in an already populated directory, and if a
directory is not already populated, there is no point saying "git add -u"
at the same time.
However, for two types of people that are very different from me, this
mode of operation may make sense and there is no reason to leave it
unsupported. That is:
(1) If you are extremely well disciplined and keep perfect .gitignore, it
always is safe to say "git add ."; or
(2) If you are extremely undisciplined and do not even know what files
you created, and you do not very much care, it does not matter if
"git add ." included everything.
So here it is, although I suspect I will not use it myself, ever.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-add.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/builtin-add.c b/builtin-add.c
index 9b2ee8c..bc02fd7 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -190,7 +190,7 @@ static const char ignore_error[] =
"The following paths are ignored by one of your .gitignore files:\n";
static int verbose = 0, show_only = 0, ignored_too = 0, refresh_only = 0;
-static int ignore_add_errors;
+static int ignore_add_errors, addremove;
static struct option builtin_add_options[] = {
OPT__DRY_RUN(&show_only),
@@ -200,6 +200,7 @@ static struct option builtin_add_options[] = {
OPT_BOOLEAN('p', "patch", &patch_interactive, "interactive patching"),
OPT_BOOLEAN('f', "force", &ignored_too, "allow adding otherwise ignored files"),
OPT_BOOLEAN('u', "update", &take_worktree_changes, "update tracked files"),
+ OPT_BOOLEAN('a', "all", &addremove, "add all, noticing removal of tracked files"),
OPT_BOOLEAN( 0 , "refresh", &refresh_only, "don't add, only refresh the index"),
OPT_BOOLEAN( 0 , "ignore-errors", &ignore_add_errors, "just skip files which cannot be added because of errors"),
OPT_END(),
@@ -254,6 +255,14 @@ int cmd_add(int argc, const char **argv, const char *prefix)
git_config(add_config, NULL);
+ if (addremove && take_worktree_changes)
+ die("-a and -u are mutually incompatible");
+ if (addremove && !argc) {
+ static const char *here[2] = { ".", NULL };
+ argc = 1;
+ argv = here;
+ }
+
add_new_files = !take_worktree_changes && !refresh_only;
require_pathspec = !take_worktree_changes;
@@ -286,7 +295,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
goto finish;
}
- if (take_worktree_changes)
+ if (take_worktree_changes || addremove)
exit_status |= add_files_to_cache(prefix, pathspec, flags);
if (add_new_files)
--
1.5.6.4.570.g052e6
^ permalink raw reply related
* [PATCH 1/2] builtin-add.c: restructure the code for maintainability
From: Junio C Hamano @ 2008-07-20 3:28 UTC (permalink / raw)
To: git; +Cc: Michael J Gruber, Jay Soffian
In-Reply-To: <7vsku5grpr.fsf@gitster.siamese.dyndns.org>
The implementation of "git add" has four major codepaths that are mutually
exclusive:
- if "--interactive" or "--patch" mode, spawn "git add--interactive" and
exit without doing anything else. Otherwise things are handled
internally in this C code.
- if "--update", update the modified files and exit without doing
anything else;
- if "--refresh", do refresh and exit without doing anything else;
- otherwise, find the paths that match pathspecs and stage their
contents.
and it led to an unholy mess in the code structure; each of the latter
three codepaths has separate call to read_cache() even though they are all
"read the current index, update it and write it back" so logically they
should read the index once _anyway_.
This cleans up the latter three cases by introducing a handful helper
variables:
- "add_new_files" is set if we need to scan the working tree for paths
that match the pathspec. This variable is false for "--update" and
"--refresh", because they only work on already tracked files.
- "require_pathspec" is set if the user must give at least one pathspec.
"--update" does not need it but all the other cases do.
This is in preparation for introducing a new option "-a" that does the
equivalent of "git add -u && git add ." (aka "addremove").
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-add.c | 75 ++++++++++++++++++++++++++++++++------------------------
1 files changed, 43 insertions(+), 32 deletions(-)
diff --git a/builtin-add.c b/builtin-add.c
index bf13aa3..9b2ee8c 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -140,8 +140,6 @@ static void refresh(int verbose, const char **pathspec)
for (specs = 0; pathspec[specs]; specs++)
/* nothing */;
seen = xcalloc(specs, 1);
- if (read_cache() < 0)
- die("index file corrupt");
refresh_index(&the_index, verbose ? 0 : REFRESH_QUIET, pathspec, seen);
for (i = 0; i < specs; i++) {
if (!seen[i])
@@ -216,13 +214,36 @@ static int add_config(const char *var, const char *value, void *cb)
return git_default_config(var, value, cb);
}
+static int add_files(struct dir_struct *dir, int flags)
+{
+ int i, exit_status = 0;
+
+ if (dir->ignored_nr) {
+ fprintf(stderr, ignore_error);
+ for (i = 0; i < dir->ignored_nr; i++)
+ fprintf(stderr, "%s\n", dir->ignored[i]->name);
+ fprintf(stderr, "Use -f if you really want to add them.\n");
+ die("no files added");
+ }
+
+ for (i = 0; i < dir->nr; i++)
+ if (add_file_to_cache(dir->entries[i]->name, flags)) {
+ if (!ignore_add_errors)
+ die("adding files failed");
+ exit_status = 1;
+ }
+ return exit_status;
+}
+
int cmd_add(int argc, const char **argv, const char *prefix)
{
int exit_status = 0;
- int i, newfd;
+ int newfd;
const char **pathspec;
struct dir_struct dir;
int flags;
+ int add_new_files;
+ int require_pathspec;
argc = parse_options(argc, argv, builtin_add_options,
builtin_add_usage, 0);
@@ -233,53 +254,43 @@ int cmd_add(int argc, const char **argv, const char *prefix)
git_config(add_config, NULL);
+ add_new_files = !take_worktree_changes && !refresh_only;
+ require_pathspec = !take_worktree_changes;
+
newfd = hold_locked_index(&lock_file, 1);
flags = ((verbose ? ADD_CACHE_VERBOSE : 0) |
(show_only ? ADD_CACHE_PRETEND : 0) |
(ignore_add_errors ? ADD_CACHE_IGNORE_ERRORS : 0));
- if (take_worktree_changes) {
- const char **pathspec;
- if (read_cache() < 0)
- die("index file corrupt");
- pathspec = get_pathspec(prefix, argv);
- exit_status = add_files_to_cache(prefix, pathspec, flags);
- goto finish;
- }
-
- if (argc == 0) {
+ if (require_pathspec && argc == 0) {
fprintf(stderr, "Nothing specified, nothing added.\n");
fprintf(stderr, "Maybe you wanted to say 'git add .'?\n");
return 0;
}
pathspec = get_pathspec(prefix, argv);
- if (refresh_only) {
- refresh(verbose, pathspec);
- goto finish;
- }
-
- fill_directory(&dir, pathspec, ignored_too);
+ /*
+ * If we are adding new files, we need to scan the working
+ * tree to find the ones that match pathspecs; this needs
+ * to be done before we read the index.
+ */
+ if (add_new_files)
+ fill_directory(&dir, pathspec, ignored_too);
if (read_cache() < 0)
die("index file corrupt");
- if (dir.ignored_nr) {
- fprintf(stderr, ignore_error);
- for (i = 0; i < dir.ignored_nr; i++) {
- fprintf(stderr, "%s\n", dir.ignored[i]->name);
- }
- fprintf(stderr, "Use -f if you really want to add them.\n");
- die("no files added");
+ if (refresh_only) {
+ refresh(verbose, pathspec);
+ goto finish;
}
- for (i = 0; i < dir.nr; i++)
- if (add_file_to_cache(dir.entries[i]->name, flags)) {
- if (!ignore_add_errors)
- die("adding files failed");
- exit_status = 1;
- }
+ if (take_worktree_changes)
+ exit_status |= add_files_to_cache(prefix, pathspec, flags);
+
+ if (add_new_files)
+ exit_status |= add_files(&dir, flags);
finish:
if (active_cache_changed) {
--
1.5.6.4.570.g052e6
^ permalink raw reply related
* Re: Addremove equivalent
From: Junio C Hamano @ 2008-07-20 3:27 UTC (permalink / raw)
To: Jay Soffian; +Cc: Michael J Gruber, git
In-Reply-To: <76718490807181318o228171f9j836aaca2edb9b377@mail.gmail.com>
"Jay Soffian" <jaysoffian@gmail.com> writes:
> On Fri, Jul 18, 2008 at 5:55 AM, Michael J Gruber
> <michaeljgruber+gmane@fastmail.fm> wrote:
>> sometimes I find my self wanting an "addremove", such as in a situation like
>
> I have the following aliased as "addremove":
>
> git ls-files -d -m -o -z --exclude-standard \
> | xargs -0 git update-index --add --remove
I'll send out two patches on this topic.
Junio C Hamano (2):
builtin-add.c: restructure the code for maintainability
git-add -a: add all files
^ permalink raw reply
* Re: Closing the merge window for 1.6.0
From: Nick Andrew @ 2008-07-20 2:23 UTC (permalink / raw)
To: git
In-Reply-To: <20080714124327.GL10151@machine.or.cz>
Petr Baudis <pasky <at> suse.cz> writes:
> Upgrading to newer version, *especially* if it's over then 1.4 - 1.5
> boundary, is not something you could seriously expect Debian to do.
> At least I actually _hope_ so, as a sysadmin of a network of 40 etch
> workstations.
Perhaps Debian could add a "git1.5" package to the etch repository. That
will guarantee that no current etch users of git 1.4.4.4 will be affected,
and they can choose if they want, to install git1.5.
Nick.
^ permalink raw reply
* What's in git.git (stable)
From: Junio C Hamano @ 2008-07-20 1:59 UTC (permalink / raw)
To: git
In-Reply-To: <7vabgiwlj5.fsf@gitster.siamese.dyndns.org>
* The 'maint' branch is at 1.5.6.4.
* The 'master' branch has these since the last announcement
in addition to what is already in 1.5.6.4.
Alexander Gavrilov (3):
Avoid rescanning unchanged entries in search for copies.
Do not try to detect move/copy for entries below threshold.
Support gitlinks in fast-import.
Eric Raible (1):
Teach lookup_prog not to select directories
Eric Wong (1):
t/lib-git-svn: fix SVN_HTTPD tests to work with "trash directory"
Fabian Emmes (2):
Testsuite: Unset CVS_SERVER
testsuite for cvs co -c
Johannes Sixt (1):
builtin-clone: rewrite guess_dir_name()
Junio C Hamano (9):
git-rebase: report checkout failure
t/aggregate-results: whitespace fix
Update draft release notes for 1.6.0
read-cache.c: typofix
mailinfo: off-by-one fix for [PATCH (foobar)] removal from Subject: line
builtin-remote.c: fix earlier "skip_prefix()" conversion
t9001 (send-email): Do not use hardcoded /bin/sh in test
.mailmap update
Getting closer to 1.6.0-rc0
Lars Noschinski (2):
cvsserver: Add support for packed refs
cvsserver: Add cvs co -c support
Lukas Sandström (3):
Make some strbuf_*() struct strbuf arguments const.
Add some useful functions for strbuf manipulation.
git-mailinfo: use strbuf's instead of fixed buffers
Miklos Vajna (4):
t0001-init.sh: change confusing directory name
t1007-hash-object.sh: use quotes for the test description
git-bisect: use dash-less form on git bisect log
make remove-dashes: apply to scripts and programs as well, not just to
builtins
Nanako Shiraishi (3):
cache-tree.c: make cache_tree_find() static
builtin-describe.c: make a global variable "pattern" static
parse-options.c: make check_typos() static
Peter Harris (1):
Add ANSI control code emulation for the Windows console
Petr Baudis (5):
Documentation/git-submodule.txt: Add Description section
Documentation/RelNotes-1.6.0.txt: Expand on the incompatible packfiles
Documentation/git-submodule.txt: Further clarify the description
Documentation: How to ignore local changes in tracked files
Documentation/git-merge.txt: Partial rewrite of How Merge Works
René Scharfe (8):
archive: remove args member from struct archiver
add context pointer to read_tree_recursive()
archive: add baselen member to struct archiver_args
archive: centralize archive entry writing
archive: unify file attribute handling
archive: remove extra arguments parsing code
archive: make zip compression level independent from core git
archive: remove unused headers
Stephan Beyer (4):
t/test-lib.sh: exit with small negagive int is ok with test_must_fail
t/: Use "test_must_fail git" instead of "! git"
Make usage strings dash-less
Link git-shell only to a subset of libgit.a
SungHyun Nam (1):
t/Makefile: use specified shell when running aggregation script
^ permalink raw reply
* What's cooking in git.git (topics)
From: Junio C Hamano @ 2008-07-20 1:58 UTC (permalink / raw)
To: git
In-Reply-To: <7vlk01hqzz.fsf@gitster.siamese.dyndns.org>
Here are the topics that have been cooking. Commits prefixed
with '-' are only in 'pu' while commits prefixed with '+' are
in 'next'.
The topics list the commits in reverse chronological order. The topics
meant to be merged to the maintenance series have "maint-" in their names.
Due to increased activity level from people including GSoC students, I
expect 'next' to stay somewhat more active than previous rounds during the
1.6.0-rc cycle. The request for people who usually follow 'next' is the
same as usual, though. After -rc1 is tagged, please run 'master' for your
daily git use instead, in order to make sure 'master' does what it claims
to do without regression.
Tentative schedule, my wishful thinking:
- 1.6.0-rc0 (Jul 20)
- 1.6.0-rc1 (Jul 23)
- 1.6.0-rc2 (Jul 30)
- 1.6.0-rc3 (Aug 6)
- 1.6.0 (Aug 10)
No real activity on 'next', as I was busy tending bugfixes and pushing out
v1.5.6.4 today.
----------------------------------------------------------------
[Will merge to "master" soon]
* ns/am-abort (Wed Jul 16 19:39:10 2008 +0900) 1 commit
+ git am --abort
This one is for Ted; builds on top of the recent "am and rebase leaves
ORIG_HEAD just like reset, merge and pull does" rather nicely.
* jc/rerere-auto-more (Wed Jul 16 20:25:18 2008 -0700) 1 commit
+ rerere.autoupdate: change the message when autoupdate is in effect
This one is for Ingo.
This changes the message rerere issues after reusing previous conflict
resolution from "Resolved" to "Staged" when autoupdate option is in
effect.
It is envisioned that in practice, some auto resolutions are trickier and
iffier than others, and we would want to add a feature to mark individual
resolutions as "this is ok to autoupdate" or "do not autoupdate the result
using this resolution even when rerere.autoupdate is in effect" in the
future. When that happens, these messages will make the distinction
clearer.
* ap/trackinfo (Wed Jul 16 15:19:27 2008 -0400) 1 commit
+ Reword "your branch has diverged..." lines to reduce line length
----------------------------------------------------------------
[Stalled/Needs more work]
* rs/imap (Wed Jul 9 22:29:02 2008 +0100) 5 commits
- Documentation: Improve documentation for git-imap-send(1)
- imap-send.c: more style fixes
- imap-send.c: style fixes
- git-imap-send: Support SSL
- git-imap-send: Allow the program to be run from subdirectories of
a git tree
I said: "Some people seem to prefer having this feature available also
with gnutls. If such a patch materializes soon, that would be good, but
otherwise I'll merge this as-is to 'next'. Such an enhancement can be
done in-tree on top of this series." Anybody?
* gi/cherry-cache (Sat Jul 12 20:14:51 2008 -0700) 1 commit
. cherry: cache patch-ids to avoid repeating work
The discussion suggested that the value of having the cache itself is
iffy, but I should pick up the updated one and look at it.
* lw/gitweb (Fri Jul 11 03:11:48 2008 +0200) 3 commits
. gitweb: use new Git::Repo API, and add optional caching
. Add new Git::Repo API
. gitweb: add test suite with Test::WWW::Mechanize::CGI
* sb/sequencer (Tue Jul 1 04:38:34 2008 +0200) 4 commits
. Migrate git-am to use git-sequencer
. Add git-sequencer test suite (t3350)
. Add git-sequencer prototype documentation
. Add git-sequencer shell prototype
I haven't looked at the updated series yet. I should, but nobody else
seems to be looking at these patches, which is somewhat depressing but
understandable. Summer is slower ;-)
* pb/submodule (Wed Jul 16 21:11:40 2008 +0200) 7 commits
. t7403: Submodule git mv, git rm testsuite
. git rm: Support for removing submodules
. git mv: Support moving submodules
. submodule.*: Introduce simple C interface for submodule lookup by
path
. git submodule add: Fix naming clash handling
. t7400: Add short "git submodule add" testsuite
. git-mv: Remove dead code branch
Long overdue usability improvement series for submodule. Very much
welcomed. It would be nice to have some submodule improvements in 1.6.0,
but it would take us a few more rounds to hit 'next' with this, and it
will not be in 'master' when 1.6.0 ships.
* jc/grafts (Wed Jul 2 17:14:12 2008 -0700) 1 commit
- [BROKEN wrt shallow clones] Ignore graft during object transfer
Cloning or fetching from a repository from grafts did not send objects
that are hidden by grafts, but the commits in the resulting repository do
need these to pass fsck. This fixes object transfer to ignore grafts.
Another fix is needed to git-prune so that it ignores grafts but treats
commits that are mentioned in grafts as reachable.
* jc/blame (Wed Jun 4 22:58:40 2008 -0700) 2 commits
- blame: show "previous" information in --porcelain/--incremental
format
- git-blame: refactor code to emit "porcelain format" output
This is for peeling the line from the blamed version to see what's behind
it, which may or may not help applications like gitweb.
----------------------------------------------------------------
[Will drop]
* xx/merge-in-c-into-next (Wed Jul 9 13:51:46 2008 -0700) 4 commits
+ Teach git-merge -X<option> again.
+ Merge branch 'jc/merge-theirs' into xx/merge-in-c-into-next
+ builtin-merge.c: use parse_options_step() "incremental parsing"
machinery
+ Merge branch 'ph/parseopt-step-blame' into xx/merge-in-c-into-next
* jc/merge-theirs (Fri Jul 18 02:43:00 2008 -0700) 6 commits
- Document that merge strategies can now take their own options
+ Make "subtree" part more orthogonal to the rest of merge-
recursive.
+ Teach git-pull to pass -X<option> to git-merge
+ Teach git-merge to pass -X<option> to the backend strategy module
+ git-merge-recursive-{ours,theirs}
+ git-merge-file --ours, --theirs
It appears nobody wants "theirs" nor "ours", so I'll soon apply a
wholesale revert for these series to 'next', and then these will be
dropped when we rewind 'next' after 1.6.0 final.
Please make sure next time somebody asks "ours/theirs" merge on the list
and #git s/he is quickly told that it was unanimously rejected so that
people do not have to waste time rehashing the topic ever again.
----------------------------------------------------------------
[On Hold]
* sg/merge-options (Sun Apr 6 03:23:47 2008 +0200) 1 commit
+ merge: remove deprecated summary and diffstat options and config
variables
This was previously in "will be in master soon" category, but it turns out
that the synonyms to the ones this one deletes are fairly new invention
that happend in 1.5.6 timeframe, and we cannot do this just yet. Perhaps
in 1.7.0.
* jc/dashless (Thu Jun 26 16:43:34 2008 -0700) 2 commits
+ Revert "Make clients ask for "git program" over ssh and local
transport"
+ Make clients ask for "git program" over ssh and local transport
This is the "botched" one. Will be resurrected during 1.7.0 or 1.8.0
timeframe.
* jk/renamelimit (Sat May 3 13:58:42 2008 -0700) 1 commit
- diff: enable "too large a rename" warning when -M/-C is explicitly
asked for
This would be the right thing to do for command line use, but gitk will be
hit due to tcl/tk's limitation, so I am holding this back for now.
^ permalink raw reply
* Re: [PATCH/rfc] git-svn.perl: workaround assertions in svn library 1.5.0
From: Junio C Hamano @ 2008-07-20 1:27 UTC (permalink / raw)
To: Dmitry Potapov; +Cc: Gerrit Pape, git, Eric Wong
In-Reply-To: <37fcd2780807171137m1c5a8197vc94b2a42ac53a297@mail.gmail.com>
"Dmitry Potapov" <dpotapov@gmail.com> writes:
> On Thu, Jul 17, 2008 at 6:08 PM, Gerrit Pape <pape@smarden.org> wrote:
>>
>> Hi, while this commit fixed the selftests, it unfortunately is a
>> regression
>>
>> http://thread.gmane.org/gmane.comp.version-control.git/87822/
>> http://bugs.debian.org/490400
>
> This particular breakage is easy to fix:
>
> diff --git a/git-svn.perl b/git-svn.perl
> index 3750e47..a5a5b1b 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -1226,7 +1226,7 @@ sub linearize_history {
>
> sub find_file_type_and_diff_status {
> my ($path) = @_;
> - return ('dir', '') if $path eq '.';
> + return ('dir', '') if $path eq '';
>
> my $diff_output =
> command_oneline(qw(diff --cached --name-status --), $path) || "";
>
> but it could be some other places in git-svn that may need correction too.
>
>>
>> I'm still not sure whether this is a git-svn problem, or actually a
>> problem in subversion 1.5.0
>
> Accordingly to SVN developers you do not use SVN API correctly,
> therefore you got assert. So, the problem in git-svn.
> http://svn.haxx.se/dev/archive-2008-01/0425.shtml
So what's the conclusion of this issue?
I'll just revert 2fe403e (git-svn.perl: workaround assertions in svn
library 1.5.0, 2008-07-06) for 1.6.0-rc0 unless I hear better
suggestions.
^ permalink raw reply
* [ANNOUNCE] GIT 1.5.6.4
From: Junio C Hamano @ 2008-07-20 0:56 UTC (permalink / raw)
To: git; +Cc: linux-kernel
The latest maintenance release GIT 1.5.6.4 is available at the
usual places:
http://www.kernel.org/pub/software/scm/git/
git-1.5.6.4.tar.{gz,bz2} (source tarball)
git-htmldocs-1.5.6.4.tar.{gz,bz2} (preformatted docs)
git-manpages-1.5.6.4.tar.{gz,bz2} (preformatted docs)
The RPM binary packages for a few architectures are also provided
as courtesy.
RPMS/$arch/git-*-1.5.6.4-1.fc9.$arch.rpm (RPM)
GIT v1.5.6.4 Release Notes
==========================
Fixes since v1.5.6.3
--------------------
* Various commands could overflow its internal buffer on a platform
with small PATH_MAX value in a repository that has contents with
long pathnames.
* There wasn't a way to make --pretty=format:%<> specifiers to honor
.mailmap name rewriting for authors and committers. Now you can with
%aN and %cN.
* Bash completion wasted too many cycles; this has been optimized to be
usable again.
* Bash completion lost ref part when completing something like "git show
pu:Makefile".
* "git-cvsserver" did not clean up its temporary working area after annotate
request.
* "git-daemon" called syslog() from its signal handler, which was a
no-no.
* "git-fetch" into an empty repository used to remind that the fetch will
be huge by saying "no common commits", but this was an unnecessary
noise; it is already known by the user anyway.
* "git-http-fetch" would have segfaulted when pack idx file retrieved
from the other side was corrupt.
* "git-index-pack" used too much memory when dealing with a deep delta chain.
* "git-mailinfo" (hence "git-am") did not correctly handle in-body [PATCH]
line to override the commit title taken from the mail Subject header.
* "git-rebase -i -p" lost parents that are not involved in the history
being rewritten.
* "git-rm" lost track of where the index file was when GIT_DIR was
specified as a relative path.
* "git-rev-list --quiet" was not quiet as advertised.
Contains other various documentation fixes.
^ permalink raw reply
* [PATCH] index: be careful when handling long names
From: Junio C Hamano @ 2008-07-20 0:51 UTC (permalink / raw)
To: git; +Cc: Petr Baudis
This is a follow-up to 7fec10b (index: be careful when handling long
names, 2008-01-18) where we fixed handling of index entries with long
names. There still remained a few remaining unsafe codepaths.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-apply.c | 2 +-
builtin-update-index.c | 2 +-
read-cache.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin-apply.c b/builtin-apply.c
index e15471b..f2377fe 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2758,7 +2758,7 @@ static void add_index_file(const char *path, unsigned mode, void *buf, unsigned
ce = xcalloc(1, ce_size);
memcpy(ce->name, path, namelen);
ce->ce_mode = create_ce_mode(mode);
- ce->ce_flags = namelen;
+ ce->ce_flags = create_ce_flags(namelen, 0);
if (S_ISGITLINK(mode)) {
const char *s = buf;
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 38eb53c..003cb98 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -95,7 +95,7 @@ static int add_one_path(struct cache_entry *old, const char *path, int len, stru
size = cache_entry_size(len);
ce = xcalloc(1, size);
memcpy(ce->name, path, len);
- ce->ce_flags = len;
+ ce->ce_flags = create_ce_flags(len, 0);
fill_stat_cache_info(ce, st);
ce->ce_mode = ce_mode_from_stat(old, st->st_mode);
diff --git a/read-cache.c b/read-cache.c
index 1648428..2dd8131 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -498,7 +498,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
size = cache_entry_size(namelen);
ce = xcalloc(1, size);
memcpy(ce->name, path, namelen);
- ce->ce_flags = namelen;
+ ce->ce_flags = create_ce_flags(namelen, 0);
fill_stat_cache_info(ce, st);
if (trust_executable_bit && has_symlinks)
^ permalink raw reply related
* Re: Statictics on Git.pm usage in git commands (was: [PATCH 2/3] add new Git::Repo API)
From: Jakub Narebski @ 2008-07-20 0:16 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
In-Reply-To: <20080719211403.GA10151@machine.or.cz>
On Sat, 19 July 2008, Petr Baudis wrote:
> On Sat, Jul 19, 2008 at 10:54:24PM +0200, Jakub Narebski wrote:
> > 3. git-send-email.perl uses 5 config, 2 config_bool, 2 ident_person
> > (for author and for committer), 1 version, and of course once
> > ->repository() constructor.
> >
> > Here we can see how to work around current API to: it uses
> > Git::config(@repo, "sendemail.identity") form, where
> > my $repo = eval { Git->repository() };
> > my @repo = $repo ? ($repo) : ();
> > to make it work both with git repository (using repo config), and
> > outside/without git repository, using only user and system git
> > config.
>
> With the envisioned model, it could use $git which would be either
> a reference to a Git::Standalone singleton or Git::Repo instance.
So that the code would look like the following, instead:
my $git = new Git::Cmd; # or Git::Standalone, or Git::CommandFactory
my $repo = eval { Git->repository() };
$git = $repo if $repo;
and later use
$git->config('sendemail.identity');
By the way, git-svn can use command(...) instead of $repo->command(...)
because it sets $ENV{'GIT_DIR'} if it is unset... but I don't see
where Git.pm inserts 'git' to commands list...
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: [PATCH] git-mv: Keep moved index entries inact
From: Junio C Hamano @ 2008-07-19 23:54 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
In-Reply-To: <20080717223036.20680.9672.stgit@localhost>
Petr Baudis <pasky@suse.cz> writes:
> A new test has been added to the testsuite to reflect this change.
> Also, based on suggestion by Junio about desired symlink behaviour
> of git mv, I have added two tests for that; however, I do not have
> need or desire to spend time fixing this, so they are expected
> to fail for now until someone gets around to fixing that.
Well, somebody would eventually come to help, then ;-).
> builtin-mv.c | 62 ++++++++-------------------------------------------------
> cache.h | 2 ++
> read-cache.c | 15 ++++++++++++++
> t/t7001-mv.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 83 insertions(+), 53 deletions(-)
Very nice code reduction, isn't it?
> diff --git a/read-cache.c b/read-cache.c
> index 1648428..70e5f57 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -38,6 +38,21 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache
> istate->cache_changed = 1;
> }
>
> +void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)
> +{
> + struct cache_entry *old = istate->cache[nr], *new;
> + int namelen = strlen(new_name);
> +
> + new = xmalloc(cache_entry_size(namelen));
> + copy_cache_entry(new, old);
> + new->ce_flags = (new->ce_flags & ~CE_NAMEMASK) | namelen;
> + memcpy(new->name, new_name, namelen);
> +
> + cache_tree_invalidate_path(istate->cache_tree, old->name);
> + remove_index_entry_at(istate, nr);
> + add_index_entry(istate, new, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
> +}
Hmm, would this use of copy_cache_entry() kosher, I have to wonder. This
new copy of cache entry begins its life unhashed, doesn't it? Shouldn't
we be not copying its hashed/unhashed bits from the old one?
Also setting of that ce_flags looks wrong when namelen does not fit within
the width of CE_NAMEMASK. Shouldn't it be doing the same thing as
create_ce_flags()?
> diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
> index 336cfaa..6b615f8 100755
> --- a/t/t7001-mv.sh
> +++ b/t/t7001-mv.sh
> @@ -156,4 +156,61 @@ test_expect_success 'absolute pathname outside should fail' '(
>
> )'
>
> +# git mv meets angry Git maintainer
What's this comment about?
> +test_expect_success 'git mv should not change sha1 of moved cache entry' '
> +
> + rm -fr .git &&
> + git init &&
> + echo 1 >dirty &&
> + git add dirty &&
> + entry="$(git ls-files --stage dirty | cut -f 1)"
"rev-parse :dirty"?
^ permalink raw reply
* Re: What's cooking in git.git (topics)
From: Johannes Schindelin @ 2008-07-19 23:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Nanako Shiraishi, git
In-Reply-To: <7v4p6l3jbm.fsf@gitster.siamese.dyndns.org>
Hi,
On Sat, 19 Jul 2008, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > Yes, I agree, if all strategies fail, it is dubitable that we find a
> > metric that will always find the "best" one. But if one fails and the
> > next one does not, it is obvious what is correct.
>
> Not at all. Imagine the case where one of them is either ours or
> theirs.
But then it is not the _default_ at all!
It is what the _user_ _asked_ for.
So this is what the user gets.
With Git, the user is not ignored (like GNOME does, to "help" the user).
With Git, the user _gets_ what she asked for, even if the question does
not make sense.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] git submodule documentation: typo fix
From: Miklos Vajna @ 2008-07-19 22:50 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Petr Baudis, git
In-Reply-To: <7vfxq5xzqy.fsf@gitster.siamese.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
On Sat, Jul 19, 2008 at 03:42:13PM -0700, Junio C Hamano <gitster@pobox.com> wrote:
> Thanks, but I think Pasky already covered this typo in his latest round.
Ah, possible. I was just reading 'git log -p junio/master' to catch up
with the recent changes and noticed this one.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [PATCH] git submodule documentation: typo fix
From: Junio C Hamano @ 2008-07-19 22:42 UTC (permalink / raw)
To: Miklos Vajna; +Cc: Petr Baudis, git
In-Reply-To: <1216506534-27649-1-git-send-email-vmiklos@frugalware.org>
Thanks, but I think Pasky already covered this typo in his latest round.
^ permalink raw reply
* Re: [PATCH] Rename ".dotest/" to ".git/rebase" and ".dotest-merge" to "rebase-merge"
From: Jakub Narebski @ 2008-07-19 22:39 UTC (permalink / raw)
To: git
In-Reply-To: <7vd4l9zgmp.fsf@gitster.siamese.dyndns.org>
[This is git@vger.kernel.org only copy]
Junio C Hamano wrote:
> Olivier Marin <dkr+ml.git@free.fr> writes:
>
>> It tries to apply patches even on a dirty tree which makes difficult
>> to automatically do a "git reset --hard" with --skip or --abort and
>> forces the user to clean the index by hand if last patch failed with
>> unmerged files.
>>
>> So, do some people still use "git am" with a dirty tree or will a
>> patch that make it work like "git rebase" be accepted?
>
> Anything that changes "am" to require a clean working tree will NEVER be
> accepted. I personally rely on the ability for it to run in a dirty tree,
> so does Linus.
>
> Side note. Anything that changes "merge" to require a clean
> working tree is also unacceptable. Cf.
>
> http://thread.gmane.org/gmane.comp.version-control.git/9073/focus=9089
>
> Linus talks about "patch" in the paragraph second to the last one
> in the message; back then he was talking about "git-applymbox" but
> the same argument there applies to its newer incarnation "git-am".
>
> Side note #2. It would have been nice if "rebase" were also
> written in such a way that it can work in a dirty tree as long as
> local changes did not interfere with the operation, but it is a
> lot more involved.
>
> When I looked at the "am --abort" patch briefly, I had an impression (by
> reading its test case) that it correctly refrained from doing the
> destructive "reset --hard".
I guess instead of "git reset --hard" we can use here "git stash save
&& git stash apply --index" to save state (perhaps as "git stash save
--no-reset"), and either "git stash drop" at the the end, or
"git reset --hard && git stash pop --index" at '--abort'.
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply
* [PATCH] git submodule documentation: typo fix
From: Miklos Vajna @ 2008-07-19 22:28 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Petr Baudis, git
The current status of submodules can be queried using the 'status' (and
not the 'submodule') subcommand.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
Documentation/git-submodule.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index bb4e6fb..e849858 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -34,7 +34,7 @@ When adding a new submodule to the tree, the 'add' subcommand is to be used.
However, when pulling a tree containing submodules, these will not be checked
out by default; the 'init' and 'update' subcommands will maintain submodules
checked out and at appropriate revision in your working tree. You can inspect
-the current status of your submodules using the 'submodule' subcommand and get
+the current status of your submodules using the 'status' subcommand and get
an overview of changes 'update' would perform using the 'summary' subcommand.
--
1.5.6.2.450.g8d367.dirty
^ permalink raw reply related
* Re: [PATCH] Rename ".dotest/" to ".git/rebase" and ".dotest-merge" to "rebase-merge"
From: Junio C Hamano @ 2008-07-19 22:27 UTC (permalink / raw)
To: Olivier Marin
Cc: Theodore Tso, Nanako Shiraishi, Johannes Schindelin,
René Scharfe, Stephan Beyer, Joe Fiorini, git, Jari Aalto
In-Reply-To: <7v3am5zfea.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> I'm happy with the documentation and help-text parts of your patch, but
> probably this, on top of 1a6f6bb (git am --abort, 2008-07-16), is more
> appropriate?
>
> ---
> git-am.sh | 6 +++---
> t/t4151-am-abort.sh | 46 +++++++++++++++++++++++++++-------------------
> 2 files changed, 30 insertions(+), 22 deletions(-)
>
> diff --git a/git-am.sh b/git-am.sh
> index a44bd7a..5cbf8f4 100755
> --- a/git-am.sh
> +++ b/git-am.sh
> @@ -203,9 +203,9 @@ then
>
> case "$abort" in
> t)
> - rm -fr "$dotest" &&
> - git read-tree -m -u ORIG_HEAD &&
> - git reset ORIG_HEAD && :
> + git rerere clear
> + git read-tree --reset -u HEAD ORIG_HEAD
> + rm -fr "$dotest"
We still need "git reset ORIG_HEAD" after the read-tree. Sorry about the
noise.
> exit ;;
> esac
> else
^ permalink raw reply
* Re: [PATCH] Rename ".dotest/" to ".git/rebase" and ".dotest-merge" to "rebase-merge"
From: Junio C Hamano @ 2008-07-19 22:18 UTC (permalink / raw)
To: Olivier Marin
Cc: Theodore Tso, Nanako Shiraishi, Johannes Schindelin,
René Scharfe, Stephan Beyer, Joe Fiorini, git, Jari Aalto
In-Reply-To: <4882350B.6020003@free.fr>
Olivier Marin <dkr+ml.git@free.fr> writes:
> Subject: [PATCH] git am --abort
>
> To squash.
>
> Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Thanks.
> @@ -203,9 +204,10 @@ then
>
> case "$abort" in
> t)
> - rm -fr "$dotest" &&
> + git rerere clear &&
> git read-tree -m -u ORIG_HEAD &&
> - git reset ORIG_HEAD && :
> + git reset ORIG_HEAD &&
> + rm -fr "$dotest"
> exit ;;
> esac
> else
Clearing the rerere information needs to be done, but I think we should
drop the last && to make sure we remove "$dotest" and exit with its exit
status.
I'm happy with the documentation and help-text parts of your patch, but
probably this, on top of 1a6f6bb (git am --abort, 2008-07-16), is more
appropriate?
---
git-am.sh | 6 +++---
t/t4151-am-abort.sh | 46 +++++++++++++++++++++++++++-------------------
2 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index a44bd7a..5cbf8f4 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -203,9 +203,9 @@ then
case "$abort" in
t)
- rm -fr "$dotest" &&
- git read-tree -m -u ORIG_HEAD &&
- git reset ORIG_HEAD && :
+ git rerere clear
+ git read-tree --reset -u HEAD ORIG_HEAD
+ rm -fr "$dotest"
exit ;;
esac
else
diff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh
index 96b2cd5..dda7e2c 100755
--- a/t/t4151-am-abort.sh
+++ b/t/t4151-am-abort.sh
@@ -22,27 +22,35 @@ test_expect_success setup '
done &&
git format-patch initial &&
git checkout -b side initial &&
- echo local change >file-2 &&
- cp file-2 file-2-expect
+ echo local change >file-2-expect
'
-test_expect_success 'am stops at a patch that does not apply' '
- test_must_fail git am 000[124]-*.patch &&
- git log --pretty=tformat:%s >actual &&
- for i in 3 2 initial
- do
- echo $i
- done >expect &&
- test_cmp expect actual
-'
+for with3 in '' ' -3'
+do
+ test_expect_success "am$with3 stops at a patch that does not apply" '
-test_expect_success 'am --abort goes back' '
- git am --abort &&
- git rev-parse HEAD >actual &&
- git rev-parse initial >expect &&
- test_cmp expect actual &&
- test_cmp file-2-expect file-2 &&
- git diff-index --exit-code --cached HEAD
-'
+ git reset --hard initial &&
+ cp file-2-expect file-2 &&
+
+ test_must_fail git am$with3 000[124]-*.patch &&
+ git log --pretty=tformat:%s >actual &&
+ for i in 3 2 initial
+ do
+ echo $i
+ done >expect &&
+ test_cmp expect actual
+ '
+
+ test_expect_success "am --abort goes back after failed am$with3" '
+ git-am --abort &&
+ git rev-parse HEAD >actual &&
+ git rev-parse initial >expect &&
+ test_cmp expect actual &&
+ test_cmp file-2-expect file-2 &&
+ git diff-index --exit-code --cached HEAD &&
+ test ! -f .git/rr-cache/MERGE_RR
+ '
+
+done
test_done
^ 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