Re: What's cooking in git.git (Mar 2014, #03; Fri, 14)

2014-03-15 Thread Torsten Bögershausen
On 2014-03-14 23.09, Junio C Hamano wrote:
> * ap/remote-hg-skip-null-bookmarks (2014-01-02) 1 commit
>  - remote-hg: do not fail on invalid bookmarks
> 
>  Reported to break tests ($gmane/240005)
>  Expecting a reroll.
I wonder what should happen here.
The change breaks all the tests in test-hg-hg-git.sh
(And the breakage may prevent us from detecting other breakages)

The ideal situation would be to have an extra test case for the problem
which we try to fix with this patch.

Antoine, is there any way to make your problem reproducable ?
And based on that, to make a patch which passes all test cases ?
Thanks
/Torsten




--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/6] Fix misuses of "nor"

2014-03-15 Thread Justin Lebar
I got annoyed by git's awkward use of "nor" in man pages and in git add -p, so
I went ahead and audited all uses of "nor" in the tree.  One might be able to
argue that some of the uses I've changed are technically acceptable, but that's
a pretty low bar to set for ourselves.  I aimed to make everything both correct
and idiomatic.

All I really care about is git-add--interactive.perl and (to a lesser extent)
the docs, so if any of these other changes are controversial or annoying to
take, I'm happy to drop them.

This is my first patch to git, so I've probably made a few fatal errors in how
I packaged this change; apologies in advance.

Justin Lebar (6):
  Documentation: Fix misuses of "nor"
  contrib: Fix misuses of "nor"
  l10n: Fix misuses of "nor"
  Fix misuses of "nor" in comments
  Fix misuses of "nor" outside comments
  Tests: Fix misuses of "nor"

 Documentation/CodingGuidelines  |  4 ++--
 Documentation/config.txt|  6 +++---
 Documentation/diff-generate-patch.txt   |  2 +-
 Documentation/diff-options.txt  |  2 +-
 Documentation/everyday.txt  |  2 +-
 Documentation/git-add.txt   |  4 ++--
 Documentation/git-count-objects.txt |  4 ++--
 Documentation/git-diff.txt  |  4 ++--
 Documentation/git-prune.txt |  2 +-
 Documentation/git-push.txt  |  2 +-
 Documentation/git-read-tree.txt |  2 +-
 Documentation/git-reset.txt |  6 +++---
 Documentation/git-show-branch.txt   |  2 +-
 Documentation/git-show-ref.txt  |  2 +-
 Documentation/howto/rebase-from-internal-branch.txt |  2 +-
 Documentation/howto/revert-a-faulty-merge.txt   |  4 ++--
 Documentation/howto/revert-branch-rebase.txt|  2 +-
 Documentation/merge-options.txt | 15 +++
 Documentation/pretty-formats.txt|  2 +-
 Documentation/pretty-options.txt|  2 +-
 Documentation/rev-list-options.txt  |  2 +-
 Documentation/technical/api-gitattributes.txt   |  2 +-
 Documentation/technical/pack-protocol.txt   |  8 
 Documentation/technical/protocol-common.txt |  2 +-
 Documentation/user-manual.txt   |  2 +-
 Makefile|  2 +-
 builtin/apply.c |  2 +-
 builtin/checkout.c  |  2 +-
 builtin/clean.c |  6 +++---
 builtin/commit.c|  2 +-
 builtin/log.c   |  2 +-
 builtin/pack-objects.c  |  2 +-
 builtin/reset.c |  4 ++--
 builtin/show-branch.c   |  2 +-
 column.c|  2 +-
 contrib/examples/git-checkout.sh|  2 +-
 contrib/examples/git-commit.sh  |  2 +-
 contrib/examples/git-reset.sh   |  4 ++--
 contrib/fast-import/import-directories.perl |  4 ++--
 contrib/svn-fe/svn-fe.txt   |  4 ++--
 delta.h |  2 +-
 diff.c  |  2 +-
 git-add--interactive.perl   |  4 ++--
 git-am.sh   |  2 +-
 gitweb/gitweb.perl  |  2 +-
 http.h  |  4 ++--
 perl/Git/SVN.pm |  6 +++---
 perl/Git/SVN/Migration.pm   |  2 +-
 pkt-line.h  |  2 +-
 po/bg.po|  6 +++---
 po/de.po|  6 +++---
 po/fr.po|  6 +++---
 po/git.pot  |  6 +++---
 po/it.po|  2 +-
 po/pt_PT.po |  2 +-
 po/sv.po|  6 +++---
 po/vi.po|  6 +++---
 po/zh_CN.po |  6 +++---
 remote.c|  2 +-
 sha1_file.c |  4 ++--
 t/t1001-read-tree-m-2way.sh |  2 +-
 t/t4005-diff-rename-2.sh|  2 +-
 t/t4009-diff-rename-4.sh|  2 +-
 t/t5304-prune.sh|  2 +-
 t/t6036-recursive-corner-cases.sh   |  2 +-
 t/t7104-reset.sh|  2 +-
 t/t9400-git-cvsser

[PATCH 2/6] contrib: Fix misuses of "nor"

2014-03-15 Thread Justin Lebar
Signed-off-by: Justin Lebar 
---
 contrib/examples/git-commit.sh | 2 +-
 contrib/svn-fe/svn-fe.txt  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/contrib/examples/git-commit.sh b/contrib/examples/git-commit.sh
index 23ffb02..4aab1a6 100755
--- a/contrib/examples/git-commit.sh
+++ b/contrib/examples/git-commit.sh
@@ -280,7 +280,7 @@ case "$#,$also,$only,$amend" in
 0,,,*)
;;
 *,,,*)
-   only_include_assumed="# Explicit paths specified without -i nor -o; 
assuming --only paths..."
+   only_include_assumed="# Explicit paths specified without -i or -o; 
assuming --only paths..."
also=
;;
 esac
diff --git a/contrib/svn-fe/svn-fe.txt b/contrib/svn-fe/svn-fe.txt
index 1128ab2..a3425f4 100644
--- a/contrib/svn-fe/svn-fe.txt
+++ b/contrib/svn-fe/svn-fe.txt
@@ -40,8 +40,8 @@ manual page.
 NOTES
 -
 Subversion dumps do not record a separate author and committer for
-each revision, nor a separate display name and email address for
-each author.  Like git-svn(1), 'svn-fe' will use the name
+each revision, nor do they record a separate display name and email
+address for each author.  Like git-svn(1), 'svn-fe' will use the name
 
 -
 user 
-- 
1.9.0.279.gdc9e3eb

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] Fix misuses of "nor" in comments

2014-03-15 Thread Justin Lebar
Signed-off-by: Justin Lebar 
---
 Makefile| 2 +-
 builtin/apply.c | 2 +-
 builtin/checkout.c  | 2 +-
 builtin/log.c   | 2 +-
 builtin/pack-objects.c  | 2 +-
 builtin/reset.c | 4 ++--
 builtin/show-branch.c   | 2 +-
 column.c| 2 +-
 contrib/examples/git-checkout.sh| 2 +-
 contrib/examples/git-reset.sh   | 4 ++--
 contrib/fast-import/import-directories.perl | 4 ++--
 delta.h | 2 +-
 diff.c  | 2 +-
 git-am.sh   | 2 +-
 gitweb/gitweb.perl  | 2 +-
 http.h  | 4 ++--
 perl/Git/SVN.pm | 2 +-
 perl/Git/SVN/Migration.pm   | 2 +-
 pkt-line.h  | 2 +-
 remote.c| 2 +-
 sha1_file.c | 2 +-
 test-chmtime.c  | 2 +-
 22 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/Makefile b/Makefile
index dddaf4f..fc02788 100644
--- a/Makefile
+++ b/Makefile
@@ -159,7 +159,7 @@ all::
 #
 # Define NEEDS_LIBINTL_BEFORE_LIBICONV if you need libintl before libiconv.
 #
-# Define NO_INTPTR_T if you don't have intptr_t nor uintptr_t.
+# Define NO_INTPTR_T if you don't have intptr_t or uintptr_t.
 #
 # Define NO_UINTMAX_T if you don't have uintmax_t.
 #
diff --git a/builtin/apply.c b/builtin/apply.c
index b0d0986..6013e19 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4061,7 +4061,7 @@ static int write_out_one_reject(struct patch *patch)
return error(_("cannot open %s: %s"), namebuf, strerror(errno));
 
