* 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
* 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
* [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
* [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 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
* 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
* 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
* [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
* [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 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 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] refresh-index: fix bitmask assignment
From: Junio C Hamano @ 2008-07-20 6:31 UTC (permalink / raw)
To: git
5fdeacb (Teach update-index about --ignore-submodules, 2008-05-14) added a
new refresh option flag but did not assign a unique bit for it correctly,
and broke "update-index --ignore-missing".
This should fix it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* The fact that it took this long for anybody to notice the breakage
probably means that the "--ignore-missing" option in particular but the
ability for plumbing to allow scripting in general is not utilized by
as many people as the design initially envisioned.
cache.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cache.h b/cache.h
index ca382d4..9735b66 100644
--- a/cache.h
+++ b/cache.h
@@ -396,7 +396,7 @@ extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
#define REFRESH_UNMERGED 0x0002 /* allow unmerged */
#define REFRESH_QUIET 0x0004 /* be quiet about it */
#define REFRESH_IGNORE_MISSING 0x0008 /* ignore non-existent */
-#define REFRESH_IGNORE_SUBMODULES 0x0008 /* ignore submodules */
+#define REFRESH_IGNORE_SUBMODULES 0x0010 /* ignore submodules */
extern int refresh_index(struct index_state *, unsigned int flags, const char **pathspec, char *seen);
struct lock_file {
--
1.5.6.4.570.g052e6
^ permalink raw reply related
* Re: "error: non-monotonic index" during fresh linux-2.6.git cloning.
From: Evgeniy Polyakov @ 2008-07-20 6:41 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7v8wvxzg97.fsf@gitster.siamese.dyndns.org>
On Sat, Jul 19, 2008 at 03:00:20PM -0700, Junio C Hamano (gitster@pobox.com) wrote:
> > I posted it so it would be stored in archive, that old enough git
> > version does not work with recent trees, so one should upgrade if this
> > error occures.
>
> Thanks, but you are about 5 days too late ;-)
>
> http://thread.gmane.org/gmane.comp.version-control.git/76650/focus=88402
Better late than never :)
--
Evgeniy Polyakov
^ permalink raw reply
* Re: "error: non-monotonic index" during fresh linux-2.6.git cloning.
From: Junio C Hamano @ 2008-07-20 6:52 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: git
In-Reply-To: <20080720064137.GA9654@2ka.mipt.ru>
Evgeniy Polyakov <johnpol@2ka.mipt.ru> writes:
> On Sat, Jul 19, 2008 at 03:00:20PM -0700, Junio C Hamano (gitster@pobox.com) wrote:
>> > I posted it so it would be stored in archive, that old enough git
>> > version does not work with recent trees, so one should upgrade if this
>> > error occures.
>>
>> Thanks, but you are about 5 days too late ;-)
>>
>> http://thread.gmane.org/gmane.comp.version-control.git/76650/focus=88402
>
> Better late than never :)
You should have said "better redundant than never", though ;-)
^ permalink raw reply
* Re: [PATCH] refresh-index: fix bitmask assignment
From: Junio C Hamano @ 2008-07-20 7:03 UTC (permalink / raw)
To: git
In-Reply-To: <7vtzelf4mf.fsf@gitster.siamese.dyndns.org>
This hopefully protects the previous fix (and other --refresh related
options) from future breakages.
I'll squash it in to the previous one.
---
t/t2103-update-index-ignore-missing.sh | 89 ++++++++++++++++++++++++++++++++
1 files changed, 89 insertions(+), 0 deletions(-)
create mode 100755 t/t2103-update-index-ignore-missing.sh
diff --git a/t/t2103-update-index-ignore-missing.sh b/t/t2103-update-index-ignore-missing.sh
new file mode 100755
index 0000000..332694e
--- /dev/null
+++ b/t/t2103-update-index-ignore-missing.sh
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+test_description='update-index with options'
+
+. ./test-lib.sh
+
+test_expect_success basics '
+ >one &&
+ >two &&
+ >three &&
+
+ # need --add when adding
+ test_must_fail git update-index one &&
+ test -z "$(git ls-files)" &&
+ git update-index --add one &&
+ test zone = "z$(git ls-files)" &&
+
+ # update-index is atomic
+ echo 1 >one &&
+ test_must_fail git update-index one two &&
+ echo "M one" >expect &&
+ git diff-files --name-status >actual &&
+ test_cmp expect actual &&
+
+ git update-index --add one two three &&
+ for i in one three two; do echo $i; done >expect &&
+ git ls-files >actual &&
+ test_cmp expect actual &&
+
+ test_tick &&
+ (
+ test_create_repo xyzzy &&
+ cd xyzzy &&
+ >file &&
+ git add file
+ git commit -m "sub initial"
+ ) &&
+ git add xyzzy &&
+
+ test_tick &&
+ git commit -m initial &&
+ git tag initial
+'
+
+test_expect_success '--ignore-missing --refresh' '
+ git reset --hard initial &&
+ echo 2 >one &&
+ test_must_fail git update-index --refresh &&
+ echo 1 >one &&
+ git update-index --refresh &&
+ rm -f two &&
+ test_must_fail git update-index --refresh &&
+ git update-index --ignore-missing --refresh
+
+'
+
+test_expect_success '--unmerged --refresh' '
+ git reset --hard initial &&
+ info=$(git ls-files -s one | sed -e "s/ 0 / 1 /") &&
+ git rm --cached one &&
+ echo "$info" | git update-index --index-info &&
+ test_must_fail git update-index --refresh &&
+ git update-index --unmerged --refresh &&
+ echo 2 >two &&
+ test_must_fail git update-index --unmerged --refresh >actual &&
+ grep two actual &&
+ ! grep one actual &&
+ ! grep three actual
+'
+
+test_expect_success '--ignore-submodules --refresh (1)' '
+ git reset --hard initial &&
+ rm -f two &&
+ test_must_fail git update-index --ignore-submodules --refresh
+'
+
+test_expect_success '--ignore-submodules --refresh (2)' '
+ git reset --hard initial &&
+ test_tick &&
+ (
+ cd xyzzy &&
+ git commit -m "sub second" --allow-empty
+ ) &&
+ test_must_fail git update-index --refresh &&
+ test_must_fail git update-index --ignore-missing --refresh &&
+ git update-index --ignore-submodules --refresh
+'
+
+test_done
^ permalink raw reply related
* Re: "error: non-monotonic index" during fresh linux-2.6.git cloning.
From: Evgeniy Polyakov @ 2008-07-20 7:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vprp9f3ne.fsf@gitster.siamese.dyndns.org>
On Sat, Jul 19, 2008 at 11:52:53PM -0700, Junio C Hamano (gitster@pobox.com) wrote:
> >> http://thread.gmane.org/gmane.comp.version-control.git/76650/focus=88402
> >
> > Better late than never :)
>
> You should have said "better redundant than never", though ;-)
Indeed, although there were no mention that error occurs with clone, so
I would find it :)
--
Evgeniy Polyakov
^ permalink raw reply
* Re: [PATCH] refresh-index: fix bitmask assignment
From: Junio C Hamano @ 2008-07-20 7:28 UTC (permalink / raw)
To: git
In-Reply-To: <7vk5fhf35p.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> This hopefully protects the previous fix (and other --refresh related
> options) from future breakages.
>
> I'll squash it in to the previous one.
Actually, I'll squash this further on top, for a reason that will become
clear with the next series...
---
t/t2103-update-index-ignore-missing.sh | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/t/t2103-update-index-ignore-missing.sh b/t/t2103-update-index-ignore-missing.sh
index 332694e..4fbf855 100755
--- a/t/t2103-update-index-ignore-missing.sh
+++ b/t/t2103-update-index-ignore-missing.sh
@@ -62,10 +62,9 @@ test_expect_success '--unmerged --refresh' '
test_must_fail git update-index --refresh &&
git update-index --unmerged --refresh &&
echo 2 >two &&
+ echo "two: needs update" >expect &&
test_must_fail git update-index --unmerged --refresh >actual &&
- grep two actual &&
- ! grep one actual &&
- ! grep three actual
+ test_cmp expect actual
'
test_expect_success '--ignore-submodules --refresh (1)' '
^ permalink raw reply related
* [RFC variant 1 of 2] "needs update" considered harmful
From: Junio C Hamano @ 2008-07-20 7:48 UTC (permalink / raw)
To: git
In-Reply-To: <7vtzelf4mf.fsf@gitster.siamese.dyndns.org>
"git update-index --refresh", "git reset" and "git add --refresh" have
reported paths that have local modifications as "needs update" since the
beginning of git.
Although this is logically correct in that you need to update the index at
that path before you can commit that change, it is now becoming more and
more clear, especially with the continuous push for user friendliness
since 1.5.0 series, that the message is suboptimal. After all, the change
may be something the user might want to get rid of, and "updating" would
be absolutely a wrong thing to do if that is the case.
I prepared two alternatives to solve this. Both aim to reword the message
to more neutral "locally modified".
This patch is a more intrusive variant that changes the message for only
Porcelain commands ("add" and "reset") while keeping the plumbing
"update-index" intact.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-add.c | 3 ++-
builtin-reset.c | 2 +-
cache.h | 1 +
read-cache.c | 5 ++++-
t/t7102-reset.sh | 2 +-
5 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/builtin-add.c b/builtin-add.c
index 9930cf5..5ffe4da 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -142,7 +142,8 @@ static void refresh(int verbose, const char **pathspec)
seen = xcalloc(specs, 1);
if (read_cache() < 0)
die("index file corrupt");
- refresh_index(&the_index, verbose ? 0 : REFRESH_QUIET, pathspec, seen);
+ refresh_index(&the_index, verbose ? REFRESH_SAY_CHANGED : REFRESH_QUIET,
+ pathspec, seen);
for (i = 0; i < specs; i++) {
if (!seen[i])
die("pathspec '%s' did not match any files", pathspec[i]);
diff --git a/builtin-reset.c b/builtin-reset.c
index a032169..98dbe1c 100644
--- a/builtin-reset.c
+++ b/builtin-reset.c
@@ -96,7 +96,7 @@ static int update_index_refresh(int fd, struct lock_file *index_lock)
if (read_cache() < 0)
return error("Could not read index");
- result = refresh_cache(0) ? 1 : 0;
+ result = refresh_cache(REFRESH_SAY_CHANGED) ? 1 : 0;
if (write_cache(fd, active_cache, active_nr) ||
commit_locked_index(index_lock))
return error ("Could not refresh index");
diff --git a/cache.h b/cache.h
index 9735b66..da87c72 100644
--- a/cache.h
+++ b/cache.h
@@ -397,6 +397,7 @@ extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
#define REFRESH_QUIET 0x0004 /* be quiet about it */
#define REFRESH_IGNORE_MISSING 0x0008 /* ignore non-existent */
#define REFRESH_IGNORE_SUBMODULES 0x0010 /* ignore submodules */
+#define REFRESH_SAY_CHANGED 0x0020 /* say "changed" not "needs update" */
extern int refresh_index(struct index_state *, unsigned int flags, const char **pathspec, char *seen);
struct lock_file {
diff --git a/read-cache.c b/read-cache.c
index f83de8c..9839362 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -980,7 +980,10 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
int not_new = (flags & REFRESH_IGNORE_MISSING) != 0;
int ignore_submodules = (flags & REFRESH_IGNORE_SUBMODULES) != 0;
unsigned int options = really ? CE_MATCH_IGNORE_VALID : 0;
+ const char *needs_update_message;
+ needs_update_message = ((flags & REFRESH_SAY_CHANGED)
+ ? "locally modified" : "needs update");
for (i = 0; i < istate->cache_nr; i++) {
struct cache_entry *ce, *new;
int cache_errno = 0;
@@ -1019,7 +1022,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
}
if (quiet)
continue;
- printf("%s: needs update\n", ce->name);
+ printf("%s: %s\n", ce->name, needs_update_message);
has_errors = 1;
continue;
}
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 96d1508..da4b142 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -419,7 +419,7 @@ test_expect_success 'resetting an unmodified path is a no-op' '
'
cat > expect << EOF
-file2: needs update
+file2: locally modified
EOF
test_expect_success '--mixed refreshes the index' '
^ permalink raw reply related
* [RFC variant 2 of 2] "needs update" considered harmful
From: Junio C Hamano @ 2008-07-20 7:48 UTC (permalink / raw)
To: git
In-Reply-To: <7vtzelf4mf.fsf@gitster.siamese.dyndns.org>
"git update-index --refresh", "git reset" and "git add --refresh" have
reported paths that have local modifications as "needs update" since the
beginning of git.
Although this is logically correct in that you need to update the index at
that path before you can commit that change, it is now becoming more and
more clear, especially with the continuous push for user friendliness
since 1.5.0 series, that the message is suboptimal. After all, the change
may be something the user might want to get rid of, and "updating" would
be absolutely a wrong thing to do if that is the case.
I prepared two alternatives to solve this. Both aim to reword the message
to more neutral "locally modified".
This patch is a more straightforward variant that changes the message not
only for Porcelain commands ("add" and "reset") but also changes the
output from the plumbing command "update-index".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
read-cache.c | 2 +-
t/t2103-update-index-ignore-missing.sh | 2 +-
t/t7102-reset.sh | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index f83de8c..d37aec0 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1019,7 +1019,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
}
if (quiet)
continue;
- printf("%s: needs update\n", ce->name);
+ printf("%s: locally modified\n", ce->name);
has_errors = 1;
continue;
}
diff --git a/t/t2103-update-index-ignore-missing.sh b/t/t2103-update-index-ignore-missing.sh
index 4fbf855..f775acb 100755
--- a/t/t2103-update-index-ignore-missing.sh
+++ b/t/t2103-update-index-ignore-missing.sh
@@ -62,7 +62,7 @@ test_expect_success '--unmerged --refresh' '
test_must_fail git update-index --refresh &&
git update-index --unmerged --refresh &&
echo 2 >two &&
- echo "two: needs update" >expect &&
+ echo "two: locally modified" >expect &&
test_must_fail git update-index --unmerged --refresh >actual &&
test_cmp expect actual
'
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 96d1508..da4b142 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -419,7 +419,7 @@ test_expect_success 'resetting an unmodified path is a no-op' '
'
cat > expect << EOF
-file2: needs update
+file2: locally modified
EOF
test_expect_success '--mixed refreshes the index' '
--
1.5.6.4.570.g052e6
^ permalink raw reply related
* [RFC] "needs update" considered harmful
From: Junio C Hamano @ 2008-07-20 7:48 UTC (permalink / raw)
To: git
In-Reply-To: <7v3am5f20f.fsf@gitster.siamese.dyndns.org>
The previous two variants both aim to reword the somewhat unpopular "needs
update" message to easier "locally modified".
"Politically correct" thing to do would be to keep the output from the
update-index (plumbing) intact and update only output from "reset" and
"add --refresh -v" which are Porcelain. This has smaller chance of
breaking people's existing scripts, but some people may find the two
messages that say the same thing inconsistent.
Rewording to "locally modified" even at the plumbing level is a simpler
patch, keeps the API to refresh_index() intact, and probably is a better
approach in the longer term, especially if we can ignore people's existing
scripts.
^ permalink raw reply
* Re: [PATCH] Enable git rev-list to parse --quiet
From: Junio C Hamano @ 2008-07-20 7:56 UTC (permalink / raw)
To: Nick Andrew; +Cc: git
In-Reply-To: <20080718092001.GD16102@mail.local.tull.net>
Nick Andrew <nick@nick-andrew.net> writes:
> ...Without
> a working "--quiet" nor exit code I can pipe the output to "wc -l"
> but is there a more efficient/reliable way to implement the requirement?
Did you read the whole thread before asking the above question?
IOW, does this answer the above question?
http://mid.gmane.org/7vy73zd8ok.fsf@gitster.siamese.dyndns.org
^ permalink raw reply
* Re: Suggestion: doc restructuring
From: Junio C Hamano @ 2008-07-20 8:14 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Michael J Gruber, git
In-Reply-To: <alpine.DEB.1.00.0807190314010.3064@eeepc-johanness>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> So what I really would like is this: leave the plumbing pages as they are,
> but enhance those pages that users (especially new ones) are likely to see
> most often.
Regarding the original "do we want to ever teach plumbing to new users?"
issue, I suspect that, with sufficient enhancement to Porcelain, we might
be able to reach a point where end users can work without ever touching a
single plumbing command at all.
Side note, that was why I suggested us to first think about use
cases in our every day work that we still need to resort to the
plumbing, so that we can identify what that enhancement would
consist of.
When we reach that point, we might want to restructure the documentation
into two volumes. One volume for end-users who exclusively use the stock
git Porcelain, and another that describes plumbing commands for Porcelain
writers.
Perhaps move the plumbing documentation to section 3; just like Perl has
DBI.3pm and friends there, /usr/share/man/man3/git-cat-file.3git will
describe what scripts can do with the command.
^ permalink raw reply
* Re: Hacks for AIX
From: Junio C Hamano @ 2008-07-20 8:33 UTC (permalink / raw)
To: Chris Cowan; +Cc: git, Brandon Casey
In-Reply-To: <7v3am9sn2p.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
>> * /usr/bin/patch - really old version, doesn't do well with some
>> diff formats. I avoid using it.
>
> t4109 seems to use patch to produce expected output for the tests; we
> should ship a precomputed expected results. Do you know of any other
> places "patch" is used?
As usual, I won't commit this patch unless I hear from people who
potentially would benefit from it. I do not need such a patch myself and
I really shouldn't be spending too much of my time on these.
-- >8 --
[PATCH] do not rely on external "patch" in tests
Some of our tests assumed a working "patch" command to produce expected
results when checking "git-apply", but some systems have broken "patch".
We can compare our output with expected output that is precomputed
instead to sidestep this issue.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
t/t4109-apply-multifrag.sh | 119 +++++++++++++++++++++++++++++++++++---------
t/t4110-apply-scan.sh | 35 ++++++++++---
2 files changed, 123 insertions(+), 31 deletions(-)
diff --git a/t/t4109-apply-multifrag.sh b/t/t4109-apply-multifrag.sh
index bd40a21..4805863 100755
--- a/t/t4109-apply-multifrag.sh
+++ b/t/t4109-apply-multifrag.sh
@@ -138,39 +138,112 @@ diff --git a/main.c b/main.c
EOF
-test_expect_success "S = git apply (1)" \
- 'git apply patch1.patch patch2.patch'
-mv main.c main.c.git
+cat >expect_1 <<\EOF
+#include <stdlib.h>
+#include <stdio.h>
-test_expect_success "S = patch (1)" \
- 'cat patch1.patch patch2.patch | patch -p1'
+int func(int num);
+void print_int(int num);
+void print_ln();
-test_expect_success "S = cmp (1)" \
- 'cmp main.c.git main.c'
+int main() {
+ int i;
-rm -f main.c main.c.git
+ for (i = 0; i < 10; i++) {
+ print_int(func(i));
+ }
-test_expect_success "S = git apply (2)" \
- 'git apply patch1.patch patch2.patch patch3.patch'
-mv main.c main.c.git
+ print_ln();
-test_expect_success "S = patch (2)" \
- 'cat patch1.patch patch2.patch patch3.patch | patch -p1'
+ return 0;
+}
-test_expect_success "S = cmp (2)" \
- 'cmp main.c.git main.c'
+int func(int num) {
+ return num * num;
+}
-rm -f main.c main.c.git
+void print_int(int num) {
+ printf("%d", num);
+}
-test_expect_success "S = git apply (3)" \
- 'git apply patch1.patch patch4.patch'
-mv main.c main.c.git
+void print_ln() {
+ printf("\n");
+}
-test_expect_success "S = patch (3)" \
- 'cat patch1.patch patch4.patch | patch -p1'
+EOF
+
+test_expect_success 'git apply (1)' '
+ git apply patch1.patch patch2.patch &&
+ mv main.c actual &&
+ test_cmp expect_1 actual
+'
+
+cat >expect_2 <<\EOF
+#include <stdio.h>
+
+int func(int num);
+void print_int(int num);
+
+int main() {
+ int i;
+
+ for (i = 0; i < 10; i++) {
+ print_int(func(i));
+ }
+
+ return 0;
+}
+
+int func(int num) {
+ return num * num;
+}
+
+void print_int(int num) {
+ printf("%d", num);
+}
+
+EOF
-test_expect_success "S = cmp (3)" \
- 'cmp main.c.git main.c'
+test_expect_success 'git apply (2)' '
+ rm -f main.c &&
+ git apply patch1.patch patch2.patch patch3.patch &&
+ mv main.c actual &&
+ test_cmp expect_2 actual
+'
+
+cat >expect_3 <<\EOF
+#include <stdio.h>
+
+int func(int num);
+int func2(int num);
+
+int main() {
+ int i;
+
+ for (i = 0; i < 10; i++) {
+ printf("%d", func(i));
+ printf("%d", func3(i));
+ }
+
+ return 0;
+}
+
+int func(int num) {
+ return num * num;
+}
+
+int func2(int num) {
+ return num * num * num;
+}
+
+EOF
+
+test_expect_success 'git apply (3)' '
+ rm -f main.c &&
+ git apply patch1.patch patch4.patch &&
+ mv main.c actual &&
+ test_cmp expect_3 actual
+'
test_done
diff --git a/t/t4110-apply-scan.sh b/t/t4110-apply-scan.sh
index db60652..ae300ca 100755
--- a/t/t4110-apply-scan.sh
+++ b/t/t4110-apply-scan.sh
@@ -86,15 +86,34 @@ diff --git a/new.txt b/new.txt
+c2222
EOF
-test_expect_success "S = git apply scan" \
- 'git apply patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch'
-mv new.txt apply.txt
+cat >expect <<\EOF
+a1
+a11
+a111
+a1111
+b1
+b11
+b111
+b1111
+b2
+b22
+b222
+b2222
+c1
+c11
+c111
+c1111
+c2
+c22
+c222
+c2222
+EOF
-test_expect_success "S = patch scan" \
- 'cat patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch | patch'
-mv new.txt patch.txt
-test_expect_success "S = cmp" \
- 'cmp apply.txt patch.txt'
+test_expect_success 'apply series of patches' '
+ git apply patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch &&
+ mv new.txt actual &&
+ test_cmp expect actual
+'
test_done
^ permalink raw reply related
* Re: What's cooking in git.git (topics)
From: Nanako Shiraishi @ 2008-07-20 10:20 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <alpine.DEB.1.00.0807181356010.3932@eeepc-johanness>
Quoting Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> On Fri, 18 Jul 2008, Nanako Shiraishi wrote:
>
>> Quoting Junio C Hamano <gitster@pobox.com>:
>> > This needs to be merged to master iff/when merge-theirs gets merged,
>> > but I do not think this series is widely supported, so both are on
>> > hold.
>>
>> Why do you say it is not widely supported? I may be wrong but I think
>> you developed these patches after somebody from the mailing list asked
>> for this feature.
>
> Asking for a feature, and then not doing a single thing to defend why it
> makes sense, of a single person, who does not even speak up now, does not
> count for "wide support".
For the record, I was not the one who asked for such a feature.
It seems that the conclusion of the discussion is that "theirs" promotes a bad workflow, and I am happy with that.
--
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
^ permalink raw reply
* [PATCH] Teach "git-merge" that "stupid" merge strategy no longer exists
From: Nanako Shiraishi @ 2008-07-20 10:21 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
Next release 1.6.0 will not have "stupid" merge strategy, but
"git merge -s confused origin" still includs it in the list of
available merge strategies.
Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
---
builtin-merge.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/builtin-merge.c b/builtin-merge.c
index 129b4e6..edc6016 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -54,7 +54,6 @@ static struct strategy all_strategy[] = {
{ "recursive", DEFAULT_TWOHEAD | NO_TRIVIAL },
{ "octopus", DEFAULT_OCTOPUS },
{ "resolve", 0 },
- { "stupid", 0 },
{ "ours", NO_FAST_FORWARD | NO_TRIVIAL },
{ "subtree", NO_FAST_FORWARD | NO_TRIVIAL },
};
--
1.5.6.3
--
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
^ 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