/* Normal git tools never deal with .rej, so do not pretend
-* this is a git patch by saying --git nor give extended
+* this is a git patch by saying --git or giving extended
 * headers.  While at it, maybe please "kompare" that wants
 * the trailing TAB and some garbage at the end of line ;-).
 */
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 5df3837..ec21b13 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -896,7 +896,7 @@ static int parse_branchname_arg(int argc, const char **argv,
 *   between A and B, A...B names that merge base.
 *
 *   (b) If  is _not_ a commit, either "--" is present
-*   or  is not a path, no -t nor -b was given, and
+*   or  is not a path, no -t or -b was given, and
 *   and there is a tracking branch whose name is 
 *   in one and only one remote, then this is a short-hand to
 *   fork local  from that remote-tracking branch.
diff --git a/builtin/log.c b/builtin/log.c
index b97373d..39e8836 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -503,7 +503,7 @@ static void show_rev_tweak_rev(struct rev_info *rev, struct 
setup_revision_opt *
/* There was no "-m" on the command line */
rev->ignore_merges = 0;
if (!rev->first_parent_only && !rev->combine_merges) {
-   /* No "--first-parent", "-c", nor "--cc" */
+   /* No "--first-parent", "-c", or "--cc" */
rev->combine_merges = 1;
rev->dense_combined_merges = 1;
}
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 541667f..ef1f20e 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -999,7 +999,7 @@ static int pbase_tree_cache_ix_incr(int ix)
 static struct pbase_tree {
struct pbase_tree *next;
/* This is a phony "cache" entry; we are not
-* going to evict it nor find it through _get()
+* going to evict it or find it through _get()
 * mechanism -- this is for the toplevel node that
 * would almost always change with any commit.
 */
diff --git a/builtin/reset.c b/builtin/reset.c
index 6004803..ef3249e 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -309,7 +309,7 @@ int cmd_reset(int argc, const char **argv, const char 
*prefix)
 
/* git reset tree [--] paths... can be used to
 * load chosen paths from the tree into the index without
-* affecting the working tree nor HEAD. */
+* affecting the working tree or HEAD. */
if (pathspec.nr) {
if (reset_type == MIXED)
warning(_("--mixed with paths is deprecated; use 'git 
reset -- ' instead."));
@@ -327,7 +327,7 @@ int cmd_reset(int argc, const char **argv, const char 
*prefix)
die(_("%s reset is not allowed in a bare repository"),
_(reset_type_names[reset_type]));
 
-   /* Soft reset does not touch the index fi

[PATCH 5/6] Fix misuses of "nor" outside comments

2014-03-15 Thread Justin Lebar
Signed-off-by: Justin Lebar 
---
 builtin/clean.c   | 6 +++---
 builtin/commit.c  | 2 +-
 git-add--interactive.perl | 4 ++--
 perl/Git/SVN.pm   | 4 ++--
 sha1_file.c   | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/builtin/clean.c b/builtin/clean.c
index 2f26297..fb1b357 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -903,11 +903,11 @@ int cmd_clean(int argc, const char **argv, const char 
*prefix)
 
if (!interactive && !dry_run && !force) {
if (config_set)
-   die(_("clean.requireForce set to true and neither -i, 
-n nor -f given; "
+   die(_("clean.requireForce set to true and neither -i, 
-n, nor -f given; "
  "refusing to clean"));
else
-   die(_("clean.requireForce defaults to true and neither 
-i, -n nor -f given; "
- "refusing to clean"));
+   die(_("clean.requireForce defaults to true and neither 
-i, -n, nor -f given;"
+ " refusing to clean"));
}
 
if (force > 1)
diff --git a/builtin/commit.c b/builtin/commit.c
index 3767478..6c6be8a 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1123,7 +1123,7 @@ static int parse_and_validate_options(int argc, const 
char *argv[],
if (argc == 0 && only && amend)
only_include_assumed = _("Clever... amending the last one with 
dirty index.");
if (argc > 0 && !also && !only)
-   only_include_assumed = _("Explicit paths specified without -i 
nor -o; assuming --only paths...");
+   only_include_assumed = _("Explicit paths specified without -i 
or -o; assuming --only paths...");
if (!cleanup_arg || !strcmp(cleanup_arg, "default"))
cleanup_mode = use_editor ? CLEANUP_ALL : CLEANUP_SPACE;
else if (!strcmp(cleanup_arg, "verbatim"))
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 24bb1ab..32c2f9c 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1156,9 +1156,9 @@ sub help_patch_cmd {
print colored $help_color, 

[PATCH 6/6] Tests: Fix misuses of "nor"

2014-03-15 Thread Justin Lebar
Signed-off-by: Justin Lebar 
---
 t/t1001-read-tree-m-2way.sh   | 2 +-
 t/t4005-diff-rename-2.sh  | 2 +-
 t/t4009-diff-rename-4.sh  | 2 +-
 t/t5304-prune.sh  | 2 +-
 t/t6036-recursive-corner-cases.sh | 2 +-
 t/t7104-reset.sh  | 2 +-
 t/t9400-git-cvsserver-server.sh   | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/t/t1001-read-tree-m-2way.sh b/t/t1001-read-tree-m-2way.sh
index acaab07..1731383 100755
--- a/t/t1001-read-tree-m-2way.sh
+++ b/t/t1001-read-tree-m-2way.sh
@@ -18,7 +18,7 @@ In the test, these paths are used:
 frotz   - not in H added in M
 nitfol  - in H, stays in M unmodified
 rezrov  - in H, deleted in M
-yomin   - not in H nor M
+yomin   - not in H or M
 '
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-read-tree.sh
diff --git a/t/t4005-diff-rename-2.sh b/t/t4005-diff-rename-2.sh
index 77d7f49..7d2c6e1 100755
--- a/t/t4005-diff-rename-2.sh
+++ b/t/t4005-diff-rename-2.sh
@@ -66,7 +66,7 @@ test_expect_success \
 
 # tree has COPYING and rezrov.  work tree has the same COPYING and
 # copy-edited COPYING.1, and unchanged rezrov.  We should not say
-# anything about rezrov nor COPYING, since the revised again diff-raw
+# anything about rezrov or COPYING, since the revised again diff-raw
 # nows how to say Copy.
 
 test_expect_success \
diff --git a/t/t4009-diff-rename-4.sh b/t/t4009-diff-rename-4.sh
index f22c8e3..57c094f 100755
--- a/t/t4009-diff-rename-4.sh
+++ b/t/t4009-diff-rename-4.sh
@@ -73,7 +73,7 @@ test_expect_success \
 
 # tree has COPYING and rezrov.  work tree has the same COPYING and
 # copy-edited COPYING.1, and unchanged rezrov.  We should not say
-# anything about rezrov nor COPYING, since the revised again diff-raw
+# anything about rezrov or COPYING, since the revised again diff-raw
 # nows how to say Copy.
 
 test_expect_success \
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
index 66c9a41..377d3d3 100755
--- a/t/t5304-prune.sh
+++ b/t/t5304-prune.sh
@@ -213,7 +213,7 @@ test_expect_success 'garbage report in count-objects -v' '
 warning: garbage found: .git/objects/pack/fake.bar
 warning: garbage found: .git/objects/pack/foo
 warning: garbage found: .git/objects/pack/foo.bar
-warning: no corresponding .idx nor .pack: .git/objects/pack/fake2.keep
+warning: no corresponding .idx or .pack: .git/objects/pack/fake2.keep
 warning: no corresponding .idx: .git/objects/pack/foo.keep
 warning: no corresponding .idx: .git/objects/pack/foo.pack
 warning: no corresponding .pack: .git/objects/pack/fake3.idx
diff --git a/t/t6036-recursive-corner-cases.sh 
b/t/t6036-recursive-corner-cases.sh
index dfee7d1..a86087b 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -388,7 +388,7 @@ test_expect_failure 'git detects conflict w/ 
criss-cross+contrived resolution' '
 
 #
 # criss-cross + d/f conflict via add/add:
-#   Commit A: Neither file 'a' nor directory 'a/' exist.
+#   Commit A: Neither file 'a' nor directory 'a/' exists.
 #   Commit B: Introduce 'a'
 #   Commit C: Introduce 'a/file'
 #   Commit D: Merge B & C, keeping 'a' and deleting 'a/'
diff --git a/t/t7104-reset.sh b/t/t7104-reset.sh
index f136ee7..16faa07 100755
--- a/t/t7104-reset.sh
+++ b/t/t7104-reset.sh
@@ -33,7 +33,7 @@ test_expect_success 'reset --hard should restore unmerged 
ones' '
 
 '
 
-test_expect_success 'reset --hard did not corrupt index nor cached-tree' '
+test_expect_success 'reset --hard did not corrupt index or cached-tree' '
 
T=$(git write-tree) &&
rm -f .git/index &&
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 3edc408..1f06e25 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -512,7 +512,7 @@ test_expect_success 'cvs co -c (shows module database)' '
 # Known issues with git-cvsserver current log output:
 #  - Hard coded "lines: +2 -3" placeholder, instead of real numbers.
 #  - CVS normally does not internally add a blank first line
-#nor a last line with nothing but a space to log messages.
+#or a last line with nothing but a space to log messages.
 #  - The latest cvs 1.12.x server sends + timezone (with some hidden "MT"
 #tagging in the protocol), and if cvs 1.12.x client sees the MT tags,
 #it converts to local time zone.  git-cvsserver doesn't do the +
-- 
1.9.0.279.gdc9e3eb

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] Documentation: Fix misuses of "nor"

2014-03-15 Thread Justin Lebar
Signed-off-by: Justin Lebar 
---
 Documentation/CodingGuidelines  |  4 ++--
 Documentation/config.txt|  6 +++---
 Documentation/diff-generate-patch.txt   |  2 +-
 Documentation/diff-options.txt  |  2 +-
 Documentation/everyday.txt  |  2 +-
 Documentation/git-add.txt   |  4 ++--
 Documentation/git-count-objects.txt |  4 ++--
 Documentation/git-diff.txt  |  4 ++--
 Documentation/git-prune.txt |  2 +-
 Documentation/git-push.txt  |  2 +-
 Documentation/git-read-tree.txt |  2 +-
 Documentation/git-reset.txt |  6 +++---
 Documentation/git-show-branch.txt   |  2 +-
 Documentation/git-show-ref.txt  |  2 +-
 Documentation/howto/rebase-from-internal-branch.txt |  2 +-
 Documentation/howto/revert-a-faulty-merge.txt   |  4 ++--
 Documentation/howto/revert-branch-rebase.txt|  2 +-
 Documentation/merge-options.txt | 15 +++
 Documentation/pretty-formats.txt|  2 +-
 Documentation/pretty-options.txt|  2 +-
 Documentation/rev-list-options.txt  |  2 +-
 Documentation/technical/api-gitattributes.txt   |  2 +-
 Documentation/technical/pack-protocol.txt   |  8 
 Documentation/technical/protocol-common.txt |  2 +-
 Documentation/user-manual.txt   |  2 +-
 25 files changed, 43 insertions(+), 44 deletions(-)

diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index ef67b53..b99fa87 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -91,13 +91,13 @@ For shell scripts specifically (not exhaustive):
E.g.: my_function () {
 
  - As to use of grep, stick to a subset of BRE (namely, no \{m,n\},
-   [::], [==], nor [..]) for portability.
+   [::], [==], or [..]) for portability.
 
- We do not use \{m,n\};
 
- We do not use -E;
 
-   - We do not use ? nor + (which are \{0,1\} and \{1,\}
+   - We do not use ? or + (which are \{0,1\} and \{1,\}
  respectively in BRE) but that goes without saying as these
  are ERE elements not BRE (note that \? and \+ are not even part
  of BRE -- making them accessible from BRE is a GNU extension).
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 5f4d793..c26a7c8 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -78,8 +78,8 @@ be escaped: use `\"` for `"` and `\\` for `\`.
 
 The following escape sequences (beside `\"` and `\\`) are recognized:
 `\n` for newline character (NL), `\t` for horizontal tabulation (HT, TAB)
-and `\b` for backspace (BS).  No other char escape sequence, nor octal
-char sequences are valid.
+and `\b` for backspace (BS).  Other char escape sequences (including octal
+escape sequences) are invalid.
 
 Variable values ending in a `\` are continued on the next line in the
 customary UNIX fashion.
@@ -827,7 +827,7 @@ color.diff::
commands will only use color when output is to the terminal.
Defaults to false.
 +
-This does not affect linkgit:git-format-patch[1] nor the
+This does not affect linkgit:git-format-patch[1] or the
 'git-diff-{asterisk}' plumbing commands.  Can be overridden on the
 command line with the `--color[=]` option.
 
diff --git a/Documentation/diff-generate-patch.txt 
b/Documentation/diff-generate-patch.txt
index 55f499a..843a20b 100644
--- a/Documentation/diff-generate-patch.txt
+++ b/Documentation/diff-generate-patch.txt
@@ -174,7 +174,7 @@ added, from the point of view of that parent).
 In the above example output, the function signature was changed
 from both files (hence two `-` removals from both file1 and
 file2, plus `++` to mean one line that was added does not appear
-in either file1 nor file2).  Also eight other lines are the same
+in either file1 or file2).  Also eight other lines are the same
 from file1 but do not appear in file2 (hence prefixed with `+`).
 
 When shown by `git diff-tree -c`, it compares the parents of a
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 9b37b2a..6cb083a 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -358,7 +358,7 @@ endif::git-log[]
 --irreversible-delete::
Omit the preimage for deletes, i.e. print only the header but not
the diff between the preimage and `/dev/null`. The resulting patch
-   is not meant to be applied with `patch` nor `git apply`; this is
+   is not meant to be applied with `patch` or `git apply`; this is
solely for people who want to just concentrate on reviewing the
text after the change. In addition, the output obviously lack
enough information to apply such a patch in reverse, even manually,
diff --git a/Doc

[PATCH 3/6] l10n: Fix misuses of "nor"

2014-03-15 Thread Justin Lebar
Signed-off-by: Justin Lebar 
---
 po/bg.po| 6 +++---
 po/de.po| 6 +++---
 po/fr.po| 6 +++---
 po/git.pot  | 6 +++---
 po/it.po| 2 +-
 po/pt_PT.po | 2 +-
 po/sv.po| 6 +++---
 po/vi.po| 6 +++---
 po/zh_CN.po | 6 +++---
 9 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/po/bg.po b/po/bg.po
index fb450b2..983e575 100644
--- a/po/bg.po
+++ b/po/bg.po
@@ -3699,13 +3699,13 @@ msgstr ""
 
 #: builtin/clean.c:906
 msgid ""
-"clean.requireForce set to true and neither -i, -n nor -f given; refusing to "
+"clean.requireForce set to true and neither -i, -n, nor -f given; refusing to "
 "clean"
 msgstr ""
 
 #: builtin/clean.c:909
 msgid ""
-"clean.requireForce defaults to true and neither -i, -n nor -f given; "
+"clean.requireForce defaults to true and neither -i, -n, nor -f given; "
 "refusing to clean"
 msgstr ""
 
@@ -4253,7 +4253,7 @@ msgid "Clever... amending the last one with dirty index."
 msgstr ""
 
 #: builtin/commit.c:1126
-msgid "Explicit paths specified without -i nor -o; assuming --only paths..."
+msgid "Explicit paths specified without -i or -o; assuming --only paths..."
 msgstr ""
 
 #: builtin/commit.c:1136 builtin/tag.c:572
diff --git a/po/de.po b/po/de.po
index b777ef4..f539bf5 100644
--- a/po/de.po
+++ b/po/de.po
@@ -3876,7 +3876,7 @@ msgstr "Die Optionen -x und -X können nicht gemeinsam 
verwendet werden."
 
 #: builtin/clean.c:906
 msgid ""
-"clean.requireForce set to true and neither -i, -n nor -f given; refusing to "
+"clean.requireForce set to true and neither -i, -n, or -f given; refusing to "
 "clean"
 msgstr ""
 "clean.requireForce auf \"true\" gesetzt und weder -i, -n noch -f gegeben; "
@@ -3884,7 +3884,7 @@ msgstr ""
 
 #: builtin/clean.c:909
 msgid ""
-"clean.requireForce defaults to true and neither -i, -n nor -f given; "
+"clean.requireForce defaults to true and neither -i, -n, or -f given; "
 "refusing to clean"
 msgstr ""
 "clean.requireForce standardmäßig auf \"true\" gesetzt und weder -i, -n noch -"
@@ -4496,7 +4496,7 @@ msgstr ""
 "Klug... den letzten Commit mit einer geänderten Staging-Area nachbessern."
 
 #: builtin/commit.c:1126
-msgid "Explicit paths specified without -i nor -o; assuming --only paths..."
+msgid "Explicit paths specified without -i or -o; assuming --only paths..."
 msgstr ""
 "Explizite Pfade ohne -i oder -o angegeben; unter der Annahme von --only "
 "Pfaden..."
diff --git a/po/fr.po b/po/fr.po
index 0b9d59e..9683264 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -3917,7 +3917,7 @@ msgstr "-x et -X ne peuvent pas être utilisés ensemble"
 
 #: builtin/clean.c:906
 msgid ""
-"clean.requireForce set to true and neither -i, -n nor -f given; refusing to "
+"clean.requireForce set to true and neither -i, -n, or -f given; refusing to "
 "clean"
 msgstr ""
 "clean.requireForce positionné à true et ni -i, -n ou -f fourni ; refus de "
@@ -3925,7 +3925,7 @@ msgstr ""
 
 #: builtin/clean.c:909
 msgid ""
-"clean.requireForce defaults to true and neither -i, -n nor -f given; "
+"clean.requireForce defaults to true and neither -i, -n, or -f given; "
 "refusing to clean"
 msgstr ""
 "clean.requireForce à true par défaut et ni -i, -n ou -f fourni ; refus de "
@@ -4526,7 +4526,7 @@ msgid "Clever... amending the last one with dirty index."
 msgstr "Malin... correction du dernier avec un index sale."
 
 #: builtin/commit.c:1126
-msgid "Explicit paths specified without -i nor -o; assuming --only paths..."
+msgid "Explicit paths specified without -i or -o; assuming --only paths..."
 msgstr "Chemins explicites spécifiés sans -i ni -o ; --only supposé..."
 
 #: builtin/commit.c:1136 builtin/tag.c:572
diff --git a/po/git.pot b/po/git.pot
index 33cc31d..3553bfc 100644
--- a/po/git.pot
+++ b/po/git.pot
@@ -3598,13 +3598,13 @@ msgstr ""
 
 #: builtin/clean.c:906
 msgid ""
-"clean.requireForce set to true and neither -i, -n nor -f given; refusing to "
+"clean.requireForce set to true and neither -i, -n, or -f given; refusing to "
 "clean"
 msgstr ""
 
 #: builtin/clean.c:909
 msgid ""
-"clean.requireForce defaults to true and neither -i, -n nor -f given; "
+"clean.requireForce defaults to true and neither -i, -n, or -f given; "
 "refusing to clean"
 msgstr ""
 
@@ -4150,7 +4150,7 @@ msgid "Clever... amending the last one with dirty index."
 msgstr ""
 
 #: builtin/commit.c:1126
-msgid "Explicit paths specified without -i nor -o; assuming --only paths..."
+msgid "Explicit paths specified without -i or -o; assuming --only paths..."
 msgstr ""
 
 #: builtin/commit.c:1136 builtin/tag.c:572
diff --git a/po/it.po b/po/it.po
index 9080219..e0ad39a 100644
--- a/po/it.po
+++ b/po/it.po
@@ -2316,7 +2316,7 @@ msgid "Clever... amending the last one with dirty index."
 msgstr ""
 
 #: builtin/commit.c:1059
-msgid "Explicit paths specified without -i nor -o; assuming --only paths..."
+msgid "Explicit paths specified without -i or -o; assuming --only paths..."
 msgstr ""
 
 #: builtin/commit.c:1069 builtin/tag.c:577
diff --git a/po/pt_PT.po b/po/pt_PT.po
index 689ad1b..d74

Re: [PATCH 0/6] Fix misuses of "nor"

2014-03-15 Thread Duy Nguyen
On Sat, Mar 15, 2014 at 3:41 PM, Justin Lebar  wrote:
> I got annoyed by git's awkward use of "nor" in man pages and in git add -p, so
> I went ahead and audited all uses of "nor" in the tree.  One might be able to
> argue that some of the uses I've changed are technically acceptable, but 
> that's
> a pretty low bar to set for ourselves.  I aimed to make everything both 
> correct
> and idiomatic.

I guess I'm cc'd because I made a few of those or/nor mistakes. Being
a non-native English speaker I'm not really qualified to review this.
But I suggest that you merge "Fix misuses of "nor" outside comments"
and "Tests: Fix muses of "nor"" into one. Otherwise you break the test
suite at 5/6 (and 6/6 fixes it, but breaking the test suite at any
commit is not very bisect-friendly).
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] test-lib.sh: use printf instead of echo

2014-03-15 Thread Johannes Sixt
Am 15.03.2014 00:57, schrieb Uwe Storbeck:
> when variables may contain backslash sequences.
> 
> Backslash sequences are interpreted as control characters
> by the echo command of some shells (e.g. dash).
> 
> Signed-off-by: Uwe Storbeck 
> ---
>  t/test-lib.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 1531c24..8209204 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -277,7 +277,7 @@ error "Test script did not set test_description."
>  
>  if test "$help" = "t"
>  then
> - echo "$test_description"
> + printf '%s\n' "$test_description"
>   exit 0
>  fi
>  
> @@ -328,7 +328,7 @@ test_failure_ () {
>   test_failure=$(($test_failure + 1))
>   say_color error "not ok $test_count - $1"
>   shift
> - echo "$@" | sed -e 's/^/#   /'
> + printf '%s\n' "$@" | sed -e 's/^/#  /'

This should be

printf '%s\n' "$*" | sed -e 's/^/#  /'

>   test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; }
>  }
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] add: Use struct argv_array in run_add_interactive()

2014-03-15 Thread Fabian Ruch
run_add_interactive() in builtin/add.c manually computes array bounds
and allocates a static args array to build the add--interactive command
line, which is error-prone. Use the argv-array helper functions instead.

Signed-off-by: Fabian Ruch 
---
 builtin/add.c | 21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/builtin/add.c b/builtin/add.c
index 4b045ba..459208a 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -15,6 +15,7 @@
 #include "diffcore.h"
 #include "revision.h"
 #include "bulk-checkin.h"
+#include "argv-array.h"
 
 static const char * const builtin_add_usage[] = {
N_("git add [options] [--] ..."),
@@ -141,23 +142,21 @@ static void refresh(int verbose, const struct pathspec 
*pathspec)
 int run_add_interactive(const char *revision, const char *patch_mode,
const struct pathspec *pathspec)
 {
-   int status, ac, i;
-   const char **args;
+   int status, i;
+   struct argv_array argv = ARGV_ARRAY_INIT;
 
-   args = xcalloc(sizeof(const char *), (pathspec->nr + 6));
-   ac = 0;
-   args[ac++] = "add--interactive";
+   argv_array_push(&argv, "add--interactive");
if (patch_mode)
-   args[ac++] = patch_mode;
+   argv_array_push(&argv, patch_mode);
if (revision)
-   args[ac++] = revision;
-   args[ac++] = "--";
+   argv_array_push(&argv, revision);
+   argv_array_push(&argv, "--");
for (i = 0; i < pathspec->nr; i++)
/* pass original pathspec, to be re-parsed */
-   args[ac++] = pathspec->items[i].original;
+   argv_array_push(&argv, pathspec->items[i].original);
 
-   status = run_command_v_opt(args, RUN_GIT_CMD);
-   free(args);
+   status = run_command_v_opt(argv.argv, RUN_GIT_CMD);
+   argv_array_clear(&argv);
return status;
 }
 
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/7] test patch hunk editing with "commit -p -m"

2014-03-15 Thread Torsten Bögershausen
On 2014-03-11 22.03, Junio C Hamano wrote:
> Benoit Pierre  writes:
> 
>> Add (failing) test: with commit changing the environment to let hooks
>> now that no editor will be used (by setting GIT_EDITOR to ":"), the
>> "edit hunk" functionality does not work (no editor is launched and the
>> whole hunk is committed).
>>
>> Signed-off-by: Benoit Pierre 
>> ---
>>  t/t7513-commit_-p_-m_hunk_edit.sh | 34 ++
>>  1 file changed, 34 insertions(+)
>>  create mode 100755 t/t7513-commit_-p_-m_hunk_edit.sh
>>
>> diff --git a/t/t7513-commit_-p_-m_hunk_edit.sh 
>> b/t/t7513-commit_-p_-m_hunk_edit.sh
> 
> I'll move this to t/t7514-commit-patch.sh for now while queuing.

This line is problematic:
echo e | env GIT_EDITOR="sed s/+line3\$/+line2/ -i" git commit -p -m 
commit2 f

(sed -i is not portable:
http://pubs.opengroup.org/onlinepubs/007908799/xcu/sed.html)

The whole test hangs in a forever loop loop under MacOS:
debug=t verbose=t ./t7514-commit-patch.sh 
Stage this hunk [y,n,q,a,d,/,e,?]? @@ -1 +1,2 @@
 line1
+line3

I think perl can be used instead of sed (but I haven't found the exact syntax 
yet)

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: What's cooking in git.git (Mar 2014, #03; Fri, 14)

2014-03-15 Thread Duy Nguyen
On Sat, Mar 15, 2014 at 5:09 AM, Junio C Hamano  wrote:
> * nd/multiple-work-trees (2014-03-06) 28 commits
>  - FIXUP: minimum compilation fix
>  - count-objects: report unused files in $GIT_DIR/repos/...
>  - gc: support prune --repos
>  - gc: style change -- no SP before closing bracket
>  - prune: strategies for linked checkouts
>  - checkout: detach if the branch is already checked out elsewhere
>  - checkout: clean up half-prepared directories in --to mode
>  - checkout: support checking out into a new working directory
>  - use new wrapper write_file() for simple file writing
>  - wrapper.c: wrapper to open a file, fprintf then close
>  - setup.c: support multi-checkout repo setup
>  - setup.c: detect $GIT_COMMON_DIR check_repository_format_gently()
>  - setup.c: convert check_repository_format_gently to use strbuf
>  - setup.c: detect $GIT_COMMON_DIR in is_git_directory()
>  - setup.c: convert is_git_directory() to use strbuf
>  - git-stash: avoid hardcoding $GIT_DIR/logs/
>  - *.sh: avoid hardcoding $GIT_DIR/hooks/...
>  - git-sh-setup.sh: use rev-parse --git-path to get $GIT_DIR/objects
>  - Add new environment variable $GIT_COMMON_DIR
>  - commit: use SEQ_DIR instead of hardcoding "sequencer"
>  - fast-import: use git_path() for accessing .git dir instead of get_git_dir()
>  - reflog: avoid constructing .lock path with git_path
>  - *.sh: respect $GIT_INDEX_FILE
>  - Make git_path() aware of file relocation in $GIT_DIR
>  - path.c: group git_path(), git_pathdup() and strbuf_git_path() together
>  - path.c: rename vsnpath() to do_git_path()
>  - Convert git_snpath() to strbuf_git_path()
>  - path.c: make get_pathname() return strbuf instead of static buffer
>
>  The series needs a serious review.

There are two minor fixes [1] [2] on top of v5, but I'm not going to
send v6 again unless I see more substantial changes. Just give me a
signal or something before you merge to next so I have a chance to fix
them if v6 never comes.

[1] http://article.gmane.org/gmane.comp.version-control.git/243693
[2] http://article.gmane.org/gmane.comp.version-control.git/243692
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add: Use struct argv_array in run_add_interactive()

2014-03-15 Thread Fabian Ruch
On 03/15/2014 12:14 PM, Fabian Ruch wrote:
> run_add_interactive() in builtin/add.c manually computes array bounds
> and allocates a static args array to build the add--interactive command
> line, which is error-prone. Use the argv-array helper functions instead.
> 
> Signed-off-by: Fabian Ruch 
> ---
>  builtin/add.c | 21 ++---
>  1 file changed, 10 insertions(+), 11 deletions(-)

I should mention that I am applying to this year's edition of Google's
Summer of Code.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mv: prevent mismatched data when ignoring errors.

2014-03-15 Thread Thomas Rast
"brian m. carlson"  writes:

> We shrink the source and destination arrays, but not the modes or
> submodule_gitfile arrays, resulting in potentially mismatched data.  Shrink
> all the arrays at the same time to prevent this.
>
> Signed-off-by: brian m. carlson 
> ---
>  builtin/mv.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/builtin/mv.c b/builtin/mv.c
> index f99c91e..b20cd95 100644
> --- a/builtin/mv.c
> +++ b/builtin/mv.c
> @@ -230,6 +230,11 @@ int cmd_mv(int argc, const char **argv, const char 
> *prefix)
>   memmove(destination + i,
>   destination + i + 1,
>   (argc - i) * sizeof(char *));
> + memmove(modes + i, modes + i + 1,
> + (argc - i) * sizeof(char *));

This isn't right -- you are computing the size of things to be moved
based on a type of char*, but 'modes' is an enum.

(Valgrind spotted this.)

-- 
Thomas Rast
t...@thomasrast.ch
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/7] test patch hunk editing with "commit -p -m"

2014-03-15 Thread Benoit Pierre
On Sat, Mar 15, 2014 at 1:28 PM, Torsten Bögershausen  wrote:
> On 2014-03-11 22.03, Junio C Hamano wrote:
>> Benoit Pierre  writes:
>>
>>> Add (failing) test: with commit changing the environment to let hooks
>>> now that no editor will be used (by setting GIT_EDITOR to ":"), the
>>> "edit hunk" functionality does not work (no editor is launched and the
>>> whole hunk is committed).
>>>
>>> Signed-off-by: Benoit Pierre 
>>> ---
>>>  t/t7513-commit_-p_-m_hunk_edit.sh | 34 ++
>>>  1 file changed, 34 insertions(+)
>>>  create mode 100755 t/t7513-commit_-p_-m_hunk_edit.sh
>>>
>>> diff --git a/t/t7513-commit_-p_-m_hunk_edit.sh 
>>> b/t/t7513-commit_-p_-m_hunk_edit.sh
>>
>> I'll move this to t/t7514-commit-patch.sh for now while queuing.
>
> This line is problematic:
> echo e | env GIT_EDITOR="sed s/+line3\$/+line2/ -i" git commit -p -m 
> commit2 f
>
> (sed -i is not portable:
> http://pubs.opengroup.org/onlinepubs/007908799/xcu/sed.html)
>
> The whole test hangs in a forever loop loop under MacOS:
> debug=t verbose=t ./t7514-commit-patch.sh
> Stage this hunk [y,n,q,a,d,/,e,?]? @@ -1 +1,2 @@
>  line1
> +line3
>
> I think perl can be used instead of sed (but I haven't found the exact syntax 
> yet)

Or maybe change the test to just 'touch' a temporary file or change
its content like Jun Hao did with for its version of the tests:

https://github.com/bloomberg/git/compare/commit-patch-allow-hunk-editing

Should I make a third version? I'll simplify and move the tests to
t/t7514-commit-patch.sh and add a test for the '--dry-run' case. And
also:
- 'now' => 'know' in one of the commit message
- sign off the last patch (which I forgot to do)
- fix the indentation in one of the patch

-- 
A: Because it destroys the flow of conversation.
Q: Why is top posting dumb?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


git submodule update "checkout" update mode

2014-03-15 Thread 乙酸鋰
Hi,

In 2.0.0 release notes (00eda23),
Newly cloned submodule repositories by "git submodule update",
   when the "checkout" update mode is used, will be on a local
   branch instead of on a detached HEAD, just like submodules added
   with "git submodule add".

It is not clear.
1. Is "checkout" update mode the default? (when without any command
line options)
2. Does "merge" update mode checkouts a local branch instead of on a
detached HEAD?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GSOC] Git Configuration API improvements

2014-03-15 Thread karthik nayak
On Fri, Mar 14, 2014 at 10:01 AM, Jeff King  wrote:
> On Tue, Mar 11, 2014 at 09:49:33PM +0530, karthik nayak wrote:
>
>> On Tue, Mar 11, 2014 at 8:21 PM, Matthieu Moy
>>  wrote:
>> > karthik nayak  writes:
>> >
>> >> Currently we have multiple invocation of git_config() in an
>> >> individual invocation of git() which is not efficient. Also, it is
>> >> hard to implement new features,
>> >
>> > I think efficiency is not a real concern here. Config files are small
>> > and easy to parse, so parsing them multiple times isn't really
>> > noticeable from the performance point of view.
>> >
>> > OTOH, the extensibility is a real concern, and that should be the main
>> > motivation for the project.
>>
>> Thanks. I understand what you mean. extensibility is the main motivation of 
>> the
>> project, i think that by implementing the cache system we can fix the
>> small problems
>> (reappearing of headers while setting and unsetting configs) and also
>> implement new features
>> like to unset a config easily.
>
> I think the most interesting part of the config idea is turning the
> fetching of config variables "inside out".
>
> That is, right now we turn control over to the config code, which
> invokes our callbacks. So we see all variables in sequence, and pick out
> the ones that are interesting.  We implement precedence with a "last one
> wins" technique where we keep overwriting a variable with subsequent
> config options.
>
> This can lead to difficult ordering situations, such as when a config
> option _might_ be respected based on another factor (e.g., the presence
> of a command line option, as in the status.branch option).
>
> It also means that it's impossible to tell after the fact whether a
> value was set explicitly on the command line, by config, or if we are
> using a system default. Most of the time this doesn't matter, but there
> are a few cases where we care, and we end up having to manually manage
> a separate flag in each case.
>
> By the phrase "inside out" above, I mean that we could read all config,
> and then fetch individual values as we need them. We do need to care
> about efficiency here, but only insofar as we don't cause any
> regressions (that is, the current system is fine speed-wise, we just
> need to make sure that we do not create new problems by calling a slow
> lookup in a tight loop or anything like that).
>
> -Peff

Hello Jeff,
Like you said yes, this will be a complete "inside out" change. Thanks
for summing it up, really helpful.
Currently i am going through the code and understanding how it works currently.
Simultaneously working on the proposal[1], would be great to have your
feedback on that.
Thanks,
Karthik

[1] https://gist.github.com/KarthikNayak/98569dd34326f7e6813a
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/1] general style: replaces memcmp() with starts_with()

2014-03-15 Thread Quint Guvernator
Hi, folks.

I've looked through the list's responses and removed the most objectionable
hunks from the patch v2, especially in cases where starts_with either hurts
readability or further obscures the use of magic numbers. Let me know what you
all think about the changes.

Thank you all again for your help. This is my first patch here, and has been
quite a microproject indeed!

Quint Guvernator (1):
  general style: replaces memcmp() with starts_with()

 builtin/apply.c   |  6 +++---
 builtin/for-each-ref.c|  2 +-
 builtin/get-tar-commit-id.c   |  2 +-
 builtin/mktag.c   |  8 
 builtin/patch-id.c| 18 +-
 commit.c  |  4 ++--
 connect.c |  6 +++---
 contrib/convert-objects/convert-objects.c |  6 +++---
 convert.c |  2 +-
 http-walker.c |  2 +-
 imap-send.c   |  6 +++---
 pack-write.c  |  2 +-
 remote.c  |  2 +-
 13 files changed, 33 insertions(+), 33 deletions(-)

-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/1] general style: replaces memcmp() with starts_with()

2014-03-15 Thread Quint Guvernator
memcmp() is replaced with negated starts_with() when comparing strings
from the beginning and when it is logical to do so. starts_with() looks
nicer and it saves the extra argument of the length of the comparing
string.

Signed-off-by: Quint Guvernator 
---
 builtin/apply.c   |  6 +++---
 builtin/for-each-ref.c|  2 +-
 builtin/get-tar-commit-id.c   |  2 +-
 builtin/mktag.c   |  8 
 builtin/patch-id.c| 18 +-
 commit.c  |  4 ++--
 connect.c |  6 +++---
 contrib/convert-objects/convert-objects.c |  6 +++---
 convert.c |  2 +-
 http-walker.c |  2 +-
 imap-send.c   |  6 +++---
 pack-write.c  |  2 +-
 remote.c  |  2 +-
 13 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/builtin/apply.c b/builtin/apply.c
index 0189523..de84dce 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1631,7 +1631,7 @@ static int parse_fragment(const char *line, unsigned long 
size,
 * l10n of "\ No newline..." is at least that long.
 */
case '\\':
-   if (len < 12 || memcmp(line, "\\ ", 2))
+   if (len < 12 || !starts_with(line, "\\ "))
return -1;
break;
}
@@ -1646,7 +1646,7 @@ static int parse_fragment(const char *line, unsigned long 
size,
 * it in the above loop because we hit oldlines == newlines == 0
 * before seeing it.
 */
-   if (12 < size && !memcmp(line, "\\ ", 2))
+   if (12 < size && starts_with(line, "\\ "))
offset += linelen(line, size);
 
patch->lines_added += added;
@@ -1673,7 +1673,7 @@ static int parse_single_patch(const char *line, unsigned 
long size, struct patch
unsigned long oldlines = 0, newlines = 0, context = 0;
struct fragment **fragp = &patch->fragments;
 
-   while (size > 4 && !memcmp(line, "@@ -", 4)) {
+   while (size > 4 && starts_with(line, "@@ -")) {
struct fragment *fragment;
int len;
 
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 3e1d5c3..4135980 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -193,7 +193,7 @@ static int verify_format(const char *format)
at = parse_atom(sp + 2, ep);
cp = ep + 1;
 
-   if (!memcmp(used_atom[at], "color:", 6))
+   if (starts_with(used_atom[at], "color:"))
need_color_reset_at_eol = !!strcmp(used_atom[at], 
color_reset);
}
return 0;
diff --git a/builtin/get-tar-commit-id.c b/builtin/get-tar-commit-id.c
index aa72596..6409c26 100644
--- a/builtin/get-tar-commit-id.c
+++ b/builtin/get-tar-commit-id.c
@@ -29,7 +29,7 @@ int cmd_get_tar_commit_id(int argc, const char **argv, const 
char *prefix)
die("git get-tar-commit-id: read error");
if (header->typeflag[0] != 'g')
return 1;
-   if (memcmp(content, "52 comment=", 11))
+   if (!starts_with(content, "52 comment="))
return 1;
 
n = write_in_full(1, content + 11, 41);
diff --git a/builtin/mktag.c b/builtin/mktag.c
index 640ab64..70385ac 100644
--- a/builtin/mktag.c
+++ b/builtin/mktag.c
@@ -49,7 +49,7 @@ static int verify_tag(char *buffer, unsigned long size)
 
/* Verify object line */
object = buffer;
-   if (memcmp(object, "object ", 7))
+   if (!starts_with(object, "object "))
return error("char%d: does not start with \"object \"", 0);
 
if (get_sha1_hex(object + 7, sha1))
@@ -57,7 +57,7 @@ static int verify_tag(char *buffer, unsigned long size)
 
/* Verify type line */
type_line = object + 48;
-   if (memcmp(type_line - 1, "\ntype ", 6))
+   if (!starts_with(type_line - 1, "\ntype "))
return error("char%d: could not find \"\\ntype \"", 47);
 
/* Verify tag-line */
@@ -66,7 +66,7 @@ static int verify_tag(char *buffer, unsigned long size)
return error("char%"PRIuMAX": could not find next \"\\n\"",
(uintmax_t) (type_line - buffer));
tag_line++;
-   if (memcmp(tag_line, "tag ", 4) || tag_line[4] == '\n')
+   if (!starts_with(tag_line, "tag ") || tag_line[4] == '\n')
return error("char%"PRIuMAX": no \"tag \" found",
(uintmax_t) (tag_line - buffer));
 
@@ -98,7 +98,7 @@ static int verify_tag(char *buffer, unsigned long size)
/* Verify the tagger line */
tagger_line = tag_line;
 
-   if (memcmp(tagger_line, "tagger ", 7))
+   if (!starts_with(tagger_line, "tagger "))
  

Re: [PATCH 0/6] Fix misuses of "nor"

2014-03-15 Thread Justin Lebar
> I guess I'm cc'd because I made a few of those or/nor mistakes.

I actually didn't look that closely at the blame; I cc'ed you because
you were a top contributor in a few of the directories I was touching.

> I suggest that you merge "Fix misuses of "nor" outside comments"
> and "Tests: Fix muses of "nor"" into one. Otherwise you break the test
> suite at 5/6

Sure thing, will do.

There's a similar incompatibility with the l10n change and "Fix
misuses of "nor" outside comments": The former references strings
changed in the latter.  Should I merge these, or should I enforce a
particular ordering between these patches?  (Right now the l10n patch
comes before the string changes in the code, but that's probably wrong
now that I think about it.)

> Being a non-native English speaker I'm not really qualified to review this.

FWIW even being a native English speaker I was unsure about a few of
the changes myself.  This caused me to finally break down and order
Garner's Modern American Usage, which I hope will reveal all.  :)

-Justin

On Sat, Mar 15, 2014 at 1:56 AM, Duy Nguyen  wrote:
> On Sat, Mar 15, 2014 at 3:41 PM, Justin Lebar  wrote:
>> I got annoyed by git's awkward use of "nor" in man pages and in git add -p, 
>> so
>> I went ahead and audited all uses of "nor" in the tree.  One might be able to
>> argue that some of the uses I've changed are technically acceptable, but 
>> that's
>> a pretty low bar to set for ourselves.  I aimed to make everything both 
>> correct
>> and idiomatic.
>
> I guess I'm cc'd because I made a few of those or/nor mistakes. Being
> a non-native English speaker I'm not really qualified to review this.
> But I suggest that you merge "Fix misuses of "nor" outside comments"
> and "Tests: Fix muses of "nor"" into one. Otherwise you break the test
> suite at 5/6 (and 6/6 fixes it, but breaking the test suite at any
> commit is not very bisect-friendly).
> --
> Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] mv: prevent mismatched data when ignoring errors.

2014-03-15 Thread brian m. carlson
We shrink the source and destination arrays, but not the modes or
submodule_gitfile arrays, resulting in potentially mismatched data.  Shrink
all the arrays at the same time to prevent this.  Add tests to ensure the
problem does not recur.

Signed-off-by: brian m. carlson 
---

I attempted to come up with a second patch that would refactor out the
four different arrays into one array of struct, as Jeff suggested, but
it became very ugly very quickly.  So this patch simply fixes the
problem and adds tests.

 builtin/mv.c  |  5 +
 t/t7001-mv.sh | 13 -
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/builtin/mv.c b/builtin/mv.c
index f99c91e..09bbc63 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -230,6 +230,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
memmove(destination + i,
destination + i + 1,
(argc - i) * sizeof(char *));
+   memmove(modes + i, modes + i + 1,
+   (argc - i) * sizeof(enum 
update_mode));
+   memmove(submodule_gitfile + i,
+   submodule_gitfile + i + 1,
+   (argc - i) * sizeof(char *));
i--;
}
} else
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index e3c8c2c..215d43d 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -294,7 +294,8 @@ test_expect_success 'setup submodule' '
git submodule add ./. sub &&
echo content >file &&
git add file &&
-   git commit -m "added sub and file"
+   git commit -m "added sub and file" &&
+   git branch submodule
 '
 
 test_expect_success 'git mv cannot move a submodule in a file' '
@@ -463,4 +464,14 @@ test_expect_success 'checking out a commit before 
submodule moved needs manual u
! test -s actual
 '
 
+test_expect_success 'mv -k does not accidentally destroy submodules' '
+   git checkout submodule &&
+   mkdir dummy dest &&
+   git mv -k dummy sub dest &&
+   git status --porcelain >actual &&
+   grep "^R  sub -> dest/sub" actual &&
+   git reset --hard &&
+   git checkout .
+'
+
 test_done
-- 
1.9.0.1010.g6633b85.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Migration from Github hosted git repository to local server.

2014-03-15 Thread shyam218
Hi All,

Could some one help me on this please,we have few repositories in the Github
and out of them couple of them are using encryption with
git-encrypt(https://github.com/shadowhand/git-encrypt)using this they have
encrypted the whole repo.

Now,we got a requirement to move all those repositories to In house
server,just for preserving the source code from hosting in third party tool.

Anybody help me in migrating them with out loosing any history and i really
appreciate if some one can give a detailed steps on how to decrypt the
encrypted file(procedure mentioned in the git-encrypt wasn't helpful
(https://github.com/shadowhand/git-encrypt) and the link for decryption
mentioned in it is also not working)

Regards,
Shyam.



--
View this message in context: 
http://git.661346.n2.nabble.com/Migration-from-Github-hosted-git-repository-to-local-server-tp7605713.html
Sent from the git mailing list archive at Nabble.com.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] reset: Print a warning when user uses "git reset" during a merge

2014-03-15 Thread Marc Branchaud

On 14-03-14 04:55 PM, Junio C Hamano wrote:


So I am OK with "eventually error out by default", but not OK with
"we know better than the user and will not allow it at all".


Can I interpret that as you being OK with my proposed "Cowardly 
refusing" approach?


M.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/7] test patch hunk editing with "commit -p -m"

2014-03-15 Thread Torsten Bögershausen
On 2014-03-15 17.11, Benoit Pierre wrote:
> On Sat, Mar 15, 2014 at 1:28 PM, Torsten Bögershausen  wrote:
>> On 2014-03-11 22.03, Junio C Hamano wrote:
>>> Benoit Pierre  writes:
>>>
 Add (failing) test: with commit changing the environment to let hooks
 now that no editor will be used (by setting GIT_EDITOR to ":"), the
 "edit hunk" functionality does not work (no editor is launched and the
 whole hunk is committed).

 Signed-off-by: Benoit Pierre 
 ---
  t/t7513-commit_-p_-m_hunk_edit.sh | 34 ++
  1 file changed, 34 insertions(+)
  create mode 100755 t/t7513-commit_-p_-m_hunk_edit.sh

 diff --git a/t/t7513-commit_-p_-m_hunk_edit.sh 
 b/t/t7513-commit_-p_-m_hunk_edit.sh
>>>
>>> I'll move this to t/t7514-commit-patch.sh for now while queuing.
>>
>> This line is problematic:
>> echo e | env GIT_EDITOR="sed s/+line3\$/+line2/ -i" git commit -p -m 
>> commit2 f
>>
>> (sed -i is not portable:
>> http://pubs.opengroup.org/onlinepubs/007908799/xcu/sed.html)
>>
>> The whole test hangs in a forever loop loop under MacOS:
>> debug=t verbose=t ./t7514-commit-patch.sh
>> Stage this hunk [y,n,q,a,d,/,e,?]? @@ -1 +1,2 @@
>>  line1
>> +line3
>>
>> I think perl can be used instead of sed (but I haven't found the exact 
>> syntax yet)
> 
> Or maybe change the test to just 'touch' a temporary file or change
> its content like Jun Hao did with for its version of the tests:
> 
> https://github.com/bloomberg/git/compare/commit-patch-allow-hunk-editing
> 
> Should I make a third version? I'll simplify and move the tests to
> t/t7514-commit-patch.sh and add a test for the '--dry-run' case. And
> also:
> - 'now' => 'know' in one of the commit message
> - sign off the last patch (which I forgot to do)
> - fix the indentation in one of the patch
> 
The following works for me, (diff against pu)
(and if you want to send a 3rd version, please do so :-)

diff --git a/t/t7514-commit-patch.sh b/t/t7514-commit-patch.sh
index 1f05d32..da92669 100755
--- a/t/t7514-commit-patch.sh
+++ b/t/t7514-commit-patch.sh
@@ -25,10 +25,20 @@ test_expect_success 'setup (initial)' '
EOF
 '
 
+write_script .git/FAKE_EDITOR <<\EOF
+   sed -e "s/+line3\$/+line2/" <"$1" >tmp &&
+   mv -f tmp "$1"
+   exit 0
+EOF
+
 test_expect_success 'edit hunk "commit -p -m message"' '
-   echo e | env GIT_EDITOR="sed s/+line3\$/+line2/ -i" git commit -p -m 
commit2 file &&
-   git diff HEAD^ HEAD >actual &&
-   test_cmp expect actual
+   (
+   GIT_EDITOR="\"$(pwd)/.git/FAKE_EDITOR\"" &&
+   export GIT_EDITOR &&
+   echo e | git commit -p -m commit2 file &&
+   git diff HEAD^ HEAD >actual &&
+   test_cmp expect actual
+   )
 '
 
 test_done

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GSOC2014] Invent a New Conflict Style

2014-03-15 Thread TamerTas
Hello everyone,

I'm Tamer Tas. I am studying computer engineering in Turkey.
I'm about to complete my junior year in Middle East Technical University.

After setting up my git development environment,
I've submitted patches to a microproject [1][2][3]. I'm still getting feedbacks 
on
the microproject. Feedback cycle has been very informative. 

I am interested in developing history repair tools for git. For the past days 
I've been learning about how git manages history, inspecting git fsck, replace, 
hash-object.
Also I've learned how git filter-branch is used to rewrite history and the 
drawbacks of this approach.
I've submitted the first draft of my proposal and I would love to get a 
feedback from
Jeff King or Michael Haggarty (Mentors of the project) or the community so I 
can improve my proposal.

If you have any questions please feel free to ask. 
Thanks in advance.

Tamer Tas

[1]http://git.661346.n2.nabble.com/PATCH-GSOC2014-changed-logical-chain-in-branch-c-to-lookup-tables-tt7605343.html
[2]http://git.661346.n2.nabble.com/PATCH-GSOC2014-install-branch-config-change-logical-chain-to-lookup-table-tt7605550.html
[3]http://git.661346.n2.nabble.com/PATCH-GSOC2014-install-branch-config-change-logical-chain-to-lookup-table-tt7605550.html#a7605663
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GSOC2014] History Repair Tools

2014-03-15 Thread TamerTas
Hello everyone,

I'm Tamer Tas. I am studying computer engineering in Turkey.
I'm about to complete my junior year in Middle East Technical University.

After setting up my git development environment,
I've submitted patches to a microproject [1][2][3]. I'm still getting feedbacks 
on
the microproject. Feedback cycle has been very informative. 

I am interested in developing history repair tools for git. For the past days 
I've been learning about how git manages history, inspecting git fsck, replace, 
hash-object.
Also I've learned how git filter-branch is used to rewrite history and the 
drawbacks of this approach.
I've submitted the first draft of my proposal and I would love to get a 
feedback from
Jeff King or Michael Haggarty (Mentors of the project) or the community so I 
can improve my proposal.

If you have any questions please feel free to ask. 
Thanks in advance.

Tamer Tas

[1]http://git.661346.n2.nabble.com/PATCH-GSOC2014-changed-logical-chain-in-branch-c-to-lookup-tables-tt7605343.html
[2]http://git.661346.n2.nabble.com/PATCH-GSOC2014-install-branch-config-change-logical-chain-to-lookup-table-tt7605550.html
[3]http://git.661346.n2.nabble.com/PATCH-GSOC2014-install-branch-config-change-logical-chain-to-lookup-table-tt7605550.html#a7605663
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/7] merge hook tests: fix missing '&&' in test

2014-03-15 Thread Benoit Pierre
Signed-off-by: Benoit Pierre 
---
 t/t7505-prepare-commit-msg-hook.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t7505-prepare-commit-msg-hook.sh 
b/t/t7505-prepare-commit-msg-hook.sh
index 3573751..1c95652 100755
--- a/t/t7505-prepare-commit-msg-hook.sh
+++ b/t/t7505-prepare-commit-msg-hook.sh
@@ -174,7 +174,7 @@ test_expect_success 'with failing hook (merge)' '
git add file &&
rm -f "$HOOK" &&
git commit -m other &&
-   write_script "$HOOK" <<-EOF
+   write_script "$HOOK" <<-EOF &&
exit 1
EOF
git checkout - &&
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/7] merge hook tests: use 'test_must_fail' instead of '!'

2014-03-15 Thread Benoit Pierre
Signed-off-by: Benoit Pierre 
---
 t/t7505-prepare-commit-msg-hook.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t7505-prepare-commit-msg-hook.sh 
b/t/t7505-prepare-commit-msg-hook.sh
index 1c95652..5531abb 100755
--- a/t/t7505-prepare-commit-msg-hook.sh
+++ b/t/t7505-prepare-commit-msg-hook.sh
@@ -154,7 +154,7 @@ test_expect_success 'with failing hook' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
-   ! GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head
+   test_must_fail env GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head
 
 '
 
@@ -163,7 +163,7 @@ test_expect_success 'with failing hook (--no-verify)' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
-   ! GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify -c $head
+   test_must_fail env GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit 
--no-verify -c $head
 
 '
 
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/7] test patch hunk editing with "commit -p -m"

2014-03-15 Thread Benoit Pierre
Add (failing) tests: with commit changing the environment to let hooks
know that no editor will be used (by setting GIT_EDITOR to ":"), the
"edit hunk" functionality does not work (no editor is launched and the
whole hunk is committed).

Signed-off-by: Benoit Pierre 
---
 t/t7513-commit-patch.sh | 32 
 1 file changed, 32 insertions(+)
 create mode 100755 t/t7513-commit-patch.sh

diff --git a/t/t7513-commit-patch.sh b/t/t7513-commit-patch.sh
new file mode 100755
index 000..9311b0c
--- /dev/null
+++ b/t/t7513-commit-patch.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+test_description='hunk edit with "commit -p -m"'
+. ./test-lib.sh
+
+if ! test_have_prereq PERL
+then
+   skip_all="skipping '$test_description' tests, perl not available"
+   test_done
+fi
+
+test_expect_success 'setup (initial)' '
+   echo line1 >file &&
+   git add file &&
+   git commit -m commit1
+'
+
+test_expect_failure 'edit hunk "commit -p -m message"' '
+   test_when_finished "rm -f editor_was_started" &&
+   echo more >>file &&
+   echo e | env GIT_EDITOR="touch editor_was_started" git commit -p -m 
commit2 file &&
+   test -r editor_was_started
+'
+
+test_expect_failure 'edit hunk "commit --dry-run -p -m message"' '
+   test_when_finished "rm -f editor_was_started" &&
+   echo more >>file &&
+   echo e | env GIT_EDITOR="touch editor_was_started" git commit -p -m 
commit3 file &&
+   test -r editor_was_started
+'
+
+test_done
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Using "-" for "previous branch" failing with rebase

2014-03-15 Thread Tim Chase
I recently learned that there are several places where git allows use
of "-" to refer to the previous branch, e.g.

  git checkout -b dev
  # hack, hack
  git checkout master
  git merge -
  git checkout -

However, it doesn't seem to understand "-" in the context of a rebase:

  git checkout branch_a
  # hack
  git commit -a
  git checkout branch_b
  # hack
  git commit -a
  git rebase - # I'd expect to rebase onto branch_a

but I get

  fatal: Needed a single revision
  invalid upstream -

Issuing

  git rebase branch_a

does exactly what I'd expect (as "git checkout -" puts me on
"branch_a").

Is this just an interface inconsistency or is there a some technical
reason this doesn't work (or, has it been addressed/fixed, and just
not pulled into Debian Stable's 1.7.10.4 version of git)?

Thanks,

-tkc





--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/7] run-command: mark run_hook_with_custom_index as deprecated

2014-03-15 Thread Benoit Pierre
Signed-off-by: Benoit Pierre 
---
 run-command.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/run-command.h b/run-command.h
index 88460f9..3653bfa 100644
--- a/run-command.h
+++ b/run-command.h
@@ -51,6 +51,7 @@ extern int run_hook_le(const char *const *env, const char 
*name, ...);
 extern int run_hook_ve(const char *const *env, const char *name, va_list args);
 
 LAST_ARG_MUST_BE_NULL
+__attribute__((deprecated))
 extern int run_hook_with_custom_index(const char *index_file, const char 
*name, ...);
 
 #define RUN_COMMAND_NO_STDIN 1
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/7] commit: fix patch hunk editing with "commit -p -m"

2014-03-15 Thread Benoit Pierre
Don't change git environment: move the GIT_EDITOR=":" override to the
hook command subprocess, like it's already done for GIT_INDEX_FILE.

Signed-off-by: Benoit Pierre 
---
 builtin/checkout.c  |  8 
 builtin/clone.c |  4 ++--
 builtin/commit.c| 35 ---
 builtin/gc.c|  2 +-
 builtin/merge.c |  6 +++---
 commit.h|  3 +++
 run-command.c   | 44 
 run-command.h   |  6 +-
 t/t7513-commit-patch.sh |  4 ++--
 9 files changed, 80 insertions(+), 32 deletions(-)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index ada51fa..1b86d9c 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -53,10 +53,10 @@ struct checkout_opts {
 static int post_checkout_hook(struct commit *old, struct commit *new,
  int changed)
 {
-   return run_hook(NULL, "post-checkout",
-   sha1_to_hex(old ? old->object.sha1 : null_sha1),
-   sha1_to_hex(new ? new->object.sha1 : null_sha1),
-   changed ? "1" : "0", NULL);
+   return run_hook_le(NULL, "post-checkout",
+  sha1_to_hex(old ? old->object.sha1 : null_sha1),
+  sha1_to_hex(new ? new->object.sha1 : null_sha1),
+  changed ? "1" : "0", NULL);
/* "new" can be NULL when checking out from the index before
   a commit exists. */
 
diff --git a/builtin/clone.c b/builtin/clone.c
index 43e772c..9b3c04d 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -660,8 +660,8 @@ static int checkout(void)
commit_locked_index(lock_file))
die(_("unable to write new index file"));
 
-   err |= run_hook(NULL, "post-checkout", sha1_to_hex(null_sha1),
-   sha1_to_hex(sha1), "1", NULL);
+   err |= run_hook_le(NULL, "post-checkout", sha1_to_hex(null_sha1),
+  sha1_to_hex(sha1), "1", NULL);
 
if (!err && option_recursive)
err = run_command_v_opt(argv_submodule, RUN_GIT_CMD);
diff --git a/builtin/commit.c b/builtin/commit.c
index 3783bca..68a90b3 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -610,7 +610,7 @@ static int prepare_to_commit(const char *index_file, const 
char *prefix,
/* This checks and barfs if author is badly specified */
determine_author_info(author_ident);
 
-   if (!no_verify && run_hook(index_file, "pre-commit", NULL))
+   if (!no_verify && run_commit_hook(use_editor, index_file, "pre-commit", 
NULL))
return 0;
 
if (squash_message) {
@@ -867,8 +867,8 @@ static int prepare_to_commit(const char *index_file, const 
char *prefix,
return 0;
}
 
-   if (run_hook(index_file, "prepare-commit-msg",
-git_path(commit_editmsg), hook_arg1, hook_arg2, NULL))
+   if (run_commit_hook(use_editor, index_file, "prepare-commit-msg",
+   git_path(commit_editmsg), hook_arg1, hook_arg2, 
NULL))
return 0;
 
if (use_editor) {
@@ -884,7 +884,7 @@ static int prepare_to_commit(const char *index_file, const 
char *prefix,
}
 
if (!no_verify &&
-   run_hook(index_file, "commit-msg", git_path(commit_editmsg), NULL)) 
{
+   run_commit_hook(use_editor, index_file, "commit-msg", 
git_path(commit_editmsg), NULL)) {
return 0;
}
 
@@ -1068,8 +1068,6 @@ static int parse_and_validate_options(int argc, const 
char *argv[],
use_editor = 0;
if (0 <= edit_flag)
use_editor = edit_flag;
-   if (!use_editor)
-   setenv("GIT_EDITOR", ":", 1);
 
/* Sanity check options */
if (amend && !current_head)
@@ -1450,6 +1448,29 @@ static int run_rewrite_hook(const unsigned char *oldsha1,
return finish_command(&proc);
 }
 
+int run_commit_hook(int editor_is_used, const char *index_file, const char 
*name, ...)
+{
+   const char *hook_env[3] =  { NULL };
+   char index[PATH_MAX];
+   va_list args;
+   int ret;
+
+   snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
+   hook_env[0] = index;
+
+   /*
+* Let the hook know that no editor will be launched.
+*/
+   if (!editor_is_used)
+   hook_env[1] = "GIT_EDITOR=:";
+
+   va_start(args, name);
+   ret = run_hook_ve(hook_env, name, args);
+   va_end(args);
+
+   return ret;
+}
+
 int cmd_commit(int argc, const char **argv, const char *prefix)
 {
static struct wt_status s;
@@ -1674,7 +1695,7 @@ int cmd_commit(int argc, const char **argv, const char 
*prefix)
 "not exceeded, and then \"git reset HEAD\" to recover."));
 
rerere(0);
-   run_hook(get_index_file(), "post-commit", NULL);
+   run_commit_hook(use_editor, get_index_file(), "post-co

[PATCH 5/7] merge: fix GIT_EDITOR override for commit hook

2014-03-15 Thread Benoit Pierre
Don't set GIT_EDITOR to ":" when calling prepare-commit-msg hook if the
editor is going to be called (e.g. with "merge -e").

Signed-off-by: Benoit Pierre 
---
 builtin/merge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/merge.c b/builtin/merge.c
index bdf6655..e15d0e1 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -824,7 +824,7 @@ static void prepare_to_commit(struct commit_list 
*remoteheads)
if (0 < option_edit)
strbuf_commented_addf(&msg, _(merge_editor_comment), 
comment_line_char);
write_merge_msg(&msg);
-   if (run_commit_hook(1, get_index_file(), "prepare-commit-msg",
+   if (run_commit_hook(0 < option_edit, get_index_file(), 
"prepare-commit-msg",
git_path("MERGE_MSG"), "merge", NULL))
abort_commit(remoteheads, NULL);
if (0 < option_edit) {
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/7] merge hook tests: fix and update tests

2014-03-15 Thread Benoit Pierre
- update 'no editor' hook test and add 'editor' hook test
- make sure the tree is reset to a clean state after running a test
  (using test_when_finished) so later tests are not impacted

Signed-off-by: Benoit Pierre 
---
 t/t7505-prepare-commit-msg-hook.sh | 27 +--
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/t/t7505-prepare-commit-msg-hook.sh 
b/t/t7505-prepare-commit-msg-hook.sh
index 5531abb..03dce09 100755
--- a/t/t7505-prepare-commit-msg-hook.sh
+++ b/t/t7505-prepare-commit-msg-hook.sh
@@ -134,14 +134,26 @@ test_expect_success 'with hook (-c)' '
 
 test_expect_success 'with hook (merge)' '
 
-   head=`git rev-parse HEAD` &&
-   git checkout -b other HEAD@{1} &&
-   echo "more" >> file &&
+   test_when_finished "git checkout -f master" &&
+   git checkout -B other HEAD@{1} &&
+   echo "more" >>file &&
+   git add file &&
+   git commit -m other &&
+   git checkout - &&
+   git merge --no-ff other &&
+   test "`git log -1 --pretty=format:%s`" = "merge (no editor)"
+'
+
+test_expect_success 'with hook and editor (merge)' '
+
+   test_when_finished "git checkout -f master" &&
+   git checkout -B other HEAD@{1} &&
+   echo "more" >>file &&
git add file &&
git commit -m other &&
git checkout - &&
-   git merge other &&
-   test "`git log -1 --pretty=format:%s`" = merge
+   env GIT_EDITOR="\"\$FAKE_EDITOR\"" git merge --no-ff -e other &&
+   test "`git log -1 --pretty=format:%s`" = "merge"
 '
 
 cat > "$HOOK" <<'EOF'
@@ -151,6 +163,7 @@ EOF
 
 test_expect_success 'with failing hook' '
 
+   test_when_finished "git checkout -f master" &&
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
@@ -160,6 +173,7 @@ test_expect_success 'with failing hook' '
 
 test_expect_success 'with failing hook (--no-verify)' '
 
+   test_when_finished "git checkout -f master" &&
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
@@ -169,6 +183,7 @@ test_expect_success 'with failing hook (--no-verify)' '
 
 test_expect_success 'with failing hook (merge)' '
 
+   test_when_finished "git checkout -f master" &&
git checkout -B other HEAD@{1} &&
echo "more" >> file &&
git add file &&
@@ -178,7 +193,7 @@ test_expect_success 'with failing hook (merge)' '
exit 1
EOF
git checkout - &&
-   test_must_fail git merge other
+   test_must_fail git merge --no-ff other
 
 '
 
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/6] Fix misuses of "nor"

2014-03-15 Thread Duy Nguyen
On Sat, Mar 15, 2014 at 11:56 PM, Justin Lebar  wrote:
> There's a similar incompatibility with the l10n change and "Fix
> misuses of "nor" outside comments": The former references strings
> changed in the latter.  Should I merge these, or should I enforce a
> particular ordering between these patches?  (Right now the l10n patch
> comes before the string changes in the code, but that's probably wrong
> now that I think about it.)

I think you can drop the l10n patch. After the source code is updated,
new .pot will be generated (probably by Jiang) and .po also
automatically updated. Updated strings in .po are most likely marked
"fuzzy" so translators can double check. So you changes in the source
code will be propagated to .po eventually.
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mv: prevent mismatched data when ignoring errors.

2014-03-15 Thread Jeff King
On Sat, Mar 15, 2014 at 05:05:29PM +0100, Thomas Rast wrote:

> > diff --git a/builtin/mv.c b/builtin/mv.c
> > index f99c91e..b20cd95 100644
> > --- a/builtin/mv.c
> > +++ b/builtin/mv.c
> > @@ -230,6 +230,11 @@ int cmd_mv(int argc, const char **argv, const char 
> > *prefix)
> > memmove(destination + i,
> > destination + i + 1,
> > (argc - i) * sizeof(char *));
> > +   memmove(modes + i, modes + i + 1,
> > +   (argc - i) * sizeof(char *));
> 
> This isn't right -- you are computing the size of things to be moved
> based on a type of char*, but 'modes' is an enum.
> 
> (Valgrind spotted this.)

Maybe using sizeof(*destination) and sizeof(*modes) would make this less
error-prone?

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] mv: prevent mismatched data when ignoring errors.

2014-03-15 Thread Jeff King
On Sat, Mar 15, 2014 at 06:56:52PM +, brian m. carlson wrote:

> We shrink the source and destination arrays, but not the modes or
> submodule_gitfile arrays, resulting in potentially mismatched data.  Shrink
> all the arrays at the same time to prevent this.  Add tests to ensure the
> problem does not recur.
> 
> Signed-off-by: brian m. carlson 
> ---
> 
> I attempted to come up with a second patch that would refactor out the
> four different arrays into one array of struct, as Jeff suggested, but
> it became very ugly very quickly.  So this patch simply fixes the
> problem and adds tests.

>From my brief look, I feared that might be the case. Oh well, thanks for
trying.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH/GSoC_v3] branch.c: turn nested if-else logic to table-driven

2014-03-15 Thread Yao Zhao
Signed-off-by: Yao Zhao 
---
 branch.c | 53 +
 1 file changed, 29 insertions(+), 24 deletions(-)
Hello Eric,

Thank you and Junio for reviewing my code. It is really helpful to improve my 
code quality.

This is version 3 of patch. Previous address : 
http://thread.gmane.org/gmane.comp.version-control.git/243919. I do not use 
positional initializer because it is not allowed to use variable in it. I don't 
know if it's ok to use this redundant way to initialize "list".

I cannot find -v flag in documentation you indicated in last email so I use 
set-prefix to add it into prefix.

Now I am working on writing proposal for git project. I am really interested in 
last one, about improve git_config. I know it's important to get known about 
git_config first and have read documentation about it. But I am really confused 
about how to understand code of git_config. When user type in git config in 
terminal, what is the execute order of functions? How git config influence 
other git command? Does program read config file every time when they execuate 
config-related command?

Thank you,

Yao

diff --git a/branch.c b/branch.c
index 723a36b..1df30c7 100644
--- a/branch.c
+++ b/branch.c
@@ -53,7 +53,33 @@ void install_branch_config(int flag, const char *local, 
const char *origin, cons
int remote_is_branch = starts_with(remote, "refs/heads/");
struct strbuf key = STRBUF_INIT;
int rebasing = should_setup_rebase(origin);
-
+   struct print_list {
+   const char *print_str;
+   const char *arg2; 
+   const char *arg3;
+   } ; 
+   struct print_list target;
+
+   struct print_list list[2][2][2];
+   list[0][0][0].print_str = N_("Branch %s set up to track local ref %s.");
+   list[0][0][0].arg2 = remote;
+   list[0][0][1].print_str = N_("Branch %s set up to track local ref %s by 
rebasing.");
+   list[0][0][1].arg2 = remote;
+   list[0][1][0].print_str = N_("Branch %s set up to track remote ref 
%s.");
+   list[0][1][0].arg2 = remote;
+   list[0][1][1].print_str = N_("Branch %s set up to track remote ref %s 
by rebasing.");
+   list[0][1][1].arg2 = remote;
+   list[1][0][0].print_str = N_("Branch %s set up to track local branch 
%s.");
+   list[1][0][0].arg2 =shortname;
+   list[1][0][1].print_str = N_("Branch %s set up to track local branch %s 
by rebasing.");
+   list[1][0][1].arg2 = shortname;
+   list[1][1][0].print_str = N_("Branch %s set up to track remote branch 
%s from %s.");
+   list[1][1][0].arg2 = shortname;
+   list[1][1][0].arg3 = origin;
+   list[1][1][1].print_str = N_("Branch %s set up to track remote branch 
%s from %s by rebasing.");
+   list[1][1][1].arg2 = shortname;
+   list[1][1][1].arg3 = origin;
+ 
if (remote_is_branch
&& !strcmp(local, shortname)
&& !origin) {
@@ -77,29 +103,8 @@ void install_branch_config(int flag, const char *local, 
const char *origin, cons
strbuf_release(&key);
 
if (flag & BRANCH_CONFIG_VERBOSE) {
-   if (remote_is_branch && origin)
-   printf_ln(rebasing ?
- _("Branch %s set up to track remote branch %s 
from %s by rebasing.") :
- _("Branch %s set up to track remote branch %s 
from %s."),
- local, shortname, origin);
-   else if (remote_is_branch && !origin)
-   printf_ln(rebasing ?
- _("Branch %s set up to track local branch %s 
by rebasing.") :
- _("Branch %s set up to track local branch 
%s."),
- local, shortname);
-   else if (!remote_is_branch && origin)
-   printf_ln(rebasing ?
- _("Branch %s set up to track remote ref %s by 
rebasing.") :
- _("Branch %s set up to track remote ref %s."),
- local, remote);
-   else if (!remote_is_branch && !origin)
-   printf_ln(rebasing ?
- _("Branch %s set up to track local ref %s by 
rebasing.") :
- _("Branch %s set up to track local ref %s."),
- local, remote);
-   else
-   die("BUG: impossible combination of %d and %p",
-   remote_is_branch, origin);
+   target = list[!!remote_is_branch][!!origin][!!rebasing];
+   printf_ln (_(target.print_str), local, target.arg2, 
target.arg3);
}
 }
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-in

[PATCH] gitk: Avoid issues with script path format

2014-03-15 Thread Steven Penny
Tk’s "wish" for Windows can be built two ways

win   this provides a "wish" that uses GDI; it only understands Windows
  paths such as C:\foo\bar
unix  this provides a "wish" that uses X11; it understands Windows and Cygwin
  paths such as C:\foo\bar or /foo/bar

Some Cygwin users will prefer to use the "win" version, as it avoids the large
X11 dependency. However Cygwin passes the path "/bin/gitk" or similar and the
"win" version of "wish" will not understand this. However "wish" does understand
STDIN. Options such as "--all" will still work using this method as well.

Signed-off-by: Steven Penny 
---
 gitk-git/gitk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 90764e8..64a125d 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Tcl ignores the next line -*- tcl -*- \
-exec wish "$0" -- "$@"
+exec wish < "$0" -- "$@"
 
 # Copyright © 2005-2014 Paul Mackerras.  All rights reserved.
 # This program is free software; it may be used, copied, modified
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html